Files
PS5_RetroArch/tools/system-folders.c
T
Mihawk 6fa72d46e7 Content: a folder for every system the installed cores run
content/ had only the folders people made (and a bare "Saturn"), so a fresh install
gave no hint where games go (issue 33). ps5_library_make_system_folders makes
content/<system> for each system the installed cores' databases name, with RetroArch's
names ("Nintendo - Nintendo Entertainment System"), which every frontend's library
reads as that system. A system with a folder already, under any name ("PS1",
"Genesis"), gets none: nothing is renamed or moved. A database no platform stands for
(Satellaview, Sufami Turbo, PICO, CD32, CDTV) gets none; variants go to their system
(Wii (Digital) -> Nintendo - Wii).

- src/main.cpp runs it at each title start, before the frontend dispatch (a home-screen
  launch goes to the picker from there; RetroArch's own init is too late), so a core
  added later gets its folder.
- tools/system-folders.c runs the same code on the staged title in build-title.sh:
  dist/PPSA99169/content holds the 46 folders of the 33 cores; video-assets.py keeps
  empty folders in the release ZIP.
- The bare content/Saturn the title made is dropped (Sega - Saturn replaces it).

Evidence: evidence/issue-33-system-folders (console: 45 folders -> 52 after a home-screen
restart, the 7 missing systems added 0777, the owner's kept; dist and the ZIP: 46);
tests/ps5_library_test.c (10 made, an existing folder honoured, unknown databases and
cores without .so skipped, a second run makes none). tools/verify.sh: PASS (format unit
build integration evidence).
2026-10-09 22:29:13 -04:00

38 lines
1.1 KiB
C

/* PS5 RetroArch - the system folders of a staged title (host tool, tools/build-title.sh).
* Copyright (C) 2026 Mihawk
* SPDX-License-Identifier: GPL-3.0-or-later
*
* system-folders <title folder>
*
* Makes <title folder>/content/<system> for each system the staged cores run, with the
* same code the title runs at each start (ps5_library_make_system_folders), so a fresh
* install has them in its package. Prints how many it made. */
#include <errno.h>
#include <stdio.h>
#include <sys/stat.h>
#include "ps5_library.h"
int main(int argc, char **argv)
{
if (argc != 2)
{
fputs("usage: system-folders <title folder>\n", stderr);
return 2;
}
char content[4096], info[4096], cores[4096];
snprintf(content, sizeof(content), "%s/content", argv[1]);
snprintf(info, sizeof(info), "%s/info", argv[1]);
snprintf(cores, sizeof(cores), "%s/cores", argv[1]);
if (mkdir(content, 0777) != 0 && errno != EEXIST)
{
perror(content);
return 1;
}
const int made = ps5_library_make_system_folders(content, info, cores);
if (made < 0)
return 1;
printf("%d\n", made);
return 0;
}