From 58f7e190c40b91fbe30f3ec24a4b2bbf17ac9ba2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Tue, 21 May 2024 11:17:34 +0200 Subject: [PATCH] Move the category array outside the function --- UI/ControlMappingScreen.cpp | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/UI/ControlMappingScreen.cpp b/UI/ControlMappingScreen.cpp index 8512686a59..12762c6e65 100644 --- a/UI/ControlMappingScreen.cpp +++ b/UI/ControlMappingScreen.cpp @@ -235,6 +235,20 @@ UI::EventReturn SingleControlMapper::OnDelete(UI::EventParams ¶ms) { return UI::EVENT_DONE; } + +struct BindingCategory { + const char *catName; + int firstKey; +}; + +// Category name, first input from psp_button_names. +static const BindingCategory cats[] = { + {"Standard PSP controls", CTRL_UP}, + {"Control modifiers", VIRTKEY_ANALOG_ROTATE_CW}, + {"Emulator controls", VIRTKEY_FASTFORWARD}, + {"Extended PSP controls", VIRTKEY_AXIS_RIGHT_Y_MAX}, +}; + void ControlMappingScreen::CreateViews() { using namespace UI; mappers_.clear(); @@ -279,19 +293,6 @@ void ControlMappingScreen::CreateViews() { size_t numMappableKeys = 0; const KeyMap::KeyMap_IntStrPair *mappableKeys = KeyMap::GetMappableKeys(&numMappableKeys); - struct Cat { - const char *catName; - int firstKey; - }; - - // Category name, first input from psp_button_names. - static const Cat cats[] = { - {"Standard PSP controls", CTRL_UP}, - {"Control modifiers", VIRTKEY_ANALOG_ROTATE_CW}, - {"Emulator controls", VIRTKEY_FASTFORWARD}, - {"Extended PSP controls", VIRTKEY_AXIS_RIGHT_Y_MAX}, - }; - int curCat = -1; CollapsibleSection *curSection = nullptr; for (size_t i = 0; i < numMappableKeys; i++) {