Android/ButtonManager: Make most file-scope local variables non-allocating
We can use std::array and const char* to make these capable of fully being stored in the read-only segment, and get rid of a few static constructors (144 of them).
This commit is contained in:
parent
069497e87d
commit
7842bd1179
|
@ -2,6 +2,7 @@
|
||||||
// Licensed under GPLv2+
|
// Licensed under GPLv2+
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
|
#include <array>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
@ -16,8 +17,8 @@ namespace ButtonManager
|
||||||
{
|
{
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
const std::string touchScreenKey = "Touchscreen";
|
constexpr char touchScreenKey[] = "Touchscreen";
|
||||||
const std::vector<std::string> configStrings = {
|
constexpr std::array<const char*, 143> configStrings{{
|
||||||
// GC
|
// GC
|
||||||
"InputA",
|
"InputA",
|
||||||
"InputB",
|
"InputB",
|
||||||
|
@ -169,9 +170,9 @@ const std::vector<std::string> configStrings = {
|
||||||
"TurntableCrossRight",
|
"TurntableCrossRight",
|
||||||
// Rumble
|
// Rumble
|
||||||
"Rumble",
|
"Rumble",
|
||||||
};
|
}};
|
||||||
|
|
||||||
const std::vector<ButtonType> configTypes = {
|
constexpr std::array<ButtonType, 143> configTypes{{
|
||||||
// GC
|
// GC
|
||||||
BUTTON_A,
|
BUTTON_A,
|
||||||
BUTTON_B,
|
BUTTON_B,
|
||||||
|
@ -323,7 +324,7 @@ const std::vector<ButtonType> configTypes = {
|
||||||
TURNTABLE_CROSSFADE_RIGHT,
|
TURNTABLE_CROSSFADE_RIGHT,
|
||||||
// Rumble
|
// Rumble
|
||||||
RUMBLE,
|
RUMBLE,
|
||||||
};
|
}};
|
||||||
|
|
||||||
std::unordered_map<std::string, InputDevice*> m_controllers;
|
std::unordered_map<std::string, InputDevice*> m_controllers;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue