Android: Add game specific gc/wii controller settings

This commit is contained in:
zackhow
2018-08-26 18:27:27 -04:00
parent f1413dbbf6
commit 5d93a10c60
17 changed files with 704 additions and 282 deletions

View File

@ -335,7 +335,7 @@ static void AddBind(const std::string& dev, sBind* bind)
m_controllers[dev]->AddBind(bind);
}
void Init()
void Init(const std::string& gameId)
{
// Initialize our touchScreenKey buttons
for (int a = 0; a < 8; ++a)
@ -592,6 +592,40 @@ void Init()
new sBind(padID, configTypes[a], type, bindnum, modifier == '-' ? -1.0f : 1.0f));
}
}
ini.Load(File::GetUserPath(D_GAMESETTINGS_IDX) + std::string(gameId + ".ini"));
for (u32 a = 0; a < configStrings.size(); ++a)
{
for (int padID = 0; padID < 8; ++padID)
{
std::ostringstream config;
config << configStrings[a] << "_" << padID;
BindType type;
int bindnum;
char dev[128];
bool hasbind = false;
char modifier = '+';
std::string value;
ini.GetOrCreateSection("Android")->Get(config.str(), &value, "None");
if (value == "None")
continue;
if (std::string::npos != value.find("Axis"))
{
hasbind = true;
type = BIND_AXIS;
sscanf(value.c_str(), "Device '%127[^\']'-Axis %d%c", dev, &bindnum, &modifier);
}
else if (std::string::npos != value.find("Button"))
{
hasbind = true;
type = BIND_BUTTON;
sscanf(value.c_str(), "Device '%127[^\']'-Button %d", dev, &bindnum);
}
if (hasbind)
AddBind(std::string(dev),
new sBind(padID, configTypes[a], type, bindnum, modifier == '-' ? -1.0f : 1.0f));
}
}
}
bool GetButtonPressed(int padID, ButtonType button)