Merge pull request #334 from negativeExponent/updates_and_fixes

Updates and fixes
This commit is contained in:
hizzlekizzle
2020-03-01 11:35:20 -06:00
committed by GitHub
2 changed files with 18 additions and 3 deletions

View File

@@ -106,6 +106,9 @@
{0x33b899c9, 16, -1}, /* Dragon Ball - Dai Maou Fukkatsu (J) [!] */
{0xa262a81f, 16, -1}, /* Rokudenashi Blues (J) */
{0x286fcd20, 21, -1}, /* Ganbare Goemon Gaiden 2 - Tenka no Zaihou (J) [!] */
{0x335E6339, 23, -1}, /* kung fu legend (unl)[!].nes */
{0x1A8D767B, 23, -1}, /* kung fu legend (unl)[!p].nes */
{0x0E263D47, 23, -1}, /* World Hero (Unl) (TV System Select) [!].nes */
{0xe4a291ce, 23, -1}, /* World Hero (Unl) [!] */
{0x51e9cd33, 23, -1}, /* World Hero (Unl) [b1] */
{0x105dd586, 27, -1}, /* Mi Hun Che variations... */

View File

@@ -808,12 +808,24 @@ int iNESLoad(const char *name, FCEUFILE *fp) {
memset((char*)(&head) + 0xA, 0, 0x6);
}
subMapper = 0;
MapperNo = (head.ROM_type >> 4) | (head.ROM_type2 & 0xF0);
/* If byte 7 AND $0C = $08, and the size taking into account byte 9 does not exceed the actual size of the ROM image, then NES 2.0.
* If byte 7 AND $0C = $00, and bytes 12-15 are all 0, then iNES.
* Otherwise, archaic iNES. - nesdev*/
switch (head.ROM_type2 & 0x0C) {
case 0x08: /* header version is NES 2.0 */
iNES2 = 1;
/* fallthrough */
case 0x00: /* header version is iNES */
MapperNo = (head.ROM_type >> 4) | (head.ROM_type2 & 0xF0);
break;
default: /* any other value is Archaic iNes, byte 7-15 not used */
MapperNo = (head.ROM_type >> 4);
break;
}
Mirroring = (head.ROM_type & 8) ? 2 : (head.ROM_type & 1);
prgRom = head.ROM_size;
chrRom = head.VROM_size;
iNES2 = ((head.ROM_type2 & 0x0C) == 0x08) ? 1 : 0;
subMapper = 0;
if (iNES2) {
MapperNo |= ((uint32)head.ROM_type3 << 8) & 0xF00;