mirror of https://github.com/mgba-emu/mgba.git
DS: Attempt to detect if a game is homebrew
This commit is contained in:
parent
f96a8f78eb
commit
9a35691a03
1
CHANGES
1
CHANGES
|
@ -17,6 +17,7 @@ Misc:
|
|||
- ARM9: Implement SMLAW<y> and SMULW<y>
|
||||
- Qt: Add .nds files to the extension list in Info.plist
|
||||
- ARM9: Implement STRD/LDRD
|
||||
- DS: Attempt to detect if a game is homebrew
|
||||
|
||||
0.6.0: (Future)
|
||||
Features:
|
||||
|
|
|
@ -123,6 +123,8 @@ struct DS {
|
|||
|
||||
struct mTimingEvent divEvent;
|
||||
struct mTimingEvent sqrtEvent;
|
||||
|
||||
bool isHomebrew;
|
||||
};
|
||||
|
||||
struct DSCartridge {
|
||||
|
@ -158,6 +160,15 @@ struct DSCartridge {
|
|||
uint32_t iconOffset;
|
||||
uint16_t secureAreaCrc16;
|
||||
uint16_t secureAreaDelay;
|
||||
uint32_t arm9Autoload;
|
||||
uint32_t arm7Autoload;
|
||||
uint8_t secureAreaDisable[8];
|
||||
uint32_t usedSize;
|
||||
uint32_t romHeaderSize;
|
||||
uint8_t reserved2[56];
|
||||
uint8_t logo[156];
|
||||
uint16_t logoCrc16;
|
||||
uint16_t headerCrc16;
|
||||
// TODO: Fill in more
|
||||
// And ROM data...
|
||||
};
|
||||
|
|
|
@ -294,6 +294,7 @@ void DS7Reset(struct ARMCore* cpu) {
|
|||
DS7IOInit(ds);
|
||||
|
||||
DSConfigureWRAM(&ds->memory, 3);
|
||||
ds->isHomebrew = false;
|
||||
|
||||
struct DSCartridge* header = ds->romVf->map(ds->romVf, sizeof(*header), MAP_READ);
|
||||
if (header) {
|
||||
|
@ -304,6 +305,9 @@ void DS7Reset(struct ARMCore* cpu) {
|
|||
ds->memory.ram[0x3FFC40 >> 2] = 1;
|
||||
memcpy(&ds->memory.ram[0x3FFE00 >> 2], header, 0x170);
|
||||
DS7IOWrite32(ds, DS_REG_ROMCNT_LO, header->busTiming | 0x2700000);
|
||||
|
||||
ds->isHomebrew = memcmp(&header->logoCrc16, DS_ROM_MAGIC, sizeof(header->logoCrc16));
|
||||
|
||||
// TODO: Error check
|
||||
ds->romVf->seek(ds->romVf, header->arm7Offset, SEEK_SET);
|
||||
uint32_t base = header->arm7Base;
|
||||
|
|
Loading…
Reference in New Issue