Load from main instead of ES_InitLib

This commit is contained in:
Spotlight 2022-01-12 16:02:31 -06:00
parent 0403609bf7
commit 70af333c7d
No known key found for this signature in database
GPG Key ID: 874AA355B3209BDC

View File

@ -195,6 +195,7 @@ var OverwriteIOSPatch = PatchSet{
LWZ(R10, 0xc, R8), LWZ(R10, 0xc, R8),
// Apply! // Apply!
STW(R10, 0x0, R9), STW(R10, 0x0, R9),
EIEIO(),
// The remainder of our patches are for a Wii U. We must detect such. // The remainder of our patches are for a Wii U. We must detect such.
// Even in vWii mode, 0x0d8005a0 (LT_CHIPREVID) will have its upper // Even in vWii mode, 0x0d8005a0 (LT_CHIPREVID) will have its upper
@ -219,53 +220,53 @@ var OverwriteIOSPatch = PatchSet{
Instruction{0x7c, 0x09, 0x50, 0x00}, Instruction{0x7c, 0x09, 0x50, 0x00},
// If we're not a Wii U, carry on until the end. // If we're not a Wii U, carry on until the end.
//bne (last blr) // bne (last blr)
Instruction{0x40, 0x82, 0x00, 0x30}, Instruction{0x40, 0x82, 0x00, 0x30},
// Apply ES_AddTicket // Apply ES_AddTicket
LWZ(R9, 0x18, R8), LWZ(R9, 0x18, R8),
LWZ(R10, 0x1c, R8), LWZ(R10, 0x1c, R8),
STW(R10, 0x0, R9), SYNC(),
EIEIO(),
// Apply ES_AddTitleStart
LWZ(R9, 0x20, R8),
LWZ(R10, 0x24, R8),
STW(R10, 0x0, R9),
EIEIO(),
// Apply ES_AddContentStart
//LWZ(R9, 0x28, R8),
//LWZ(R10, 0x2c, R8),
//STW(R10, 0x0, R9), //STW(R10, 0x0, R9),
//EIEIO(), //EIEIO(),
// TODO: FILL //// Apply ES_AddTitleStart
//LWZ(R9, 0x20, R8),
//LWZ(R10, 0x24, R8),
//STW(R10, 0x0, R9),
//
//// Apply ES_AddContentStart
//LWZ(R9, 0x28, R8),
//LWZ(R10, 0x2c, R8),
//STW(R10, 0x0, R9),
BLR(), BLR(), BLR(), BLR(), BLR(), BLR(),
BLR(), BLR(), BLR(),
BLR(),
// We're finished patching! // We're finished patching!
BLR(), BLR(),
}.toBytes(), }.toBytes(),
}, },
Patch{ Patch{
Name: "Modify ES_InitLib", Name: "Modify main",
AtOffset: 2399844, AtOffset: 688,
// We inject in the epilog of the function. // We inject the tail end of the function.
Before: Instructions{ Before: Instructions{
LWZ(R0, 0x14, R1), // bl main
MTSPR(), BL(0x800041b0, 0x80023df0),
ADDI(R1, R1, 0x10), // b exit
BLR(), B(0x800041b4, 0x801d0960),
padding, padding,
}.toBytes(), }.toBytes(),
After: Instructions{ After: Instructions{
LWZ(R0, 0x14, R1), // bl overwriteIOSMemory
// bl overwriteIOSMemory @ 0x80014428 BL(0x800041b0, 0x800143f4),
Instruction{0x4b, 0xdb, 0xb0, 0xcd}, // bl main
MTSPR(), BL(0x800041b4, 0x80023df0),
ADDI(R1, R1, 0x10), // b exit
BLR(), B(0x800041b8, 0x801d0960),
}.toBytes(), }.toBytes(),
}, },
} }