FindByCRC: match only once (#540)

This commit is contained in:
Igor authored and GitHub committed 2024-03-28 17:41:50 +01:00
1 parent 57d55be994
commit d327cb9203
1 file changed
+6 -3
+6 -3
View File
@@ -70,6 +70,7 @@ func (db *DB) FindByCRC(romPath string, romName string, crc uint32, size int64,
return
}
once := sync.Once{}
var wg sync.WaitGroup
wg.Add(len(*db))
// For every Dat in the DB
@@ -82,9 +83,11 @@ func (db *DB) FindByCRC(romPath string, romName string, crc uint32, size int64,
}
// If the checksums and sizes match
if crc == uint32(game.ROMs[0].CRC) && size == game.ROMs[0].Size {
game.Path = romPath
game.System = system
games <- game
once.Do(func() {
game.Path = romPath
game.System = system
games <- game
})
}
}
wg.Done()