diff options
-rw-r--r-- | src/Config.cpp | 10 | ||||
-rw-r--r-- | src/Config.h | 5 | ||||
-rw-r--r-- | src/wx/main.cpp | 25 | ||||
-rw-r--r-- | src/wx/main.h | 4 |
4 files changed, 32 insertions, 12 deletions
diff --git a/src/Config.cpp b/src/Config.cpp index dcbad9b..677af96 100644 --- a/src/Config.cpp +++ b/src/Config.cpp @@ -28,6 +28,11 @@ namespace Config int KeyMapping[12]; int JoyMapping[12]; +int WindowWidth; +int WindowHeight; + +int DirectBoot; + typedef struct { char Name[16]; @@ -67,6 +72,11 @@ ConfigEntry ConfigFile[] = {"Joy_X", 0, &JoyMapping[10], -1, NULL, 0}, {"Joy_Y", 0, &JoyMapping[11], -1, NULL, 0}, + {"WindowWidth", 0, &WindowWidth, 256, NULL, 0}, + {"WindowHeight", 0, &WindowHeight, 384, NULL, 0}, + + {"DirectBoot", 0, &DirectBoot, 1, NULL, 0}, + {"", -1, NULL, 0, NULL, 0} }; diff --git a/src/Config.h b/src/Config.h index 16561f6..0672fcc 100644 --- a/src/Config.h +++ b/src/Config.h @@ -30,6 +30,11 @@ void Save(); extern int KeyMapping[12]; extern int JoyMapping[12]; +extern int WindowWidth; +extern int WindowHeight; + +extern int DirectBoot; + } #endif // CONFIG_H diff --git a/src/wx/main.cpp b/src/wx/main.cpp index 0c9cc51..c761d0e 100644 --- a/src/wx/main.cpp +++ b/src/wx/main.cpp @@ -26,12 +26,6 @@ #include "InputConfig.h" -bool Touching; - -int WindowX, WindowY; -int WindowW, WindowH; - - wxIMPLEMENT_APP_NO_MAIN(wxApp_melonDS); @@ -153,8 +147,6 @@ MainFrame::MainFrame() GetMenuBar()->Enable(ID_PAUSE, false); GetMenuBar()->Enable(ID_RESET, false); - Touching = false; - joy = NULL; joyid = -1; } @@ -169,6 +161,7 @@ void MainFrame::OnClose(wxCloseEvent& event) { if (emuthread) { + emuthread->EmuPause(); emuthread->EmuExit(); emuthread->Wait(); @@ -188,6 +181,8 @@ void MainFrame::OnClose(wxCloseEvent& event) SDL_Quit(); Destroy(); + + Config::Save(); } void MainFrame::OnCloseFromMenu(wxCommandEvent& event) @@ -320,7 +315,7 @@ wxThread::ExitCode EmuThread::Entry() sdlwin = SDL_CreateWindow("melonDS " MELONDS_VERSION, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, - 256, 384, + Config::WindowWidth, Config::WindowHeight, SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI); SDL_SetWindowMinimumSize(sdlwin, 256, 384); @@ -344,6 +339,7 @@ wxThread::ExitCode EmuThread::Entry() botdst.x = 0; botdst.y = 192; botdst.w = 256; botdst.h = 192; + Touching = false; axismask = 0; u32 nframes = 0; @@ -356,6 +352,8 @@ wxThread::ExitCode EmuThread::Entry() ProcessEvents(); + if (emustatus == 0) break; + if (emustatus == 1) { u32 starttick = SDL_GetTicks(); @@ -413,7 +411,6 @@ wxThread::ExitCode EmuThread::Entry() lasttick = SDL_GetTicks(); fpslimitcount = 0; - emupaused = true; Sleep(50); SDL_RenderCopy(sdlrend, sdltex, NULL, NULL); @@ -424,6 +421,8 @@ wxThread::ExitCode EmuThread::Entry() char* melontitle = "Paused - melonDS " MELONDS_VERSION; SDL_SetWindowTitle(sdlwin, melontitle); } + + emupaused = true; } } @@ -449,7 +448,7 @@ void EmuThread::ProcessEvents() wxThread* thread = parent->emuthread; parent->CloseFromOutside(); EmuExit(); - delete thread; + //delete thread; return; } if (evt.window.event != SDL_WINDOWEVENT_EXPOSED) @@ -486,10 +485,12 @@ void EmuThread::ProcessEvents() botdst.x = 0; botdst.y = screenh + gap; botdst.w = w; botdst.h = screenh; } + + Config::WindowWidth = w; + Config::WindowHeight = h; } SDL_GetWindowPosition(sdlwin, &WindowX, &WindowY); - SDL_GetWindowSize(sdlwin, &WindowW, &WindowH); } break; diff --git a/src/wx/main.h b/src/wx/main.h index 0b44a8e..d61442d 100644 --- a/src/wx/main.h +++ b/src/wx/main.h @@ -102,6 +102,10 @@ protected: SDL_Rect topsrc, topdst; SDL_Rect botsrc, botdst; + bool Touching; + + int WindowX, WindowY; + void* texpixels; int texstride; |