Move the category array outside the function

This commit is contained in:
Henrik Rydgård 2024-05-21 11:17:34 +02:00
parent 635b4d4acf
commit 58f7e190c4

View File

@ -235,6 +235,20 @@ UI::EventReturn SingleControlMapper::OnDelete(UI::EventParams &params) {
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++) {