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
|
uhGLoad
Syntax Return Values
Explanation
uhPartnerCmd issues the various commands that PARTNER can use. For more information, see the PARTNER manual. uhGLoad uses PARTNER to load and execute the 64 game specified bygamename. Following is an example of the uh functions used for Partner. This example is a host application that responds to instructions from the game once it is loaded. In this example, instructions from the game are received and passed after being stored in the structure TCommandPacket. PARTNER must be started before the application is executed. #include <ultrahost.h> #define DEV_U64_DATA "PARTNER-N64" typedef TCommandPacket int; TCommandPacket cmdpkt; extern s32 errStop(char *); main(int argc, char **argv) /* Host side code */ { int cmd,done; /* Open the device. */ if ((fd = uhOpenGame(DEV_U64_DATA)) < 0) errStop("device open error"); /* Load the game. */ if( uhGLoad(fd ,0) != 0 ) errStop("gload failed"); while (!done) { cmd = catchCommand(); // Receive a command from the 64 game. switch(cmd) // Process according to the command. { case CMD_A: .... case CMD_B: ... } } uhCloseGame(fd); } int catchCommand(void) // Receive 64 data. Take care to avoid using the wrong endian format. { TCommandPacket cmdpkt; if ( uhReadGame(fd, (void *)&cmdpkt, sizeof(TCommandPacket)) < 0) errStop("fail uhReadGame"); #ifdef __PARTNER_PC__ rev((unsigned *)&cmdpkt); // Reverse the endian format for PC. #endif return (int)cmdpkt; }See Also uhCloseGame uhOpenGame uhReadGame uhWriteGame osReadHost osWriteHost
|