mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-01 14:58:14 +00:00
Make multi-mapping save-able, add test to verify backwards and forwards compat
This commit is contained in:
1 parent
0e1c42ce70
commit
49a2c93b66
5 files changed
+94
-14
No files matched your search
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "Common/Input/InputState.h"
|
||||
#include "Common/Input/KeyCodes.h"
|
||||
#include "Common/StringUtils.h"
|
||||
|
||||
const char *GetDeviceName(int deviceId) {
|
||||
switch (deviceId) {
|
||||
@@ -79,6 +80,23 @@ int GetAnalogYDirection(int deviceId) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// NOTE: Changing the format of FromConfigString/ToConfigString breaks controls.ini backwards compatibility.
|
||||
InputMapping InputMapping::FromConfigString(const std::string &str) {
|
||||
std::vector<std::string> parts;
|
||||
SplitString(str, '-', parts);
|
||||
int deviceId = atoi(parts[0].c_str());
|
||||
int keyCode = atoi(parts[1].c_str());
|
||||
|
||||
InputMapping mapping;
|
||||
mapping.deviceId = deviceId;
|
||||
mapping.keyCode = keyCode;
|
||||
return mapping;
|
||||
}
|
||||
|
||||
std::string InputMapping::ToConfigString() const {
|
||||
return StringFromFormat("%d-%d", deviceId, keyCode);
|
||||
}
|
||||
|
||||
void InputMapping::FormatDebug(char *buffer, size_t bufSize) const {
|
||||
if (IsAxis()) {
|
||||
int direction;
|
||||
|
||||
Reference in new issue
Block a user