From 55d51217d8ab53daa2af061be17ce4ae319decd3 Mon Sep 17 00:00:00 2001 From: TuxSH Date: Wed, 15 Apr 2020 22:28:38 +0100 Subject: [PATCH] Fix hex parsing in patcher.c (langemu). Fixes #1375 Thanks @Lizardon1 --- sysmodules/loader/source/patcher.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sysmodules/loader/source/patcher.c b/sysmodules/loader/source/patcher.c index 8884106..8d7ac17 100644 --- a/sysmodules/loader/source/patcher.c +++ b/sysmodules/loader/source/patcher.c @@ -468,13 +468,13 @@ static inline bool loadTitleLocaleConfig(u64 progId, u8 *mask, u8 *regionId, u8 ((buf[10] >= '0' && buf[10] <= '9') || (buf[10] >= 'a' && buf[10] <= 'f') || (buf[10] >= 'A' && buf[10] <= 'F')) && ((buf[11] >= '0' && buf[11] <= '9') || (buf[11] >= 'a' && buf[11] <= 'f') || (buf[11] >= 'A' && buf[11] <= 'F'))) { - if (buf[10] >= '0' && buf[10] <= '9') *stateId = 16 * (buf[10] - '0'); - else if(buf[10] >= 'a' && buf[10] <= 'f') *stateId = 16 * (buf[10] - 'a'); - else if(buf[10] >= 'A' && buf[10] <= 'F') *stateId = 16 * (buf[10] - 'A'); + if (buf[10] >= '0' && buf[10] <= '9') *stateId = 16 * (buf[10] - '0' + 10); + else if(buf[10] >= 'a' && buf[10] <= 'f') *stateId = 16 * (buf[10] - 'a' + 10); + else if(buf[10] >= 'A' && buf[10] <= 'F') *stateId = 16 * (buf[10] - 'A' + 10); - if (buf[11] >= '0' && buf[11] <= '9') *stateId += buf[11] - '0'; - else if(buf[11] >= 'a' && buf[11] <= 'f') *stateId += buf[11] - 'a'; - else if(buf[11] >= 'A' && buf[11] <= 'F') *stateId += buf[11] - 'A'; + if (buf[11] >= '0' && buf[11] <= '9') *stateId += buf[11] - '0' + 10; + else if(buf[11] >= 'a' && buf[11] <= 'f') *stateId += buf[11] - 'a' + 10; + else if(buf[11] >= 'A' && buf[11] <= 'F') *stateId += buf[11] - 'A' + 10; *mask |= 8; }