gamedata: Add support for hexadecimal offsets (#1426)

* Allow hexadecimal and octal offsets

* Fix typo

* Allow hexadecimal input in Addresses "read" and "offset" values

Co-authored-by: Peace-Maker <peace-maker@wcfan.de>
This commit is contained in:
Corey D 2021-03-16 06:46:04 +11:00 committed by GitHub
parent 46c54f829c
commit 65043baf5d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -415,7 +415,7 @@ SMCResult CGameConfig::ReadSMC_KeyValue(const SMCStates *states, const char *key
} else if (strcmp(key, "prop") == 0) { } else if (strcmp(key, "prop") == 0) {
strncopy(m_Prop, value, sizeof(m_Prop)); strncopy(m_Prop, value, sizeof(m_Prop));
} else if (IsPlatformCompatible(key, &matched_platform)) { } else if (IsPlatformCompatible(key, &matched_platform)) {
m_Offsets.replace(m_offset, atoi(value)); m_Offsets.replace(m_offset, static_cast<int>(strtol(value, NULL, 0)));
} }
} else if (m_ParseState == PSTATE_GAMEDEFS_KEYS) { } else if (m_ParseState == PSTATE_GAMEDEFS_KEYS) {
std::string vstr(value); std::string vstr(value);
@ -484,7 +484,7 @@ SMCResult CGameConfig::ReadSMC_KeyValue(const SMCStates *states, const char *key
{ {
m_AddressLastIsOffset = true; m_AddressLastIsOffset = true;
} }
m_AddressRead[m_AddressReadCount] = atoi(value); m_AddressRead[m_AddressReadCount] = static_cast<int>(strtol(value, NULL, 0));
m_AddressReadCount++; m_AddressReadCount++;
} }
else else