Change bunny to revenge

This commit is contained in:
Cristiandis 2024-11-15 11:45:12 +01:00
parent 051816832e
commit 3f5723ea20
6 changed files with 88 additions and 88 deletions

View file

@ -1,4 +1,4 @@
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#define LOG_PREFIX @"[Bunny]" #define LOG_PREFIX @"[Revenge]"
#define BunnyLog(fmt, ...) NSLog((LOG_PREFIX @" " fmt), ##__VA_ARGS__) #define RevengeLog(fmt, ...) NSLog((LOG_PREFIX @" " fmt), ##__VA_ARGS__)

View file

@ -7,12 +7,12 @@ include $(THEOS)/makefiles/common.mk
TWEAK_NAME = Revenge TWEAK_NAME = Revenge
BUNDLE_NAME = RevengeResources BUNDLE_NAME = RevengeResources
Bunny_FILES = $(wildcard Sources/*.x Sources/*.m Sources/**/*.x Sources/**/*.m) Revenge_FILES = $(wildcard Sources/*.x Sources/*.m Sources/**/*.x Sources/**/*.m)
Bunny_CFLAGS = -fobjc-arc -DPACKAGE_VERSION='@"$(THEOS_PACKAGE_BASE_VERSION)"' -I$(THEOS_PROJECT_DIR)/Headers Revenge_CFLAGS = -fobjc-arc -DPACKAGE_VERSION='@"$(THEOS_PACKAGE_BASE_VERSION)"' -I$(THEOS_PROJECT_DIR)/Headers
Bunny_FRAMEWORKS = Foundation UIKit CoreGraphics CoreText CoreFoundation Revenge_FRAMEWORKS = Foundation UIKit CoreGraphics CoreText CoreFoundation
BunnyResources_INSTALL_PATH = "/Library/Application\ Support/" RevengeResources_INSTALL_PATH = "/Library/Application\ Support/"
BunnyResources_RESOURCE_DIRS = Resources RevengeResources_RESOURCE_DIRS = Resources
include $(THEOS_MAKE_PATH)/tweak.mk include $(THEOS_MAKE_PATH)/tweak.mk
include $(THEOS_MAKE_PATH)/bundle.mk include $(THEOS_MAKE_PATH)/bundle.mk

View file

