mirror of
https://github.com/Maschell/controller_patcher.git
synced 2024-11-22 03:59:16 +01:00
aa0ce59f87
Changelog: Bugfixes: - Fixes the still moving mouse in aim mode, when mouse is actually not moving - Fixed a bug at initializing the config_controller_list; - Fixed the support for almost all mouses that uses the normal HID mouse standard (boot mode). - The emulated sticks are now supported correctly - The stick now only produces valid values. Stick absusing not possible anymore New features: - Added support for config files that can be read from an SD Card. - Added support for more keyboard buttons - Added support for gamepad button remapping - Made the double used buttons on the GC Pad configuable - The keyboard can now emulate the sticks correctly - Keyboard buttons for the sticks can be set - The mouse buttons can now be configured - The mouse can be configured to emulate the left stick - Added support for one more DPAD mode (CONTRPDM_Absolute_2Values) Other: - Removed the support for the PS2 Adapter and Saitek P2600, but they can be added trough a config file. - The engine now uses 16 hardcoded slots the devices can use. - cleaned up the logging output - Logging of the currently pressed buttons possible and more little things I dont remember
52 lines
1.2 KiB
C++
52 lines
1.2 KiB
C++
#include <string>
|
|
#include <vector>
|
|
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
#include <gctypes.h>
|
|
#include "string_tools.hpp"
|
|
|
|
bool EndsWith(const std::string& a, const std::string& b) {
|
|
if (b.size() > a.size()) return false;
|
|
return std::equal(a.begin() + a.size() - b.size(), a.end(), b.begin());
|
|
}
|
|
|
|
std::vector<std::string> MyStringSplit(const std::string & inValue, const std::string & splitter)
|
|
{
|
|
std::string value = inValue;
|
|
std::vector<std::string> result;
|
|
while (true) {
|
|
unsigned int index = value.find(splitter);
|
|
if (index == std::string::npos) {
|
|
result.push_back(value);
|
|
break;
|
|
}
|
|
std::string first = value.substr(0, index);
|
|
result.push_back(first);
|
|
if (index + splitter.size() == value.length()) {
|
|
result.push_back("");
|
|
break;
|
|
}
|
|
if(index + splitter.size() > value.length()) {
|
|
break;
|
|
}
|
|
value = value.substr(index + splitter.size(), value.length());
|
|
}
|
|
return result;
|
|
}
|
|
|
|
|
|
extern "C" const char *byte_to_binary(int x)
|
|
{
|
|
static char b[9];
|
|
b[0] = '\0';
|
|
|
|
int z;
|
|
for (z = 128; z > 0; z >>= 1)
|
|
{
|
|
strcat(b, ((x & z) == z) ? "1" : "0");
|
|
}
|
|
|
|
return b;
|
|
}
|