* remember screen rotation/gap/etc settings

* fix menu cleanup to take submenus into account properly, so it doesn't crash when exiting
This commit is contained in:
StapleButter
2017-11-23 21:02:24 +01:00
parent aa4f427ed4
commit 85c375cce7
4 changed files with 48 additions and 3 deletions

View File

@ -865,6 +865,8 @@ void OnSetScreenRotation(uiMenuItem* item, uiWindow* window, void* param)
w = blarg;
uiWindowSetContentSize(window, w, h);
Config::WindowWidth = w;
Config::WindowHeight = h;
}
}
else if (ScreenLayout == 1) // vertical
@ -1139,6 +1141,20 @@ int main(int argc, char** argv)
uiControlSetMinSize(uiControl(MainDrawArea), 256, 384);
uiAreaSetBackgroundColor(MainDrawArea, 0, 0, 0); // TODO: make configurable?
ScreenRotation = Config::ScreenRotation;
ScreenGap = Config::ScreenGap;
ScreenLayout = Config::ScreenLayout;
ScreenSizing = Config::ScreenSizing;
#define SANITIZE(var, min, max) if ((var < min) || (var > max)) var = 0;
SANITIZE(ScreenRotation, 0, 3);
SANITIZE(ScreenGap, 0, 5);
SANITIZE(ScreenLayout, 0, 2);
SANITIZE(ScreenSizing, 0, 3);
#undef SANITIZE
OnSetScreenRotation(MenuItem_ScreenRot[ScreenRotation], MainWindow, (void*)&kScreenRot[ScreenRotation]);
EmuRunning = 2;
RunningSomething = false;
EmuThread = SDL_CreateThread(EmuThreadFunc, "melonDS magic", NULL);
@ -1165,6 +1181,11 @@ int main(int argc, char** argv)
EmuRunning = 0;
SDL_WaitThread(EmuThread, NULL);
Config::ScreenRotation = ScreenRotation;
Config::ScreenGap = ScreenGap;
Config::ScreenLayout = ScreenLayout;
Config::ScreenSizing = ScreenSizing;
Config::Save();
if (ScreenBitmap) uiDrawFreeBitmap(ScreenBitmap);