@ -15,7 +15,7 @@ NSMutableDictionary<NSString *, NSString *> *fontMap;
UIFontDescriptor *replacementDescriptor = [UIFontDescriptor fontDescriptorWithName:replacementName size:size]; UIFontDescriptor *replacementDescriptor = [UIFontDescriptor fontDescriptorWithName:replacementName size:size];
UIFontDescriptor *fallbackDescriptor = [replacementDescriptor fontDescriptorByAddingAttributes:@{UIFontDescriptorNameAttribute: @[name]}]; UIFontDescriptor *fallbackDescriptor = [replacementDescriptor fontDescriptorByAddingAttributes:@{UIFontDescriptorNameAttribute: @[name]}];
UIFontDescriptor *finalDescriptor = [replacementDescriptor fontDescriptorByAddingAttributes:@{UIFontDescriptorCascadeListAttribute: @[fallbackDescriptor]}]; UIFontDescriptor *finalDescriptor = [replacementDescriptor fontDescriptorByAddingAttributes:@{UIFontDescriptorCascadeListAttribute: @[fallbackDescriptor]}];
return [UIFont fontWithDescriptor:finalDescriptor size:size]; return [UIFont fontWithDescriptor:finalDescriptor size:size];
} }
return %orig; return %orig;
@ -26,7 +26,7 @@ NSMutableDictionary<NSString *, NSString *> *fontMap;
if (replacementName) { if (replacementName) {
UIFontDescriptor *replacementDescriptor = [UIFontDescriptor fontDescriptorWithName:replacementName size:size]; UIFontDescriptor *replacementDescriptor = [UIFontDescriptor fontDescriptorWithName:replacementName size:size];
UIFontDescriptor *finalDescriptor = [replacementDescriptor fontDescriptorByAddingAttributes:@{UIFontDescriptorCascadeListAttribute: @[descriptor]}]; UIFontDescriptor *finalDescriptor = [replacementDescriptor fontDescriptorByAddingAttributes:@{UIFontDescriptorCascadeListAttribute: @[descriptor]}];
return [UIFont fontWithDescriptor:finalDescriptor size:size]; return [UIFont fontWithDescriptor:finalDescriptor size:size];
} }
return %orig; return %orig;
@ -51,77 +51,77 @@ NSMutableDictionary<NSString *, NSString *> *fontMap;
%end %end
void patchFonts(NSDictionary<NSString *, NSString *> *mainFonts, NSString *fontDefName) { void patchFonts(NSDictionary<NSString *, NSString *> *mainFonts, NSString *fontDefName) {
BunnyLog(@"patchFonts called with fonts: %@ and def name: %@", mainFonts, fontDefName); RevengeLog(@"patchFonts called with fonts: %@ and def name: %@", mainFonts, fontDefName);
if (!fontMap) { if (!fontMap) {
BunnyLog(@"Creating new fontMap"); RevengeLog(@"Creating new fontMap");
fontMap = [NSMutableDictionary dictionary]; fontMap = [NSMutableDictionary dictionary];
} }
NSString *fontJson = [NSString stringWithContentsOfURL:[getPyoncordDirectory() URLByAppendingPathComponent:@"fonts.json"] NSString *fontJson = [NSString stringWithContentsOfURL:[getPyoncordDirectory() URLByAppendingPathComponent:@"fonts.json"]
encoding:NSUTF8StringEncoding encoding:NSUTF8StringEncoding
error:nil]; error:nil];
if (fontJson) { if (fontJson) {
BunnyLog(@"Found existing fonts.json: %@", fontJson); RevengeLog(@"Found existing fonts.json: %@", fontJson);
} }
for (NSString *fontName in mainFonts) { for (NSString *fontName in mainFonts) {
NSString *url = mainFonts[fontName]; NSString *url = mainFonts[fontName];
BunnyLog(@"Replacing font %@ with URL: %@", fontName, url); RevengeLog(@"Replacing font %@ with URL: %@", fontName, url);
NSURL *fontURL = [NSURL URLWithString:url]; NSURL *fontURL = [NSURL URLWithString:url];
NSString *fontExtension = fontURL.pathExtension; NSString *fontExtension = fontURL.pathExtension;
NSURL *fontCachePath = [[[getPyoncordDirectory() NSURL *fontCachePath = [[[getPyoncordDirectory()
URLByAppendingPathComponent:@"downloads" isDirectory:YES] URLByAppendingPathComponent:@"downloads" isDirectory:YES]
URLByAppendingPathComponent:@"fonts" isDirectory:YES] URLByAppendingPathComponent:@"fonts" isDirectory:YES]
URLByAppendingPathComponent:fontDefName isDirectory:YES]; URLByAppendingPathComponent:fontDefName isDirectory:YES];
fontCachePath = [fontCachePath URLByAppendingPathComponent:[NSString stringWithFormat:@"%@.%@", fontName, fontExtension]]; fontCachePath = [fontCachePath URLByAppendingPathComponent:[NSString stringWithFormat:@"%@.%@", fontName, fontExtension]];
NSURL *parentDir = [fontCachePath URLByDeletingLastPathComponent]; NSURL *parentDir = [fontCachePath URLByDeletingLastPathComponent];
if (![[NSFileManager defaultManager] fileExistsAtPath:parentDir.path]) { if (![[NSFileManager defaultManager] fileExistsAtPath:parentDir.path]) {
BunnyLog(@"Creating parent directory: %@", parentDir.path); RevengeLog(@"Creating parent directory: %@", parentDir.path);
[[NSFileManager defaultManager] createDirectoryAtURL:parentDir [[NSFileManager defaultManager] createDirectoryAtURL:parentDir
withIntermediateDirectories:YES withIntermediateDirectories:YES
attributes:nil attributes:nil
error:nil]; error:nil];
} }
if (![[NSFileManager defaultManager] fileExistsAtPath:fontCachePath.path]) { if (![[NSFileManager defaultManager] fileExistsAtPath:fontCachePath.path]) {
BunnyLog(@"Downloading font %@ from %@", fontName, url); RevengeLog(@"Downloading font %@ from %@", fontName, url);
NSData *data = [NSData dataWithContentsOfURL:fontURL]; NSData *data = [NSData dataWithContentsOfURL:fontURL];
if (data) { if (data) {
BunnyLog(@"Writing font data to: %@", fontCachePath.path); RevengeLog(@"Writing font data to: %@", fontCachePath.path);
[data writeToURL:fontCachePath atomically:YES]; [data writeToURL:fontCachePath atomically:YES];
} }
} }
NSData *fontData = [NSData dataWithContentsOfURL:fontCachePath]; NSData *fontData = [NSData dataWithContentsOfURL:fontCachePath];
if (fontData) { if (fontData) {
BunnyLog(@"Registering font %@ with provider", fontName); RevengeLog(@"Registering font %@ with provider", fontName);
CGDataProviderRef provider = CGDataProviderCreateWithCFData((__bridge CFDataRef)fontData); CGDataProviderRef provider = CGDataProviderCreateWithCFData((__bridge CFDataRef)fontData);
CGFontRef font = CGFontCreateWithDataProvider(provider); CGFontRef font = CGFontCreateWithDataProvider(provider);
if (font) { if (font) {
CFStringRef postScriptName = CGFontCopyPostScriptName(font); CFStringRef postScriptName = CGFontCopyPostScriptName(font);
CTFontRef existingFont = CTFontCreateWithName(postScriptName, 0, NULL); CTFontRef existingFont = CTFontCreateWithName(postScriptName, 0, NULL);
if (existingFont) { if (existingFont) {
CFErrorRef unregisterError = NULL; CFErrorRef unregisterError = NULL;
if (!CTFontManagerUnregisterGraphicsFont(font, &unregisterError)) { if (!CTFontManagerUnregisterGraphicsFont(font, &unregisterError)) {
BunnyLog(@"Failed to deregister font %@: %@", (__bridge NSString *)postScriptName, RevengeLog(@"Failed to deregister font %@: %@", (__bridge NSString *)postScriptName,
unregisterError ? (__bridge NSString *)CFErrorCopyDescription(unregisterError) : @"Unknown error"); unregisterError ? (__bridge NSString *)CFErrorCopyDescription(unregisterError) : @"Unknown error");
if (unregisterError) CFRelease(unregisterError); if (unregisterError) CFRelease(unregisterError);
} }
CFRelease(existingFont); CFRelease(existingFont);
} }
CFErrorRef error = NULL; CFErrorRef error = NULL;
if (CTFontManagerRegisterGraphicsFont(font, &error)) { if (CTFontManagerRegisterGraphicsFont(font, &error)) {
fontMap[fontName] = (__bridge NSString *)postScriptName; fontMap[fontName] = (__bridge NSString *)postScriptName;
BunnyLog(@"Successfully registered font %@ to %@", fontName, (__bridge NSString *)postScriptName); RevengeLog(@"Successfully registered font %@ to %@", fontName, (__bridge NSString *)postScriptName);
NSError *jsonError; NSError *jsonError;
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:fontMap options:0 error:&jsonError]; NSData *jsonData = [NSJSONSerialization dataWithJSONObject:fontMap options:0 error:&jsonError];
if (!jsonError) { if (!jsonError) {
@ -129,22 +129,22 @@ void patchFonts(NSDictionary<NSString *, NSString *> *mainFonts, NSString *fontD
} }
} else { } else {
NSString *errorDesc = error ? (__bridge NSString *)CFErrorCopyDescription(error) : @"Unknown error"; NSString *errorDesc = error ? (__bridge NSString *)CFErrorCopyDescription(error) : @"Unknown error";
BunnyLog(@"Failed to register font %@: %@", fontName, errorDesc); RevengeLog(@"Failed to register font %@: %@", fontName, errorDesc);
if (error) CFRelease(error); if (error) CFRelease(error);
} }
CFRelease(postScriptName); CFRelease(postScriptName);
CFRelease(font); CFRelease(font);
} }
CGDataProviderRelease(provider); CGDataProviderRelease(provider);
} }
} }
} }
%ctor { %ctor {
@autoreleasepool { @autoreleasepool {
fontMap = [NSMutableDictionary dictionary]; fontMap = [NSMutableDictionary dictionary];
BunnyLog(@"Font hooks initialized"); RevengeLog(@"Font hooks initialized");
%init; %init;
} }
} }

