22 {
23 s32 (*readFunc)(OSPiHandle*, u32, u32*);
24 s32 (*readFunc2)(OSPiHandle*, u32, u32*);
27 s32 seed;
28 u32 hash;
29 u32 thisInsn;
30 u32 thisInsn2;
31 u32 prevInsn;
32 u8* it;
33
34
35 readFunc = osEPiReadIo;
36 seed = 0x0B112D28;
37 hash = 0;
38 readFunc(nuPiCartHandle, 0xB0000D10, &thisInsn);
39 seed -= thisInsn;
40 prevInsn = 0;
41
42 for (it = battle_heap_create_obfuscated_ROM_START; it < battle_heap_create_obfuscated_ROM_END; it += 4) {
43 readFunc(nuPiCartHandle, (u32)it, &thisInsn);
45
48 hash -=
LOWER(thisInsn);
49 hash -=
LOWER(prevInsn);
50 }
51 }
52
54 hash -=
LOWER(thisInsn) + (
UPPER(thisInsn) & 0xFC00);
55 }
56
57 prevInsn = thisInsn;
58 }
59 vramDest += seed + 0x2A4EB6 - hash;
60
61
62 readFunc2 = osEPiReadIo;
63 seed = 0x18F414AB;
64 hash = 0;
65 readFunc2(nuPiCartHandle, 0xB0000E38, &thisInsn2);
66 seed -= thisInsn2;
67 prevInsn = 0;
68
69 for (it = obfuscation_shims_ROM_START; it < obfuscation_shims_ROM_END; it += 4) {
70 readFunc2(nuPiCartHandle, (u32)it, &thisInsn2);
72
75 hash -=
LOWER(thisInsn2);
76 hash -=
LOWER(prevInsn);
77 }
78 }
79
81 hash -=
LOWER(thisInsn2) + (
UPPER(thisInsn2) & 0xFC00);
82 }
83 prevInsn = thisInsn2;
84 }
85 romStart += seed + 0xED41C - hash;
86
87 dma_copy(romStart, obfuscation_shims_ROM_END, vramDest);
88}
u32 dma_copy(Addr romStart, Addr romEnd, void *vramDest)
s8 obfuscated_obfuscation_shims_VRAM[]
s8 obfuscated_obfuscation_shims_ROM_START[]