Skip to content

Commit

Permalink
Merge pull request #14 from joeyjurjens/framework_support
Browse files Browse the repository at this point in the history
Support for framework based games
  • Loading branch information
joeyjurjens authored Apr 24, 2020
2 parents 54d7846 + cd84173 commit b36fda4
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 5 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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


<b> Setting a framework as executable </b>
You can set this in the function setupMenu() inside Tweak.xm
```obj-c
[menu setFrameworkName:"FrameworkName"];
```
<b> Patching a offset without switch: </b>
```c
Expand Down
4 changes: 2 additions & 2 deletions template/Macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions template/Menu.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
12 changes: 11 additions & 1 deletion template/Menu.mm
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ @implementation Menu
BOOL hasRestoredLastSession = false;
UIButton *menuButton;

const char *frameworkName = NULL;

UIWindow *mainWindow;


Expand Down Expand Up @@ -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!


Expand All @@ -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 {
Expand Down
5 changes: 5 additions & 0 deletions template/Tweak.xm
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion template/versionCheck.sh
Original file line number Diff line number Diff line change
@@ -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 '
Expand Down

0 comments on commit b36fda4

Please sign in to comment.