|
11 | 11 |
|
12 | 12 | typedef struct {
|
13 | 13 | NcsdHeader ncsd;
|
14 |
| - u8 cinfo[0x800]; |
15 |
| - NcchHeader ncch; |
16 | 14 | u32 card2_offset;
|
17 |
| - u8 dinfo[0x300 - 0x4]; |
18 |
| - u8 padding[0x3000 - (0x200 + 0x300)]; |
| 15 | + u8 cinfo[0x1000 - (0x200 + sizeof(u32))]; |
| 16 | + NcchHeader ncch; |
| 17 | + u8 padding[0x3000 - 0x200]; |
19 | 18 | u8 private[PRIV_HDR_SIZE];
|
20 |
| - u8 unused[0xC000 - PRIV_HDR_SIZE]; // 0xFF |
| 19 | + u8 unused[0x4000 + 0x8000 - PRIV_HDR_SIZE]; // 0xFF |
21 | 20 | u32 cart_type;
|
22 | 21 | u32 cart_id;
|
23 | 22 | u64 cart_size;
|
@@ -67,7 +66,7 @@ u32 InitCardRead(CartData* cdata) {
|
67 | 66 | cdata->cart_id = Cart_GetID();
|
68 | 67 | cdata->cart_type = (cdata->cart_id & 0x10000000) ? CART_CTR : CART_NTR;
|
69 | 68 | if (cdata->cart_type & CART_CTR) {
|
70 |
| - memset(cdata, 0xFF, 0x4000); // switch the padding to 0xFF |
| 69 | + memset(cdata, 0xFF, 0x8000); // switch the padding to 0xFF |
71 | 70 |
|
72 | 71 | // init, NCCH header
|
73 | 72 | static u32 sec_keys[4];
|
@@ -201,8 +200,7 @@ u32 ReadCartBytes(u8* buffer, u32 offset, u32 count, CartData* cdata) {
|
201 | 200 | u32 ReadCartPrivateHeader(u8* buffer, u32 offset, u32 count, CartData* cdata) {
|
202 | 201 | if (!(cdata->cart_type & CART_CTR)) return 1;
|
203 | 202 | if (offset < PRIV_HDR_SIZE) {
|
204 |
| - CartDataCtr* cdata_i = (CartDataCtr*)(void*) cdata; |
205 |
| - u8* priv_hdr = cdata_i->private; |
| 203 | + u8* priv_hdr = cdata->header + 0x4000; |
206 | 204 | if (offset + count > PRIV_HDR_SIZE) count = PRIV_HDR_SIZE - offset;
|
207 | 205 | memcpy(buffer, priv_hdr + offset, count);
|
208 | 206 | }
|
|
0 commit comments