Skip to content

Commit

Permalink
System: Don't auto enable analog on unknown games
Browse files Browse the repository at this point in the history
  • Loading branch information
stenzek committed May 8, 2023
1 parent eb77894 commit 7681551
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 14 deletions.
5 changes: 2 additions & 3 deletions src/core/analog_controller.cpp
Expand Up @@ -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,
Expand Down Expand Up @@ -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"),
Expand Down
16 changes: 6 additions & 10 deletions src/core/system.cpp
Expand Up @@ -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;
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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)
{
Expand All @@ -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
{
Expand Down
2 changes: 1 addition & 1 deletion src/core/system.h
Expand Up @@ -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();

Expand Down

0 comments on commit 7681551

Please sign in to comment.