void _start(int argc, char **argv) { ProcUIInit(&SaveCallback); int ret = main(argc, argv); ProcUIShutdown(); exit(ret); }
int main(int argc, char **argv) { #if 1 setup_os_exceptions(); #else InstallExceptionHandler(); #endif ProcUIInit(&SaveCallback); socket_lib_init(); #if defined(PC_DEVELOPMENT_IP_ADDRESS) && defined(PC_DEVELOPMENT_TCP_PORT) log_init(PC_DEVELOPMENT_IP_ADDRESS, PC_DEVELOPMENT_TCP_PORT); devoptab_list[STD_OUT] = &dotab_stdout; devoptab_list[STD_ERR] = &dotab_stdout; #endif #ifndef IS_SALAMANDER VPADInit(); WPADEnableURCC(true); WPADEnableWiiRemote(true); KPADInit(); #endif verbosity_enable(); printf("starting\n"); fflush(stdout); DEBUG_VAR(ARGV_PTR); if(ARGV_PTR && ((u32)ARGV_PTR < 0x01000000)) { struct { u32 magic; u32 argc; char * argv[3]; }*param = ARGV_PTR; if(param->magic == ARGV_MAGIC) { argc = param->argc; argv = param->argv; } ARGV_PTR = NULL; } DEBUG_VAR(argc); DEBUG_STR(argv[0]); DEBUG_STR(argv[1]); fflush(stdout); #ifdef IS_SALAMANDER int salamander_main(int, char **); salamander_main(argc, argv); #else #if 1 #if 0 int argc_ = 2; // char* argv_[] = {WIIU_SD_PATH "retroarch/retroarch.elf", WIIU_SD_PATH "rom.nes", NULL}; char *argv_[] = {WIIU_SD_PATH "retroarch/retroarch.elf", WIIU_SD_PATH "rom.sfc", NULL}; rarch_main(argc_, argv_, NULL); #else rarch_main(argc, argv, NULL); #endif do { unsigned sleep_ms = 0; int ret = runloop_iterate(&sleep_ms); if (ret == 1 && sleep_ms > 0) retro_sleep(sleep_ms); task_queue_ctl(TASK_QUEUE_CTL_WAIT, NULL); if (ret == -1) break; } while (1); main_exit(NULL); #endif #endif fflush(stdout); fflush(stderr); ProcUIShutdown(); #if defined(PC_DEVELOPMENT_IP_ADDRESS) && defined(PC_DEVELOPMENT_TCP_PORT) log_deinit(); #endif /* returning non 0 here can prevent loading a different rpx/elf in the HBL environment */ return 0; }
int main(int argc, char **argv) { OSScreenInit(); OSReport("Screen initted\n"); ProcUIInit(&SaveCallback); /****************************> Globals <****************************/ struct pongGlobals myPongGlobals; //Flag for restarting the entire game. myPongGlobals.restart = 1; //scale of game myPongGlobals.scale=1; //Default locations for paddles and ball location and movement dx/dy myPongGlobals.p1X_default=40*myPongGlobals.scale; myPongGlobals.p2X_default=340*myPongGlobals.scale; myPongGlobals.ballX_default=200*myPongGlobals.scale; myPongGlobals.p1Y_default=150*myPongGlobals.scale; myPongGlobals.p2Y_default=150*myPongGlobals.scale; myPongGlobals.ballY_default=120*myPongGlobals.scale; //Sizes of objects myPongGlobals.p1X_size=20*myPongGlobals.scale; myPongGlobals.p1Y_size=60*myPongGlobals.scale; myPongGlobals.ballX_size=8*myPongGlobals.scale; myPongGlobals.ballY_size=8*myPongGlobals.scale; myPongGlobals.p2X_size=20*myPongGlobals.scale; myPongGlobals.p2Y_size=60*myPongGlobals.scale; //Boundry of play area (screen) myPongGlobals.xMinBoundry=0*myPongGlobals.scale; myPongGlobals.xMaxBoundry=400*myPongGlobals.scale; myPongGlobals.yMinBoundry=0*myPongGlobals.scale; myPongGlobals.yMaxBoundry=240*myPongGlobals.scale; myPongGlobals.winX=11*2*myPongGlobals.scale; myPongGlobals.winY=5*2*myPongGlobals.scale; myPongGlobals.score1X=13*2*myPongGlobals.scale; myPongGlobals.score2X=15*2*myPongGlobals.scale; myPongGlobals.score1Y=0*myPongGlobals.scale; myPongGlobals.score2Y=0*myPongGlobals.scale; //Game engine globals myPongGlobals.direction = 1; myPongGlobals.button = 0; myPongGlobals.paddleColorR=0xFF; myPongGlobals.paddleColorG=0x00; myPongGlobals.paddleColorB=0x00; myPongGlobals.ballColorR=0x00; myPongGlobals.ballColorG=0xFF; myPongGlobals.ballColorB=0x00; myPongGlobals.ballTrailColorR=0x00; myPongGlobals.ballTrailColorG=0x00; myPongGlobals.ballTrailColorB=0xFF; myPongGlobals.backgroundColorR=0x00; myPongGlobals.backgroundColorG=0x00; myPongGlobals.backgroundColorB=0x00; myPongGlobals.count = 0; //Keep track of score myPongGlobals.score1 = 0; myPongGlobals.score2 = 0; myPongGlobals.scoreWin = 9; //Game engine globals myPongGlobals.direction = 1; myPongGlobals.button = 0; myPongGlobals.paddleColorR=0xFF; myPongGlobals.paddleColorG=0x00; myPongGlobals.paddleColorB=0x00; myPongGlobals.ballColorR=0x00; myPongGlobals.ballColorG=0xFF; myPongGlobals.ballColorB=0x00; myPongGlobals.ballTrailColorR=0x00; myPongGlobals.ballTrailColorG=0x00; myPongGlobals.ballTrailColorB=0xFF; myPongGlobals.backgroundColorR=0x00; myPongGlobals.backgroundColorG=0x00; myPongGlobals.backgroundColorB=0x00; myPongGlobals.count = 0; //Keep track of score myPongGlobals.score1 = 0; myPongGlobals.scoreWin = 9; //Used for collision myPongGlobals.flag = 0; //Flag to determine if p1 should be rendered along with p1's movement direction myPongGlobals.renderP1Flag = 0; //Flags for render states myPongGlobals.renderResetFlag = 0; myPongGlobals.renderBallFlag = 0; myPongGlobals.renderWinFlag = 0; myPongGlobals.renderScoreFlag = 0; OSReport("Globals initialized\n"); /****************************> VPAD Loop <****************************/ int error; VPADStatus vpad_data; while (AppRunning()) { if(!initialized) continue; VPADRead(0, &vpad_data, 1, &error); //Get the status of the gamepad myPongGlobals.button = vpad_data.hold; //If the game has been restarted, reset the game (we do this one time in the beginning to set everything up) if (myPongGlobals.restart == 1) { OSReport("Game reset\n"); reset(&myPongGlobals); myPongGlobals.restart = 0; } //Set old positions. updatePosition(&myPongGlobals); //Update location of player1 and 2 paddles p1Move(&myPongGlobals); p2Move(&myPongGlobals); //Update location of the ball moveBall(&myPongGlobals); //Check if their are any collisions between the ball and the paddles. checkCollision(&myPongGlobals); //Render the scene myPongGlobals.renderBallFlag = 1; render(&myPongGlobals); //Increment the counter (used for physicals calcuations) myPongGlobals.count+=1; } return 0; }