Help! How to add unlimited coins to the android mod menu template, how is the hook method?

nkmod

Rookie
Original poster
Aug 24, 2023
1
0
1
Russia
i am using android mod menu version 3.2, i want hook method for arm64 as well as armv7

this is my code, please check where is the error, please help

main.cpp :

#if defined(__aarch64__) //Compile for arm64 lib only
#include <And64InlineHook/And64InlineHook.hpp>
#else //Compile for armv7 lib only. Do not worry about greyed out highlighting code, it still works

#include <Substrate/SubstrateHook.h>
#include <Substrate/CydiaSubstrate.h>

#endif

// fancy struct for patches for kittyMemory
struct My_Patches {
// let's assume we have patches for these functions for whatever game
// like show in miniMap boolean function
MemoryPatch Mode, Mode1, SliderExample;
// etc...
} hexPatches;

bool feature1, feature2, featureHookToggle, Health;
bool coins = false;
bool keys = false;
int sliderValue = 1, level = 0;
void *instanceBtn;

void (*old_AddCoins)(void *instance, int _amount);
void AddCoins(void *instance, int _amount)
{
if(instance != NULL && coins)
{
old_AddCoins(instance, 99999);
}
old_AddCoins(instance, _amount);
}

void (*old_AddKeys)(void *instance, int _amount);
void AddKeys(void *instance, int _amount)
{
if(instance != NULL && keys)
{
old_AddKeys(instance, 99999);
}
old_AddKeys(instance, _amount);
}

//Target lib here
#define targetLibName OBFUSCATE("libil2cpp.so")

#include "Includes/Macros.h"

#if defined(__aarch64__) //To compile this code for arm64 lib only. Do not worry about greyed out highlighting code, it still works

#else //To compile this code for armv7 lib only.


MSHookFunction((void*)getAbsoluteAddress("libil2cpp.so", 0xA47F0C), (void*)AddCoins, (void**)&old_AddCoins);
MSHookFunction((void*)getAbsoluteAddress("libil2cpp.so", 0xA47F58), (void*)AddKeys, (void**)&old_AddKeys);


const char *features[] = {
OBFUSCATE("Category_MOD INFO"), //Not counted
OBFUSCATE("Toggle_Unlimited Coins"), //0
OBFUSCATE("Toggle_Unlimited Keys"), //1


switch (featNum) {

case 0:
coins = !coins;
break;
case 1:
keys = !keys;
break;


it has been repeated many times, but there is no change, which one do you think needs to be fixed? Thank You