Headless: --dump-file lists a directory when given one

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
Henrik RydgårdandClaude Opus 5.5 committed 2026-09-25 15:34:47 -06:00
1 parent a0b812bc31
commit e6330a58f4
2 files changed
+10 -1

No files matched your search

+1 -1
View File
@@ -224,7 +224,7 @@ static const CommandLineParam g_autoParams[] = {
{POFF(reRawBase), CmdParamType::String, "re-raw-base", '\0', "Treat --re-module as a raw code image loaded at this address, e.g. 0x08300000", CmdLineMode::Headless},
{POFF(reDecrypt), CmdParamType::String, "re-decrypt", '\0', "Decrypt one encrypted PSP file (PRX or ME image) and exit", CmdLineMode::Headless},
{POFF(reDecryptOut), CmdParamType::String, "re-decrypt-out", '\0', "Output file for --re-decrypt (default: decrypted.bin)", CmdLineMode::Headless},
{POFF(dumpFile), CmdParamType::String, "dump-file", '\0', "Copy one file out of the disc image, e.g. disc0:/PSP_GAME/USRDIR/MOVIE.PMF, and exit", CmdLineMode::Headless},
{POFF(dumpFile), CmdParamType::String, "dump-file", '\0', "Copy one file out of the disc image, e.g. disc0:/PSP_GAME/USRDIR/MOVIE.PMF, or list a directory, and exit", CmdLineMode::Headless},
{POFF(dumpFileOut), CmdParamType::String, "dump-file-out", '\0', "Output file for --dump-file (default: the file's own name)", CmdLineMode::Headless},
{POFF(odsLog), CmdParamType::Bool, "odslog", 'o', "Also log through OutputDebugString (Windows)", CmdLineMode::Headless},
{POFF(generateInterpreterDispatch), CmdParamType::Bool, "generate-interpreter-dispatch", '\0', "Generate C++ interpreter dispatch code (ExecInstruction) to stdout and exit", CmdLineMode::Headless},
+9
View File
@@ -414,6 +414,15 @@ int RunDumpDiscFile(const std::string &discPath, const std::string &inPath, cons
loader.release();
ISOFileSystem isoFs(&pspFileSystem, device);
// A directory gets listed instead.
const PSPFileInfo dirInfo = isoFs.GetFileInfo(insideDisc);
if (dirInfo.exists && dirInfo.type == FILETYPE_DIRECTORY) {
for (const PSPFileInfo &entry : isoFs.GetDirListing(insideDisc)) {
printf("%s %10lld %s\n", entry.type == FILETYPE_DIRECTORY ? "d" : "-", (long long)entry.size, entry.name.c_str());
}
return 0;
}
const int handle = isoFs.OpenFile(insideDisc, FILEACCESS_READ);
if (handle < 0) {
fprintf(stderr, "dump-file: no such file on the disc: %s\n", insideDisc.c_str());