al - Audio Library Functions gDP - DP GBI Macros gdSP - General GBI Macros gSP - SP GBI Macros gt - Turbo Microcode RDP gu - Graphics Utilities Math - Math Functions nuSys - NuSystem os - N64 Operating System sp - Sprite Library Functions uh - Host to Target IO 64DD - N64 Disk Drive
|
uhCloseGameFormat#include <ultrahost.h> int uhCloseGame(int fd); Return Value On success, a value of 0 is returned. Otherwise, a -1 is returned and errno is set to indicate the error. What This Function Does The host-to-target IO routines allow a host application to set up a communications channel for the transfer of raw data between the host and the game. They work in concert with OS routines (osReadHost, osWriteHost, osTestHost, osAckRamromRead, and osAckRamromWrite) on the game side. These routines are part of the Ultra 64 host-side library libultrahost.a, so they are available to the application by adding -lultrahost on the link line. The uhCloseGame procedure can be used if desired to close the given file descriptor. Example The following example shows how a host application can initiate the game and establish a connection to transfer data. This particular sequence guarantees that no handshaking events are lost. By the time the game sends its first packet of data, the host device driver is ready to acknowledge it. Furthermore, the host side application does not attempt to send data to the game before it has booted. /* Host side code */ main(int argc, char **argv) { pid_t pid; int fd, status; if ((fd = uhOpenGame("/dev/u64_data")) == -1) { perror("uhOpenGame"); return(-1); } if ((pid = fork()) == -1) { perror("fork); return(-1); } else if (pid == 0) { (void)execl("/usr/sbin/gload", "/usr/sbin/gload", 0); fprintf(stderr, "host: execl( return(-1); } if (uhReadGame(fd, hostBuffer, 4) == -1) { fprintf(stderr, "uhReadGame %s0, sys_errlist[errno]); return(1); } if (uhCloseGame(fd) != 0) { perror("uhCloseGame"); return(-1); } if (waitpid(pid, status, WUNTRACED) == -1) { perror("waitpid"); return(-1); } } /* Game side code */ mainproc(void *arg) { osWriteHost(gameBuffer, 4); osExit(); }See Also uhOpenGame uhReadGame uhWriteGame uhReadRamrom uhWriteRamrom osReadHost osWriteHost osTestHost osAckRamromRead osAckRamromWrite
|