From a9cf1fbcc1d4128b85d4b2a3ef75cb17e6b61148 Mon Sep 17 00:00:00 2001 From: Mihawk <163614687+mihawk-99@users.noreply.github.com> Date: Sat, 17 Oct 2026 19:36:00 -0400 Subject: [PATCH] Library: a cartridge system's archives are games whatever else its core runs The content scan counted a system's .zip and .7z as games only when none of its cores took a .cue or .chd, so a core that also runs a disc system hid a cartridge system's archives: Genesis Plus GX (Sega CD) for the Mega Drive, Master System, SG-1000 and Game Gear, PicoDrive (Sega CD) for the 32X, Beetle PCE (the PC Engine CD) for the PC Engine and SuperGrafx. Their archived games were in neither ES-DE nor the WebUI's library. Whether a system's archives are games now goes by the system: the disc systems (psx, ps2, psp, saturn, dreamcast, segacd, pcfx, 3do, neogeocd, gc, wii) keep theirs out, as before, since RetroArch extracts only the file it loads and a .cue's tracks would be left behind. Evidence: tests/ps5_library_test.c, an archived game in an ES-DE megadrive folder whose core also takes cue and chd (counted; it was not before this change: the test failed on the game count) beside an archived PlayStation disc (still left out): python3 -m unittest tests.test_ps5_library OK. On the console (evidence/esde-folder-names): ES-DE's library went from 28 systems and 255 games to 34 and 317 with the same 325 game backups, the six systems above among the new ones. tools/verify.sh: all five gates PASS. --- src/ps5_library.c | 6 ++++-- tests/ps5_library_test.c | 19 +++++++++++++++---- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/src/ps5_library.c b/src/ps5_library.c index 3c628ee..928b325 100644 --- a/src/ps5_library.c +++ b/src/ps5_library.c @@ -1364,8 +1364,10 @@ static void scan_root(struct loading *loading, const char *root, const char *fir continue; /* no core for it */ /* RetroArch opens a .zip or .7z itself for a core that does not take one, so a * cartridge system's archives are games. A disc system's are not: an archived - * disc is a .cue and its tracks, and RetroArch extracts only the file it loads. */ - if (!list_has(scanning.extensions, "cue") && !list_has(scanning.extensions, "chd")) + * disc is a .cue and its tracks, and RetroArch extracts only the file it loads. + * Which one a system is goes by the system, not by its core: Genesis Plus GX also + * takes Sega CD's .cue, and the Mega Drive's archives are still games. */ + if (!list_has("psx|ps2|psp|saturn|dreamcast|segacd|pcfx|3do|neogeocd|gc|wii", platform)) add_extensions(scanning.extensions, sizeof(scanning.extensions), "zip|7z"); char path[PS5_LIBRARY_PATH_MAX]; if (!joined(path, sizeof(path), root, listing.names[i])) diff --git a/tests/ps5_library_test.c b/tests/ps5_library_test.c index 9ed76a1..4d02ab6 100644 --- a/tests/ps5_library_test.c +++ b/tests/ps5_library_test.c @@ -298,6 +298,9 @@ int main(int argc, char **argv) } core(dir, "dosbox_pure", "DOS", "zip|dosz|exe|com|bat|iso|cue"); core(dir, "scummvm", "ScummVM", "scummvm"); + /* a cartridge system whose core also runs a disc system (Sega CD) */ + core(dir, "genesis_plus_gx", "Sega - Mega Drive - Genesis|Sega - Mega-CD - Sega CD", + "md|bin|cue|chd"); const char *content_folders[] = {"content", "content/ATARI 2600", "content/ATARI 2600/Hacks", @@ -310,6 +313,8 @@ int main(int argc, char **argv) "content/ScummVM/Mansion/game", "content/My Stuff", "content/Saturn", + "content/megadrive", + "content/psx", "usb", "usb/Atari 2600"}; for (size_t i = 0; i < sizeof(content_folders) / sizeof(content_folders[0]); i++) @@ -336,6 +341,8 @@ int main(int argc, char **argv) "content/Saturn/game.cue", "usb/Atari 2600/River Run.a26", "content/3DO/Archived Disc.7z", + "content/megadrive/Racer.7z", + "content/psx/Archived Disc.7z", "usb/loose.a26"}; for (size_t i = 0; i < sizeof(content_files) / sizeof(content_files[0]); i++) { @@ -348,12 +355,16 @@ int main(int argc, char **argv) const char *const roots[] = {content_root, usb_root, NULL}; assert(ps5_library_load_content(&library, playlists, info, cores, roots) == 0); /* The playlists' nine, and: Quest, Jungle Jump, River Run (the drive), the 3DO game's - * .cue, SHOOTER.EXE, Platform.zip and Mansion (Quest.zip though Stella takes no .zip: a - * cartridge system's archives are RetroArch's to open). Not: the 3DO's archived disc - * (a disc system's archive), readme.txt, the firmware (by the info's + * .cue, SHOOTER.EXE, Platform.zip, Mansion and Racer.7z (Quest.zip though Stella takes no + * .zip: a cartridge system's archives are RetroArch's to open, and Racer.7z though its core + * also runs Sega CD discs). Not: the 3DO's and PlayStation's archived discs (a disc + * system's archives), readme.txt, the firmware (by the info's * names, a variant of one, [BIOS]), the .iso behind the .cue, SETUP.EXE, SHOOTER.WAD, * dosbox.conf, My Stuff (no platform), Saturn (no core), a file at a drive's top. */ - assert(library.game_count == 9 + 7); + assert(library.game_count == 9 + 8); + const struct ps5_library_system *megadrive = system_of(&library, "genesis"); + assert(megadrive && megadrive->game_count == 1 && + strstr(library.games[megadrive->first_game].path, "megadrive/Racer.7z")); const struct ps5_library_system *atari = system_of(&library, "atari2600"); assert(atari && atari->game_count == 3 && strcmp(atari->folder, "/") != 0); const struct ps5_library_system *panasonic = system_of(&library, "3do");