Skip to content

Commit

Permalink
Merge pull request #15835 from Halo-Michael/betterGetProperty
Browse files Browse the repository at this point in the history
[Apple] Better get property
  • Loading branch information
hrydgard committed Aug 14, 2022
2 parents f832563 + 58d28b4 commit a35d261
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions ios/main.mm
Expand Up @@ -92,16 +92,20 @@ kern_return_t catch_exception_raise(mach_port_t exception_port,
static float g_safeInsetTop = 0.0;
static float g_safeInsetBottom = 0.0;

// We no longer need to judge if jit is usable or not by according to the ios version.
/*
static bool g_jitAvailable = false;
static int g_iosVersionMajor;
static int g_iosVersionMinor;
*/
static int g_iosVersionMajor;
static std::string version;

std::string System_GetProperty(SystemProperty prop) {
switch (prop) {
case SYSPROP_NAME:
return StringFromFormat("iOS %d.%d", g_iosVersionMajor, g_iosVersionMinor);
return StringFromFormat("iOS %s", version.c_str());
case SYSPROP_LANGREGION:
return "en_US";
return [[[NSLocale currentLocale] objectForKey:NSLocaleIdentifier] UTF8String];
default:
return "";
}
Expand Down Expand Up @@ -156,7 +160,7 @@ bool System_GetPropertyBool(SystemProperty prop) {
return false;
#endif
case SYSPROP_CAN_JIT:
return g_jitAvailable;
return get_debugged();

default:
return false;
Expand Down Expand Up @@ -255,15 +259,15 @@ int main(int argc, char *argv[])

// So, we'll just resort to a version check.

std::string version = [[UIDevice currentDevice].systemVersion UTF8String];
if (2 != sscanf(version.c_str(), "%d.%d", &g_iosVersionMajor, &g_iosVersionMinor)) {
version = [[[UIDevice currentDevice] systemVersion] UTF8String];
if (2 != sscanf(version.c_str(), "%d", &g_iosVersionMajor)) {
// Just set it to 14.0 if the parsing fails for whatever reason.
g_iosVersionMajor = 14;
g_iosVersionMinor = 0;
}

g_jitAvailable = get_debugged();
/*
g_jitAvailable = get_debugged();
if (g_iosVersionMajor > 14 || (g_iosVersionMajor == 14 && g_iosVersionMinor >= 4)) {
g_jitAvailable = false;
} else {
Expand Down

0 comments on commit a35d261

Please sign in to comment.