diff --git a/Core/Config.cpp b/Core/Config.cpp index 8fe72b606e..d04466bee4 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -51,6 +51,7 @@ void CConfig::Load(const char *iniFileName) general->Get("DisplayFramebuffer", &bDisplayFramebuffer, false); general->Get("CurrentDirectory", ¤tDirectory, ""); general->Get("ShowFPSCounter", &bShowFPSCounter, false); + general->Get("WindowZoom", &iWindowZoom, 1); IniFile::Section *sound = iniFile.GetOrCreateSection("Sound"); sound->Get("Enable", &bEnableSound, true); @@ -76,6 +77,7 @@ void CConfig::Save() general->Set("DisplayFramebuffer", bDisplayFramebuffer); general->Set("CurrentDirectory", currentDirectory); general->Set("ShowFPSCounter", bShowFPSCounter); + general->Set("WindowZoom", iWindowZoom); IniFile::Section *sound = iniFile.GetOrCreateSection("Sound"); sound->Set("Enable", bEnableSound); diff --git a/Core/Config.h b/Core/Config.h index e1b74642b8..4c4e4b4fdc 100644 --- a/Core/Config.h +++ b/Core/Config.h @@ -46,6 +46,7 @@ public: bool bShowAnalogStick; bool bShowFPSCounter; + int iWindowZoom; // for Windows std::string currentDirectory; diff --git a/Windows/OpenGLBase.cpp b/Windows/OpenGLBase.cpp index 488b70e9fa..706d3c17e8 100644 --- a/Windows/OpenGLBase.cpp +++ b/Windows/OpenGLBase.cpp @@ -41,8 +41,11 @@ void setVSync(int interval=1) wglSwapIntervalEXT(interval); } } -GLvoid ResizeGLScene() // Resize And Initialize The GL Window + +void GL_Resized() // Resize And Initialize The GL Window { + if (!hWnd) + return; RECT rc; GetWindowRect(hWnd,&rc); xres=rc.right-rc.left; //account for border :P @@ -136,7 +139,7 @@ bool GL_Init(HWND window) glewInit(); - ResizeGLScene(); // Set Up Our Perspective GL Screen + GL_Resized(); // Set Up Our Perspective GL Screen return true; // Success } @@ -162,4 +165,5 @@ void GL_Shutdown() MessageBox(NULL,"Release Device Context Failed.","SHUTDOWN ERROR",MB_OK | MB_ICONINFORMATION); hDC=NULL; // Set DC To NULL } + hWnd = NULL; } diff --git a/Windows/OpenGLBase.h b/Windows/OpenGLBase.h index 173d68102b..50a154089f 100644 --- a/Windows/OpenGLBase.h +++ b/Windows/OpenGLBase.h @@ -5,5 +5,6 @@ bool GL_Init(HWND window); void GL_Shutdown(); +void GL_Resized(); void GL_BeginFrame(); void GL_EndFrame(); diff --git a/Windows/WndMainWindow.cpp b/Windows/WndMainWindow.cpp index 57da99d854..c91f146cd0 100644 --- a/Windows/WndMainWindow.cpp +++ b/Windows/WndMainWindow.cpp @@ -11,7 +11,7 @@ #include "commctrl.h" #include "../Core/Debugger/SymbolMap.h" - +#include "OpenGLBase.h" #include "Debugger/Debugger_Disasm.h" #include "Debugger/Debugger_MemoryDlg.h" #include "main.h" @@ -96,34 +96,36 @@ namespace MainWindow RegisterClassEx(&wcex); } - void RequestWindowSize(int w, int h) - { - RECT rc; - rc.left=20; - rc.top=100; + void GetWindowRectAtZoom(int zoom, RECT &rcInner, RECT &rcOuter) { + rcInner.left=20; + rcInner.top=100; - rc.right=w+rc.left;//+client edge - rc.bottom=h+rc.top; //+client edge + rcInner.right=480*zoom + rcInner.left;//+client edge + rcInner.bottom=272*zoom + rcInner.top; //+client edge - AdjustWindowRect(&rc, WS_OVERLAPPEDWINDOW, TRUE); - SetWindowPos(hwndMain,0,0,0,rc.right-rc.left,rc.bottom-rc.top,SWP_NOMOVE|SWP_NOZORDER); + rcOuter=rcInner; + AdjustWindowRect(&rcOuter, WS_OVERLAPPEDWINDOW, TRUE); + } + + void SetZoom(int zoom) { + g_Config.iWindowZoom = zoom; + RECT rc, rcOuter; + GetWindowRectAtZoom(zoom, rc, rcOuter); + MoveWindow(hwndMain, rcOuter.left, rcOuter.top, rcOuter.right - rcOuter.left, rcOuter.bottom - rcOuter.top, TRUE); + MoveWindow(hwndDisplay, 0, 0, rc.right - rc.left, rc.bottom - rc.top, TRUE); + GL_Resized(); } BOOL Show(HINSTANCE hInstance, int nCmdShow) { hInst = hInstance; // Store instance handle in our global variable + int zoom = g_Config.iWindowZoom; + if (zoom < 1) zoom = 1; + if (zoom > 4) zoom = 4; + RECT rc,rcOrig; - rc.left=20; - rc.top=100; - - int zoom = 4; - - rc.right=480*zoom+rc.left;//+client edge - rc.bottom=272*zoom+rc.top; //+client edge - - rcOrig=rc; - AdjustWindowRect(&rc, WS_OVERLAPPEDWINDOW, TRUE); + GetWindowRectAtZoom(zoom, rcOrig, rc); u32 style = skinMode ? WS_POPUP : WS_OVERLAPPEDWINDOW; @@ -317,6 +319,23 @@ namespace MainWindow } break; + case ID_OPTIONS_SCREEN1X: + SetZoom(1); + UpdateMenus(); + break; + case ID_OPTIONS_SCREEN2X: + SetZoom(2); + UpdateMenus(); + break; + case ID_OPTIONS_SCREEN3X: + SetZoom(3); + UpdateMenus(); + break; + case ID_OPTIONS_SCREEN4X: + SetZoom(4); + UpdateMenus(); + break; + case ID_FILE_EXIT: DestroyWindow(hWnd); break; @@ -590,6 +609,16 @@ namespace MainWindow EnableMenuItem(menu,ID_EMULATION_STOP,!enable); EnableMenuItem(menu,ID_OPTIONS_SETTINGS,enable); EnableMenuItem(menu,ID_PLUGINS_CHOOSEPLUGINS,enable); + + const int zoomitems[4] = { + ID_OPTIONS_SCREEN1X, + ID_OPTIONS_SCREEN2X, + ID_OPTIONS_SCREEN3X, + ID_OPTIONS_SCREEN4X, + }; + for (int i = 0; i < 4; i++) { + CheckMenuItem(menu, zoomitems[i], MF_BYCOMMAND | ((i == g_Config.iWindowZoom - 1) ? MF_CHECKED : MF_UNCHECKED)); + } } diff --git a/Windows/WndMainWindow.h b/Windows/WndMainWindow.h index d126e87552..2db48c759a 100644 --- a/Windows/WndMainWindow.h +++ b/Windows/WndMainWindow.h @@ -13,5 +13,4 @@ namespace MainWindow HINSTANCE GetHInstance(); HWND GetDisplayHWND(); void SetPlaying(const char*text); - void RequestWindowSize(int w, int h); } diff --git a/Windows/ppsspp.rc b/Windows/ppsspp.rc index 59fe2f9eb4..c75d227f82 100644 --- a/Windows/ppsspp.rc +++ b/Windows/ppsspp.rc @@ -214,6 +214,11 @@ BEGIN MENUITEM "&Toggle Full Screen\tAlt+Enter", ID_OPTIONS_FULLSCREEN, GRAYED MENUITEM "&Display raw framebuffer", ID_OPTIONS_DISPLAYRAWFRAMEBUFFER MENUITEM SEPARATOR + MENUITEM "Screen &1x", ID_OPTIONS_SCREEN1X + MENUITEM "Screen &2x", ID_OPTIONS_SCREEN2X + MENUITEM "Screen &3x", ID_OPTIONS_SCREEN3X + MENUITEM "Screen &4x", ID_OPTIONS_SCREEN4X + MENUITEM SEPARATOR MENUITEM "&Ignore illegal reads/writes", ID_OPTIONS_IGNOREILLEGALREADS END POPUP "&Help" diff --git a/Windows/resource.h b/Windows/resource.h index 85e7774f9e..382a6dbec2 100644 --- a/Windows/resource.h +++ b/Windows/resource.h @@ -233,13 +233,18 @@ #define ID_OPTIONS_DISPLAYRAWFRAMEBUFFER 40110 #define ID_HELP_OPENHTTP 40111 #define ID_HELP_OPENWEBSITE 40112 +#define ID_OPTIONS_SCREEN1X 40113 +#define ID_OPTIONS_MENUEDITOR 40114 +#define ID_OPTIONS_SCREEN3X 40115 +#define ID_OPTIONS_SCREEN4X 40116 +#define ID_OPTIONS_SCREEN2X 40117 // Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 232 -#define _APS_NEXT_COMMAND_VALUE 40113 +#define _APS_NEXT_COMMAND_VALUE 40118 #define _APS_NEXT_CONTROL_VALUE 1162 #define _APS_NEXT_SYMED_VALUE 101 #endif diff --git a/test.py b/test.py index f1642fc6f8..7485b53694 100644 --- a/test.py +++ b/test.py @@ -23,7 +23,6 @@ tests_good = [ "cpu/lsu/lsu", "cpu/fpu/fpu", - "malloc/malloc", "display/display", "dmac/dmactest", "intr/intr", @@ -46,6 +45,7 @@ tests_good = [ ] tests_next = [ + "malloc/malloc", # These are the next tests up for fixing. These run by default. "threads/fpl/fpl", "threads/msgpipe/msgpipe",