Merge pull request #8165 from lioncash/linkage

{Android/ButtonManager, ResourcePack/Manager}: Make file-scope variables/functions internally linked where applicable
This commit is contained in:
Connor McLaughlin 2019-06-08 20:56:13 +10:00 committed by GitHub
commit b13e00b003
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 14 deletions

View file

@ -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>
@ -14,9 +15,10 @@
namespace ButtonManager namespace ButtonManager
{ {
const std::string touchScreenKey = "Touchscreen"; namespace
std::unordered_map<std::string, InputDevice*> m_controllers; {
std::vector<std::string> configStrings = { constexpr char touchScreenKey[] = "Touchscreen";
constexpr std::array<const char*, 143> configStrings{{
// GC // GC
"InputA", "InputA",
"InputB", "InputB",
@ -168,8 +170,9 @@ std::vector<std::string> configStrings = {
"TurntableCrossRight", "TurntableCrossRight",
// Rumble // Rumble
"Rumble", "Rumble",
}; }};
std::vector<ButtonType> configTypes = {
constexpr std::array<ButtonType, 143> configTypes{{
// GC // GC
BUTTON_A, BUTTON_A,
BUTTON_B, BUTTON_B,
@ -321,9 +324,11 @@ std::vector<ButtonType> configTypes = {
TURNTABLE_CROSSFADE_RIGHT, TURNTABLE_CROSSFADE_RIGHT,
// Rumble // Rumble
RUMBLE, RUMBLE,
}; }};
static void AddBind(const std::string& dev, sBind* bind) std::unordered_map<std::string, InputDevice*> m_controllers;
void AddBind(const std::string& dev, sBind* bind)
{ {
auto it = m_controllers.find(dev); auto it = m_controllers.find(dev);
if (it != m_controllers.end()) if (it != m_controllers.end())
@ -334,6 +339,7 @@ static void AddBind(const std::string& dev, sBind* bind)
m_controllers[dev] = new InputDevice(dev); m_controllers[dev] = new InputDevice(dev);
m_controllers[dev]->AddBind(bind); m_controllers[dev]->AddBind(bind);
} }
} // Anonymous namespace
void Init(const std::string& gameId) void Init(const std::string& gameId)
{ {

View file

@ -11,15 +11,13 @@
#include <algorithm> #include <algorithm>
namespace
{
std::vector<ResourcePack::ResourcePack> packs;
std::string packs_path;
} // namespace
namespace ResourcePack namespace ResourcePack
{ {
namespace
{
std::vector<ResourcePack> packs;
std::string packs_path;
IniFile GetPackConfig() IniFile GetPackConfig()
{ {
packs_path = File::GetUserPath(D_RESOURCEPACK_IDX) + "/Packs.ini"; packs_path = File::GetUserPath(D_RESOURCEPACK_IDX) + "/Packs.ini";
@ -29,6 +27,7 @@ IniFile GetPackConfig()
return file; return file;
} }
} // Anonymous namespace
bool Init() bool Init()
{ {