Skip to content
Permalink
Browse files

Load custom game IR values if they are not set

This is mostly for android so that a user can use the touchscreen to
accurately emulate pointer movements
  • Loading branch information...
zackhow committed Oct 25, 2018
1 parent 1db02c1 commit d0b42286cff1e5f9c9f2de205213c16f98bd34fe
Showing with 30 additions and 3 deletions.
  1. +30 −3 Source/Core/InputCommon/InputConfig.cpp
@@ -33,6 +33,11 @@ bool InputConfig::LoadConfig(bool isGC)
std::string profile[MAX_BBMOTES];
std::string path;

#if defined(ANDROID)
bool use_ir_config = false;
std::string ir_values[3];
#endif

if (SConfig::GetInstance().GetGameID() != "00000000")
{
std::string type;
@@ -73,13 +78,26 @@ bool InputConfig::LoadConfig(bool isGC)
}
}
}
#if defined(ANDROID)
// For use on android touchscreen IR pointer
// Check for IR values
if (control_section->Exists("IRWidth") && control_section->Exists("IRHeight") &&
control_section->Exists("IRCenter"))
{
use_ir_config = true;
control_section->Get("IRWidth", &ir_values[0]);
control_section->Get("IRHeight", &ir_values[1]);
control_section->Get("IRCenter", &ir_values[2]);
}
#endif
}

if (inifile.Load(File::GetUserPath(D_CONFIG_IDX) + m_ini_name + ".ini"))
{
int n = 0;
for (auto& controller : m_controllers)
{
IniFile::Section config;
// Load settings from ini
if (useProfile[n])
{
@@ -91,13 +109,22 @@ bool InputConfig::LoadConfig(bool isGC)

IniFile profile_ini;
profile_ini.Load(profile[n]);
controller->LoadConfig(profile_ini.GetOrCreateSection("Profile"));
config = *profile_ini.GetOrCreateSection("Profile");
}
else
{
controller->LoadConfig(inifile.GetOrCreateSection(controller->GetName()));
config = *inifile.GetOrCreateSection(controller->GetName());
}

#if defined(ANDROID)
// Only set for wii pads
if (!isGC && use_ir_config)
{
config.Set("IR/Width", ir_values[0]);
config.Set("IR/Height", ir_values[1]);
config.Set("IR/Center", ir_values[2]);
}
#endif
controller->LoadConfig(&config);
// Update refs
controller->UpdateReferences(g_controller_interface);

0 comments on commit d0b4228

Please sign in to comment.
You can’t perform that action at this time.