# HG changeset patch # User Michael Pavone # Date 1653443378 25200 # Node ID 6a954675d634e39d03cfb1559f9df9d73037c778 # Parent 3f09312685e343bb53d5a06ea8b9d3c141a7b319 Improved detection of bogus device headers diff -r 3f09312685e3 -r 6a954675d634 romdb.c --- a/romdb.c Tue May 24 18:31:12 2022 -0700 +++ b/romdb.c Tue May 24 18:49:38 2022 -0700 @@ -472,12 +472,38 @@ info.wants_cd = 0; for (uint32_t offset = 0x190; offset < rom_size && offset < 0x1A0; offset++) { - if (rom[offset] == 'F') { - // probably a codemasters game with a garbage header + uint8_t invalid = 0; + switch(rom[offset]) + { + case 'J': + case '6': + case '0': + case 'A': + case '4': + case 'G': + case 'L': + case 'M': + case 'B': + case 'K': + case 'R': + case 'D': + //valid device letter + //TODO: do something with these break; + case 'F': + case 'T': + case 'P': + //unreleased peripheral, probably garbage + invalid = 1; + break; + case 'C': + info.wants_cd = 1; + break; + default: + invalid = 1; } - if (rom[offset] == 'C') { - info.wants_cd = 1; + if (invalid) { + info.wants_cd = 0; break; } }