Merge pull request #1687 from ggrtk/controller-type-cache

FullscreenUI: Update type cache when controller type is changed
This commit is contained in:
Connor McLaughlin 2021-02-26 02:45:00 +10:00 committed by GitHub
commit 9425f34ceb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -1540,7 +1540,7 @@ void DrawSettingsWindow()
CommonHostInterface::InputProfileList profiles(s_host_interface->GetInputProfileList()); CommonHostInterface::InputProfileList profiles(s_host_interface->GetInputProfileList());
ImGuiFullscreen::ChoiceDialogOptions options; ImGuiFullscreen::ChoiceDialogOptions options;
options.reserve(profiles.size()); options.reserve(profiles.size());
for (const CommonHostInterface::InputProfileEntry& entry : profiles) for (CommonHostInterface::InputProfileEntry& entry : profiles)
options.emplace_back(std::move(entry.name), false); options.emplace_back(std::move(entry.name), false);
auto callback = [profiles](s32 index, const std::string& title, bool checked) { auto callback = [profiles](s32 index, const std::string& title, bool checked) {
@ -1574,6 +1574,7 @@ void DrawSettingsWindow()
const ControllerType ctype = s_settings_copy.controller_types[port]; const ControllerType ctype = s_settings_copy.controller_types[port];
if (ctype != type_cache[port]) if (ctype != type_cache[port])
{ {
type_cache[port] = ctype;
button_cache[port] = Controller::GetButtonNames(ctype); button_cache[port] = Controller::GetButtonNames(ctype);
axis_cache[port] = Controller::GetAxisNames(ctype); axis_cache[port] = Controller::GetAxisNames(ctype);
setting_cache[port] = Controller::GetSettings(ctype); setting_cache[port] = Controller::GetSettings(ctype);