diff --git a/Core/Config.cpp b/Core/Config.cpp index 3ee86667db..e38a04c2d9 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -358,6 +358,8 @@ static ConfigSetting generalSettings[] = { ConfigSetting("DumpDecryptedEboots", &g_Config.bDumpDecryptedEboot, false, true, true), ConfigSetting("FullscreenOnDoubleclick", &g_Config.bFullscreenOnDoubleclick, true, false, false), + ReportedConfigSetting("MemStickInserted", &g_Config.bMemStickInserted, true, true, true), + ConfigSetting(false), }; diff --git a/Core/Config.h b/Core/Config.h index 1a3afc10cc..119acebea9 100644 --- a/Core/Config.h +++ b/Core/Config.h @@ -139,6 +139,7 @@ public: bool bAutoSaveSymbolMap; bool bCacheFullIsoInRam; int iRemoteISOPort; + bool bMemStickInserted; int iScreenRotation; // The rotation angle of the PPSSPP UI. Only supported on Android and possibly other mobile platforms. int iInternalScreenRotation; // The internal screen rotation angle. Useful for vertical SHMUPs and similar. diff --git a/Core/HLE/sceIo.cpp b/Core/HLE/sceIo.cpp index 5cc6f4598b..f02b2fa5b5 100644 --- a/Core/HLE/sceIo.cpp +++ b/Core/HLE/sceIo.cpp @@ -506,6 +506,9 @@ static void __IoVblank() { // We update memstick status here just to avoid possible thread safety issues. // It doesn't actually need to be on a vblank. + // This will only change status if g_Config was changed. + MemoryStick_SetState(g_Config.bMemStickInserted ? PSP_MEMORYSTICK_STATE_INSERTED : PSP_MEMORYSTICK_STATE_NOT_INSERTED); + MemStickState newState = MemoryStick_State(); MemStickFatState newFatState = MemoryStick_FatState(); diff --git a/Core/HW/MemoryStick.cpp b/Core/HW/MemoryStick.cpp index 5c1ab7a82f..2995f10055 100644 --- a/Core/HW/MemoryStick.cpp +++ b/Core/HW/MemoryStick.cpp @@ -59,6 +59,10 @@ void MemoryStick_SetFatState(MemStickFatState state) { } void MemoryStick_SetState(MemStickState state) { + if (memStickState == state) { + return; + } + memStickState = state; // If removed, we unmount. Otherwise, mounting is delayed. @@ -71,8 +75,14 @@ void MemoryStick_SetState(MemStickState state) { } void MemoryStick_Init() { - memStickState = PSP_MEMORYSTICK_STATE_INSERTED; - memStickFatState = PSP_FAT_MEMORYSTICK_STATE_ASSIGNED; + if (g_Config.bMemStickInserted) { + memStickState = PSP_MEMORYSTICK_STATE_INSERTED; + memStickFatState = PSP_FAT_MEMORYSTICK_STATE_ASSIGNED; + } else { + memStickState = PSP_MEMORYSTICK_STATE_NOT_INSERTED; + memStickFatState = PSP_FAT_MEMORYSTICK_STATE_UNASSIGNED; + } + // Harry Potter and the Goblet of Fire has a bug where it can't handle certain amounts // of free space due to incorrect 32-bit math. // We use 9GB here, which does not trigger the bug, as a cap for the max free space. diff --git a/UI/GameSettingsScreen.cpp b/UI/GameSettingsScreen.cpp index 79c76fd42b..d25a46df4c 100644 --- a/UI/GameSettingsScreen.cpp +++ b/UI/GameSettingsScreen.cpp @@ -534,6 +534,8 @@ void GameSettingsScreen::CreateViews() { PopupSliderChoice *rewindFreq = systemSettings->Add(new PopupSliderChoice(&g_Config.iRewindFlipFrequency, 0, 1800, sy->T("Rewind Snapshot Frequency", "Rewind Snapshot Frequency (mem hog)"), screenManager(), sy->T("frames, 0:off"))); rewindFreq->SetZeroLabel(sy->T("Off")); + systemSettings->Add(new CheckBox(&g_Config.bMemStickInserted, sy->T("Memory Stick inserted"))); + systemSettings->Add(new ItemHeader(sy->T("General"))); #ifdef ANDROID