diff --git a/template/Macros.h b/template/Macros.h index be9bcc4..2105296 100644 --- a/template/Macros.h +++ b/template/Macros.h @@ -11,6 +11,7 @@ #include #include +#include // definition at Menu.h extern Menu *menu; @@ -21,6 +22,11 @@ extern Switches *switches; #define HOOK(offset, ptr, orig) MSHookFunction((void *)getRealOffset(offset), (void *)ptr, (void **)&orig) #define HOOK_NO_ORIG(offset, ptr) MSHookFunction((void *)getRealOffset(offset), (void *)ptr, NULL) +// Note to not prepend an underscore to the symbol. See Notes on the Apple manpage (https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man3/dlsym.3.html) +#define HOOKSYM(sym, ptr, org) MSHookFunction((void*)dlsym((void *)-2, sym), (void *)ptr, (void **)&org) +#define HOOKSYM_NO_ORIG(sym, ptr) MSHookFunction((void*)dlsym((void *)-2, sym), (void *)ptr, NULL) +#define getSym(symName) dlsym((void *)-2, symName) + // Convert hex color to UIColor, usage: For the color #BD0000 you'd use: UIColorFromHex(0xBD0000) #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] diff --git a/template/sample.xm b/template/sample.xm index be5f1ae..84911be 100644 --- a/template/sample.xm +++ b/template/sample.xm @@ -69,6 +69,13 @@ int get_Gems(void *this_) { return old_get_Gems(this_); } +void (*old_gl_draw_elements)(GLenum mode, GLsizei count, GLenum type, const void *indices); + +void gl_draw_elements(GLenum mode, GLsizei count, GLenum type, const void *indices) { + // This hook is absolutely useless. Just to show a PoC + old_gl_draw_elements(mode, count type, indices); +} + void setup() { //public virtual void UpdateCharacter(float deltaTime); // RVA: 0x10194DE30 Offset: 0x194DE30 -> CharacterBase @@ -79,6 +86,9 @@ void setup() { //public int get_Gems(); // RVA: 0x1018A3F24 Offset: 0x18A3F24 HOOK(0x1018A3F24, get_Gems, old_get_Gems); + + // This entry is fictional but is just there to show a PoC. + HOOKSYM("glDrawElements", gl_draw_elements, old_gl_draw_elements); [switches addTextfieldSwitch:@"Custom Coins:" description:@"Here you can enter your own coins amount!" @@ -173,4 +183,4 @@ static void didFinishLaunching(CFNotificationCenterRef center, void *observer, C %ctor { CFNotificationCenterAddObserver(CFNotificationCenterGetLocalCenter(), NULL, &didFinishLaunching, (CFStringRef)UIApplicationDidFinishLaunchingNotification, NULL, CFNotificationSuspensionBehaviorDeliverImmediately); -} \ No newline at end of file +} diff --git a/template/versionCheck.sh b/template/versionCheck.sh index f89c852..76ab4db 100755 --- a/template/versionCheck.sh +++ b/template/versionCheck.sh @@ -1,5 +1,5 @@ #!/bin/bash -VERSION='0.6.6' +VERSION='0.6.7' # 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 '