diff --git a/src/common/config.cpp b/src/common/config.cpp index 94d8b488c..1af326af7 100644 --- a/src/common/config.cpp +++ b/src/common/config.cpp @@ -199,6 +199,7 @@ static ConfigEntry isDebugDump(false); static ConfigEntry isShaderDebug(false); static ConfigEntry isSeparateLogFilesEnabled(false); static ConfigEntry isFpsColor(true); +static ConfigEntry showFpsCounter(false); static ConfigEntry logEnabled(true); // GUI @@ -466,6 +467,14 @@ bool fpsColor() { return isFpsColor.get(); } +bool getShowFpsCounter() { + return showFpsCounter.get(); +} + +void setShowFpsCounter(bool enable, bool is_game_specific) { + showFpsCounter.set(enable, is_game_specific); +} + bool isLoggingEnabled() { return logEnabled.get(); } @@ -969,6 +978,7 @@ void load(const std::filesystem::path& path, bool is_game_specific) { isSeparateLogFilesEnabled.setFromToml(debug, "isSeparateLogFilesEnabled", is_game_specific); isShaderDebug.setFromToml(debug, "CollectShader", is_game_specific); isFpsColor.setFromToml(debug, "FPSColor", is_game_specific); + showFpsCounter.setFromToml(debug, "showFpsCounter", is_game_specific); logEnabled.setFromToml(debug, "logEnabled", is_game_specific); current_version = toml::find_or(debug, "ConfigVersion", current_version); } @@ -1188,6 +1198,7 @@ void save(const std::filesystem::path& path, bool is_game_specific) { data["GPU"]["internalScreenHeight"] = internalScreenHeight.base_value; data["GPU"]["patchShaders"] = shouldPatchShaders.base_value; data["Debug"]["FPSColor"] = isFpsColor.base_value; + data["Debug"]["showFpsCounter"] = showFpsCounter.base_value; } // Sorting of TOML sections @@ -1296,6 +1307,7 @@ void setDefaultValues(bool is_game_specific) { // Debug isFpsColor.base_value = true; + showFpsCounter.base_value = false; } } diff --git a/src/common/config.h b/src/common/config.h index 481ef6444..2bd65b783 100644 --- a/src/common/config.h +++ b/src/common/config.h @@ -126,6 +126,8 @@ bool getPSNSignedIn(); void setPSNSignedIn(bool sign, bool is_game_specific = false); bool patchShaders(); // no set bool fpsColor(); // no set +bool getShowFpsCounter(); +void setShowFpsCounter(bool enable, bool is_game_specific = false); bool isNeoModeConsole(); void setNeoMode(bool enable, bool is_game_specific = false); bool isDevKitConsole(); diff --git a/src/core/devtools/layer.cpp b/src/core/devtools/layer.cpp index 1fb810030..cfa950568 100644 --- a/src/core/devtools/layer.cpp +++ b/src/core/devtools/layer.cpp @@ -311,6 +311,7 @@ static void LoadSettings(const char* line) { void L::SetupSettings() { frame_graph.is_open = true; + show_simple_fps = Config::getShowFpsCounter(); using SettingLoader = void (*)(const char*); @@ -475,6 +476,11 @@ void ToggleSimpleFps() { visibility_toggled = true; } +void SetSimpleFps(bool enabled) { + show_simple_fps = enabled; + visibility_toggled = true; +} + void ToggleQuitWindow() { show_quit_window = !show_quit_window; } diff --git a/src/core/devtools/layer.h b/src/core/devtools/layer.h index 44afc95bc..96b48a7f0 100644 --- a/src/core/devtools/layer.h +++ b/src/core/devtools/layer.h @@ -30,6 +30,7 @@ private: namespace Overlay { void ToggleSimpleFps(); +void SetSimpleFps(bool enabled); void ToggleQuitWindow(); } // namespace Overlay diff --git a/src/main.cpp b/src/main.cpp index f1e5ce932..b3a8586ba 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -67,6 +67,7 @@ int main(int argc, char* argv[]) { "values, ignores the config file(s) entirely.\n" " --config-global Run the emulator with the base config file " "only, ignores game specific configs.\n" + " --show-fps Enable FPS counter display at startup\n" " -h, --help Display this help message\n"; exit(0); }}, @@ -174,13 +175,15 @@ int main(int argc, char* argv[]) { game_folder = folder; }}, {"--wait-for-debugger", [&](int& i) { waitForDebugger = true; }}, - {"--wait-for-pid", [&](int& i) { + {"--wait-for-pid", + [&](int& i) { if (++i >= argc) { std::cerr << "Error: Missing argument for --wait-for-pid\n"; exit(1); } waitPid = std::stoi(argv[i]); - }}}; + }}, + {"--show-fps", [&](int& i) { Config::setShowFpsCounter(true); }}}; if (argc == 1) { if (!SDL_ShowSimpleMessageBox(