System: Don't auto enable analog on unknown games

This commit is contained in:
Stenzek 2023-05-08 13:07:19 +10:00
parent eb77894315
commit 7681551544
3 changed files with 9 additions and 14 deletions

View File

@ -53,7 +53,7 @@ void AnalogController::Reset()
if (m_force_analog_on_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( Host::AddIconOSDMessage(
fmt::format("Controller{}AnalogMode", m_index), ICON_FA_GAMEPAD, 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[] = { static const SettingInfo s_settings[] = {
{SettingInfo::Type::Boolean, "ForceAnalogOnReset", TRANSLATABLE("AnalogController", "Force Analog Mode on Reset"), {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 " TRANSLATABLE("AnalogController", "Forces the controller to analog mode when the console is reset/powered on."),
"cause issues with games, so it is recommended to leave this option off."),
"true"}, "true"},
{SettingInfo::Type::Boolean, "AnalogDPadInDigitalMode", {SettingInfo::Type::Boolean, "AnalogDPadInDigitalMode",
TRANSLATABLE("AnalogController", "Use Analog Sticks for D-Pad in Digital Mode"), TRANSLATABLE("AnalogController", "Use Analog Sticks for D-Pad in Digital Mode"),

View File

@ -147,7 +147,7 @@ static BIOS::Hash s_bios_hash = {};
static std::string s_running_game_path; static std::string s_running_game_path;
static std::string s_running_game_serial; static std::string s_running_game_serial;
static std::string s_running_game_title; 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_throttle_frequency = 60.0f;
static float s_target_speed = 1.0f; static float s_target_speed = 1.0f;
@ -329,9 +329,9 @@ const std::string& System::GetRunningTitle()
return s_running_game_title; 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() const BIOS::ImageInfo* System::GetBIOSImageInfo()
@ -967,9 +967,6 @@ void System::ResetSystem()
ResetPerformanceCounters(); ResetPerformanceCounters();
ResetThrottler(); ResetThrottler();
Host::AddOSDMessage(Host::TranslateStdString("OSDMessage", "System reset.")); 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) void System::PauseSystem(bool paused)
@ -1248,9 +1245,6 @@ bool System::BootSystem(SystemBootParameters parameters)
return false; 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(); UpdateControllers();
UpdateMemoryCardTypes(); UpdateMemoryCardTypes();
UpdateMultitaps(); UpdateMultitaps();
@ -1519,7 +1513,7 @@ void System::ClearRunningGame()
s_running_game_serial.clear(); s_running_game_serial.clear();
s_running_game_path.clear(); s_running_game_path.clear();
s_running_game_title.clear(); s_running_game_title.clear();
s_running_bios = false; s_running_unknown_game = false;
s_cheat_list.reset(); s_cheat_list.reset();
s_state = State::Shutdown; 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_path.clear();
s_running_game_serial.clear(); s_running_game_serial.clear();
s_running_game_title.clear(); s_running_game_title.clear();
s_running_unknown_game = true;
if (path && std::strlen(path) > 0) 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_serial = entry->serial;
s_running_game_title = entry->title; s_running_game_title = entry->title;
s_running_unknown_game = false;
} }
else else
{ {

View File

@ -181,7 +181,7 @@ const std::string& GetRunningPath();
const std::string& GetRunningSerial(); const std::string& GetRunningSerial();
const std::string& GetRunningTitle(); const std::string& GetRunningTitle();
bool IsRunningBIOS(); bool IsRunningUnknownGame();
const BIOS::ImageInfo* GetBIOSImageInfo(); const BIOS::ImageInfo* GetBIOSImageInfo();
const BIOS::Hash& GetBIOSHash(); const BIOS::Hash& GetBIOSHash();