MCPcopy Create free account
hub / github.com/aldostools/webMAN-MOD / patch_gameboot

Function patch_gameboot

include/mount/patch_gameboot.h:13–102  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11static bool is_patching_gameboot = false;
12
13static 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

Callers 5

reload_xmbFunction · 0.85
mount_threadFunction · 0.85
patch_gameboot_by_typeFunction · 0.85
pad_combo_play.hFile · 0.85
randomizers.hFile · 0.85

Calls 13

file_sizeFunction · 0.85
get_current_pidFunction · 0.85
ps3mapi_find_offsetFunction · 0.85
ps3mapi_patch_processFunction · 0.85
map_patched_modulesFunction · 0.85
concat_path2Function · 0.85
concat3Function · 0.85
sprintfFunction · 0.50
isDirFunction · 0.50
file_existsFunction · 0.50
sys_map_pathFunction · 0.50
not_existsFunction · 0.50

Tested by

no test coverage detected