diff options
-rw-r--r-- | src/Config.cpp | 4 | ||||
-rw-r--r-- | src/Config.h | 2 | ||||
-rw-r--r-- | src/libui_sdl/main.cpp | 13 |
3 files changed, 17 insertions, 2 deletions
diff --git a/src/Config.cpp b/src/Config.cpp index 4836cf5..c4a81b1 100644 --- a/src/Config.cpp +++ b/src/Config.cpp @@ -46,6 +46,8 @@ int ScreenLayout; int ScreenSizing; int ScreenFilter; +int LimitFPS; + int DirectBoot; int Threaded3D; @@ -114,6 +116,8 @@ ConfigEntry ConfigFile[] = {"ScreenSizing", 0, &ScreenSizing, 0, NULL, 0}, {"ScreenFilter", 0, &ScreenFilter, 1, NULL, 0}, + {"LimitFPS", 0, &LimitFPS, 1, NULL, 0}, + {"DirectBoot", 0, &DirectBoot, 1, NULL, 0}, {"Threaded3D", 0, &Threaded3D, 1, NULL, 0}, diff --git a/src/Config.h b/src/Config.h index 236c1a3..b112309 100644 --- a/src/Config.h +++ b/src/Config.h @@ -51,6 +51,8 @@ extern int ScreenLayout; extern int ScreenSizing; extern int ScreenFilter; +extern int LimitFPS; + extern int DirectBoot; extern int Threaded3D; diff --git a/src/libui_sdl/main.cpp b/src/libui_sdl/main.cpp index b30c81b..ee6b80d 100644 --- a/src/libui_sdl/main.cpp +++ b/src/libui_sdl/main.cpp @@ -404,7 +404,6 @@ int EmuThreadFunc(void* burp) u32 lasttick = starttick; u32 lastmeasuretick = lasttick; u32 fpslimitcount = 0; - bool limitfps = true; char melontitle[100]; while (EmuRunning != 0) @@ -516,7 +515,7 @@ int EmuThreadFunc(void* burp) lasttick = curtick; u32 wantedtick = starttick + (u32)((float)fpslimitcount * framerate); - if (curtick < wantedtick && limitfps) + if (curtick < wantedtick && Config::LimitFPS) { SDL_Delay(wantedtick - curtick); } @@ -1533,6 +1532,12 @@ void OnSetScreenFiltering(uiMenuItem* item, uiWindow* window, void* blarg) else Config::ScreenFilter = 0; } +void OnSetLimitFPS(uiMenuItem* item, uiWindow* window, void* blarg) +{ + int chk = uiMenuItemChecked(item); + if (chk != 0) Config::LimitFPS = true; + else Config::LimitFPS = false; +} void ApplyNewSettings() { @@ -1765,6 +1770,10 @@ int main(int argc, char** argv) uiMenuItemOnClicked(menuitem, OnSetScreenFiltering, NULL); uiMenuItemSetChecked(menuitem, Config::ScreenFilter==1); + menuitem = uiMenuAppendCheckItem(menu, "Limit framerate"); + uiMenuItemOnClicked(menuitem, OnSetLimitFPS, NULL); + uiMenuItemSetChecked(menuitem, Config::LimitFPS==1); + int w = Config::WindowWidth; int h = Config::WindowHeight; |