Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(Database) Serial scanning for Gamecube/MegaCD/SegaCD/Saturn/PSX/PSP/Dreamcast/Wii #11719

Merged
merged 1 commit into from Jan 7, 2022

Conversation

pkos
Copy link
Contributor

@pkos pkos commented Dec 19, 2020

These updates improve support for "Directory Scan". While previously the scan was made against raw disc serials, this code converts and parses those serials into redump.org curated serials.

Features

  • Logs and playlists now include these Redump serials
  • Multi-disc support
  • CRC checks are still enabled and disabling them may increase performance
  • Bad discs are scrubbed and logged

Related Issues

Currently, scanner will not detect .gcz, .cso files, but it will crc them.
#7428

This PR code replaces changes already merged here:
Reworked magic numbers.
#6544
#6555
#5239
Serials are in playlists.
#6548

Related Pull Requests

The following libchdr issue will crash the scanner.
#10368
Issue resolved (3/31/20)
#10376

Reviewers

@realnc
@celerizer
@Alcaro
@panasonic
@phcoder

They have added support in #programming, fixing bugs and providing C code.

@pkos
Copy link
Contributor Author

pkos commented Dec 19, 2020

Originally here, but rebuilt on RA 1.9.0.

#10291

@inactive123
Copy link
Contributor

Cool work! I will ask @jdgleaver when he has more time (probably after the build infrastructure proceedings) to look into this. Rest assured, we have a high degree of interest in this and will get back to you!

Copy link
Member

@RobLoach RobLoach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just tested and it scanned the games I tested on Dreamcast, GAmeCube, Sega CD, PlayStation, PSP, Saturn and Wii.

tasks/task_database.c Outdated Show resolved Hide resolved
tasks/task_database_cue.c Outdated Show resolved Hide resolved
tasks/task_database_cue.c Outdated Show resolved Hide resolved
@pkos
Copy link
Contributor Author

pkos commented Feb 1, 2021

There is a bug preventing the insertion of the serial into a playlist. Working on that bug.

@pkos
Copy link
Contributor Author

pkos commented Feb 1, 2021

Tests

Sega - Dreamcast
1270/1356
Sega - Mega-CD - Sega CD
420/533
Sega - Saturn
2195/2326
Sony - PlayStation Portable
496 - inconclusive stalled on crc32 / 2150
Sony - PlayStation
9974/10422

This is actually about 95%.

@pkos
Copy link
Contributor Author

pkos commented Feb 1, 2021

There is a bug preventing the insertion of the serial into a playlist. Working on that bug.

Fixed in latest push. Playlists now contain proper crc32 or serials.

@lgtm-com
Copy link

lgtm-com bot commented Feb 1, 2021

This pull request introduces 1 alert when merging b735658 into 94beed5 - view on LGTM.com

new alerts:

  • 1 for Empty branch of conditional

@kivutar
Copy link
Member

kivutar commented May 2, 2021

This PR looks very good. We should merge this.
Are the travis errors related to the changes? Some of them look unrelated, they happen in graphics parts of RA.

Copy link
Contributor Author

@pkos pkos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like the conflicts are resolved.

Copy link
Contributor Author

@pkos pkos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved string functions to libretro-common

Copy link
Contributor Author

@pkos pkos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved string functions to libretro-common

@pkos pkos requested a review from RobLoach August 12, 2021 20:27
@lgtm-com
Copy link

lgtm-com bot commented Aug 12, 2021

This pull request introduces 15 alerts when merging 5485a64 into 9e84c5c - view on LGTM.com

new alerts:

  • 13 for Lossy pointer cast
  • 1 for Empty branch of conditional
  • 1 for Implicit function declaration

@pkos
Copy link
Contributor Author

pkos commented Aug 12, 2021

This PR is ready to merge.

@Sanaki
Copy link
Contributor

Sanaki commented Aug 13, 2021

This has to do with scanning, not playing. I have no knowledge of openemu at all, so I'm not sure how it could tie in. I don't know if it's even libretro-based.

@pkos
Copy link
Contributor Author

pkos commented Aug 13, 2021

The last commits resolved the LGTM alerts/overflow. With 0 alerts/errors it should now be ready.

tasks/task_database.c Outdated Show resolved Hide resolved
@RobLoach
Copy link
Member

This is looking really good! Will do more testing on it this weekend.

@eku
Copy link

eku commented Sep 23, 2021

Any progress on this PR is welcome?

@ofry
Copy link

ofry commented Sep 24, 2021

@pkos Please fix @RobLoach reviewed style nits.

tasks/task_database_cue.c Outdated Show resolved Hide resolved
@ofry
Copy link

