Skip to content

Commit

Permalink
Feature: better Dreamcast parent/clone inference (#1262)
Browse files Browse the repository at this point in the history
  • Loading branch information
emmercm authored Jul 30, 2024
1 parent f86f5d4 commit 302a601
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 12 deletions.
6 changes: 4 additions & 2 deletions src/modules/datParentInferrer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export default class DATParentInferrer extends Module {
// ***** Regions *****
.replace(new RegExp(`\\(((${Internationalization.REGION_CODES.join('|')})[,+-]? ?)+\\)`, 'i'), '')
.replace(new RegExp(`\\(((${Internationalization.REGION_NAMES.join('|')})[,+-]? ?)+\\)`, 'i'), '')
.replace(/\(Latin America\)/i, '')
// ***** Languages *****
.replace(new RegExp(`\\(((${Internationalization.LANGUAGES.join('|')})[,+-]? ?)+\\)`, 'i'), '')
// ***** Cleanup *****
Expand All @@ -73,6 +74,7 @@ export default class DATParentInferrer extends Module {
.replace(/\(Alt( [a-z0-9. ]*)?\)/i, '')
.replace(/\([^)]*Collector's Edition\)/i, '')
.replace(/\(Extra Box\)/i, '')
.replace(/ - European Version/i, '')
.replace(/\(Fukkokuban\)/i, '') // "reprint"
.replace(/\([^)]*Genteiban\)/i, '') // "limited edition"
.replace(/\(Limited[^)]+Edition\)/i, '')
Expand Down Expand Up @@ -152,8 +154,8 @@ export default class DATParentInferrer extends Module {
// Nintendo - Super Nintendo Entertainment System
.replace(/\(NP\)/i, '') // "Nintendo Power"
// Sega - Dreamcast
.replace(/\[[0-9]+S\]/, '') // boxcode
.replace(/\[[0-9]+MM?[0-9]+(, [0-9]+MM?[0-9]+)*\]/, '')
.replace(/\[([0-9A-Z ]+(, )?)+\]$/, '') // TOSEC boxcode
.replace(/\[(compilation|data identical to retail|fixed version|keyboard|limited edition|req\. microphone|scrambled|unscrambled|white label)\]/ig, '') // TOSEC
.replace(/for Dreamcast/i, '')
// Sega - Mega Drive / Genesis
.replace(/\(MP\)/i, '') // "MegaPlay version"
Expand Down
60 changes: 50 additions & 10 deletions test/modules/datParentInferrer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,17 @@ describe('similar games', () => {
'All Star Tennis \'99 (Europe) (En,Fr,De,Es,It)',
'All Star Tennis 99 (USA)',
], 'All Star Tennis 99 (USA)'],
[[
'[BIOS] PS3 System Software Update (World) (v4.88)',
'[BIOS] PS3 System Software Update (World) (v3.41) (Patch)',
'[BIOS] PS3 System Software Update (World) (v0.90) (Tool)',
'[BIOS] PS3 System Software Update (World) (v0.91-005) (Tool)',
'[BIOS] PS3 System Software Update (World) (v3.41) (Shop)',
'[BIOS] PS3 System Software Update (World) (v3.41-1)',
'[BIOS] PS3 System Software Update (World) (v1.60) (Debug) [b]',
'[BIOS] PS3 System Software Update (World) (v1.00) (Disc)',
'[BIOS] PS3 System Software Update (World) (v4.70) (Arcade)',
], '[BIOS] PS3 System Software Update (World) (v4.88)'],
// https://emulation.gametechwiki.com/index.php/GoodTools
[[
'A game (1990)(Side A).zip',
Expand Down Expand Up @@ -179,16 +190,45 @@ describe('similar games', () => {
'F1 World Grand Prix v1.006 (2000)(Video System)(US)(M4)[!]',
], 'F1 World Grand Prix for Dreamcast v1.011 (1999)(Video System)(JP)(en)[!]'],
[[
'[BIOS] PS3 System Software Update (World) (v4.88)',
'[BIOS] PS3 System Software Update (World) (v3.41) (Patch)',
'[BIOS] PS3 System Software Update (World) (v0.90) (Tool)',
'[BIOS] PS3 System Software Update (World) (v0.91-005) (Tool)',
'[BIOS] PS3 System Software Update (World) (v3.41) (Shop)',
'[BIOS] PS3 System Software Update (World) (v3.41-1)',
'[BIOS] PS3 System Software Update (World) (v1.60) (Debug) [b]',
'[BIOS] PS3 System Software Update (World) (v1.00) (Disc)',
'[BIOS] PS3 System Software Update (World) (v4.70) (Arcade)',
], '[BIOS] PS3 System Software Update (World) (v4.88)'],
'18 Wheeler - American Pro Trucker (2001)(Sega)(US)',
'18 Wheeler - American Pro Trucker v1.006 (2000)(Sega)(JP)(en)[!]',
'18 Wheeler - American Pro Trucker v1.500 (2001)(Sega)(US)[!]',
'18 Wheeler - American Pro Trucker v1.700 (2001)(Sega)(PAL)(M4)[!]',
], '18 Wheeler - American Pro Trucker (2001)(Sega)(US)'],
[[
'Airforce Delta v1.000 (1999)(Konami)(US)[!][1S]',
'Airforce Delta v1.000 (1999)(Konami)(US)[!][2S]',
'Airforce Delta v1.000 (1999)(Konami)(US)[3S]',
'Airforce Delta v1.002 (1999)(Konami)(JP)[!]',
], 'Airforce Delta v1.000 (1999)(Konami)(US)[!][1S]'],
[[
'Biohazard - Code Veronica Shokai Genteiban v1.002 (1999)(Capcom)(JP)(Disc 1 of 2)[!][2, 3]',
'Biohazard - Code Veronica Shokai Genteiban v1.002 (1999)(Capcom)(JP)(Disc 1 of 2)[!][2M1, 2M3, 2MB1]',
'Biohazard - Code Veronica Shokai Genteiban v1.002 (1999)(Capcom)(JP)(Disc 1 of 2)[!][HK112D, HK112E]',
], 'Biohazard - Code Veronica Shokai Genteiban v1.002 (1999)(Capcom)(JP)(Disc 1 of 2)[!][2, 3]'],
[[
'Comic Party v2.001 (2001)(Aqua Plus)(JP)(Disc 1 of 2)[!][10MM1]',
'Comic Party v2.001 (2001)(Aqua Plus)(JP)(Disc 1 of 2)[!][12MM1]',
'Comic Party v2.001 (2001)(Aqua Plus)(JP)(Disc 1 of 2)[!][14M1]',
'Comic Party v2.001 (2001)(Aqua Plus)(JP)(Disc 1 of 2)[!][15M1, 15M2]',
'Comic Party v3.004 (2001)(Aqua Plus)(JP)(Disc 1 of 2)[!]',
], 'Comic Party v2.001 (2001)(Aqua Plus)(JP)(Disc 1 of 2)[!][10MM1]'],
[[
'Generator Vol. 1 v1.002 (1999)(Sega)(US)[!][14S]',
'Generator Vol. 1 v1.002 (1999)(Sega)(US)[!][1M5, 1MM1]',
'Generator Vol. 1 v1.002 (1999)(Sega)(US)[!][2MB13, 2MB14, 2MB32]',
'Generator Vol. 1 v1.002 (1999)(Sega)(US)[!][2MB3, 7MM1]',
'Generator Vol. 1 v1.002 (1999)(Sega)(US)[!][5M2, 5M3]',
'Generator Vol. 1 v1.002 (1999)(Sega)(US)[!][8MB1, 8MB4]',
'Generator Vol. 1 v1.002 (1999)(Sega)(US)[3MM1]',
'Generator Vol. 1 v1.010 (1999)(Sega)(JP)(en)[!]',
], 'Generator Vol. 1 v1.002 (1999)(Sega)(US)[!][14S]'],
[[
'NFL 2K v1.007 (1999)(Sega)(US)[!][10S]',
'NFL 2K v1.007 (1999)(Sega)(US)[!][13S]',
'NFL 2K v1.007 (1999)(Sega)(US)[!][9S]',
'NFL 2K v1.007 (1999)(Sega)(US)[!][MT B08, B13, B17, B19, B20]',
], 'NFL 2K v1.007 (1999)(Sega)(US)[!][10S]'],
])('should group similar games: %s', async (gameNames, expectedGameName) => {
const ungroupedDat = buildDat(gameNames);
const groupedDat = await new DATParentInferrer(new Options(), new ProgressBarFake())
Expand Down

0 comments on commit 302a601

Please sign in to comment.