Skip to content

Commit

Permalink
Controllers: Make restore defaults restore controller LED (#12264)
Browse files Browse the repository at this point in the history
  • Loading branch information
TheTechnician27 authored Feb 3, 2025
1 parent 282317c commit 33aed95
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pcsx2/Input/SDLInputSource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,14 @@ u32 SDLInputSource::ParseRGBForPlayerId(const std::string_view str, u32 player_i
return color;
}

void SDLInputSource::ResetRGBForAllPlayers(SettingsInterface& si)
{
for (u32 player_id = 0; player_id < MAX_LED_COLORS; player_id++)
{
si.DeleteValue("SDLExtra", fmt::format("Player{}LED", player_id).c_str());
}
}

void SDLInputSource::SetHints()
{
if (const std::string upath = Path::Combine(EmuFolders::DataRoot, CONTROLLER_DB_FILENAME); FileSystem::FileExists(upath.c_str()))
Expand Down
1 change: 1 addition & 0 deletions pcsx2/Input/SDLInputSource.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class SDLInputSource final : public InputSource

static u32 GetRGBForPlayerId(SettingsInterface& si, u32 player_id);
static u32 ParseRGBForPlayerId(const std::string_view str, u32 player_id);
static void ResetRGBForAllPlayers(SettingsInterface& si);

private:
struct ControllerData
Expand Down
3 changes: 3 additions & 0 deletions pcsx2/SIO/Pad/Pad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
#include "SIO/Pad/PadNotConnected.h"
#include "SIO/Sio.h"

#include "Input/SDLInputSource.h"

#include "IconsFontAwesome5.h"

#include "VMManager.h"
Expand Down Expand Up @@ -167,6 +169,7 @@ void Pad::SetDefaultControllerConfig(SettingsInterface& si)
si.SetBoolValue("Pad", "MultitapPort2", false);
si.SetFloatValue("Pad", "PointerXScale", 8.0f);
si.SetFloatValue("Pad", "PointerYScale", 8.0f);
SDLInputSource::ResetRGBForAllPlayers(si);

// PCSX2 Controller Settings - Default pad types and parameters.
for (u32 i = 0; i < Pad::NUM_CONTROLLER_PORTS; i++)
Expand Down

0 comments on commit 33aed95

Please sign in to comment.