| 11 | static bool is_patching_gameboot = false; |
| 12 | |
| 13 | static void patch_gameboot(u8 boot_type) |
| 14 | { |
| 15 | if(is_patching_gameboot) return; |
| 16 | |
| 17 | if(IS_ON_XMB && (file_size(CUSTOM_RENDER_PLUGIN_RCO) >= MIN_RCO_SIZE)) |
| 18 | { |
| 19 | is_patching_gameboot = true; |
| 20 | |
| 21 | u32 pid = get_current_pid(); |
| 22 | |
| 23 | if(pid) |
| 24 | { |
| 25 | const char *ids[] = { "non", "ps1", "ps2", "ps3", "psp", "bdv", "dvd", "rom", // 0-7 |
| 26 | "sns", "nes", "gba", "gen", "neo", "pce", "mam", "fba", // 8-15 |
| 27 | "ata", "gby", "cmd", "ids"}; // 16-19 |
| 28 | |
| 29 | if(boot_type > 19) boot_type = 0; |
| 30 | |
| 31 | const char *id = ids[boot_type]; |
| 32 | |
| 33 | u32 address; |
| 34 | char value[16]; int len; |
| 35 | |
| 36 | len = sprintf(value, "%s_%sboot", "page", "game"); // find "page_gameboot" |
| 37 | address = (u32)ps3mapi_find_offset(pid, BASE_PATCH_ADDRESS, 0x1800000, 4, value, len, value, patched_address1); |
| 38 | |
| 39 | if(address > BASE_PATCH_ADDRESS) |
| 40 | { |
| 41 | len = sprintf(value, "%s_", id); // patch "xxx__gameboot" |
| 42 | ps3mapi_patch_process(pid, address, value, len, 0); patched_address1 = address; |
| 43 | |
| 44 | len = sprintf(value, "%slogo", "ps3"); // find ps3logo |
| 45 | address = ps3mapi_find_offset(pid, patched_address1, 0x1800000, 4, value, len, value, patched_address2); |
| 46 | |
| 47 | if(address > patched_address1) |
| 48 | { |
| 49 | len = sprintf(value, "%slogo", (boot_type == 3) ? "psx" : id); // patch xxxlogo |
| 50 | ps3mapi_patch_process(pid, address, value, len, 0); patched_address2 = address; |
| 51 | } |
| 52 | |
| 53 | bool is_bdv_dvd = (boot_type == 5) || (boot_type == 6); |
| 54 | const char *anim = is_bdv_dvd ? "other" : "game"; |
| 55 | |
| 56 | len = sprintf(value, "%s_%sboot", "anim", "game"); // find anim_gameboot for ps3/ps2/ps1/psp/rom |
| 57 | address = ps3mapi_find_offset(pid, patched_address1, 0x1800000, 4, value, len, value, patched_address3); |
| 58 | |
| 59 | if(address > patched_address1) |
| 60 | { |
| 61 | len = sprintf(value, "%s__%sboot", id, anim); // patch xxx__otherboot / xxx__gameboot |
| 62 | ps3mapi_patch_process(pid, address, value, len + 1, 0); patched_address3 = address; |
| 63 | } |
| 64 | |
| 65 | len = sprintf(value, "%s_%sboot", "anim", "other"); // find anim_otherboot for dvd/bdv |
| 66 | address = ps3mapi_find_offset(pid, patched_address1, 0x1800000, 4, value, len, value, patched_address4); |
| 67 | |
| 68 | if(address > patched_address1) |
| 69 | { |
| 70 | len = sprintf(value, "%s__%sboot", id, anim); // patch xxx__otherboot / xxx__gameboot |
no test coverage detected