View file

@ -12,7 +12,7 @@
} }
+ (instancetype)getLoaderConfig { + (instancetype)getLoaderConfig {
BunnyLog(@"Getting loader config"); RevengeLog(@"Getting loader config");
NSURL *loaderConfigUrl = [getPyoncordDirectory() URLByAppendingPathComponent:@"loader.json"]; NSURL *loaderConfigUrl = [getPyoncordDirectory() URLByAppendingPathComponent:@"loader.json"];
@ -35,7 +35,7 @@
} }
} }
BunnyLog(@"Couldn't get loader config"); RevengeLog(@"Couldn't get loader config");
return [LoaderConfig defaultConfig]; return [LoaderConfig defaultConfig];
} }

View file

@ -4,34 +4,34 @@
#import <objc/runtime.h> #import <objc/runtime.h>
void swizzleDCDThemeColor(NSDictionary<NSString *, NSArray<NSString *> *> *semanticColors) { void swizzleDCDThemeColor(NSDictionary<NSString *, NSArray<NSString *> *> *semanticColors) {
BunnyLog(@"Swizzling DCDThemeColor"); RevengeLog(@"Swizzling DCDThemeColor");
Class DCDTheme = NSClassFromString(@"DCDTheme"); Class DCDTheme = NSClassFromString(@"DCDTheme");
Class dcdThemeTarget = object_getClass(DCDTheme); Class dcdThemeTarget = object_getClass(DCDTheme);
SEL themeIndexSelector = NSSelectorFromString(@"themeIndex"); SEL themeIndexSelector = NSSelectorFromString(@"themeIndex");
Method themeIndexMethod = class_getClassMethod(dcdThemeTarget, themeIndexSelector); Method themeIndexMethod = class_getClassMethod(dcdThemeTarget, themeIndexSelector);
IMP themeIndexImpl = method_getImplementation(themeIndexMethod); IMP themeIndexImpl = method_getImplementation(themeIndexMethod);
int (*themeIndex)(id, SEL) = (int (*)(id, SEL))themeIndexImpl; int (*themeIndex)(id, SEL) = (int (*)(id, SEL))themeIndexImpl;
Class DCDThemeColor = NSClassFromString(@"DCDThemeColor"); Class DCDThemeColor = NSClassFromString(@"DCDThemeColor");
Class target = object_getClass(DCDThemeColor); Class target = object_getClass(DCDThemeColor);
unsigned int methodCount; unsigned int methodCount;
Method *methods = class_copyMethodList(target, &methodCount); Method *methods = class_copyMethodList(target, &methodCount);
for (unsigned int i = 0; i < methodCount; i++) { for (unsigned int i = 0; i < methodCount; i++) {
Method method = methods[i]; Method method = methods[i];
SEL selector = method_getName(method); SEL selector = method_getName(method);
NSString *methodName = NSStringFromSelector(selector); NSString *methodName = NSStringFromSelector(selector);
NSArray<NSString *> *semanticColor = semanticColors[methodName]; NSArray<NSString *> *semanticColor = semanticColors[methodName];
if (semanticColor) { if (semanticColor) {
BunnyLog(@"Swizzling %@", methodName); RevengeLog(@"Swizzling %@", methodName);
IMP originalImpl = method_getImplementation(method); IMP originalImpl = method_getImplementation(method);
UIColor *(*original)(id, SEL) = (UIColor *(*)(id, SEL))originalImpl; UIColor *(*original)(id, SEL) = (UIColor *(*)(id, SEL))originalImpl;
id block = ^UIColor *(id self) { id block = ^UIColor *(id self) {
int themeIndexVal = themeIndex(dcdThemeTarget, themeIndexSelector); int themeIndexVal = themeIndex(dcdThemeTarget, themeIndexSelector);
if (semanticColor.count - 1 >= themeIndexVal) { if (semanticColor.count - 1 >= themeIndexVal) {
@ -42,41 +42,41 @@ void swizzleDCDThemeColor(NSDictionary<NSString *, NSArray<NSString *> *> *seman
} }
return original(target, selector); return original(target, selector);
}; };
IMP newImpl = imp_implementationWithBlock(block); IMP newImpl = imp_implementationWithBlock(block);
method_setImplementation(method, newImpl); method_setImplementation(method, newImpl);
} }
} }
free(methods); free(methods);
} }
void swizzleUIColor(NSDictionary<NSString *, NSString *> *rawColors) { void swizzleUIColor(NSDictionary<NSString *, NSString *> *rawColors) {
BunnyLog(@"Swizzling UIColor"); RevengeLog(@"Swizzling UIColor");
Class UIColorClass = NSClassFromString(@"UIColor"); Class UIColorClass = NSClassFromString(@"UIColor");
Class target = object_getClass(UIColorClass); Class target = object_getClass(UIColorClass);
unsigned int methodCount; unsigned int methodCount;
Method *methods = class_copyMethodList(target, &methodCount); Method *methods = class_copyMethodList(target, &methodCount);
for (unsigned int i = 0; i < methodCount; i++) { for (unsigned int i = 0; i < methodCount; i++) {
Method method = methods[i]; Method method = methods[i];
SEL selector = method_getName(method); SEL selector = method_getName(method);
NSString *methodName = NSStringFromSelector(selector); NSString *methodName = NSStringFromSelector(selector);
NSString *rawColor = rawColors[methodName]; NSString *rawColor = rawColors[methodName];
if (rawColor) { if (rawColor) {
BunnyLog(@"Swizzling %@", methodName); RevengeLog(@"Swizzling %@", methodName);
id block = ^UIColor *(id self) { id block = ^UIColor *(id self) {
return hexToUIColor(rawColor); return hexToUIColor(rawColor);
}; };
IMP newImpl = imp_implementationWithBlock(block); IMP newImpl = imp_implementationWithBlock(block);
method_setImplementation(method, newImpl); method_setImplementation(method, newImpl);
} }
} }
free(methods); free(methods);
} }

View file

@ -8,14 +8,14 @@
static NSURL *source; static NSURL *source;
static BOOL isJailbroken; static BOOL isJailbroken;
static NSString *bunnyPatchesBundlePath; static NSString *revengePatchesBundlePath;
static NSURL *pyoncordDirectory; static NSURL *pyoncordDirectory;
static LoaderConfig *loaderConfig; static LoaderConfig *loaderConfig;
%hook NSFileManager %hook NSFileManager
- (NSURL *)containerURLForSecurityApplicationGroupIdentifier:(NSString *)groupIdentifier { - (NSURL *)containerURLForSecurityApplicationGroupIdentifier:(NSString *)groupIdentifier {
BunnyLog(@"containerURLForSecurityApplicationGroupIdentifier called! %@", RevengeLog(@"containerURLForSecurityApplicationGroupIdentifier called! %@",
groupIdentifier ?: @"nil"); groupIdentifier ?: @"nil");
if (isJailbroken) { if (isJailbroken) {
@ -36,22 +36,22 @@ static LoaderConfig *loaderConfig;
return %orig; return %orig;
} }
NSBundle *bunnyPatchesBundle = [NSBundle bundleWithPath:bunnyPatchesBundlePath]; NSBundle *revengePatchesBundle = [NSBundle bundleWithPath:revengePatchesBundlePath];
if (!bunnyPatchesBundle) { if (!revengePatchesBundle) {
BunnyLog(@"Failed to load BunnyPatches bundle from path: %@", bunnyPatchesBundlePath); RevengeLog(@"Failed to load RevengePatches bundle from path: %@", revengePatchesBundlePath);
showErrorAlert(@"Loader Error", @"Failed to initialize mod loader. Please reinstall the tweak."); showErrorAlert(@"Loader Error", @"Failed to initialize mod loader. Please reinstall the tweak.");
return %orig; return %orig;
} }
NSURL *patchPath = [bunnyPatchesBundle URLForResource:@"payload-base" withExtension:@"js"]; NSURL *patchPath = [revengePatchesBundle URLForResource:@"payload-base" withExtension:@"js"];
if (!patchPath) { if (!patchPath) {
BunnyLog(@"Failed to find payload-base.js in bundle"); RevengeLog(@"Failed to find payload-base.js in bundle");
showErrorAlert(@"Loader Error", @"Failed to initialize mod loader. Please reinstall the tweak."); showErrorAlert(@"Loader Error", @"Failed to initialize mod loader. Please reinstall the tweak.");
return %orig; return %orig;
} }
NSData *patchData = [NSData dataWithContentsOfURL:patchPath]; NSData *patchData = [NSData dataWithContentsOfURL:patchPath];
BunnyLog(@"Injecting loader"); RevengeLog(@"Injecting loader");
%orig(patchData, source, YES); %orig(patchData, source, YES);
__block NSData *bundle = [NSData dataWithContentsOfURL:[pyoncordDirectory URLByAppendingPathComponent:@"bundle.js"]]; __block NSData *bundle = [NSData dataWithContentsOfURL:[pyoncordDirectory URLByAppendingPathComponent:@"bundle.js"]];
@ -62,10 +62,10 @@ static LoaderConfig *loaderConfig;
NSURL *bundleUrl; NSURL *bundleUrl;
if (loaderConfig.customLoadUrlEnabled && loaderConfig.customLoadUrl) { if (loaderConfig.customLoadUrlEnabled && loaderConfig.customLoadUrl) {
bundleUrl = loaderConfig.customLoadUrl; bundleUrl = loaderConfig.customLoadUrl;
BunnyLog(@"Using custom load URL: %@", bundleUrl.absoluteString); RevengeLog(@"Using custom load URL: %@", bundleUrl.absoluteString);
} else { } else {
bundleUrl = [NSURL URLWithString:@"https://github.com/revenge-mod/revenge-bundle/releases/latest/download/revenge.min.js"]; bundleUrl = [NSURL URLWithString:@"https://github.com/revenge-mod/revenge-bundle/releases/latest/download/revenge.min.js"];
BunnyLog(@"Using default bundle URL: %@", bundleUrl.absoluteString); RevengeLog(@"Using default bundle URL: %@", bundleUrl.absoluteString);
} }
NSMutableURLRequest *bundleRequest = [NSMutableURLRequest requestWithURL:bundleUrl NSMutableURLRequest *bundleRequest = [NSMutableURLRequest requestWithURL:bundleUrl
@ -114,13 +114,13 @@ static LoaderConfig *loaderConfig;
NSError *jsonError; NSError *jsonError;
NSDictionary *fontDict = [NSJSONSerialization JSONObjectWithData:fontData options:0 error:&jsonError]; NSDictionary *fontDict = [NSJSONSerialization JSONObjectWithData:fontData options:0 error:&jsonError];
if (!jsonError && fontDict[@"main"]) { if (!jsonError && fontDict[@"main"]) {
BunnyLog(@"Found font configuration, applying..."); RevengeLog(@"Found font configuration, applying...");
patchFonts(fontDict[@"main"], fontDict[@"name"]); patchFonts(fontDict[@"main"], fontDict[@"name"]);
} }
} }
if (bundle) { if (bundle) {
BunnyLog(@"Executing JS bundle"); RevengeLog(@"Executing JS bundle");
%orig(bundle, source, async); %orig(bundle, source, async);
} }
@ -134,7 +134,7 @@ static LoaderConfig *loaderConfig;
if (!error) { if (!error) {
for (NSURL *fileURL in contents) { for (NSURL *fileURL in contents) {
if ([[fileURL pathExtension] isEqualToString:@"js"]) { if ([[fileURL pathExtension] isEqualToString:@"js"]) {
BunnyLog(@"Executing preload JS file %@", fileURL.absoluteString); RevengeLog(@"Executing preload JS file %@", fileURL.absoluteString);
NSData *data = [NSData dataWithContentsOfURL:fileURL]; NSData *data = [NSData dataWithContentsOfURL:fileURL];
if (data) { if (data) {
%orig(data, source, async); %orig(data, source, async);
@ -142,7 +142,7 @@ static LoaderConfig *loaderConfig;
} }
} }
} else { } else {
BunnyLog(@"Error reading contents of preloads directory"); RevengeLog(@"Error reading contents of preloads directory");
} }
} }
@ -153,30 +153,30 @@ static LoaderConfig *loaderConfig;
%ctor { %ctor {
@autoreleasepool { @autoreleasepool {
source = [NSURL URLWithString:@"bunny"]; source = [NSURL URLWithString:@"revenge"];
NSString *install_prefix = @"/var/jb"; NSString *install_prefix = @"/var/jb";
isJailbroken = [[NSFileManager defaultManager] fileExistsAtPath:install_prefix]; isJailbroken = [[NSFileManager defaultManager] fileExistsAtPath:install_prefix];
NSString *bundlePath = [NSString stringWithFormat:@"%@/Library/Application Support/BunnyResources.bundle", install_prefix]; NSString *bundlePath = [NSString stringWithFormat:@"%@/Library/Application Support/RevengeResources.bundle", install_prefix];
BunnyLog(@"Is jailbroken: %d", isJailbroken); RevengeLog(@"Is jailbroken: %d", isJailbroken);
BunnyLog(@"Bundle path for jailbroken: %@", bundlePath); RevengeLog(@"Bundle path for jailbroken: %@", bundlePath);
NSString *jailedPath = [[NSBundle mainBundle].bundleURL.path stringByAppendingPathComponent:@"BunnyResources.bundle"]; NSString *jailedPath = [[NSBundle mainBundle].bundleURL.path stringByAppendingPathComponent:@"RevengeResources.bundle"];
BunnyLog(@"Bundle path for jailed: %@", jailedPath); RevengeLog(@"Bundle path for jailed: %@", jailedPath);
bunnyPatchesBundlePath = isJailbroken ? bundlePath : jailedPath; revengePatchesBundlePath = isJailbroken ? bundlePath : jailedPath;
BunnyLog(@"Selected bundle path: %@", bunnyPatchesBundlePath); RevengeLog(@"Selected bundle path: %@", revengePatchesBundlePath);
BOOL bundleExists = [[NSFileManager defaultManager] fileExistsAtPath:bunnyPatchesBundlePath]; BOOL bundleExists = [[NSFileManager defaultManager] fileExistsAtPath:revengePatchesBundlePath];
BunnyLog(@"Bundle exists at path: %d", bundleExists); RevengeLog(@"Bundle exists at path: %d", bundleExists);
NSError *error = nil; NSError *error = nil;
NSArray *bundleContents = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:bunnyPatchesBundlePath error:&error]; NSArray *bundleContents = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:revengePatchesBundlePath error:&error];
if (error) { if (error) {
BunnyLog(@"Error listing bundle contents: %@", error); RevengeLog(@"Error listing bundle contents: %@", error);
} else { } else {
BunnyLog(@"Bundle contents: %@", bundleContents); RevengeLog(@"Bundle contents: %@", bundleContents);
} }
pyoncordDirectory = getPyoncordDirectory(); pyoncordDirectory = getPyoncordDirectory();