mirror of
https://github.com/libretro/RetroArch
synced 2025-04-09 21:45:45 +00:00
commit
9db8bb1593
@ -33,6 +33,7 @@
|
|||||||
|
|
||||||
#define HASH_EXTENSION_ZIP 0x0b88c7d8U
|
#define HASH_EXTENSION_ZIP 0x0b88c7d8U
|
||||||
#define HASH_EXTENSION_CUE 0x0b886782U
|
#define HASH_EXTENSION_CUE 0x0b886782U
|
||||||
|
#define HASH_EXTENSION_ISO 0x0b8880d0U
|
||||||
|
|
||||||
#ifndef COLLECTION_SIZE
|
#ifndef COLLECTION_SIZE
|
||||||
#define COLLECTION_SIZE 99999
|
#define COLLECTION_SIZE 99999
|
||||||
@ -153,6 +154,18 @@ static int cue_get_serial(database_state_handle_t *db_state,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int iso_get_serial(database_state_handle_t *db_state,
|
||||||
|
database_info_handle_t *db, const char *name, char* serial)
|
||||||
|
{
|
||||||
|
RARCH_LOG("Detected ISO image\n");
|
||||||
|
|
||||||
|
if (detect_psp_game(name, serial) == 0)
|
||||||
|
return 0;
|
||||||
|
RARCH_LOG("Found disk label '%s'\n", serial);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int database_info_iterate_playlist(
|
static int database_info_iterate_playlist(
|
||||||
database_state_handle_t *db_state,
|
database_state_handle_t *db_state,
|
||||||
database_info_handle_t *db, const char *name)
|
database_info_handle_t *db, const char *name)
|
||||||
@ -180,6 +193,11 @@ static int database_info_iterate_playlist(
|
|||||||
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;
|
||||||
|
case HASH_EXTENSION_ISO:
|
||||||
|
db_state->serial[0] = '\0';
|
||||||
|
iso_get_serial(db_state, db, name, db_state->serial);
|
||||||
|
db->type = DATABASE_TYPE_SERIAL_LOOKUP;
|
||||||
|
return 1;
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
ssize_t ret;
|
ssize_t ret;
|
||||||
|
@ -269,6 +269,72 @@ int detect_ps1_game(const char *track_path, char *game_id)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
int detect_psp_game(const char *track_path, char *game_id)
|
||||||
|
{
|
||||||
|
bool rv = false;
|
||||||
|
unsigned pos;
|
||||||
|
RFILE *fd = retro_fopen(track_path, RFILE_MODE_READ, -1);
|
||||||
|
|
||||||
|
if (!fd)
|
||||||
|
{
|
||||||
|
RARCH_LOG("Could not open data track: %s\n", strerror(errno));
|
||||||
|
return -errno;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (pos = 0; pos < 100000; pos++)
|
||||||
|
{
|
||||||
|
retro_fseek(fd, pos, SEEK_SET);
|
||||||
|
|
||||||
|
if (retro_fread(fd, game_id, 5) > 0)
|
||||||
|
{
|
||||||
|
game_id[5] = '\0';
|
||||||
|
if (!strcmp(game_id, "ULES-")
|
||||||
|
|| !strcmp(game_id, "ULUS-")
|
||||||
|
|| !strcmp(game_id, "ULJS-")
|
||||||
|
|
||||||
|
|| !strcmp(game_id, "ULEM-")
|
||||||
|
|| !strcmp(game_id, "ULUM-")
|
||||||
|
|| !strcmp(game_id, "ULJM-")
|
||||||
|
|
||||||
|
|| !strcmp(game_id, "UCES-")
|
||||||
|
|| !strcmp(game_id, "UCUS-")
|
||||||
|
|| !strcmp(game_id, "UCJS-")
|
||||||
|
|| !strcmp(game_id, "UCAS-")
|
||||||
|
|
||||||
|
|| !strcmp(game_id, "NPEH-")
|
||||||
|
|| !strcmp(game_id, "NPUH-")
|
||||||
|
|| !strcmp(game_id, "NPJH-")
|
||||||
|
|
||||||
|
|| !strcmp(game_id, "NPEG-")
|
||||||
|
|| !strcmp(game_id, "NPUG-")
|
||||||
|
|| !strcmp(game_id, "NPJG-")
|
||||||
|
|| !strcmp(game_id, "NPHG-")
|
||||||
|
|
||||||
|
|| !strcmp(game_id, "NPEZ-")
|
||||||
|
|| !strcmp(game_id, "NPUZ-")
|
||||||
|
|| !strcmp(game_id, "NPJZ-")
|
||||||
|
)
|
||||||
|
{
|
||||||
|
retro_fseek(fd, pos, SEEK_SET);
|
||||||
|
if (retro_fread(fd, game_id, 10) > 0)
|
||||||
|
{
|
||||||
|
//game_id[4] = '-';
|
||||||
|
//game_id[8] = game_id[9];
|
||||||
|
//game_id[9] = game_id[10];
|
||||||
|
game_id[10] = '\0';
|
||||||
|
rv = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
retro_fclose(fd);
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
int detect_system(const char *track_path, int32_t offset,
|
int detect_system(const char *track_path, int32_t offset,
|
||||||
const char **system_name)
|
const char **system_name)
|
||||||
{
|
{
|
||||||
|
@ -112,6 +112,8 @@ int detect_system(const char* track_path, int32_t offset,
|
|||||||
|
|
||||||
int detect_ps1_game(const char *track_path, char *game_id);
|
int detect_ps1_game(const char *track_path, char *game_id);
|
||||||
|
|
||||||
|
int detect_psp_game(const char *track_path, char *game_id);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user