-
Posts
7 -
Joined
-
Last visited
Profile Information
-
iDevice
iPhone 7
-
iOS Version
13.3
-
Jailbroken
Yes
-
Rooted
No
Recent Profile Visitors
184 profile views
Dababababa7777's Achievements
Newbie (1/14)
2
Reputation
-
Help/Support MSHookFunction can't hook an 8-byte function
Dababababa7777 replied to Dababababa7777's topic in Help & Support
Isn't there a way to hook it?😢 -
Help/Support MSHookFunction can't hook an 8-byte function
Dababababa7777 posted a topic in Help & Support
I'm trying to hook a function called Actor::getPos in MinecraftBE. However, that function is less than 8 bytes long, so I can't hook it with MSHookFunction. What should I do? Sample Code: struct Vec3 { float x, y, z; }; struct Actor {}; static Vec3& (*Actor_getPos)(Actor*); static Vec3& _Actor_getPos(Actor* self) { return Actor_getPos(self); } %ctor { //If it doesn't, it will crash... MSHookFunction((void*)(0x10228c2b8 + _dyld_get_image_vmaddr_slide(0)), (void*)&_Actor_getPos, (void**)&Actor_getPos); } -
I want to put the scope and address information of a class and a function in the symbol of MSHookFunction at the same time. Of course, if you leave it like this, you will get an error, but like this: Tweak.xm #include "Item.h" #include "ItemInstance.h" #include "Recipes.h" void (*Recipes_init)(Recipes*); void _Recipes_init(Recipes* res) { Recipes_init(res); const std::vector<Recipes::Type, std::allocator<Recipes::Type>>& def = definition<Item*, Item*>('#', Item::mItems[296], 'S', Item::mItems[368]); res->addShapedRecipe(ItemInstance(Item::mItems[432], 0), "###", "#S#", "###", def); } %ctor { MSHookFunction(Recipes::_init + (0x100774f40 + _dyld_get_image_vmaddr_slide(0)), (void*)&_Recipes_init, (void**)&_Recipes_init); MSHookFunction(Recipes::addShapedRecipe + (0x100781d74 + _dyld_get_image_vmaddr_slide(0)), NULL, NULL); MSHookFunction(Item::mItems + (0x10074689c + _dyld_get_image_vmaddr_slide(0)), NULL, NULL); MSHookFunction(ItemInstance::ItemInstance + (0x1007569a4 + _dyld_get_image_vmaddr_slide(0)), NULL, NULL); } Recipes.h #pragma once #include <memory> #include <string> #include <vector> #include <stdint.h> #include "ItemInstance.h" class Recipes { public: class Type { public: Item* item; uintptr_t* block; ItemInstance inst; char c; }; public: void _init(); void addShapedRecipe(const ItemInstance&, const std::string&, const std::string&, const std::string&, const std::vector<Recipes::Type, std::allocator<Recipes::Type>>&); }; template <class A, class B> std::vector<Recipes::Type, std::allocator<Recipes::Type>> definition(char, A, char, B); ItemInstance.h #pragma once #include <memory> #include "Item.h" class ItemInstance { public: ItemInstance(Item const*, int); }; Item.h #pragma once #include <string> #include <memory> #include <vector> #include <unordered_map> class Item { public: char filler[200]; public: static Item* mItems[512]; };
-
I want to put the scope and address information of a class and a function in the symbol of MSHookFunction at the same time. Of course, if you leave it like this, you will get an error, but like this: Tweak.xm #include "Item.h" #include "ItemInstance.h" #include "Recipes.h" void (*Recipes_init)(Recipes*); void _Recipes_init(Recipes* res) { Recipes_init(res); const std::vector<Recipes::Type, std::allocator<Recipes::Type>>& def = definition<Item*, Item*>('#', Item::mItems[296], 'S', Item::mItems[368]); res->addShapedRecipe(ItemInstance(Item::mItems[432], 0), "###", "#S#", "###", def); } %ctor { MSHookFunction(Recipes::_init + (0x100774f40 + _dyld_get_image_vmaddr_slide(0)), (void*)&_Recipes_init, (void**)&_Recipes_init); MSHookFunction(Recipes::addShapedRecipe + (0x100781d74 + _dyld_get_image_vmaddr_slide(0)), NULL, NULL); MSHookFunction(Item::mItems + (0x10074689c + _dyld_get_image_vmaddr_slide(0)), NULL, NULL); MSHookFunction(ItemInstance::ItemInstance + (0x1007569a4 + _dyld_get_image_vmaddr_slide(0)), NULL, NULL); } Recipes.h #pragma once #include <memory> #include <string> #include <vector> #include <stdint.h> #include "ItemInstance.h" class Recipes { public: class Type { public: Item* item; uintptr_t* block; ItemInstance inst; char c; }; public: void _init(); void addShapedRecipe(const ItemInstance&, const std::string&, const std::string&, const std::string&, const std::vector<Recipes::Type, std::allocator<Recipes::Type>>&); }; template <class A, class B> std::vector<Recipes::Type, std::allocator<Recipes::Type>> definition(char, A, char, B); ItemInstance.h #pragma once #include <memory> #include "Item.h" class ItemInstance { public: ItemInstance(Item const*, int); }; Item.h #pragma once #include <string> #include <memory> #include <vector> #include <unordered_map> class Item { public: char filler[200]; public: static Item* mItems[512]; };