ofry commented Sep 30, 2021

@pkos Now there's merge conflict too.

intl/crowdin.yaml Outdated Show resolved Hide resolved
@pkos
Copy link
Contributor Author

pkos commented Nov 26, 2021

Ok, due to automated workflow actions that were recently enabled, the crowdin.yaml file was corrupted in my PR. To fix this I reverted several pushes and force pushed the original crowdin.yaml file from RA master. The PR has been compiled, tested and is bug fixed and in working order with all the latest change requests.

Copy link
Contributor Author

@pkos pkos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Finishing up now

Copy link
Member

@RobLoach RobLoach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did another test of this and it's looking really solid. Picked up files that I had from GC, Wii, Dreamcast, Sega CD, Saturn, PSP, PS1, and PSP(PSN). A couple code suggestions, addressed in pkos#1 .

libretro-common/include/string/stdstring.h Outdated Show resolved Hide resolved
libretro-common/string/stdstring.c Outdated Show resolved Hide resolved
libretro-common/string/stdstring.c Outdated Show resolved Hide resolved
libretro-common/string/stdstring.c Outdated Show resolved Hide resolved
tasks/task_database.c Outdated Show resolved Hide resolved
tasks/task_database.c Outdated Show resolved Hide resolved
tasks/task_database.c Outdated Show resolved Hide resolved
tasks/task_database_cue.c Outdated Show resolved Hide resolved
tasks/task_database_cue.c Outdated Show resolved Hide resolved
tasks/task_database_cue.c Outdated Show resolved Hide resolved
tasks/task_database_cue.c Outdated Show resolved Hide resolved
@pkos
Copy link
Contributor Author

pkos commented Dec 30, 2021

Whitespace may exist, however in this diff no whitespace changes are marked. We've removed and replaced them at this point.

@pkos
Copy link
Contributor Author

pkos commented Dec 31, 2021

"star wars"

Amstrad - CPC | 7/7 | dsk
Arcade (MAME 2000) | 1/20 | rom
Atari - 2600 | 5/5 | a26
Atari - 5200 | 2/2 | a52
Atari - ST | 0/6 | st
Atari 8bit | 0/2 | bin
Coleco - ColecoVision | 1/1 | col
Commodore - 64 | 1/7 | tap
Commodore - Amiga | 7/7 | ipf
Mattel - Intellivision | 1/1 | int
MS-DOS | 4/9 | exe/com/bat
Nintendo - Game Boy | 6/6 | gb
Nintendo - Game Boy Advance | 16/16 | gba
Nintendo - Game Boy Color | 4/4 | gbc
Nintendo - GameCube | 0/38 | gcz
Nintendo - Nintendo 3DS | 0/13 | 3ds
Nintendo - Nintendo 64 | 16/16 | z64
Nintendo - Nintendo DS | 26/27 | nds
Nintendo - Nintendo Entertainment System | 6/9 | nes
Nintendo - Super Nintendo Entertainment System | 19/19 | sfc
Nintendo - Wii | 0/20 | gcz
Panasonic - 3DO | 2/2 | chd
Sega - 32X | 21/21 | X32
Sega - Dreamcast | 3/4 | cue/bin
Sega - Game Gear | 3/3 | gg
Sega - Master System - Mark III | 1/1 | sms
Sega - Mega Drive - Genesis | 1/1 | md
Sega - Mega-CD - Sega CD | 8/8 | chd
Sharp - X68000 | 7/7 | dim
Sinclair - ZX Spectrum | 7/7 | tap
Sony - PlayStation | 4/44 | chd
Sony - PlayStation 2 | 17/88 | cue/bin
Sony - PlayStation Portable | 0/19 | cso

@pkos
Copy link
Contributor Author

pkos commented Dec 31, 2021

"disney"

Arcade (MAME 2000) | 0/4 | rom
Atari - 2600 | 1/1 | a26
Commodore - Amiga | 7/7 | ipf
MS-DOS | 21/21 | exe/com/bat
NEC - PC Engine - TurboGrafx 16 | 2/2 | pce
Nintendo - Game Boy | 43/43 | gb
Nintendo - Game Boy Advance | 95/93 | gba
Nintendo - Game Boy Color | 38/38 | gbc
Nintendo - GameCube | 70/71 | gcz
Nintendo - Nintendo 3DS | 0/52 | 3ds
Nintendo - Nintendo 64 | 25/25 | z64
Nintendo - Nintendo DS | 136/140 | nds
Nintendo - Nintendo Entertainment System | 24/42 | nes
Nintendo - Super Nintendo Entertainment System | 73/73 | sfc
Sega - Dreamcast | 13/16 | cue/bin
Sega - Game Gear | 46/46 | gg
Sega - Master System - Mark III | 12/12 | sms
Sega - Mega Drive - Genesis | 56/56 | md
Sega - Mega-CD - Sega CD | 3/4 | chd
Sega - PICO | 50/50 | md
Sony - PlayStation | 50/227 | chd
Sony - PlayStation Portable | 0/46 | cso

