WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit 4a046ae

Browse files
committed
NES: Calculate auto-mapper CRC32 over 8192 bytes instead of 512
This should fix about 70% of misidentified auto-mapper settings.
1 parent b9db819 commit 4a046ae

File tree

3 files changed

+8725
-21500
lines changed

3 files changed

+8725
-21500
lines changed

Cart_Reader/Cart_Reader.ino

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1297,6 +1297,11 @@ void mainMenu() {
12971297
display_Clear();
12981298
display_Update();
12991299
setup_NES();
1300+
// Wait for MMC3
1301+
for (size_t c = 0; c < 512; c++) {
1302+
read_prg_byte(0x8000 + c);
1303+
read_prg_byte(0xE000 + c);
1304+
}
13001305
getMapping();
13011306
checkStatus_NES();
13021307
return nesMenu();
@@ -3774,4 +3779,3 @@ void loop() {
37743779
//******************************************
37753780
// End of File
37763781
//******************************************
3777-

Cart_Reader/NES.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -796,9 +796,9 @@ void getMapping() {
796796
// never reached
797797
}
798798

799-
// Read first 512 bytes of first and last block of PRG ROM and compute CRC32
799+
// Read last 8kb block of PRG ROM and compute CRC32
800800
// Some mappers (like MMC3) map the last 8KB block of PRG ROM to 0xE000 while 0x8000 can contain random data after bootup
801-
for (size_t c = 0; c < 512; c++) {
801+
for (size_t c = 0; c < 8192; c++) {
802802
UPDATE_CRC(oldcrc32, read_prg_byte(0x8000 + c));
803803
UPDATE_CRC(oldcrc32MMC3, read_prg_byte(0xE000 + c));
804804
}

0 commit comments

Comments
 (0)