bool ExitDemo() { #ifdef __PLAT_NGPS__ prepare_to_exit(); while (1) { sceSifExitCmd(); // Sony suggested fix to make LoadExecPS2 work more reliably. if (Config::SonyBootstrap()) { printf ("Exiting with sceDemoEnd\n"); sceDemoEnd(demo_exit_reason); } else { sceSifExitCmd(); // Sony suggested fix to make LoadExecPS2 work more reliably. char *args[] = {Config::gReturnString }; printf ("Exiting with LoadExecPS2( %s [%s] )\n", Config::gReturnTo, Config::gReturnString); LoadExecPS2(Config::gReturnTo, 1, args); } printf ("ERROR - Failed to exit!!!!!!! RETRYING\n"); } #endif return true; // actually will never get here }
bool LoadExec( const char* pELFName ) { #ifdef __PLAT_NGPS__ char p_string[100]; sprintf(p_string,"%s;1",pELFName); // add on the ;1 prepare_to_exit(); sceSifExitCmd(); // Sony suggested fix to make LoadExecPS2 work more reliably. char *args[4]; args[0] = "bootstrap"; if (Config::NTSC()) { args[1] = "cdrom0:\\SLUS_207.31;1"; args[2] = ""; args[3] = ""; } else { switch (Config::GetLanguage()) { case Config::LANGUAGE_FRENCH: args[1] = "cdrom0:\\SLES_518.51;1"; break; case Config::LANGUAGE_GERMAN: args[1] = "cdrom0:\\SLES_518.52;1"; break; case Config::LANGUAGE_ITALIAN: args[1] = "cdrom0:\\SLES_518.53;1"; break; case Config::LANGUAGE_SPANISH: args[1] = "cdrom0:\\SLES_518.54;1"; break; default: Dbg_MsgAssert(0,("Bad Language (%d)",(int)(Config::GetLanguage()))); // allow drop through to english as a failsafe. case Config::LANGUAGE_ENGLISH: args[1] = "cdrom0:\\SLES_518.48;1"; break; } args[2] = "PAL"; args[3] = "Framerate=50"; } printf ("LoadExecPS2(%s) args = (%s,%s,%s,%s)\n",p_string, args[0], args[1], args[2], args[3] ); LoadExecPS2(p_string, 4, args); printf ("LoadExecPS2 Failed - probably file not found, profiling on, or bad media type\n"); // LoadExecPS2("cdrom0:\\demo\\slus_201.99;1", 2, args); #endif // __PLAT_NGC__ return true; // actually will never get here} }
void ExecGame(void) { int i; scr_printf(" Installing Engine...\n"); u32 EngineStore = 0x80080000; u32 EngineRead = (void*)Engine; for (i = 0; i < sizeof(Engine); i += 4) { //scr_printf("A"); ee_kmode_enter(); *(u32*)EngineStore = *(u32*)EngineRead; ee_kmode_exit(); EngineStore += 4; EngineRead += 4; } ee_kmode_enter(); *(u32*)0x80081000 = 0x80081010; //Writes the initial storage of the codes ee_kmode_exit(); waitCdReady(); scr_printf(" Loading...\n"); //for (a = 0; a < 40000000; a++) { } if(strlen(bootFileName = parseSystemCnf()) <= 0) { scr_printf(" == Fatal Error ==\n"); SleepThread(); } scr_printf("\n Loaded Game!\n"); u32 HookValue = (0x00080000 / 4) + 0x0C000000; padPortClose(0, 0); //scr_printf(" Shut down PAD, shutting down RPC\n GOODBYE!!!"); SifExitRpc(); ee_kmode_enter(); *(u32*)0x800002FC = HookValue; ee_kmode_exit(); LoadExecPS2((const char *)bootFileName, 0, NULL); SleepThread(); }
int main(int argc, char **argv){ char ElfPath[32]; DINIT(); DPRINTF("OPL EE core start!\n"); SifInitRpc(0); int i = 0; if (!_strncmp(argv[i], "USB_MODE", 8)) GameMode = USB_MODE; else if (!_strncmp(argv[i], "ETH_MODE", 8)) GameMode = ETH_MODE; else if (!_strncmp(argv[i], "HDD_MODE", 8)) GameMode = HDD_MODE; DPRINTF("Game Mode = %d\n", GameMode); DisableDebug = 0; if (!_strncmp(&argv[i][9], "1", 1)) { DisableDebug = 1; DPRINTF("Debug Colors disabled\n"); } PS2Logo = 0; if (!_strncmp(&argv[i][11], "1", 1)) { PS2Logo = 1; DPRINTF("PS2 Logo enabled\n"); } char *p = _strtok(&argv[i][13], " "); if (!_strncmp(p, "Browser", 7)) ExitPath[0] = '\0'; else _strcpy(ExitPath, p); DPRINTF("Exit Path = (%s)\n", ExitPath); p = _strtok(NULL, " "); HDDSpindown = _strtoui(p); DPRINTF("HDD Spindown = %d\n", HDDSpindown); p = _strtok(NULL, " "); _strcpy(g_ps2_ip, p); p = _strtok(NULL, " "); _strcpy(g_ps2_netmask, p); p = _strtok(NULL, " "); _strcpy(g_ps2_gateway, p); g_ps2_ETHOpMode=_strtoui(_strtok(NULL, " ")); DPRINTF("IP=%s NM=%s GW=%s mode: %d\n", g_ps2_ip, g_ps2_netmask, g_ps2_gateway, g_ps2_ETHOpMode); #ifdef CHEAT EnableCheatOp = (gCheatList = (void*)_strtoui(_strtok(NULL, " "))) != NULL; DPRINTF("PS2RD Cheat Engine = %s\n", EnableCheatOp==0?"Disabled":"Enabled"); #endif #ifdef GSM EnableGSMOp = _strtoi(_strtok(NULL, " ")); DPRINTF("GSM = %s\n", EnableGSMOp==0?"Disabled":"Enabled"); #endif i++; ModStorageStart = (void*)_strtoui(_strtok(argv[i], " ")); ModStorageEnd = (void*)_strtoui(_strtok(NULL, " ")); i++; argv[i][11]=0x00; // fix for 8+3 filename. _strcpy(ElfPath, "cdrom0:\\"); _strcat(ElfPath, argv[i]); _strcat(ElfPath, ";1"); strncpy(GameID, argv[i], sizeof(GameID) - 1); GameID[sizeof(GameID) - 1] = '\0'; DPRINTF("Elf path = '%s'\n", ElfPath); DPRINTF("Game ID = '%s'\n", GameID); i++; // bitmask of the compat. settings g_compat_mask = _strtoui(argv[i]); DPRINTF("Compat Mask = 0x%02x\n", g_compat_mask); i++; #ifdef CHEAT if(EnableCheatOp){ EnableCheats(); } #endif #ifdef GSM if(EnableGSMOp){ u32 interlace, mode, ffmd, dx_offset, dy_offset, skip_videos_fix; u64 display, syncv, smode2; interlace=_strtoui(_strtok(argv[i], " ")); mode=_strtoui(_strtok(NULL, " ")); ffmd=_strtoui(_strtok(NULL, " ")); display=_strtoul(_strtok(NULL, " ")); syncv=_strtoul(_strtok(NULL, " ")); smode2=_strtoui(_strtok(NULL, " ")); dx_offset=_strtoui(_strtok(NULL, " ")); dy_offset=_strtoui(_strtok(NULL, " ")); skip_videos_fix=_strtoui(_strtok(NULL, " ")); UpdateGSMParams(interlace, mode, ffmd, display, syncv, smode2, dx_offset, dy_offset, skip_videos_fix); EnableGSM(); } #endif set_ipconfig(); /* installing kernel hooks */ DPRINTF("Installing Kernel Hooks...\n"); Install_Kernel_Hooks(); if(!DisableDebug) GS_BGCOLOUR = 0xff0000; //Blue SifExitRpc(); DPRINTF("Executing '%s'...\n", ElfPath); //PS2LOGO Caller, based on l_oliveira & SP193 tips if (PS2Logo) { char *argvs[1]; argvs[0] = ElfPath; argvs[1] = NULL; LoadExecPS2("rom0:PS2LOGO", 1, argvs); } else { LoadExecPS2(ElfPath, 0, NULL); } if(!DisableDebug) GS_BGCOLOUR = 0x0000ff; //Red DPRINTF("LoadExecPS2 failed!\n"); SleepThread(); return 0; }