[AltServer] Fixes incorrectly parsing thread state as decimal value when enabling JIT

Thread state is hexadecimal, so we now explicitly use NSScanner to parse string as base-16.
This commit is contained in:
Riley Testut
2021-09-13 14:15:52 -07:00
parent 0570f2cd5b
commit babb2c0856

View File

@@ -258,8 +258,13 @@ char *bin2hex(const unsigned char *bin, size_t length)
NSString *mainThread = components[1];
NSString *threadState = [[mainThread componentsSeparatedByString:@":"] lastObject];
NSScanner *scanner = [NSScanner scannerWithString:threadState];
unsigned long long mainThreadState = 0;
[scanner scanHexLongLong:&mainThreadState];
// If main thread state == 0, app is not running.
if ([threadState longLongValue] == 0)
if (mainThreadState == 0)
{
if (error)
{