mirror of
https://github.com/stenzek/duckstation.git
synced 2025-06-07 12:05:52 +00:00
InputManager: Fix SDL sub-options not copying to profile
This commit is contained in:
parent
7ac4a85765
commit
ee33044f3d
@ -267,4 +267,13 @@ public:
|
|||||||
else
|
else
|
||||||
DeleteValue(section, key);
|
DeleteValue(section, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NOTE: Writes values as strings.
|
||||||
|
ALWAYS_INLINE void CopySection(const SettingsInterface& si, const char* section)
|
||||||
|
{
|
||||||
|
ClearSection(section);
|
||||||
|
|
||||||
|
for (const auto& [key, value] : si.GetKeyValueList(section))
|
||||||
|
SetStringValue(section, key.c_str(), value.c_str());
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
@ -1456,6 +1456,12 @@ void InputManager::CopyConfiguration(SettingsInterface* dest_si, const SettingsI
|
|||||||
dest_si->CopyBoolValue(src_si, "InputSources",
|
dest_si->CopyBoolValue(src_si, "InputSources",
|
||||||
InputManager::InputSourceToString(static_cast<InputSourceType>(type)));
|
InputManager::InputSourceToString(static_cast<InputSourceType>(type)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef ENABLE_SDL
|
||||||
|
// I hate this, but there isn't a better location for it...
|
||||||
|
if (dest_si->GetBoolValue("InputSources", "SDL"))
|
||||||
|
InputSource::CopySDLSourceSettings(dest_si, src_si);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
for (u32 port = 0; port < NUM_CONTROLLER_AND_CARD_PORTS; port++)
|
for (u32 port = 0; port < NUM_CONTROLLER_AND_CARD_PORTS; port++)
|
||||||
|
@ -84,6 +84,7 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
#ifndef __ANDROID__
|
#ifndef __ANDROID__
|
||||||
static std::unique_ptr<InputSource> CreateSDLSource();
|
static std::unique_ptr<InputSource> CreateSDLSource();
|
||||||
|
static void CopySDLSourceSettings(SettingsInterface* dest_si, const SettingsInterface& src_si);
|
||||||
#else
|
#else
|
||||||
static std::unique_ptr<InputSource> CreateAndroidSource();
|
static std::unique_ptr<InputSource> CreateAndroidSource();
|
||||||
#endif
|
#endif
|
||||||
|
@ -248,10 +248,21 @@ void SDLInputSource::LoadSettings(const SettingsInterface& si)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void InputSource::CopySDLSourceSettings(SettingsInterface* dest_si, const SettingsInterface& src_si)
|
||||||
|
{
|
||||||
|
for (u32 i = 0; i < SDLInputSource::MAX_LED_COLORS; i++)
|
||||||
|
dest_si->CopyStringValue(src_si, "SDLExtra", TinyString::from_format("Player{}LED", i).c_str());
|
||||||
|
|
||||||
|
dest_si->CopyBoolValue(src_si, "InputSources", "SDLControllerEnhancedMode");
|
||||||
|
dest_si->CopyBoolValue(src_si, "InputSources", "SDLPS5PlayerLED");
|
||||||
|
dest_si->CopyBoolValue(src_si, "InputSources", "SDLTouchpadAsPointer");
|
||||||
|
dest_si->CopySection(src_si, "SDLHints");
|
||||||
|
}
|
||||||
|
|
||||||
u32 SDLInputSource::GetRGBForPlayerId(const SettingsInterface& si, u32 player_id)
|
u32 SDLInputSource::GetRGBForPlayerId(const SettingsInterface& si, u32 player_id)
|
||||||
{
|
{
|
||||||
return ParseRGBForPlayerId(
|
return ParseRGBForPlayerId(si.GetStringValue("SDLExtra", TinyString::from_format("Player{}LED", player_id).c_str(),
|
||||||
si.GetStringValue("SDLExtra", fmt::format("Player{}LED", player_id).c_str(), s_sdl_default_led_colors[player_id]),
|
s_sdl_default_led_colors[player_id]),
|
||||||
player_id);
|
player_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,6 +50,8 @@ public:
|
|||||||
|
|
||||||
static bool IsHandledInputEvent(const SDL_Event* ev);
|
static bool IsHandledInputEvent(const SDL_Event* ev);
|
||||||
|
|
||||||
|
static void CopySettings(SettingsInterface& dest_si, const SettingsInterface& src_si);
|
||||||
|
|
||||||
static bool ALLOW_EVENT_POLLING;
|
static bool ALLOW_EVENT_POLLING;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user