From 7029cb293b904560ac8184283d2ef5816ce7bd26 Mon Sep 17 00:00:00 2001 From: shenweip Date: Wed, 27 Nov 2013 21:57:17 +0800 Subject: [PATCH] Add Switch UMD to Win32 menu. --- Windows/WndMainWindow.cpp | 25 ++++++++++++++++++++++++- Windows/WndMainWindow.h | 1 + Windows/ppsspp.rc | 1 + Windows/resource.h | 1 + 4 files changed, 27 insertions(+), 1 deletion(-) diff --git a/Windows/WndMainWindow.cpp b/Windows/WndMainWindow.cpp index 801d60ec88..303889c6f2 100644 --- a/Windows/WndMainWindow.cpp +++ b/Windows/WndMainWindow.cpp @@ -67,6 +67,8 @@ #include "Core/HLE/sceUtility.h" #include "GPU/Common/PostShader.h" +#include "Core/HLE/sceUmd.h" + #ifdef THEMES #include "XPTheme.h" #endif @@ -372,6 +374,7 @@ namespace MainWindow void SetIngameMenuItemStates(const GlobalUIState state) { UINT menuEnable = state == UISTATE_INGAME ? MF_ENABLED : MF_GRAYED; + UINT umdSwitchEnable = state == UISTATE_INGAME && getUMDReplacePermit()? MF_ENABLED : MF_GRAYED; EnableMenuItem(menu, ID_FILE_SAVESTATEFILE, menuEnable); EnableMenuItem(menu, ID_FILE_LOADSTATEFILE, menuEnable); @@ -380,6 +383,7 @@ namespace MainWindow EnableMenuItem(menu, ID_TOGGLE_PAUSE, menuEnable); EnableMenuItem(menu, ID_EMULATION_STOP, menuEnable); EnableMenuItem(menu, ID_EMULATION_RESET, menuEnable); + EnableMenuItem(menu, ID_EMULATION_SWITCH_UMD, umdSwitchEnable); } // These are used as an offset @@ -547,7 +551,8 @@ namespace MainWindow // Emulation menu TranslateMenuItem(ID_TOGGLE_PAUSE, L"\tF8", "Pause"); TranslateMenuItem(ID_EMULATION_STOP, L"\tCtrl+W"); - TranslateMenuItem(ID_EMULATION_RESET, L"\tCtrl+B"); + TranslateMenuItem(ID_EMULATION_RESET, L"\tCtrl+B"); + TranslateMenuItem(ID_EMULATION_SWITCH_UMD, L"\tCtrl+U", "Switch UMD"); // Debug menu TranslateMenuItem(ID_DEBUG_LOADMAPFILE); @@ -849,6 +854,21 @@ namespace MainWindow } } + void UmdSwitchAction() { + std::string fn; + std::string filter = "PSP ROMs (*.iso *.cso *.pbp *.elf)|*.pbp;*.elf;*.iso;*.cso;*.prx|All files (*.*)|*.*||"; + + for (int i=0; i<(int)filter.length(); i++) { + if (filter[i] == '|') + filter[i] = '\0'; + } + + if (W32Util::BrowseForFileName(true, GetHWND(), L"Switch Umd", 0, ConvertUTF8ToWString(filter).c_str(), L"*.pbp;*.elf;*.iso;*.cso;",fn)) { + fn = ReplaceAll(fn, "\\", "/"); + __UmdReplace(fn); + } + } + LRESULT CALLBACK DisplayProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { // Only apply a factor > 1 in windowed mode. int factor = !IsZoomed(GetHWND()) && !g_Config.bFullScreen && g_Config.iWindowWidth < (480 + 80) ? 2 : 1; @@ -1150,6 +1170,9 @@ namespace MainWindow NativeMessageReceived("reset", ""); Core_EnableStepping(false); break; + case ID_EMULATION_SWITCH_UMD: + UmdSwitchAction(); + break; case ID_EMULATION_CHEATS: g_Config.bEnableCheats = !g_Config.bEnableCheats; diff --git a/Windows/WndMainWindow.h b/Windows/WndMainWindow.h index 61078c9574..06cdbb04bc 100644 --- a/Windows/WndMainWindow.h +++ b/Windows/WndMainWindow.h @@ -67,4 +67,5 @@ namespace MainWindow void ToggleDebugConsoleVisibility(); void TranslateMenus(); void setTexScalingMultiplier(int level); + void UmdSwitchAction(); } diff --git a/Windows/ppsspp.rc b/Windows/ppsspp.rc index 98f586b596..3f34c86282 100644 --- a/Windows/ppsspp.rc +++ b/Windows/ppsspp.rc @@ -389,6 +389,7 @@ BEGIN MENUITEM "Run", ID_TOGGLE_PAUSE MENUITEM "Stop", ID_EMULATION_STOP MENUITEM "Reset", ID_EMULATION_RESET + MENUITEM "Switch UMD", ID_EMULATION_SWITCH_UMD END POPUP "Debug" diff --git a/Windows/resource.h b/Windows/resource.h index cce8701c05..7882ac8103 100644 --- a/Windows/resource.h +++ b/Windows/resource.h @@ -299,6 +299,7 @@ #define ID_OPTIONS_LANGUAGE 40141 #define ID_MEMVIEW_COPYVALUE_16 40142 #define ID_MEMVIEW_COPYVALUE_32 40143 +#define ID_EMULATION_SWITCH_UMD 40144 // Dummy option to let the buffered rendering hotkey cycle through all the options. #define ID_OPTIONS_BUFFEREDRENDERINGDUMMY 40500