From 65043baf5d6df85539fcf2c9b4ddf0efa21046ae Mon Sep 17 00:00:00 2001 From: Corey D Date: Tue, 16 Mar 2021 06:46:04 +1100 Subject: [PATCH] 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 --- core/logic/GameConfigs.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/logic/GameConfigs.cpp b/core/logic/GameConfigs.cpp index 2d0d394a..cc0bcd4d 100644 --- a/core/logic/GameConfigs.cpp +++ b/core/logic/GameConfigs.cpp @@ -415,7 +415,7 @@ SMCResult CGameConfig::ReadSMC_KeyValue(const SMCStates *states, const char *key } else if (strcmp(key, "prop") == 0) { strncopy(m_Prop, value, sizeof(m_Prop)); } else if (IsPlatformCompatible(key, &matched_platform)) { - m_Offsets.replace(m_offset, atoi(value)); + m_Offsets.replace(m_offset, static_cast(strtol(value, NULL, 0))); } } else if (m_ParseState == PSTATE_GAMEDEFS_KEYS) { std::string vstr(value); @@ -484,7 +484,7 @@ SMCResult CGameConfig::ReadSMC_KeyValue(const SMCStates *states, const char *key { m_AddressLastIsOffset = true; } - m_AddressRead[m_AddressReadCount] = atoi(value); + m_AddressRead[m_AddressReadCount] = static_cast(strtol(value, NULL, 0)); m_AddressReadCount++; } else