mirror of
https://github.com/libretro/RetroArch
synced 2025-04-01 04:20:27 +00:00
(task_database) Simplify code - put logging behind DEBUG ifdef
This commit is contained in:
parent
8bad1559f9
commit
60161982b2
@ -155,51 +155,37 @@ static int intfstream_get_serial(intfstream_t *fd, char *serial, const char *fil
|
||||
{
|
||||
if (string_is_equal(system_name, "Sony - PlayStation Portable"))
|
||||
{
|
||||
if (detect_psp_game(fd, serial, filename) == 0)
|
||||
return 0;
|
||||
RARCH_LOG("[Scanner]: Serial: %s\n", serial);
|
||||
if (detect_psp_game(fd, serial, filename) != 0)
|
||||
return 1;
|
||||
}
|
||||
else if (string_is_equal(system_name, "Sony - PlayStation"))
|
||||
{
|
||||
if (detect_ps1_game(fd, serial, filename) == 0)
|
||||
return 0;
|
||||
RARCH_LOG("[Scanner]: Serial: %s\n", serial);
|
||||
if (detect_ps1_game(fd, serial, filename) != 0)
|
||||
return 1;
|
||||
}
|
||||
else if (string_is_equal(system_name, "Nintendo - GameCube"))
|
||||
{
|
||||
if (detect_gc_game(fd, serial, filename) == 0)
|
||||
return 0;
|
||||
RARCH_LOG("[Scanner]: Serial: %s\n", serial);
|
||||
if (detect_gc_game(fd, serial, filename) != 0)
|
||||
return 1;
|
||||
}
|
||||
else if (string_is_equal(system_name, "Sega - Mega-CD - Sega CD"))
|
||||
{
|
||||
if (detect_scd_game(fd, serial, filename) == 0)
|
||||
return 0;
|
||||
RARCH_LOG("[Scanner]: Serial: %s\n", serial);
|
||||
if (detect_scd_game(fd, serial, filename) != 0)
|
||||
return 1;
|
||||
}
|
||||
else if (string_is_equal(system_name, "Sega - Saturn"))
|
||||
{
|
||||
if (detect_sat_game(fd, serial, filename) == 0)
|
||||
return 0;
|
||||
RARCH_LOG("[Scanner]: Serial: %s\n", serial);
|
||||
if (detect_sat_game(fd, serial, filename) != 0)
|
||||
return 1;
|
||||
}
|
||||
else if (string_is_equal(system_name, "Sega - Dreamcast"))
|
||||
{
|
||||
if (detect_dc_game(fd, serial, filename) == 0)
|
||||
return 0;
|
||||
RARCH_LOG("[Scanner]: Serial: %s\n", serial);
|
||||
if (detect_dc_game(fd, serial, filename) != 0)
|
||||
return 1;
|
||||
}
|
||||
else if (string_is_equal(system_name, "Nintendo - Wii"))
|
||||
{
|
||||
if (detect_wii_game(fd, serial, filename) == 0)
|
||||
return 0;
|
||||
RARCH_LOG("[Scanner]: Serial: %s\n", serial);
|
||||
if (detect_wii_game(fd, serial, filename) != 0)
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@ -279,13 +265,17 @@ static int task_database_cue_get_serial(const char *name, char* serial)
|
||||
|
||||
if (rv < 0)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
RARCH_LOG("%s: %s\n",
|
||||
msg_hash_to_str(MSG_COULD_NOT_FIND_VALID_DATA_TRACK),
|
||||
strerror(-rv));
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
RARCH_LOG("%s\n", msg_hash_to_str(MSG_READING_FIRST_DATA_TRACK));
|
||||
#endif
|
||||
|
||||
return intfstream_file_get_serial(track_path, offset, size, serial);
|
||||
}
|
||||
@ -301,13 +291,17 @@ static int task_database_gdi_get_serial(const char *name, char* serial)
|
||||
|
||||
if (rv < 0)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
RARCH_LOG("%s: %s\n",
|
||||
msg_hash_to_str(MSG_COULD_NOT_FIND_VALID_DATA_TRACK),
|
||||
strerror(-rv));
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
RARCH_LOG("%s\n", msg_hash_to_str(MSG_READING_FIRST_DATA_TRACK));
|
||||
#endif
|
||||
|
||||
return intfstream_file_get_serial(track_path, 0, SIZE_MAX, serial);
|
||||
}
|
||||
@ -402,22 +396,25 @@ static int task_database_cue_get_crc(const char *name, uint32_t *crc)
|
||||
|
||||
if (rv < 0)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
RARCH_LOG("%s: %s\n",
|
||||
msg_hash_to_str(MSG_COULD_NOT_FIND_VALID_DATA_TRACK),
|
||||
strerror(-rv));
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
RARCH_LOG("CUE '%s' primary track: %s\n (%lu, %lu)\n",name, track_path, (unsigned long) offset, (unsigned long) size);
|
||||
|
||||
RARCH_LOG("%s\n", msg_hash_to_str(MSG_READING_FIRST_DATA_TRACK));
|
||||
|
||||
rv = intfstream_file_get_crc(track_path, offset, (size_t)size, crc);
|
||||
if (rv == 1)
|
||||
{
|
||||
RARCH_LOG("CUE '%s' crc: %x\n", name, *crc);
|
||||
}
|
||||
return rv;
|
||||
#else
|
||||
return intfstream_file_get_crc(track_path, offset, (size_t)size, crc);
|
||||
#endif
|
||||
}
|
||||
|
||||
static int task_database_gdi_get_crc(const char *name, uint32_t *crc)
|
||||
@ -431,21 +428,24 @@ static int task_database_gdi_get_crc(const char *name, uint32_t *crc)
|
||||
|
||||
if (rv < 0)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
RARCH_LOG("%s: %s\n", msg_hash_to_str(MSG_COULD_NOT_FIND_VALID_DATA_TRACK),
|
||||
strerror(-rv));
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
RARCH_LOG("GDI '%s' primary track: %s\n", name, track_path);
|
||||
|
||||
RARCH_LOG("%s\n", msg_hash_to_str(MSG_READING_FIRST_DATA_TRACK));
|
||||
|
||||
rv = intfstream_file_get_crc(track_path, 0, SIZE_MAX, crc);
|
||||
if (rv == 1)
|
||||
{
|
||||
RARCH_LOG("GDI '%s' crc: %x\n", name, *crc);
|
||||
}
|
||||
return rv;
|
||||
#else
|
||||
return intfstream_file_get_crc(track_path, 0, SIZE_MAX, crc);
|
||||
#endif
|
||||
}
|
||||
|
||||
static bool task_database_chd_get_crc(const char *name, uint32_t *crc)
|
||||
@ -460,10 +460,10 @@ static bool task_database_chd_get_crc(const char *name, uint32_t *crc)
|
||||
return 0;
|
||||
|
||||
rv = intfstream_get_crc(fd, crc);
|
||||
#ifdef DEBUG
|
||||
if (rv)
|
||||
{
|
||||
RARCH_LOG("CHD '%s' crc: %x\n", name, *crc);
|
||||
}
|
||||
#endif
|
||||
if (fd)
|
||||
{
|
||||
intfstream_close(fd);
|
||||
@ -492,7 +492,9 @@ static void task_database_cue_prune(database_info_handle_t *db,
|
||||
if (db->list->elems[i].data
|
||||
&& string_is_equal(path, db->list->elems[i].data))
|
||||
{
|
||||
#ifdef DEBUG
|
||||
RARCH_LOG("Pruning file referenced by cue: %s\n", path);
|
||||
#endif
|
||||
free(db->list->elems[i].data);
|
||||
db->list->elems[i].data = NULL;
|
||||
}
|
||||
|
@ -364,7 +364,9 @@ int detect_gc_game(intfstream_t *fd, char *game_id, const char *filename)
|
||||
/** Scrub files with bad data and log **/
|
||||
if (raw_game_id[0] == '\0' || raw_game_id[0] == ' ')
|
||||
{
|
||||
#ifdef DEBUG
|
||||
RARCH_LOG("[Scanner]: Scrubbing: %s\n", filename);
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -591,7 +593,9 @@ int detect_sat_game(intfstream_t *fd, char *game_id, const char *filename)
|
||||
/** Scrub files with bad data and log **/
|
||||
if (raw_game_id[0] == '\0' || raw_game_id[0] == ' ')
|
||||
{
|
||||
#ifdef DEBUG
|
||||
RARCH_LOG("[Scanner]: Scrubbing: %s\n", filename);
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -881,7 +885,9 @@ int detect_wii_game(intfstream_t *fd, char *game_id, const char *filename)
|
||||
/** Scrub files with bad data and log **/
|
||||
if (raw_game_id[0] == '\0' || raw_game_id[0] == ' ')
|
||||
{
|
||||
#ifdef DEBUG
|
||||
RARCH_LOG("[Scanner]: Scrubbing: %s\n", filename);
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -944,7 +950,9 @@ int detect_system(intfstream_t *fd, const char **system_name, const char * filen
|
||||
int i;
|
||||
char magic[50];
|
||||
|
||||
#ifdef DEBUG
|
||||
RARCH_LOG("[Scanner]: %s\n", msg_hash_to_str(MSG_COMPARING_WITH_KNOWN_MAGIC_NUMBERS));
|
||||
#endif
|
||||
for (i = 0; MAGIC_NUMBERS[i].system_name != NULL; i++)
|
||||
{
|
||||
if (intfstream_seek(fd, MAGIC_NUMBERS[i].offset, SEEK_SET) >= 0)
|
||||
@ -955,16 +963,20 @@ int detect_system(intfstream_t *fd, const char **system_name, const char * filen
|
||||
if (memcmp(MAGIC_NUMBERS[i].magic, magic, MAGIC_NUMBERS[i].length_magic) == 0)
|
||||
{
|
||||
*system_name = MAGIC_NUMBERS[i].system_name;
|
||||
#ifdef DEBUG
|
||||
RARCH_LOG("[Scanner]: Name: %s\n", filename);
|
||||
RARCH_LOG("[Scanner]: System: %s\n", MAGIC_NUMBERS[i].system_name);
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
RARCH_LOG("[Scanner]: Name: %s\n", filename);
|
||||
RARCH_LOG("[Scanner]: System: Unknown\n");
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1030,12 +1042,16 @@ int cue_find_track(const char *cue_path, bool first,
|
||||
if (!intfstream_open(fd, cue_path,
|
||||
RETRO_VFS_FILE_ACCESS_READ, RETRO_VFS_FILE_ACCESS_HINT_NONE))
|
||||
{
|
||||
#ifdef DEBUG
|
||||
RARCH_LOG("Could not open CUE file '%s': %s\n", cue_path,
|
||||
strerror(errno));
|
||||
#endif
|
||||
goto error;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
RARCH_LOG("Parsing CUE file '%s'...\n", cue_path);
|
||||
#endif
|
||||
|
||||
tmp_token[0] = '\0';
|
||||
|
||||
@ -1083,7 +1099,9 @@ int cue_find_track(const char *cue_path, bool first,
|
||||
|
||||
if (sscanf(tmp_token, "%02d:%02d:%02d", &m, &s, &f) < 3)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
RARCH_LOG("Error parsing time stamp '%s'\n", tmp_token);
|
||||
#endif
|
||||
goto error;
|
||||
}
|
||||
|
||||
@ -1181,12 +1199,16 @@ int gdi_find_track(const char *gdi_path, bool first,
|
||||
if (!intfstream_open(fd, gdi_path,
|
||||
RETRO_VFS_FILE_ACCESS_READ, RETRO_VFS_FILE_ACCESS_HINT_NONE))
|
||||
{
|
||||
#ifdef DEBUG
|
||||
RARCH_LOG("Could not open GDI file '%s': %s\n", gdi_path,
|
||||
strerror(errno));
|
||||
#endif
|
||||
goto error;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
RARCH_LOG("Parsing GDI file '%s'...\n", gdi_path);
|
||||
#endif
|
||||
|
||||
tmp_token[0] = '\0';
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user