From cd84173b37d33da0f4dc8b6765959ccaaae1ab54 Mon Sep 17 00:00:00 2001 From: joeyjurjens Date: Fri, 24 Apr 2020 21:40:10 +0200 Subject: [PATCH] Support for framework based games --- README.md | 6 +++++- template/Macros.h | 4 ++-- template/Menu.h | 2 ++ template/Menu.mm | 12 +++++++++++- template/Tweak.xm | 5 +++++ template/versionCheck.sh | 2 +- 6 files changed, 26 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 4c24638..a9eca08 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,11 @@ In order to get a base64 string from the image, upload the image here: https://w Images 50x50 are recommended, you can get a sample of my images by copying the standard(in tweak.xm) base64 string & use this website to show the picture: https://base64.guru/converter/decode/image - + Setting a framework as executable +You can set this in the function setupMenu() inside Tweak.xm +```obj-c +[menu setFrameworkName:"FrameworkName"]; +``` Patching a offset without switch: ```c diff --git a/template/Macros.h b/template/Macros.h index f8befb0..be9bcc4 100644 --- a/template/Macros.h +++ b/template/Macros.h @@ -25,12 +25,12 @@ extern Switches *switches; #define UIColorFromHex(hexColor) [UIColor colorWithRed:((float)((hexColor & 0xFF0000) >> 16))/255.0 green:((float)((hexColor & 0xFF00) >> 8))/255.0 blue:((float)(hexColor & 0xFF))/255.0 alpha:1.0] uint64_t getRealOffset(uint64_t offset){ - return _dyld_get_image_vmaddr_slide(0) + offset; + return KittyMemory::getAbsoluteAddress([menu getFrameworkName], offset); } // Patching a offset without switch. void patchOffset(uint64_t offset, std::string hexBytes) { - MemoryPatch patch = MemoryPatch::createWithHex(NULL, offset, hexBytes); + MemoryPatch patch = MemoryPatch::createWithHex([menu getFrameworkName], offset, hexBytes); if(!patch.isValid()){ [menu showPopup:@"Invalid patch" description:[NSString stringWithFormat:@"Failing offset: 0x%llx, please re-check the hex you entered.", offset]]; return; diff --git a/template/Menu.h b/template/Menu.h index 6002503..83ffe04 100644 --- a/template/Menu.h +++ b/template/Menu.h @@ -21,6 +21,8 @@ @interface Menu : UIView -(id)initWithTitle:(NSString *)title_ titleColor:(UIColor *)titleColor_ titleFont:(NSString *)titleFont_ credits:(NSString *)credits_ headerColor:(UIColor *)headerColor_ switchOffColor:(UIColor *)switchOffColor_ switchOnColor:(UIColor *)switchOnColor_ switchTitleFont:(NSString *)switchTitleFont_ switchTitleColor:(UIColor *)switchTitleColor_ infoButtonColor:(UIColor *)infoButtonColor_ maxVisibleSwitches:(int)maxVisibleSwitches_ menuWidth:(CGFloat )menuWidth_ menuIcon:(NSString *)menuIconBase64_ menuButton:(NSString *)menuButtonBase64_; +-(void)setFrameworkName:(const char *)name_; +-(const char *)getFrameworkName; -(void)showMenuButton; diff --git a/template/Menu.mm b/template/Menu.mm index ed8bb72..6357ab3 100644 --- a/template/Menu.mm +++ b/template/Menu.mm @@ -37,6 +37,8 @@ @implementation Menu BOOL hasRestoredLastSession = false; UIButton *menuButton; +const char *frameworkName = NULL; + UIWindow *mainWindow; @@ -285,6 +287,14 @@ -(void)switchClicked:(id)switch_ { // Update switch background color and pref value. [self changeSwitchBackground:switch_ isSwitchOn:isOn]; } + +-(void)setFrameworkName:(const char *)name_ { + frameworkName = name_; +} + +-(const char *)getFrameworkName { + return frameworkName; +} @end // End of menu class! @@ -305,7 +315,7 @@ - (id)initHackNamed:(NSString *)hackName_ description:(NSString *)description_ o } else { // For each offset, we create a MemoryPatch. for(int i = 0; i < offsets_.size(); i++) { - MemoryPatch patch = MemoryPatch::createWithHex(NULL, offsets_[i], bytes_[i]); + MemoryPatch patch = MemoryPatch::createWithHex([menu getFrameworkName], offsets_[i], bytes_[i]); if(patch.isValid()) { memoryPatches.push_back(patch); } else { diff --git a/template/Tweak.xm b/template/Tweak.xm index d4c362f..735b991 100644 --- a/template/Tweak.xm +++ b/template/Tweak.xm @@ -63,6 +63,11 @@ void setup() { then replace that string with mine. ************************************************************************************************************/ void setupMenu() { + + // If a game uses a framework as base executable, you can enter the name here. + // For example: UnityFramework, in that case you have to replace NULL with "UnityFramework" (note the quotes) + [menu setFrameworkName:NULL]; + menu = [[Menu alloc] initWithTitle:@"@@APPNAME@@ - Mod Menu" titleColor:[UIColor whiteColor] diff --git a/template/versionCheck.sh b/template/versionCheck.sh index dbeb13f..7af575f 100755 --- a/template/versionCheck.sh +++ b/template/versionCheck.sh @@ -1,5 +1,5 @@ #!/bin/bash -VERSION='0.6.4' +VERSION='0.6.5' # Don't remove the above line. Serves as the version this script will fetch. Only update when a new version is out. ERROR='\033[1;31m[*] Error:\033[1;37m '