mirror of https://github.com/mgba-emu/mgba.git
Merge pull request #453 from tzlion/vfame-mjqb
GBA Memory: Support for Mo Jie Qi Bing by Vast Fame
This commit is contained in:
commit
ecba499b95
1
CHANGES
1
CHANGES
|
@ -33,6 +33,7 @@ Misc:
|
||||||
- Debugger: Modularize CLI debugger
|
- Debugger: Modularize CLI debugger
|
||||||
- Core: Clean up some thread state checks
|
- Core: Clean up some thread state checks
|
||||||
- Debugger: Make building with debugging aspects optional
|
- Debugger: Make building with debugging aspects optional
|
||||||
|
- GBA Memory: Support for Mo Jie Qi Bing by Vast Fame (taizou)
|
||||||
|
|
||||||
0.5.1: (2016-10-05)
|
0.5.1: (2016-10-05)
|
||||||
Bugfixes:
|
Bugfixes:
|
||||||
|
|
|
@ -58,7 +58,9 @@ void GBAVFameDetect(struct GBAVFameCart* cart, uint32_t* rom, size_t romSize) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (memcmp(INIT_SEQUENCE, &rom[0x57], sizeof(INIT_SEQUENCE)) == 0) {
|
// Most games have the same init sequence in the same place
|
||||||
|
// but LOTR/Mo Jie Qi Bing doesn't, probably because it's based on the Kiki KaiKai engine, so just detect based on its title
|
||||||
|
if (memcmp(INIT_SEQUENCE, &rom[0x57], sizeof(INIT_SEQUENCE)) == 0 || memcmp("\0LORD\0WORD\0\0AKIJ", &((struct GBACartridge*) rom)->title, 16) == 0) {
|
||||||
cart->cartType = VFAME_STANDARD;
|
cart->cartType = VFAME_STANDARD;
|
||||||
mLOG(GBA_MEM, INFO, "Vast Fame game detected");
|
mLOG(GBA_MEM, INFO, "Vast Fame game detected");
|
||||||
}
|
}
|
||||||
|
@ -262,14 +264,18 @@ static uint32_t _modifySramAddress(enum GBAVFameCartType type, uint32_t address,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int8_t _modifySramValue(enum GBAVFameCartType type, uint8_t value, int mode) {
|
static int8_t _modifySramValue(enum GBAVFameCartType type, uint8_t value, int mode) {
|
||||||
mode = (mode & 0xF) >> 2;
|
int reorderType = (mode & 0xF) >> 2;
|
||||||
if (mode == 0) {
|
if (reorderType != 0) {
|
||||||
return value;
|
if (type == VFAME_GEORGE) {
|
||||||
} else if (type == VFAME_GEORGE) {
|
value = _reorderBits(value, VALUE_REORDERING_GEORGE[reorderType - 1], 8);
|
||||||
return _reorderBits(value, VALUE_REORDERING_GEORGE[mode - 1], 8);
|
} else {
|
||||||
} else {
|
value = _reorderBits(value, VALUE_REORDERING[reorderType - 1], 8);
|
||||||
return _reorderBits(value, VALUE_REORDERING[mode - 1], 8);
|
}
|
||||||
}
|
}
|
||||||
|
if (mode & 0x80) {
|
||||||
|
value ^= 0xAA;
|
||||||
|
}
|
||||||
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reorder bits in a byte according to the reordering given
|
// Reorder bits in a byte according to the reordering given
|
||||||
|
|
Loading…
Reference in New Issue