diff --git a/core/systemctrl/src/exitgame.c b/core/systemctrl/src/exitgame.c index f792bb1bd..2952d67f5 100644 --- a/core/systemctrl/src/exitgame.c +++ b/core/systemctrl/src/exitgame.c @@ -29,6 +29,7 @@ // Exit Button Mask #define EXIT_MASK (PSP_CTRL_LTRIGGER | PSP_CTRL_RTRIGGER | PSP_CTRL_START | PSP_CTRL_DOWN) +#define XBOOT_MASK (PSP_CTRL_LTRIGGER | PSP_CTRL_RTRIGGER | PSP_CTRL_CROSS | PSP_CTRL_DOWN) extern ARKConfig* ark_config; extern int disable_plugins; @@ -70,6 +71,42 @@ void exitLauncher() sctrlKernelLoadExecVSHWithApitype(0x141, path, ¶m); } +void xbootLauncher() +{ + + // Refuse Operation in Save dialog + if(sceKernelFindModuleByName("sceVshSDUtility_Module") != NULL) return; + + // Refuse Operation in Dialog + if(sceKernelFindModuleByName("sceDialogmain_Module") != NULL) return; + + // Load Execute Parameter + struct SceKernelLoadExecVSHParam param; + + // set xboot app + char path[ARK_PATH_SIZE]; + strcpy(path, ark_config->arkpath); + if (ark_config->recovery) strcat(path, ARK_RECOVERY); + else if (ark_config->launcher[0]) strcat(path, ark_config->launcher); + else strcat(path, ARK_XMENU); + + // Clear Memory + memset(¶m, 0, sizeof(param)); + + // Configure Parameters + param.size = sizeof(param); + param.args = strlen(path) + 1; + param.argp = path; + param.key = "game"; + + // set default mode + sctrlSESetUmdFile(""); + sctrlSESetBootConfFileIndex(MODE_UMD); + + // Trigger Reboot + sctrlKernelLoadExecVSHWithApitype(0x141, path, ¶m); +} + static void startExitThread(){ // Exit to custom launcher int k1 = pspSdkSetK1(0); @@ -79,6 +116,16 @@ static void startExitThread(){ pspSdkSetK1(k1); } +static void startExitThreadXBOOT(){ + // Exit to XBOOT launcher + int k1 = pspSdkSetK1(0); + int uid = sceKernelCreateThread("ExitGamePollThread", xbootLauncher, 16 - 1, 2048, 0, NULL); + sceKernelStartThread(uid, 0, NULL); + sceKernelWaitThreadEnd(uid, NULL); + pspSdkSetK1(k1); +} + + // Gamepad Hook #1 int (*CtrlPeekBufferPositive)(SceCtrlData *, int) = NULL; int peek_positive(SceCtrlData * pad_data, int count) @@ -92,6 +139,11 @@ int peek_positive(SceCtrlData * pad_data, int count) startExitThread(); } + // Check for XBOOT Mask + if((pad_data[0].Buttons & XBOOT_MASK) == XBOOT_MASK) + { + startExitThreadXBOOT(); + } // Return Number of Input Frames return count; } @@ -109,6 +161,11 @@ int peek_negative(SceCtrlData * pad_data, int count) startExitThread(); } + // Check for XBOOT Mask + if((pad_data[0].Buttons & XBOOT_MASK) == 0) + { + startExitThreadXBOOT(); + } // Return Number of Input Frames return count; } @@ -125,6 +182,11 @@ int read_positive(SceCtrlData * pad_data, int count) { startExitThread(); } + + if((pad_data[0].Buttons & XBOOT_MASK) == XBOOT_MASK) + { + startExitThreadXBOOT(); + } // Return Number of Input Frames return count; @@ -142,6 +204,12 @@ int read_negative(SceCtrlData * pad_data, int count) { startExitThread(); } + + // Check for XBOOT Mask + if((pad_data[0].Buttons & XBOOT_MASK) == 0) + { + startExitThreadXBOOT(); + } // Return Number of Input Frames return count; @@ -184,4 +252,4 @@ void patchController(void) sctrlHENPatchSyscall((void *)CtrlPeekBufferNegative, peek_negative); sctrlHENPatchSyscall((void *)CtrlReadBufferPositive, read_positive); sctrlHENPatchSyscall((void *)CtrlReadBufferNegative, read_negative); -} \ No newline at end of file +} diff --git a/extras/menus/xMenu/src/menu.cpp b/extras/menus/xMenu/src/menu.cpp index 2d8518038..0cdd19fdf 100644 --- a/extras/menus/xMenu/src/menu.cpp +++ b/extras/menus/xMenu/src/menu.cpp @@ -3,6 +3,8 @@ #include #include +#define BOTTOM 260 + static ARKConfig _ark_conf; ARKConfig* ark_config = &_ark_conf; static SEConfig _se_conf; @@ -125,7 +127,7 @@ void Menu::updateScreen(){ for (int i=this->start; istart+3, (int)eboots.size()); i++){ int offset = 8 + (90 * (i-this->start)); blitAlphaImageToScreen(0, 0, eboots[i]->getIcon()->imageWidth, \ - eboots[i]->getIcon()->imageHeight, eboots[i]->getIcon(), 10, offset); + eboots[i]->getIcon()->imageHeight, eboots[i]->getIcon(), 10, offset+10); if (i == this->index) fillScreenRect(WHITE_COLOR, 200, offset+30+TEXT_HEIGHT, min((int)eboots[i]->getPath().size()*TEXT_WIDTH, 280), 1); } @@ -138,7 +140,16 @@ void Menu::updateScreen(){ common::printText(200, offset+30, eboots[i]->getName().c_str()); } - common::printText(2, 2, ark_version.c_str()); + stringstream ver; + + ver << ark_version; + + ver << " - Memory Stick Speedup: " << ((se_config->msspeed)? "Enabled" : "Disabled"); + + + common::printText(2, 2, ver.str().c_str()); + + common::printText(2, BOTTOM, "LT - Toggle Speedup"); common::flip(); } @@ -199,6 +210,11 @@ void Menu::control(){ else if (control.select()){ rebootMenu(); } + else if (control.LT()){ + se_config->msspeed = !se_config->msspeed; + sctrlSESetConfig(se_config); + } + } } @@ -226,7 +242,8 @@ void Menu::rebootMenu(){ char path[256]; strcpy(path, ark_config->arkpath); - strcat(path, ark_config->launcher); + //strcat(path, ark_config->launcher); + strcat(path, ARK_XMENU); int runlevel = 0x141; @@ -260,7 +277,7 @@ void Menu::run(){ version << " DEBUG"; #endif - version << " - Memory Stick Speedup: " << ((se_config->msspeed)? "Enabled" : "Disabled"); + //version << " - Memory Stick Speedup: " << ((se_config->msspeed)? "Enabled" : "Disabled"); ark_version = version.str();