From 57c193d74244c6815f68907e356e372f7a8af365 Mon Sep 17 00:00:00 2001 From: LunaMoo Date: Sat, 7 Nov 2015 04:40:04 +0100 Subject: [PATCH] Add Display Rotation to windows menu bar. --- Windows/MainWindowMenu.cpp | 33 +++++++++++++++++++++++++++++++++ Windows/ppsspp.rc | 7 +++++++ Windows/resource.h | 4 ++++ 3 files changed, 44 insertions(+) diff --git a/Windows/MainWindowMenu.cpp b/Windows/MainWindowMenu.cpp index d628ad048..cf9ebcb84 100644 --- a/Windows/MainWindowMenu.cpp +++ b/Windows/MainWindowMenu.cpp @@ -80,6 +80,9 @@ namespace MainWindow { // File submenus SUBMENU_FILE_SAVESTATE_SLOT = 6, + // Emulation submenus + SUBMENU_DISPLAY_ROTATION = 8, + // Game Settings submenus SUBMENU_CUSTOM_SHADERS = 10, SUBMENU_RENDERING_RESOLUTION = 11, @@ -235,6 +238,11 @@ namespace MainWindow { TranslateMenuItem(menu, ID_EMULATION_STOP, L"\tCtrl+W"); TranslateMenuItem(menu, ID_EMULATION_RESET, L"\tCtrl+B"); TranslateMenuItem(menu, ID_EMULATION_SWITCH_UMD, L"\tCtrl+U", "Switch UMD"); + TranslateSubMenu(menu, "Display Rotation", MENU_EMULATION, SUBMENU_DISPLAY_ROTATION); + TranslateMenuItem(menu, ID_EMULATION_ROTATION_H); + TranslateMenuItem(menu, ID_EMULATION_ROTATION_V); + TranslateMenuItem(menu, ID_EMULATION_ROTATION_H_R); + TranslateMenuItem(menu, ID_EMULATION_ROTATION_V_R); // Debug menu TranslateMenuItem(menu, ID_DEBUG_LOADMAPFILE); @@ -385,6 +393,10 @@ namespace MainWindow { } } + static void setScreenRotation(int rotation) { + g_Config.iInternalScreenRotation = rotation; + } + static void SaveStateActionFinished(bool result, void *userdata) { PostMessage(MainWindow::GetHWND(), WM_USER_SAVESTATE_FINISH, 0, 0); } @@ -534,6 +546,11 @@ namespace MainWindow { UmdSwitchAction(); break; + case ID_EMULATION_ROTATION_H: setScreenRotation(ROTATION_LOCKED_HORIZONTAL); break; + case ID_EMULATION_ROTATION_V: setScreenRotation(ROTATION_LOCKED_VERTICAL); break; + case ID_EMULATION_ROTATION_H_R: setScreenRotation(ROTATION_LOCKED_HORIZONTAL180); break; + case ID_EMULATION_ROTATION_V_R: setScreenRotation(ROTATION_LOCKED_VERTICAL180); break; + case ID_EMULATION_CHEATS: g_Config.bEnableCheats = !g_Config.bEnableCheats; osm.ShowOnOff(gr->T("Cheats"), g_Config.bEnableCheats); @@ -933,6 +950,22 @@ namespace MainWindow { CHECKITEM(ID_EMULATION_CHEATS, g_Config.bEnableCheats); CHECKITEM(ID_OPTIONS_IGNOREWINKEY, g_Config.bIgnoreWindowsKey); + static const int displayrotationitems[] = { + ID_EMULATION_ROTATION_H, + ID_EMULATION_ROTATION_V, + ID_EMULATION_ROTATION_H_R, + ID_EMULATION_ROTATION_V_R + }; + if (g_Config.iInternalScreenRotation < ROTATION_LOCKED_HORIZONTAL) + g_Config.iInternalScreenRotation = ROTATION_LOCKED_HORIZONTAL; + + else if (g_Config.iInternalScreenRotation > ROTATION_LOCKED_VERTICAL180) + g_Config.iInternalScreenRotation = ROTATION_LOCKED_VERTICAL180; + + for (int i = 0; i < ARRAY_SIZE(displayrotationitems); i++) { + CheckMenuItem(menu, displayrotationitems[i], MF_BYCOMMAND | ((i + 1) == g_Config.iInternalScreenRotation ? MF_CHECKED : MF_UNCHECKED)); + } + // Disable Vertex Cache when HW T&L is disabled. if (!g_Config.bHardwareTransform) { EnableMenuItem(menu, ID_OPTIONS_VERTEXCACHE, MF_GRAYED); diff --git a/Windows/ppsspp.rc b/Windows/ppsspp.rc index be654e816..96bba8e4f 100644 --- a/Windows/ppsspp.rc +++ b/Windows/ppsspp.rc @@ -411,6 +411,13 @@ BEGIN MENUITEM "Stop", ID_EMULATION_STOP MENUITEM "Reset", ID_EMULATION_RESET MENUITEM "Switch UMD", ID_EMULATION_SWITCH_UMD + POPUP "Display Rotation" + BEGIN + MENUITEM "Landscape", ID_EMULATION_ROTATION_H + MENUITEM "Portrait", ID_EMULATION_ROTATION_V + MENUITEM "Landscape reversed", ID_EMULATION_ROTATION_H_R + MENUITEM "Portrait reversed", ID_EMULATION_ROTATION_V_R + END END POPUP "Debug" diff --git a/Windows/resource.h b/Windows/resource.h index 5ef058e63..2bc7be481 100644 --- a/Windows/resource.h +++ b/Windows/resource.h @@ -319,6 +319,10 @@ #define ID_OPTIONS_BUFNEARESTFILTER 40153 #define ID_OPTIONS_DIRECT3D9 40154 #define ID_OPTIONS_OPENGL 40155 +#define ID_EMULATION_ROTATION_H 40156 +#define ID_EMULATION_ROTATION_V 40157 +#define ID_EMULATION_ROTATION_H_R 40158 +#define ID_EMULATION_ROTATION_V_R 40159 // Dummy option to let the buffered rendering hotkey cycle through all the options. #define ID_OPTIONS_BUFFEREDRENDERINGDUMMY 40500