diff --git a/Core/Config.cpp b/Core/Config.cpp index 326044fd4c..fd0496a966 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -58,6 +58,9 @@ void Config::Load(const char *iniFileName) // "default" means let emulator decide, "" means disable. general->Get("ReportHost", &sReportHost, "default"); general->Get("Recent", recentIsos); + general->Get("WindowX", &iWindowX, 40); + general->Get("WindowY", &iWindowY, 100); + if (recentIsos.size() > MAX_RECENT) recentIsos.resize(MAX_RECENT); @@ -134,6 +137,8 @@ void Config::Save() general->Set("ShowDebuggerOnLoad", bShowDebuggerOnLoad); general->Set("ReportHost", sReportHost); general->Set("Recent", recentIsos); + general->Set("WindowX", iWindowX); + general->Set("WindowY", iWindowY); IniFile::Section *cpu = iniFile.GetOrCreateSection("CPU"); cpu->Set("Jit", bJit); diff --git a/Core/Config.h b/Core/Config.h index 7d22ebe030..6c963150cb 100644 --- a/Core/Config.h +++ b/Core/Config.h @@ -58,6 +58,8 @@ public: int iFrameSkip; // 0 = off; 1 = auto; (future: 2 = skip every 2nd frame; 3 = skip every 3rd frame etc). bool bUseMediaEngine; + int iWindowX; + int iWindowY; int iWindowZoom; // for Windows bool SSAntiAliasing; //for Windows, too bool bVertexCache; diff --git a/Windows/WndMainWindow.cpp b/Windows/WndMainWindow.cpp index b4ac15d25c..aa97685dd4 100644 --- a/Windows/WndMainWindow.cpp +++ b/Windows/WndMainWindow.cpp @@ -108,8 +108,8 @@ namespace MainWindow void GetWindowRectAtZoom(int zoom, RECT &rcInner, RECT &rcOuter) { // GetWindowRect(hwndMain, &rcInner); - rcInner.left = 20; - rcInner.top = 120; + rcInner.left = g_Config.iWindowX; + rcInner.top = g_Config.iWindowY; rcInner.right=480*zoom + rcInner.left;//+client edge rcInner.bottom=272*zoom + rcInner.top; //+client edge @@ -118,6 +118,17 @@ namespace MainWindow AdjustWindowRect(&rcOuter, WS_OVERLAPPEDWINDOW, TRUE); } + void SavePosition() { + WINDOWPLACEMENT placement; + GetWindowPlacement(hwndMain, &placement); + if (placement.showCmd == SW_SHOWNORMAL) { + RECT rc; + GetWindowRect(hwndMain, &rc); + g_Config.iWindowX = rc.left; + g_Config.iWindowY = rc.top; + } + } + void ResizeDisplay(bool noWindowMovement = false) { RECT rc; GetClientRect(hwndMain, &rc); @@ -291,10 +302,12 @@ namespace MainWindow break; case WM_MOVE: + SavePosition(); ResizeDisplay(); break; case WM_SIZE: + SavePosition(); ResizeDisplay(); break;