Search the ps1 serial in the whole binary
This commit is contained in:
parent
632d85cfba
commit
938e89562b
|
@ -176,6 +176,7 @@ static int database_info_iterate_playlist(
|
||||||
return 1;
|
return 1;
|
||||||
#endif
|
#endif
|
||||||
case HASH_EXTENSION_CUE:
|
case HASH_EXTENSION_CUE:
|
||||||
|
db_state->serial[0] = '\0';
|
||||||
cue_get_serial(db_state, db, name, db_state->serial);
|
cue_get_serial(db_state, db, name, db_state->serial);
|
||||||
db->type = DATABASE_TYPE_SERIAL_LOOKUP;
|
db->type = DATABASE_TYPE_SERIAL_LOOKUP;
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
@ -127,6 +127,7 @@ static int find_token(RFILE *fd, const char *token)
|
||||||
|
|
||||||
int detect_ps1_game(const char *track_path, char *game_id)
|
int detect_ps1_game(const char *track_path, char *game_id)
|
||||||
{
|
{
|
||||||
|
unsigned pos = 0;
|
||||||
RFILE *fd = retro_fopen(track_path, RFILE_MODE_READ, -1);
|
RFILE *fd = retro_fopen(track_path, RFILE_MODE_READ, -1);
|
||||||
|
|
||||||
if (!fd)
|
if (!fd)
|
||||||
|
@ -135,12 +136,39 @@ int detect_ps1_game(const char *track_path, char *game_id)
|
||||||
return -errno;
|
return -errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
retro_fseek(fd, 0x9340, SEEK_SET);
|
while (true)
|
||||||
|
|
||||||
if (retro_fread(fd, game_id, 10) > 0)
|
|
||||||
{
|
{
|
||||||
game_id[10] = '\0';
|
retro_fseek(fd, pos, SEEK_SET);
|
||||||
game_id[4] = '-';
|
|
||||||
|
if (retro_fread(fd, game_id, 5) > 0)
|
||||||
|
{
|
||||||
|
if (!strcmp(game_id, "SLUS_")
|
||||||
|
|| !strcmp(game_id, "SCUS_")
|
||||||
|
|
||||||
|
|| !strcmp(game_id, "SLES_")
|
||||||
|
|| !strcmp(game_id, "SCES_")
|
||||||
|
|| !strcmp(game_id, "SCED_")
|
||||||
|
|
||||||
|
|| !strcmp(game_id, "SLPS_")
|
||||||
|
|| !strcmp(game_id, "SCPS_")
|
||||||
|
|| !strcmp(game_id, "SLPM_")
|
||||||
|
)
|
||||||
|
{
|
||||||
|
retro_fseek(fd, pos, SEEK_SET);
|
||||||
|
if (retro_fread(fd, game_id, 11) > 0)
|
||||||
|
{
|
||||||
|
game_id[4] = '-';
|
||||||
|
game_id[8] = game_id[9];
|
||||||
|
game_id[9] = game_id[10];
|
||||||
|
game_id[10] = '\0';
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
|
||||||
|
pos++;
|
||||||
}
|
}
|
||||||
|
|
||||||
retro_fclose(fd);
|
retro_fclose(fd);
|
||||||
|
|
Loading…
Reference in New Issue