@pkos
Copy link
Contributor Author

pkos commented Dec 31, 2021

added prefix to PSX logic

|| (string_is_equal_fast(raw_game_id, "SCES_", 5))

test "disney"

before
Sony - PlayStation | 50/227 | chd

after
Sony - PlayStation | 150/227 | chd

@pkos
Copy link
Contributor Author

pkos commented Dec 31, 2021

"marvel"

Amstrad - CPC | 4/12 | dsk
Arcade (MAME 2000) | 54/123 | rom
Atari - 2600 | 1/1 | a26
Commodore - 64 | 0/14 | nib
Commodore - Amiga | 2/2 | ipf
MS-DOS | 18/14 | exe/com/bat
Nintendo - Game Boy | 7/7 | gb
Nintendo - Game Boy Advance | 42/42 | gba
Nintendo - Game Boy Color | 11/11 | gbc
Nintendo - GameCube | 0/52 | gcz
Nintendo - Nintendo 3DS | 0/29 | 3ds
Nintendo - Nintendo 64 | 1/1 | z64
Nintendo - Nintendo DS | 75/76 | nds
Nintendo - Nintendo Entertainment System | 6/8 | nes
Nintendo - Super Nintendo Entertainment System | 31/31 | sfc
Sega - 32X | 1/1 | X32
Sega - Dreamcast | 8/8 | cue/bin
Sega - Game Gear | 19/19 | gg
Sega - Master System - Mark III | 4/4 | sms
Sega - Mega Drive - Genesis | 37/37 | md
Sega - Mega-CD - Sega CD | 3/3 | chd
Sega - Saturn | 8/18 | chd
Sony - PlayStation | 44/62 | chd
Sony - PlayStation 2 | 8/108 | iso
Sony - PlayStation Portable | 0/35 | cso

@pkos
Copy link
Contributor Author

pkos commented Jan 1, 2022

added conditional to fix raw "-5" and "50" suffix for Saturn:

     if (strcmp(check_suffix_5, "-5") == 0 || strcmp(check_suffix_50, "50") == 0)
     {
        strncpy(rgame_id, &raw_game_id[2], length - 4);
        rgame_id[length - 4] = '\0';
     }

test "marvel"

before
Sega - Saturn | 8/18 | chd

after
Sega - Saturn | 13*/18 | chd
*confirmed 5 missing from DB

@pkos
Copy link
Contributor Author

pkos commented Jan 1, 2022

added conditional to remove raw "." character for ps1

        if (string_is_equal_fast(&raw_game_id[8], ".", 1))
        {
           raw_game_id[8] = raw_game_id[9];
           raw_game_id[9] = raw_game_id[10];
        }

test "marvel"

before
Sony - PlayStation | 44/62 | chd

after
Sony - PlayStation | 61/62 | chd

@pkos
Copy link
Contributor Author

pkos commented Jan 1, 2022

Additional scanning tests conducted by volunteers can help promote bug fixes. Enable logs to check serials.

@kivutar
Copy link
Member

kivutar commented Jan 6, 2022

I compiled it and tested it on my catalog, on OSX. Everything went well. I think we can merge.

@pkos
Copy link
Contributor Author

pkos commented Jan 6, 2022

Possible change "_" to "-" as I'm looking at this one in hex editor.
|| (string_is_equal_fast(raw_game_id, "SLPS-", 5))

@pkos
Copy link
Contributor Author

pkos commented Jan 6, 2022

I've found a more GC specific suffix match in the samples, which overrides -EUR. Looking into it.

DL-DOL-G6TP-FRA

@pkos
Copy link
Contributor Author

pkos commented Jan 6, 2022

SLPS

How about we add SLPS- and SLPS_ both to be safe.

@pkos
Copy link
Contributor Author

pkos commented Jan 6, 2022

This is the conditional catching the country code "P" which is usually in the dat file as -EUR, but in once case here it actually should be -FRA. No other known indicator can separate the P country code.

  case 'P': /** NYI: P can also be P-UKV, P-AUS **/
     strcat(game_id, "-EUR");
     return true;

@pkos
Copy link
Contributor Author

pkos commented Jan 6, 2022

It's ready.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

(database) add support for another Korea PSP code
9 participants