From ec07d6bd55f4886c4d6dd1f67f6e3e3bc0e3e7d3 Mon Sep 17 00:00:00 2001 From: mtabachenko Date: Mon, 11 Nov 2013 00:17:13 +0000 Subject: [PATCH] Slot2: - add new "PassME" stuff; --- desmume/src/addons/slot2_auto.cpp | 3 +++ desmume/src/addons/slot2_passme.cpp | 27 +++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/desmume/src/addons/slot2_auto.cpp b/desmume/src/addons/slot2_auto.cpp index 7bfac1b3e..4d92898e7 100644 --- a/desmume/src/addons/slot2_auto.cpp +++ b/desmume/src/addons/slot2_auto.cpp @@ -46,6 +46,9 @@ public: if ((memcmp(gameInfo.header.gameCode, "UBR", 3) == 0) // Opera Browser ) selection = NDS_SLOT2_EXPMEMORY; + else + if (gameInfo.isHomebrew()) + selection = NDS_SLOT2_PASSME; mSelectedImplementation = slot2_List[selection]; mSelectedImplementation->connect(); diff --git a/desmume/src/addons/slot2_passme.cpp b/desmume/src/addons/slot2_passme.cpp index 2fd082905..286853274 100644 --- a/desmume/src/addons/slot2_passme.cpp +++ b/desmume/src/addons/slot2_passme.cpp @@ -15,6 +15,8 @@ along with the this software. If not, see . */ +#include "../NDSSystem.h" +#include "../types.h" #include "../slot2.h" class Slot2_PassME : public ISlot2Interface @@ -25,6 +27,31 @@ public: static Slot2InfoSimple info("PassME", "PassME in GBA slot"); return &info; } + + virtual u8 readByte(u8 PROCNUM, u32 addr) + { + u32 tmp_addr = (addr & 0x07FFFFFF); + if (tmp_addr < gameInfo.romsize) + return (u8)gameInfo.readROM(tmp_addr); + + return (0xFF); + } + virtual u16 readWord(u8 PROCNUM, u32 addr) + { + u32 tmp_addr = (addr & 0x07FFFFFF); + if (tmp_addr < gameInfo.romsize) + return (u16)gameInfo.readROM(tmp_addr); + + return (0xFFFF); + } + virtual u32 readLong(u8 PROCNUM, u32 addr) + { + u32 tmp_addr = (addr & 0x07FFFFFF); + if (tmp_addr < gameInfo.romsize) + return (u32)gameInfo.readROM(tmp_addr); + + return (0xFFFFFFFF); + } }; ISlot2Interface* construct_Slot2_PassME() { return new Slot2_PassME(); }