AriA99 65b55f9d60
Dump cart ID2 properly in private header (#862)
* Add cart_id2 to gamecart.h

This prepares changes to fix private header dumps.

The name ID2 matches Lotus3 (see Switchbrew) since it's evident Lotus3 is just a continuation of the 3DS cart controller

* Add Cart_GetID2() to protocol.h

This prepares changes to fix private header dumps.

The name ID2 matches Lotus3 (see Switchbrew) since it's evident Lotus3 is just a continuation of the 3DS cart controller.

* gc protocol: Add support to get ID2

This renames the unknowna0_cmd to its proper name and the A0_Response to CartID2, matching Lotus3 terminology.

* Store ID2 in private header at +0x44

The ID2 contains important information that in particular determines the cryptographic keys used. It is impossible to decrypt a dump of cart<->controller communications without knowing the ID2 or trying all possible keys.

This behavior matches Gateway. I suppose that it was presumed that Gateway would always store zeroes there because regular cartridges on retail would always report zero and then everybody just copied this false assumption.

* fix build (gamecart.c): memset->memcpy

* fix build (protocol.c): Fix dupe definition of Cart_GetID()
2026-03-20 15:53:37 +01:00

24 lines
559 B
C

// Copyright 2014 Normmatt
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#pragma once
#include "common.h"
#define REG_CARDCTL (*(vu16*)0x1000000C)
#define REG_CARDSTATUS (*(vu8* )0x10000010)
#define REG_CARDCYCLES0 (*(vu16*)0x10000012)
#define REG_CARDCYCLES1 (*(vu16*)0x10000014)
#define LATENCY 0x822Cu
#define BSWAP32(n) __builtin_bswap32(n)
void Cart_Init(void);
int Cart_IsInserted(void);
u32 Cart_GetID(void);
u32 Cart_GetID2(void);
void Cart_Secure_Init(u32* buf, u32* out);
void Cart_Dummy(void);