Write unique game info to /tmp/GAMENAME (#1045)
* Write unique game info to /tmp/GAMENAME * Remove CD product code lookup, and crc32 * Remove product codes /tmp/GAMENAME only uses file path and crc32 * Clean up * Cleanup * Only write CRC32 and or Product Code to /tmp/GAMEID Realizing we already have the file path, this change writes the already calculated CRC32 and or game ID (N64 and PSX only) to /tmp/GAMEID. This ignores boot*.rom and cd_bios*.rom CRC32: XXXXXXXX Product Code: XXXXXXXXXXXX * Clean up * Update neogeo_loader.cpp * Skip GAMEID for all BIOS files * Guard behind log_file_entry ini option and clean up print statements * Add MRA GAMEID support and improve GAMEID writing MRA files use setname as serial * Add MGL handling for /tmp/ STARTPATH, FULLPATH, CURRENTPATH, and FILESELECT * Update mgl /tmp/ file handling
This commit is contained in:
54
user_io.cpp
54
user_io.cpp
@@ -1325,6 +1325,9 @@ void user_io_init(const char *path, const char *xml)
|
||||
core_name[0] = 0;
|
||||
disable_osd = 0;
|
||||
|
||||
// Clean up old game ID when loading a new core
|
||||
unlink("/tmp/GAMEID");
|
||||
|
||||
// we need to set the directory to where the XML file (MRA) is
|
||||
// not the RBF. The RBF will be in arcade, which the user shouldn't
|
||||
// browse
|
||||
@@ -2422,6 +2425,55 @@ uint32_t user_io_get_file_crc()
|
||||
return file_crc;
|
||||
}
|
||||
|
||||
void user_io_write_gameid(const char *filename, uint32_t crc32_val, const char *serial)
|
||||
{
|
||||
if (!cfg.log_file_entry) return;
|
||||
|
||||
// Extract basename from filename
|
||||
const char *fname = strrchr(filename, '/');
|
||||
if (!fname) fname = filename;
|
||||
else fname++;
|
||||
|
||||
// Skip BIOS files
|
||||
if (strncasecmp(fname, "boot", 4) == 0 || strcasestr(fname, "bios"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
FILE *f = fopen("/tmp/GAMEID", "w");
|
||||
if (!f)
|
||||
{
|
||||
printf("Failed to write /tmp/GAMEID\n");
|
||||
return;
|
||||
}
|
||||
|
||||
int wrote_something = 0;
|
||||
printf("Game ID: %s", fname);
|
||||
|
||||
if (crc32_val)
|
||||
{
|
||||
fprintf(f, "CRC32: %08X\n", crc32_val);
|
||||
printf(" [CRC32: %08X]", crc32_val);
|
||||
wrote_something = 1;
|
||||
}
|
||||
if (serial && serial[0])
|
||||
{
|
||||
fprintf(f, "Serial: %s\n", serial);
|
||||
printf(" [%s]", serial);
|
||||
wrote_something = 1;
|
||||
}
|
||||
|
||||
// Ensure we always write something to the file
|
||||
if (!wrote_something)
|
||||
{
|
||||
fprintf(f, "# No game ID available\n");
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
fflush(f);
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
int user_io_use_cheats()
|
||||
{
|
||||
return use_cheats;
|
||||
@@ -2729,6 +2781,8 @@ int user_io_file_tx(const char* name, unsigned char index, char opensave, char m
|
||||
printf("Done.\n");
|
||||
printf("CRC32: %08X\n", file_crc);
|
||||
|
||||
user_io_write_gameid(name, file_crc);
|
||||
|
||||
FileClose(&f);
|
||||
|
||||
if (opensave)
|
||||
|
||||
Reference in New Issue
Block a user