Skip to content

Commit

Permalink
NES: Fixed bogus corrections in rom_loadmem when crc32 isn't available (
Browse files Browse the repository at this point in the history
#181)

When loading a ROM, retro-go calcs the crc32 of the rom and searches for it in the database. If the CRC32 is 0, the last entry in the database will be selected, which is invalid.

This patch just confirms that the selected entry is valid.

A proper patch might be to not search the database at all if we don't have a crc function. But that would change multiple lines versus just this one!
  • Loading branch information
ducalex committed Jan 26, 2025
1 parent eb70c10 commit f8494a8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion retro-core/components/nofrendo/nes/rom.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ rom_t *rom_loadmem(uint8 *data, size_t size)
while (entry->crc && entry->crc != rom.checksum)
entry++;

if (entry->crc == rom.checksum)
if (entry->crc && entry->crc == rom.checksum)
{
MESSAGE_INFO("ROM: Game found in database.\n");

Expand Down

0 comments on commit f8494a8

Please sign in to comment.