Add Display Rotation to windows menu bar.

This commit is contained in:
LunaMoo 2015-11-07 04:40:04 +01:00 committed by Luna
parent 284600b1a7
commit 57c193d742
3 changed files with 44 additions and 0 deletions

View File

@ -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);

View File

@ -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"

View File

@ -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