Add platform check

This commit is contained in:
Taj • forcequitOS 2026-05-02 14:09:21 -04:00
parent f1c2fcaf2d
commit dda4e636f6

View File

@ -244,6 +244,10 @@ void setTSURLSchemeState(BOOL newState, NSString* customAppPath)
} }
} }
NSArray *getCurrentPlatforms(void)
{
return infoDictionaryForAppPath(trollStoreAppPath())[@"CFBundleSupportedPlatforms"];
}
#ifdef TROLLSTORE_LITE #ifdef TROLLSTORE_LITE
BOOL isLdidInstalled(void) BOOL isLdidInstalled(void)
@ -864,6 +868,7 @@ void applyPatchesToInfoDictionary(NSString* appPath)
// 174: // 174:
// 180: tried to sign app where the main binary is encrypted // 180: tried to sign app where the main binary is encrypted
// 184: tried to sign app where an additional binary is encrypted // 184: tried to sign app where an additional binary is encrypted
// 186: application is for the wrong platform
int installApp(NSString* appPackagePath, BOOL sign, BOOL force, BOOL isTSUpdate, BOOL useInstalldMethod, BOOL skipUICache) int installApp(NSString* appPackagePath, BOOL sign, BOOL force, BOOL isTSUpdate, BOOL useInstalldMethod, BOOL skipUICache)
{ {
@ -884,6 +889,23 @@ int installApp(NSString* appPackagePath, BOOL sign, BOOL force, BOOL isTSUpdate,
if(!infoDictionaryForAppPath(appBundleToInstallPath)) return 172; if(!infoDictionaryForAppPath(appBundleToInstallPath)) return 172;
NSArray* currentPlatforms = getCurrentPlatforms();
NSArray* supportedPlatforms = infoDictionaryForAppPath(appBundleToInstallPath)[@"CFBundleSupportedPlatforms"];
BOOL platformMatch = NO;
for (NSString *platform in supportedPlatforms)
{
if ([currentPlatforms containsObject:platform])
{
platformMatch = YES;
break;
}
}
if (!platformMatch) return 186;
// if (![supportedPlatforms containsObject:@"iPhoneOS"]) return 186;
if(!isTSUpdate) if(!isTSUpdate)
{ {
applyPatchesToInfoDictionary(appBundleToInstallPath); applyPatchesToInfoDictionary(appBundleToInstallPath);