// we can run extra code at the end of the OFW's task init void hack_post_init_hook(void) { // Inject our hacked_TransferScreen //TransferScreen = hack_TransferScreen; //cache_fake(0xFF92DA50, ASM_BL(0xFF92DA50, &hack_FF92E704), TYPE_ICACHE); //cache_fake(0xFF92DA88, ASM_BL(0xFF92DA88, &hack_FF92E4C4), TYPE_ICACHE); // Intercept JUMP and TRASH buttons SetSendButtonProc(&hack_jump_trash_events, 0); // take over the vram copy locations, so we can invert the screen //cache_fake(0xFF92C5D8, ASM_BL(0xFF92C5D8, &hack_invert_olc_screen), TYPE_ICACHE); //cache_fake(0xFF92C5FC, ASM_BL(0xFF92C5FC, &hack_invert_olc_screen), TYPE_ICACHE); // prevent screen turn off on ptp (to see the debug on lcd) //cache_fake(0xFF9DE0DC, ASM_MOV_R0_INT(0), TYPE_ICACHE); // these freezes the usb communication //cache_fake(0xFF81B9D0, ASM_MOV_R0_INT(0), TYPE_ICACHE); // prevent ui lock //cache_fake(0xFF81B400, ASM_MOV_R0_INT(0), TYPE_ICACHE); // prevent ui lock //cache_fake(0xFF9DDB24, ASM_MOV_R0_INT(0), TYPE_ICACHE); // prevent ui lock // Hack redraw on some dialogs, to prevent flickering when entering our menu cache_fake(0xFF916434, ASM_B(0xFF916434, &hack_dialog_redraw), TYPE_ICACHE); // Hack items in dialogs cache_fake(0xFF838300, ASM_BL(0xFF838300, &hack_item_set_label_int), TYPE_ICACHE); cache_fake(0xFF837FEC, ASM_BL(0xFF837FEC, &hack_item_set_label_str), TYPE_ICACHE); }
int cpu_post_test_b (void) { int ret = 0; unsigned int i; int flag = disable_interrupts(); if (ret == 0) { ulong code[] = { ASM_MFLR(4), ASM_MTLR(3), ASM_B(4), ASM_MFLR(3), ASM_MTLR(4), ASM_BLR, }; ulong res; cpu_post_exec_11 (code, &res, 0); ret = res == 0 ? 0 : -1; if (ret != 0) { post_log ("Error at b1 test !\n"); } } if (ret == 0) { ulong code[] = { ASM_MFLR(4), ASM_MTLR(3), ASM_BL(4), ASM_MFLR(3), ASM_MTLR(4), ASM_BLR, }; ulong res; cpu_post_exec_11 (code, &res, 0); ret = res == (ulong)code + 12 ? 0 : -1; if (ret != 0) { post_log ("Error at b2 test !\n"); } } if (ret == 0) { ulong cc, cd; int cond; ulong ctr; int link; i = 0; for (cc = 0; cc < 4 && ret == 0; cc++) { for (cd = 0; cd < 4 && ret == 0; cd++) { for (link = 0; link <= 1 && ret == 0; link++) { for (cond = 0; cond <= 1 && ret == 0; cond++) { for (ctr = 1; ctr <= 2 && ret == 0; ctr++) { int decr = cd < 2; int cr = cond ? 0x80000000 : 0x00000000; int jumpc = cc >= 2 || (cc == 0 && !cond) || (cc == 1 && cond); int jumpd = cd >= 2 || (cd == 0 && ctr != 1) || (cd == 1 && ctr == 1); int jump = jumpc && jumpd; ret = cpu_post_test_bc (link ? OP_BCL : OP_BC, (cc << 3) + (cd << 1), 0, jump, decr, link, ctr, cr); if (ret != 0) { post_log ("Error at b3 test %d !\n", i); } i++; } } } } } } if (flag) enable_interrupts(); return ret; }