Remove unnecessary vector

This commit is contained in:
Henrik Rydgård committed 2023-12-21 11:16:10 +01:00
1 parent 144ed7a3ab
commit e47791d4c4
3 files changed
+7 -9

No files matched your search

+3 -6
View File
@@ -504,12 +504,9 @@ const char* GetPspButtonNameCharPointer(int btn) {
return nullptr;
}
std::vector<KeyMap_IntStrPair> GetMappableKeys() {
std::vector<KeyMap_IntStrPair> temp;
for (size_t i = 0; i < ARRAY_SIZE(psp_button_names); i++) {
temp.push_back(psp_button_names[i]);
}
return temp;
const KeyMap::KeyMap_IntStrPair *GetMappableKeys(size_t *count) {
*count = ARRAY_SIZE(psp_button_names);
return psp_button_names;
}
bool InputMappingToPspButton(const InputMapping &mapping, std::vector<int> *pspButtons) {
+1 -1
View File
@@ -172,7 +172,7 @@ namespace KeyMap {
const char *GetVirtKeyName(int vkey);
const char *GetPspButtonNameCharPointer(int btn);
std::vector<KeyMap_IntStrPair> GetMappableKeys();
const KeyMap_IntStrPair *GetMappableKeys(size_t *count);
// Use to translate input mappings to and from PSP buttons. You should have already translated
// your platform's keys to InputMapping keys.
+3 -2
View File
@@ -274,7 +274,8 @@ void ControlMappingScreen::CreateViews() {
root_->Add(leftColumn);
root_->Add(rightScroll_);
std::vector<KeyMap::KeyMap_IntStrPair> mappableKeys = KeyMap::GetMappableKeys();
size_t numMappableKeys = 0;
const KeyMap::KeyMap_IntStrPair *mappableKeys = KeyMap::GetMappableKeys(&numMappableKeys);
struct Cat {
const char *catName;
@@ -291,7 +292,7 @@ void ControlMappingScreen::CreateViews() {
int curCat = -1;
CollapsibleSection *curSection = nullptr;
for (size_t i = 0; i < mappableKeys.size(); i++) {
for (size_t i = 0; i < numMappableKeys; i++) {
if (curCat < (int)ARRAY_SIZE(cats) && mappableKeys[i].key == cats[curCat + 1].firstKey) {
if (curCat >= 0 && !cats[curCat].openByDefault) {
curSection->SetOpen(false);