CHEATS GAMES
Solid & Active Platinian
I'm new to the mod menu and gamehaking area, so please be patient with my non-technical explanation.
I wanted to use the update function in two buttons in the mod menu, so you know that when compiling it gives an error because of the two Update functions with the same name, so I bring the solution..
I asked this question here..
is it possible to use two UPDATE in the modmenu? - Platinmods.com - Android & iOS MODs, Mobile Games & Apps
how could i use two or more functions with the same name in modmenu buttons? see below.
I will add 2 classes and say that the
update = c1
update = c2
just put c1 and c2 in the two cheats you have.
Look:
now see how my cpp was after I changed
NOTE; I just tried to insert the enemy's pointer using my player's update but it didn't work, so the only way is to access the enemy's class using my player's class, this I couldn't, so I managed to do it that way..
I wanted to use the update function in two buttons in the mod menu, so you know that when compiling it gives an error because of the two Update functions with the same name, so I bring the solution..
I asked this question here..
is it possible to use two UPDATE in the modmenu? - Platinmods.com - Android & iOS MODs, Mobile Games & Apps
how could i use two or more functions with the same name in modmenu buttons? see below.
I will add 2 classes and say that the
update = c1
update = c2
just put c1 and c2 in the two cheats you have.
Look:
C++:
#include <iostream>
// #include <new>
using namespace std;
class Class1{
public:
void Update()
{
cout << "Class1::Update" << endl;
};
};
class Class2{
public:
void Update()
{
cout << "Class2::Update" << endl;
};
};
int main(void)
{
Class2 *c2 = new Class2();
Class1 *c1 = new Class1();
c1->Update();
c2->Update();
delete c2;
delete c1;
}
now see how my cpp was after I changed
C++:
float sliderValue = 1;
bool hack1 = false, hack2 = false, hack3 = false, hack4 = false, hack5 = false, hack6 = false;
// Hooking examples. Assuming you know how to write hook
void (*AddMoneyExample)(void *instance, int amount);
using namespace std;
class Class1{
public:
void Update()
{
cout << "Class1::Update" << endl;
};
};
class Class2{
public:
void Update()
{
cout << "Class2::Update" << endl;
};
};
int main(void)
{
Class2 *c2 = new Class2();
Class1 *c1 = new Class1();
c1->Update();
c2->Update();
delete c2;
delete c1;
}
void (*orig_c1) (void* instance);
void c1(void* instance) {
if (sliderValue > 0.0f)
{
*(float*)((uint64_t)instance + 0xC0) = sliderValue;
*(float*)((uint64_t)instance + 0xBC) = sliderValue;
}
return orig_c1(instance);
}
void (*orig_c2) (void* instance);
void c2(void* instance) {
if (hack1)
{
*(float*)((uint64_t)instance + 0x34) = 0.0f;
*(float*)((uint64_t)instance + 0x30) = 0.0f;
}
return orig_c2(instance);
}
// we will run our hacks in a new thread so our while loop doesn't block process main thread
void *hack_thread(void *) {
LOGI(OBFUSCATE("pthread created"));
//Check if target lib is loaded
do {
sleep(1);
} while (!isLibraryLoaded(targetLibName));
//Anti-lib rename
/*
do {
sleep(1);
} while (!isLibraryLoaded("libYOURNAME.so"));*/
LOGI(OBFUSCATE("%s has been loaded"), (const char *) targetLibName);
#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(targetLibName, string2Offset(OBFUSCATE_KEY("0x556A90", '?'))), (void *) c1, (void **) &orig_c1);
MSHookFunction((void *) getAbsoluteAddress(targetLibName, string2Offset(OBFUSCATE_KEY("0x73A6C8", '?'))), (void *) c2, (void **) &orig_c2);
NOTE; I just tried to insert the enemy's pointer using my player's update but it didn't work, so the only way is to access the enemy's class using my player's class, this I couldn't, so I managed to do it that way..