Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void MainThread(uint64_t arg)
- {
- int GameProcessID = 0, lastGameProcessID = 0;
- while (true)
- {
- if (GetGameRunningFlag() == 1)
- {
- GameProcessID = GetGameProcessID();
- if (GameProcessID != 0)
- {
- if (GameProcessID != lastGameProcessID)
- {
- for (int x = 0; x < (10 * 100); x++) //10 second delay
- {
- sys_timer_usleep(10000);
- sys_ppu_thread_yield();
- }
- if (create_ingameThread)
- {
- _printf("init_ingame\n");
- sys_ppu_thread_t id;
- sys_ppu_thread_create(&id, init_ingame, 0, 3000, 0x2000, 0, "init_ingame");
- create_ingameThread = 0;
- }
- }
- }
- }
- sys_timer_usleep(100 * 1000); //0.1 second delay
- }
- lastGameProcessID = GameProcessID;
- //sys_timer_usleep(1668);
- //sys_ppu_thread_yield();
- //sys_ppu_thread_exit(0);
- }
- BOOL __cdecl GTAHOOK()
- {
- _printf("GTAHOOK() sucess\n");
- return 1;
- }
- void ScriptMain(uint64_t arg)
- {
- _printf("GTA Thread Created\n");
- sleep(8000);
- XNotifyUI("WELCOME TO SUCCESSFUL!!!");
- sleep(30000);
- //writing into mem
- //works
- //SET_CHEAT(0x3F8B84, 1);
- //crashes
- //*(char *)(0x3F8B84) = 60000000;
- //hooking
- //crashes
- //PatchInJump(0x3E3A20, (int)GTAHOOK, false);
- }
- char *lastGameID = 0, *GameID = 0;
- bool createGTAThread = 1;
- void init_ingame(uint64_t ulParameter)
- {
- _printf("in ingame_client\n");
- sleep(38000);
- while (true)
- {
- //to do;
- //fix GameID, when switching games. make it reset
- GameID = GetGameID();
- //is GTA
- if (!strcmp(GameID, "BLES01807"))
- {
- _printf("in GTA\n");
- sleep(8000);
- LoadGameProcessID = GetGameProcessID();
- sleep(30000);
- if (createGTAThread)
- {
- //hook into the game preccess
- //PatchInJump(LoadGameProcessID, (int)GTAHOOK, false);
- //PatchInJump(0x3E3A20, (int)GTAHOOK, false);
- sys_ppu_thread_t g_thread_id;
- sys_ppu_thread_create(&g_thread_id, ScriptMain, 0, 300, 0x2000, SYS_PPU_THREAD_CREATE_JOINABLE, "GTA THREAD");
- createGTAThread = 0;
- }
- }
- //is BO2
- if (!strcmp(GameID, "BLUS31011") || !strcmp(GameID, "BLES01717") || !strcmp(GameID, "BLES01718") || !strcmp(GameID, "BLES01719") || !strcmp(GameID, "BLES01720"))
- {
- _printf("in BO2\n");
- }
- //RDR
- if (!strcmp(GameID, "BLES01294"))
- {
- _printf("in RDR\n");
- }
- sys_timer_usleep(100 * 1000); //0.1 second delay
- }
- lastGameID = GameID;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement