Options redesign; Rumble intensity; Dark fix; Remove OGL patches

This commit is contained in:
nastys
2021-08-11 18:25:15 +02:00
parent 389d8f2b5c
commit 3b0338a5ba
11 changed files with 773 additions and 534 deletions
@@ -23,12 +23,12 @@ namespace TLAC::FileSystem
return found;
}
int ConfigFile::GetIntegerValue(const std::string& key)
int ConfigFile::GetIntegerValue(const std::string& key, int defaultval)
{
auto pair = ConfigMap.find(key);
bool found = pair != ConfigMap.end();
return found ? atoi(pair->second.c_str()) : 0;
return found ? atoi(pair->second.c_str()) : defaultval;
}
bool ConfigFile::GetBooleanValue(const std::string& key)
@@ -14,7 +14,7 @@ namespace TLAC::FileSystem
std::unordered_map<std::string, std::string> ConfigMap;
bool TryGetValue(const std::string &key, std::string **value);
int GetIntegerValue(const std::string& key);
int GetIntegerValue(const std::string& key, int defaultval = 0);
bool GetBooleanValue(const std::string& key);
float GetFloatValue(const std::string& key);
std::string GetStringValue(const std::string& key);
@@ -16,6 +16,8 @@ namespace TLAC::Input
config.OpenRead();
xinput_num = config.GetIntegerValue("xinput_preferred");
rumble = config.GetBooleanValue("rumble");
rumble_left = config.GetIntegerValue("xinput_rumble_intensity_left", 8000);
rumble_right = config.GetIntegerValue("xinput_rumble_intensity_right", 4000);
}
Xinput* Xinput::GetInstance()
@@ -256,8 +258,8 @@ namespace TLAC::Input
{
XINPUT_VIBRATION vibration;
ZeroMemory(&vibration, sizeof(XINPUT_VIBRATION));
vibration.wLeftMotorSpeed = 8000; // use any value between 0-65535 here
vibration.wRightMotorSpeed = 4000; // use any value between 0-65535 here
vibration.wLeftMotorSpeed = rumble_left; // use any value between 0-65535 here
vibration.wRightMotorSpeed = rumble_right; // use any value between 0-65535 here
XInputSetState(xc_pref, &vibration);
}
else
@@ -48,7 +48,7 @@ namespace TLAC::Input
void SetTapStates(BYTE keycode, float elapsed);
int xinput_num;
int xinput_num, rumble_left, rumble_right;
bool rumble;
};
}