Added option to keep patches when a starting a not fully supported game.

This commit is contained in:
Maschell 2017-04-14 16:35:30 +02:00
parent 9d89a8f53e
commit 4b170a72c6
2 changed files with 26 additions and 9 deletions

View File

@ -35,19 +35,26 @@ extern "C" s32 Menu_Main(void){
//!******************************************************************* //!*******************************************************************
//! do OS (for acquire) and sockets first so we got logging //! do OS (for acquire) and sockets first so we got logging
InitOSFunctionPointers(); InitOSFunctionPointers();
InitVPadFunctionPointers();
if(OSGetTitleID() == 0x00050000101a5f00L || // Shantae and the Pirate's Curse USA (reason: crashes when pressing HOME, Pro Controller not recognized) if(OSGetTitleID() == 0x00050000101a5f00L || // Shantae and the Pirate's Curse USA (reason: crashes when pressing HOME, Pro Controller not recognized)
OSGetTitleID() == 0x00050000101a9500L){ // Shantae and the Pirate's Curse EUR (reason: crashes when pressing HOME, Pro Controller not recognized) OSGetTitleID() == 0x00050000101a9500L){ // Shantae and the Pirate's Curse EUR (reason: crashes when pressing HOME, Pro Controller not recognized)
SplashScreen(5, std::string("Error. This game is not supported. Starting without patches =(").c_str()); bool res = SplashScreen(5, std::string("This game is not fully supported. Press X to keep patches applied.").c_str(),0,VPAD_BUTTON_X);
if(res){
SplashScreen(0, std::string("Keeping patches applied. Pressing Home results in a crash.").c_str(),1,0);
SplashScreen(5, std::string("Pro Controller emulation is not supported.").c_str(),2,0);
}else{
SplashScreen(3, std::string("Unloading patches. The game should work normally!").c_str(),1,0);
RestorePatches(); RestorePatches();
return EXIT_RELAUNCH_ON_LOAD; return EXIT_RELAUNCH_ON_LOAD;
} }
}
InitFSFunctionPointers(); InitFSFunctionPointers();
InitSocketFunctionPointers(); InitSocketFunctionPointers();
InitGX2FunctionPointers(); InitGX2FunctionPointers();
InitSysFunctionPointers(); InitSysFunctionPointers();
InitVPadFunctionPointers();
InitPadScoreFunctionPointers(); InitPadScoreFunctionPointers();
InitAXFunctionPointers(); InitAXFunctionPointers();
@ -62,7 +69,7 @@ extern "C" s32 Menu_Main(void){
log_printf("Menu_Main (line %d): Initializing the controller data\n",__LINE__); log_printf("Menu_Main (line %d): Initializing the controller data\n",__LINE__);
bool res = ControllerPatcher::Init(); bool res = ControllerPatcher::Init();
if(!res){ if(!res){
SplashScreen(5, std::string("Error. The app starts in 5 seconds without patches.").c_str()); SplashScreen(5, std::string("Error. The app starts in 5 seconds without patches.").c_str(),0,0);
RestorePatches(); RestorePatches();
return EXIT_RELAUNCH_ON_LOAD; return EXIT_RELAUNCH_ON_LOAD;
} }
@ -142,7 +149,8 @@ s32 isInMiiMakerHBL(){
} }
void SplashScreen(s32 time,const char * message){ bool SplashScreen(s32 time,const char * message,u8 pos,u32 button){
bool result = false;
// Prepare screen // Prepare screen
s32 screen_buf0_size = 0; s32 screen_buf0_size = 0;
@ -163,8 +171,8 @@ void SplashScreen(s32 time,const char * message){
OSScreenFlipBuffersEx(0); OSScreenFlipBuffersEx(0);
OSScreenFlipBuffersEx(1); OSScreenFlipBuffersEx(1);
OSScreenPutFontEx(0, 0, 0, message); OSScreenPutFontEx(0, 0, pos, message);
OSScreenPutFontEx(1, 0, 0, message); OSScreenPutFontEx(1, 0, pos, message);
OSScreenFlipBuffersEx(0); OSScreenFlipBuffersEx(0);
OSScreenFlipBuffersEx(1); OSScreenFlipBuffersEx(1);
@ -173,8 +181,17 @@ void SplashScreen(s32 time,const char * message){
s32 times = 1000; s32 times = 1000;
s32 sleepingtime = tickswait / 1000; s32 sleepingtime = tickswait / 1000;
s32 i=0; s32 i=0;
VPADData vpad_data;
s32 error;
while(i<times){ while(i<times){
VPADRead(0, &vpad_data, 1, &error);
if(button > 0 && (vpad_data.btns_h & button)){
result = true;
i = times;
}
i++; i++;
usleep(sleepingtime); usleep(sleepingtime);
} }
return result;
} }

View File

@ -16,7 +16,7 @@ void ApplyPatches(void);
void RestorePatches(void); void RestorePatches(void);
s32 isInMiiMakerHBL(); s32 isInMiiMakerHBL();
void SplashScreen(s32 time,const char * message); bool SplashScreen(s32 time,const char * message,u8 pos, u32 button);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif