mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2025-07-23 14:19:55 -06:00
add the pokémon thing
This commit is contained in:
@ -1368,7 +1368,44 @@ u8 CartRetailNAND::SPIWrite(u8 val, u32 pos, bool last)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
CartRetailIR::CartRetailIR(u8* rom, u32 len, u32 chipid, u32 irversion) : CartRetail(rom, len, chipid)
|
||||||
|
{
|
||||||
|
IRVersion = irversion;
|
||||||
|
}
|
||||||
|
|
||||||
|
CartRetailIR::~CartRetailIR()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CartRetailIR::Reset()
|
||||||
|
{
|
||||||
|
IRCmd = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CartRetailIR::DoSavestate(Savestate* file)
|
||||||
|
{
|
||||||
|
// TODO?
|
||||||
|
}
|
||||||
|
|
||||||
|
u8 CartRetailIR::SPIWrite(u8 val, u32 pos, bool last)
|
||||||
|
{
|
||||||
|
if (pos == 0)
|
||||||
|
{
|
||||||
|
IRCmd = val;
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: emulate actual IR comm
|
||||||
|
|
||||||
|
switch (IRCmd)
|
||||||
|
{
|
||||||
|
case 0x00: // pass-through
|
||||||
|
return CartRetail::SPIWrite(val, pos-1, last);
|
||||||
|
|
||||||
|
case 0x08: // ID
|
||||||
|
return 0xAA;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
CartHomebrew::CartHomebrew(u8* rom, u32 len, u32 chipid) : CartCommon(rom, len, chipid)
|
CartHomebrew::CartHomebrew(u8* rom, u32 len, u32 chipid) : CartCommon(rom, len, chipid)
|
||||||
@ -1827,6 +1864,15 @@ bool LoadROMCommon(u32 filelength, const char *sram, bool direct)
|
|||||||
|
|
||||||
CartInserted = true;
|
CartInserted = true;
|
||||||
|
|
||||||
|
u32 irversion = 0;
|
||||||
|
if ((gamecode & 0xFF) == 'I')
|
||||||
|
{
|
||||||
|
if (((gamecode >> 8) & 0xFF) < 'P')
|
||||||
|
irversion = 1; // Active Health / Walk with Me
|
||||||
|
else
|
||||||
|
irversion = 2; // Pokémon HG/SS, B/W, B2/W2
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: support more fancy cart types (homebrew?, flashcarts, etc)
|
// TODO: support more fancy cart types (homebrew?, flashcarts, etc)
|
||||||
/*if (CartIsHomebrew)
|
/*if (CartIsHomebrew)
|
||||||
ROMCommandHandler = ROMCommand_Homebrew;
|
ROMCommandHandler = ROMCommand_Homebrew;
|
||||||
@ -1839,8 +1885,8 @@ bool LoadROMCommon(u32 filelength, const char *sram, bool direct)
|
|||||||
Cart = new CartHomebrew(CartROM, CartROMSize, CartID);
|
Cart = new CartHomebrew(CartROM, CartROMSize, CartID);
|
||||||
else if (CartID & 0x08000000)
|
else if (CartID & 0x08000000)
|
||||||
Cart = new CartRetailNAND(CartROM, CartROMSize, CartID);
|
Cart = new CartRetailNAND(CartROM, CartROMSize, CartID);
|
||||||
//else if (CartID & 0x00010000)
|
else if (irversion != 0)
|
||||||
// Cart = new CartRetailIR(CartROM, CartROMSize, CartID);
|
Cart = new CartRetailIR(CartROM, CartROMSize, CartID, irversion);
|
||||||
else
|
else
|
||||||
Cart = new CartRetail(CartROM, CartROMSize, CartID);
|
Cart = new CartRetail(CartROM, CartROMSize, CartID);
|
||||||
|
|
||||||
|
@ -166,7 +166,7 @@ private:
|
|||||||
class CartRetailIR : public CartRetail
|
class CartRetailIR : public CartRetail
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CartRetailIR(u8* rom, u32 len, u32 chipid);
|
CartRetailIR(u8* rom, u32 len, u32 chipid, u32 irversion);
|
||||||
~CartRetailIR();
|
~CartRetailIR();
|
||||||
|
|
||||||
void Reset();
|
void Reset();
|
||||||
@ -176,6 +176,7 @@ public:
|
|||||||
u8 SPIWrite(u8 val, u32 pos, bool last);
|
u8 SPIWrite(u8 val, u32 pos, bool last);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
u32 IRVersion;
|
||||||
u8 IRCmd;
|
u8 IRCmd;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user