InputCommon: Use distinct values for profile key

Because the last commit made us use separate folders for GCPad and
GCKey profiles, we should also use separate game INI keys for them.
Otherwise setting e.g. PadProfile1 in a game INI will make both GCPad
and GCKey try to load it, typically with one of them succeeding and the
other one showing a panic alert due to the profile not existing in its
folder.

Better do this breaking change for GCKeys in the same PR as the other
breaking change rather than later.
This commit is contained in:
JosJuice 2024-02-04 17:36:15 +01:00
parent 6cf55ab1ee
commit 1315b54ffa
8 changed files with 11 additions and 33 deletions

View File

@ -313,7 +313,7 @@ void FreeLookController::UpdateInput(CameraControllerInput* camera_controller)
namespace FreeLook
{
static InputConfig s_config("FreeLookController", _trans("FreeLook"), "FreeLookController",
InputConfig::InputClass::GC);
"FreeLookController");
InputConfig* GetInputConfig()
{
return &s_config;

View File

@ -10,7 +10,7 @@
namespace Pad
{
static InputConfig s_config("GBA", _trans("Pad"), "GBA", InputConfig::InputClass::GBA);
static InputConfig s_config("GBA", _trans("Pad"), "GBA", "GBA");
InputConfig* GetGBAConfig()
{
return &s_config;

View File

@ -17,7 +17,7 @@
namespace Keyboard
{
static InputConfig s_config("GCKeyNew", _trans("Keyboard"), "GCKey", InputConfig::InputClass::GC);
static InputConfig s_config("GCKeyNew", _trans("Keyboard"), "GCKey", "GCKey");
InputConfig* GetConfig()
{
return &s_config;

View File

@ -14,7 +14,7 @@
namespace Pad
{
static InputConfig s_config("GCPadNew", _trans("Pad"), "GCPad", InputConfig::InputClass::GC);
static InputConfig s_config("GCPadNew", _trans("Pad"), "GCPad", "Pad");
InputConfig* GetConfig()
{
return &s_config;

View File

@ -97,8 +97,7 @@ HIDWiimote* GetHIDWiimoteSource(unsigned int index)
namespace Wiimote
{
static InputConfig s_config(WIIMOTE_INI_NAME, _trans("Wii Remote"), "Wiimote",
InputConfig::InputClass::Wii);
static InputConfig s_config(WIIMOTE_INI_NAME, _trans("Wii Remote"), "Wiimote", "Wiimote");
InputConfig* GetConfig()
{

View File

@ -207,7 +207,7 @@ static std::array<u32, NUM_HOTKEY_GROUPS> s_hotkey_down;
static HotkeyStatus s_hotkey;
static bool s_enabled;
static InputConfig s_config("Hotkeys", _trans("Hotkeys"), "Hotkeys", InputConfig::InputClass::GC);
static InputConfig s_config("Hotkeys", _trans("Hotkeys"), "Hotkeys", "Hotkeys");
InputConfig* GetConfig()
{

View File

@ -20,9 +20,9 @@
#include "InputCommon/InputProfile.h"
InputConfig::InputConfig(const std::string& ini_name, const std::string& gui_name,
const std::string& profile_directory_name, InputClass input_class)
const std::string& profile_directory_name, const std::string& profile_key)
: m_ini_name(ini_name), m_gui_name(gui_name), m_profile_directory_name(profile_directory_name),
m_input_class(input_class)
m_profile_key(profile_key)
{
}
@ -159,20 +159,6 @@ bool InputConfig::ControllersNeedToBeCreated() const
return m_controllers.empty();
}
std::string InputConfig::GetProfileKey() const
{
switch (m_input_class)
{
case InputClass::GBA:
return "GBA";
case InputClass::Wii:
return "Wiimote";
case InputClass::GC:
default:
return "Pad";
}
}
std::string InputConfig::GetUserProfileDirectoryPath() const
{
return fmt::format("{}Profiles/{}/", File::GetUserPath(D_CONFIG_IDX), GetProfileDirectoryName());

View File

@ -24,15 +24,8 @@ class EmulatedController;
class InputConfig
{
public:
enum class InputClass
{
GC,
Wii,
GBA,
};
InputConfig(const std::string& ini_name, const std::string& gui_name,
const std::string& profile_directory_name, InputClass input_class);
const std::string& profile_directory_name, const std::string& profile_key);
~InputConfig();
@ -51,7 +44,7 @@ public:
bool IsControllerControlledByGamepadDevice(int index) const;
std::string GetGUIName() const { return m_gui_name; }
std::string GetProfileKey() const;
std::string GetProfileKey() const { return m_profile_key; }
std::string GetProfileDirectoryName() const { return m_profile_directory_name; }
std::string GetUserProfileDirectoryPath() const;
std::string GetSysProfileDirectoryPath() const;
@ -69,6 +62,6 @@ private:
const std::string m_ini_name;
const std::string m_gui_name;
const std::string m_profile_directory_name;
const InputClass m_input_class;
const std::string m_profile_key;
InputCommon::DynamicInputTextureManager m_dynamic_input_tex_config_manager;
};