From 7681551544c39294369d0f0366971a0d76cf045c Mon Sep 17 00:00:00 2001 From: Stenzek Date: Mon, 8 May 2023 13:07:19 +1000 Subject: [PATCH] System: Don't auto enable analog on unknown games --- src/core/analog_controller.cpp | 5 ++--- src/core/system.cpp | 16 ++++++---------- src/core/system.h | 2 +- 3 files changed, 9 insertions(+), 14 deletions(-) diff --git a/src/core/analog_controller.cpp b/src/core/analog_controller.cpp index bfe67fb054..2e12882141 100644 --- a/src/core/analog_controller.cpp +++ b/src/core/analog_controller.cpp @@ -53,7 +53,7 @@ void AnalogController::Reset() if (m_force_analog_on_reset) { - if (g_settings.controller_disable_analog_mode_forcing || System::IsRunningBIOS()) + if (g_settings.controller_disable_analog_mode_forcing || System::IsRunningUnknownGame()) { Host::AddIconOSDMessage( fmt::format("Controller{}AnalogMode", m_index), ICON_FA_GAMEPAD, @@ -835,8 +835,7 @@ static const char* s_invert_settings[] = {TRANSLATABLE("AnalogController", "Not static const SettingInfo s_settings[] = { {SettingInfo::Type::Boolean, "ForceAnalogOnReset", TRANSLATABLE("AnalogController", "Force Analog Mode on Reset"), - TRANSLATABLE("AnalogController", "Forces the controller to analog mode when the console is reset/powered on. May " - "cause issues with games, so it is recommended to leave this option off."), + TRANSLATABLE("AnalogController", "Forces the controller to analog mode when the console is reset/powered on."), "true"}, {SettingInfo::Type::Boolean, "AnalogDPadInDigitalMode", TRANSLATABLE("AnalogController", "Use Analog Sticks for D-Pad in Digital Mode"), diff --git a/src/core/system.cpp b/src/core/system.cpp index 59b2b8d7a1..3b82f717ea 100644 --- a/src/core/system.cpp +++ b/src/core/system.cpp @@ -147,7 +147,7 @@ static BIOS::Hash s_bios_hash = {}; static std::string s_running_game_path; static std::string s_running_game_serial; static std::string s_running_game_title; -static bool s_running_bios; +static bool s_running_unknown_game; static float s_throttle_frequency = 60.0f; static float s_target_speed = 1.0f; @@ -329,9 +329,9 @@ const std::string& System::GetRunningTitle() return s_running_game_title; } -bool System::IsRunningBIOS() +bool System::IsRunningUnknownGame() { - return s_running_bios; + return s_running_unknown_game; } const BIOS::ImageInfo* System::GetBIOSImageInfo() @@ -967,9 +967,6 @@ void System::ResetSystem() ResetPerformanceCounters(); ResetThrottler(); Host::AddOSDMessage(Host::TranslateStdString("OSDMessage", "System reset.")); - - // need to clear this here, because of eject disc -> reset. - s_running_bios = !s_running_game_path.empty(); } void System::PauseSystem(bool paused) @@ -1248,9 +1245,6 @@ bool System::BootSystem(SystemBootParameters parameters) return false; } - // Allow controller analog mode for EXEs and PSFs. - s_running_bios = s_running_game_path.empty() && exe_boot.empty() && psf_boot.empty(); - UpdateControllers(); UpdateMemoryCardTypes(); UpdateMultitaps(); @@ -1519,7 +1513,7 @@ void System::ClearRunningGame() s_running_game_serial.clear(); s_running_game_path.clear(); s_running_game_title.clear(); - s_running_bios = false; + s_running_unknown_game = false; s_cheat_list.reset(); s_state = State::Shutdown; @@ -3037,6 +3031,7 @@ void System::UpdateRunningGame(const char* path, CDImage* image, bool booting) s_running_game_path.clear(); s_running_game_serial.clear(); s_running_game_title.clear(); + s_running_unknown_game = true; if (path && std::strlen(path) > 0) { @@ -3054,6 +3049,7 @@ void System::UpdateRunningGame(const char* path, CDImage* image, bool booting) { s_running_game_serial = entry->serial; s_running_game_title = entry->title; + s_running_unknown_game = false; } else { diff --git a/src/core/system.h b/src/core/system.h index 7dfd229023..adbec80ca4 100644 --- a/src/core/system.h +++ b/src/core/system.h @@ -181,7 +181,7 @@ const std::string& GetRunningPath(); const std::string& GetRunningSerial(); const std::string& GetRunningTitle(); -bool IsRunningBIOS(); +bool IsRunningUnknownGame(); const BIOS::ImageInfo* GetBIOSImageInfo(); const BIOS::Hash& GetBIOSHash();