Skip to content

Commit

Permalink
System: Disable auto analog mode when starting shell
Browse files Browse the repository at this point in the history
  • Loading branch information
stenzek committed Oct 3, 2022
1 parent df06931 commit 587fbf6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/core/analog_controller.cpp
Expand Up @@ -45,7 +45,7 @@ void AnalogController::Reset()

if (m_force_analog_on_reset)
{
if (g_settings.controller_disable_analog_mode_forcing)
if (g_settings.controller_disable_analog_mode_forcing || System::IsRunningBIOS())
{
Host::AddIconOSDMessage(
fmt::format("Controller{}AnalogMode", m_index), ICON_FA_GAMEPAD,
Expand Down
13 changes: 13 additions & 0 deletions src/core/system.cpp
Expand Up @@ -137,6 +137,7 @@ static u32 s_internal_frame_number = 1;
static std::string s_running_game_path;
static std::string s_running_game_code;
static std::string s_running_game_title;
static bool s_running_bios;

static float s_throttle_frequency = 60.0f;
static float s_target_speed = 1.0f;
Expand Down Expand Up @@ -314,6 +315,11 @@ const std::string& System::GetRunningTitle()
return s_running_game_title;
}

bool System::IsRunningBIOS()
{
return s_running_bios;
}

float System::GetFPS()
{
return s_fps;
Expand Down Expand Up @@ -912,6 +918,9 @@ void System::ResetSystem()
#ifdef WITH_CHEEVOS
Achievements::ResetChallengeMode();
#endif

// 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 @@ -1173,6 +1182,9 @@ 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 && !psf_boot;

Bus::SetBIOS(*bios_image);
UpdateControllers();
UpdateMemoryCardTypes();
Expand Down Expand Up @@ -1421,6 +1433,7 @@ void System::ClearRunningGame()
s_running_game_code.clear();
s_running_game_path.clear();
s_running_game_title.clear();
s_running_bios = false;
s_cheat_list.reset();
s_state = State::Shutdown;

Expand Down
1 change: 1 addition & 0 deletions src/core/system.h
Expand Up @@ -170,6 +170,7 @@ void IncrementInternalFrameNumber();
const std::string& GetRunningPath();
const std::string& GetRunningCode();
const std::string& GetRunningTitle();
bool IsRunningBIOS();

// TODO: Move to PerformanceMetrics
float GetFPS();
Expand Down

0 comments on commit 587fbf6

Please sign in to comment.