Skip to content

Commit

Permalink
Don't match any files for ROMs or disks with no hashes.
Browse files Browse the repository at this point in the history
  • Loading branch information
dillof committed Feb 23, 2024
1 parent 283e1ca commit 89365b3
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 6 deletions.
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
X.X (Unreleased)
================

* Don't match any files for ROMs or disks with no hashes.

2.1 (2024-02-23)
================

Expand Down
2 changes: 0 additions & 2 deletions regress/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,6 @@ set(XFAIL_TESTS
file-no-crc-wrong-name-other-set.zip.test
rom-from-extra-loose-directory.zip.test
rom-from-extra-loose-toplevel.zip.test
rom-no-data.dir.test
rom-no-data.zip.test
unknown-rename-failed.zip.test
)

Expand Down
14 changes: 14 additions & 0 deletions regress/rom-no-data-in-game-wrong-name.vtest
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
description test single-rom game with no data at all
return 0
arguments -cFv -e extra -D ../mamedb-no-data.db nodata
file roms/nodata.zip 1-8-ok.zip {}
file unknown/nodata.zip {} 1-8-ok.zip
file unknown/.ckmame.db {} <inline.ckmamedb>
hashes nodata.zip * cheap
end-of-inline-data
stdout
In game nodata:
game nodata : not a single file found
file 08.rom size 8 crc 3656897d: unknown
move unknown file '08.rom'
end-of-inline-data
11 changes: 11 additions & 0 deletions regress/rom-no-data-in-game.vtest
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
description test single-rom game with no data at all
return 0
arguments -cFv -e extra -D ../mamedb-no-data.db nodata
file roms/nodata.zip 1-4-ok.zip
file roms/.ckmame.db {} <inline.ckmamedb>
hashes nodata.zip * cheap
end-of-inline-data
stdout
In game nodata:
game nodata : correct
end-of-inline-data
7 changes: 4 additions & 3 deletions regress/rom-no-data.vtest
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ description test single-rom game with no data at all
return 0
arguments -cFv -e extra -D ../mamedb-no-data.db nodata
file extra/nodata.zip 1-4-ok.zip
file roms/.ckmame.db {} <inline.ckmamedb>
file extra/.ckmame.db {} <inline.ckmamedb>
hashes nodata.zip * cheap
end-of-inline-data
stdout
In game nosize:
game nosize : correct
In game nodata:
game nodata : not a single file found
end-of-inline-data
2 changes: 1 addition & 1 deletion src/check_game_files.cc
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ void check_game_files(Game *game, filetype_t filetype, GameArchives *archives, R
}
}

if (rom.where == FILE_INGAME && match->quality == Match::MISSING && rom.hashes.size > 0 && rom.status != Rom::NO_DUMP) {
if (rom.where == FILE_INGAME && match->quality == Match::MISSING && rom.hashes.size > 0 && !rom.hashes.empty() && rom.status != Rom::NO_DUMP) {
/* search for matching file in other games (via db) */
if (find_in_romset(filetype, detector_id, &rom, nullptr, game->name, "", match) == FIND_EXISTS) {
continue;
Expand Down
4 changes: 4 additions & 0 deletions src/find.cc
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,10 @@ static find_result_t find_in_db(RomDB *rdb, filetype_t filetype, size_t detector
for (size_t i = 0; (status != FIND_ERROR && status != FIND_EXISTS) && i < locations.size(); i++) {
auto &location = locations[i];

if (location.rom.hashes.empty()) {
continue;
}

if (location.game_name == skip_game && skip_file.empty()) {
continue;
}
Expand Down

0 comments on commit 89365b3

Please sign in to comment.