Add a hacky workaround for problematic carts
This adds a few strategically placed dummy commands which skip the bad responses, allowing the cart to be dumped.
This commit is contained in:
parent
ff6e6862ff
commit
43554a68d3
@ -189,3 +189,10 @@ void Cart_Secure_Init(u32 *buf, u32 *out)
|
||||
ioDelay(0xF0000);
|
||||
}
|
||||
}
|
||||
|
||||
void Cart_Dummy(void) {
|
||||
// Sends a dummy command to skip encrypted responses some problematic carts send.
|
||||
u32 test;
|
||||
const u32 A2_cmd[4] = { 0xA2000000, 0x00000000, rand1, rand2 };
|
||||
CTR_SendCommand(A2_cmd, 4, 1, 0x100822C, &test);
|
||||
}
|
||||
|
@ -22,3 +22,4 @@ void Cart_Init(void);
|
||||
int Cart_IsInserted(void);
|
||||
u32 Cart_GetID(void);
|
||||
void Cart_Secure_Init(u32* buf, u32* out);
|
||||
void Cart_Dummy(void);
|
||||
|
@ -66,6 +66,7 @@ restart_program:
|
||||
u32 blocks = 1 * 1024 * 1024 / mediaUnit; //1MB of blocks
|
||||
|
||||
// Read out the header 0x0000-0x1000
|
||||
Cart_Dummy();
|
||||
CTR_CmdReadData(0, mediaUnit, 0x1000 / mediaUnit, target);
|
||||
|
||||
u32 NCSD_magic = *(u32*)(&target[0x100]);
|
||||
@ -105,6 +106,8 @@ restart_program:
|
||||
|
||||
u8* read_ptr = target;
|
||||
while (read_ptr < target + target_buf_size && current_sector < cartSize) {
|
||||
Cart_Dummy();
|
||||
Cart_Dummy();
|
||||
CTR_CmdReadData(current_sector, mediaUnit, blocks, read_ptr);
|
||||
read_ptr += mediaUnit * blocks;
|
||||
current_sector += blocks;
|
||||
|
Loading…
x
Reference in New Issue
Block a user