Skip to content

Commit 6c3c394

Browse files
committed
add #75
1 parent fab5cff commit 6c3c394

13 files changed

+83
-17
lines changed

EnterpriseLoader/EnterpriseLoader.m

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#import <UIKit/UIKit.h>
44
#include <dlfcn.h>
55
#include <objc/runtime.h>
6-
6+
#import "../src/EnterpriseCompare.h"
77

88
NSString* exitMsg = nil;
99
BOOL showNothing = NO;
@@ -12,7 +12,6 @@ @interface RootViewController : UIViewController
1212
@end
1313

1414
@implementation RootViewController
15-
1615
- (void)viewDidAppear:(BOOL)animated {
1716
NSLog(@"[EnterpriseLoader] viewDidAppear");
1817
[super viewDidAppear:animated];
@@ -43,7 +42,7 @@ - (void)overrideToWindow {
4342
// something terribly went wrong here
4443
return;
4544
}
46-
window.backgroundColor = [UIColor blackColor];
45+
window.backgroundColor = [UIColor grayColor];
4746
window.rootViewController = [[RootViewController alloc] init];
4847
[window makeKeyAndVisible];
4948
}
@@ -83,6 +82,13 @@ - (BOOL)rly_application:(UIApplication*)application didFinishLaunchingWithOption
8382
decodedString = [NSString stringWithFormat:@"%@ --geode:binary-dir=\"%@/mods\"", decodedString, [[NSBundle mainBundle] resourcePath]];
8483
setenv("LAUNCHARGS", decodedString.UTF8String, 1);
8584
}
85+
} else if ([item.name isEqualToString:@"checksum"]) {
86+
NSString* currChecksum = [EnterpriseCompare getChecksum:YES];
87+
NSString* otherChecksum = [item.value mutableCopy];
88+
NSLog(@"[EnterpriseLoader] curr-checksum %@ vs other-checksum %@", currChecksum, otherChecksum);
89+
if (![currChecksum isEqualToString:otherChecksum]) {
90+
exitMsg = @"You must update the Helper to use any new mods. If you accidentally skipped the step to save the IPA, go back to the launcher, settings, and tap \"Install Helper\".";
91+
}
8692
}
8793
}
8894
} else if ([url.host isEqualToString:@"check"]) {

EnterpriseLoader/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ include $(THEOS)/makefiles/common.mk
22

33
LIBRARY_NAME = EnterpriseLoader
44

5-
EnterpriseLoader_FILES = EnterpriseLoader.m ../src/LCUtils/unarchive.m
5+
EnterpriseLoader_FILES = EnterpriseLoader.m ../src/LCUtils/unarchive.m ../src/EnterpriseCompare.m
66
EnterpriseLoader_CFLAGS = -objc-arc
77
EnterpriseLoader_LIBRARIES = archive
88
EnterpriseLoader_INSTALL_PATH = /Applications/Geode.app/Frameworks

INSTALL.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,5 @@ To get started, choose an installation guide for your iOS version.
2323
> \
2424
> If you **don't have a PC**, **are on iOS 17.4 or later (especially iOS 26)**, and are **willing to spend money on an Apple developer certificate**, you can follow the [JIT-less](/JITLESS-INSTALL-GUIDE.md) guide to use Geode **without a PC**. If you **have a PC**, as long as **you're not on iOS 26**, you can use the [SideStore](/MODERN-IOS-INSTALL.md) method. If **you are on iOS 26 and have a PC**, follow the [SideStore](/MODERN-IOS-INSTALL.md) guide but **instead of setting up StikDebug**, follow the [JIT-less](/JITLESS-INSTALL-GUIDE.md) guide and **import the SideStore certificate** (the steps to import the certificate are **available in the JIT-less guide**) and make sure that you have **the versions of SideStore listed in the JIT-less guide**.
2525
> \
26+
> \
2627
> Otherwise if you **don't have a PC**, **are on iOS 17.4 or later**, **can't spend money on an Apple developer certificate**, you can follow the not recommended guide for setting up [Enterprise Mode](./ENTERPRISE-INSTALL-GUIDE.md) to use Geode **without a PC** or any money. However, this method is not recommended and can **__lead to your iDevice being blacklisted from using any other certificate__**

LIVECONTAINER-INSTALL-GUIDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ After these steps:
3333
- LiveContainer (Latest)
3434
- Confirming JIT-less works on LiveContainer
3535
- An internet connection
36-
- IPA file of Geode launcher from [Releases](https://github.com/geode-sdk/ios-launcher/releases)
36+
- IPA file of Geode launcher from [Releases](https://github.com/geode-sdk/ios-launcher/releases/latest)
3737

3838
## Set Up LiveContainer for Geode
3939
- Sideload Geode using LiveContainer

src/AppDelegate.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,11 +130,11 @@ - (BOOL)application:(UIApplication*)application openURL:(nonnull NSURL*)url opti
130130

131131
if ([url.host isEqualToString:@"launchent"]) {
132132
AppLog(@"force open helper3");
133-
[((RootViewController*)self.window.rootViewController) launchHelper2:NO];
133+
[((RootViewController*)self.window.rootViewController) launchHelper2:NO patchCheck:YES];
134134
return YES;
135135
}
136136
if ([[Utils getPrefs] boolForKey:@"ENTERPRISE_MODE"] && ![url.host isEqualToString:@"import"]) {
137-
[Utils showNoticeGlobal:@"Any app scheme is not supported. This includes restarting Geode."];
137+
[Utils showNoticeGlobal:@"Any app scheme is not supported. This includes restarting Geode. Tap Launch if you recently installed mods to patch the helper."];
138138
return YES;
139139
} else if ([[Utils getPrefs] boolForKey:@"ENTERPRISE_MODE"] && [url.host isEqualToString:@"import"]) {
140140
NSFileManager* fm = [NSFileManager defaultManager];
@@ -189,7 +189,7 @@ - (BOOL)application:(UIApplication*)application openURL:(nonnull NSURL*)url opti
189189
} else {
190190
AppLog(@"force open helper3");
191191
// this is funny
192-
[((RootViewController*)self.window.rootViewController) launchHelper2:safeMode];
192+
[((RootViewController*)self.window.rootViewController) launchHelper2:safeMode patchCheck:YES];
193193
}
194194
}
195195
return YES;

src/EnterpriseCompare.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#import <Foundation/Foundation.h>
2+
@interface EnterpriseCompare : NSObject
3+
+ (NSString*)getChecksum:(BOOL)helper;
4+
@end

src/EnterpriseCompare.m

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#import "EnterpriseCompare.h"
2+
#import <CommonCrypto/CommonCrypto.h>
3+
4+
@implementation EnterpriseCompare
5+
+ (NSString*)getChecksum:(BOOL)helper {
6+
NSURL* from = [[NSBundle mainBundle] executableURL];
7+
NSURL* docPath = [[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask].lastObject;
8+
NSURL* bundlePath = [[docPath URLByAppendingPathComponent:@"Applications"] URLByAppendingPathComponent:@"com.robtop.geometryjump.app"];
9+
if (!helper) {
10+
from = [bundlePath URLByAppendingPathComponent:@"GeometryOriginal"];
11+
}
12+
NSFileManager* fm = [NSFileManager defaultManager];
13+
NSError* error;
14+
if (![fm fileExistsAtPath:from.path]) return nil;
15+
NSMutableData* data = [NSMutableData dataWithContentsOfURL:from options:0 error:&error];
16+
if (!data || error) {
17+
NSLog(@"[Patcher] Couldn't read binary: %@", error);
18+
return nil;
19+
}
20+
NSMutableSet<NSString*>* modIDs = [NSMutableSet new];
21+
NSMutableSet<NSString*>* modDict = [NSMutableSet new];
22+
23+
NSArray* modsDir = [fm contentsOfDirectoryAtPath:[[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"mods"] error:nil];
24+
if (!helper) {
25+
modsDir = [fm contentsOfDirectoryAtPath:[bundlePath.path stringByAppendingPathComponent:@"mods"] error:nil];
26+
}
27+
for (NSString *file in modsDir) {
28+
NSString *modID = [[file stringByDeletingPathExtension] stringByDeletingPathExtension];
29+
if (![modDict containsObject:file]) {
30+
[modIDs addObject:modID];
31+
[modDict addObject:file];
32+
}
33+
}
34+
NSMutableArray* modIDSorted = [[[modIDs allObjects] sortedArrayUsingSelector:@selector(localizedCaseInsensitiveCompare:)] mutableCopy];
35+
for (int i = 0; i < modIDSorted.count; i++) {
36+
NSString *item = modIDSorted[i];
37+
if (item == nil || [item isEqualToString:@""]) {
38+
[modIDSorted removeObjectAtIndex:i];
39+
}
40+
}
41+
42+
NSData* stringData = [[NSString stringWithFormat:@"%@",[modIDSorted componentsJoinedByString:@","]] dataUsingEncoding:NSUTF8StringEncoding];
43+
unsigned char digest[CC_SHA256_DIGEST_LENGTH];
44+
CC_SHA256(stringData.bytes, (CC_LONG)stringData.length, digest);
45+
NSMutableString* output = [NSMutableString stringWithCapacity:CC_SHA256_DIGEST_LENGTH * 2];
46+
for (int i = 0; i < CC_SHA256_DIGEST_LENGTH; i++) {
47+
[output appendFormat:@"%02x", digest[i]];
48+
}
49+
50+
return output;
51+
}
52+
@end

src/LCUtils/GCSharedUtils.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@import Foundation;
1+
#import <Foundation/Foundation.h>
22

33
@interface GCSharedUtils : NSObject
44
+ (NSString*)liveContainerBundleID;

src/Patcher.mm

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -876,5 +876,4 @@ + (NSString*)getPatchChecksum:(NSURL*)from withSafeMode:(BOOL)safeMode {
876876
NSString* hash = [Utils sha256sumWithString:[NSString stringWithFormat:@"%@+%@",[modIDSorted componentsJoinedByString:@","], modHashSorted]];
877877
return hash;
878878
}
879-
880879
@end

src/RootViewController.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
- (void)signAppWithSafeMode:(void (^)(BOOL success, NSString* error))completionHandler;
2828
- (void)refreshTheme;
2929
- (BOOL)bundleIPAWithPatch:(BOOL)safeMode withLaunch:(BOOL)launch;
30-
- (void)launchHelper2:(BOOL)safeMode;
30+
- (void)launchHelper2:(BOOL)safeMode patchCheck:(BOOL)patchCheck;
3131
- (void)launchHelper:(BOOL)safeMode;
3232
- (void)updatePatchStatus;
3333
@end

0 commit comments

Comments
 (0)