Headless improvements

This commit is contained in:
Henrik Rydgård committed 2026-07-29 16:27:33 +02:00
1 parent 35355d90e2
commit 54618c67c6
5 files changed
+19 -7

No files matched your search

+1
View File
@@ -58,6 +58,7 @@ struct CoreParameter {
Path mountIso; // If non-empty, and fileToStart is an ELF or PBP, will mount this ISO in the background to umd1:.
Path mountRoot; // If non-empty, and fileToStart is an ELF or PBP, mount this as host0: / umd0:.
std::string errorString;
bool loadGameConfigs = true;
bool startBreak = false;
std::string *collectDebugOutput = nullptr;
+4 -2
View File
@@ -339,7 +339,7 @@ static Path NormalizePath(const Path &path) {
#endif
}
bool Load_PSP_ELF_PBP(FileLoader *fileLoader, std::string_view discId, std::string *error_string) {
bool Load_PSP_ELF_PBP(FileLoader *fileLoader, std::string_view discId, bool loadGameConfigs, std::string *error_string) {
// This is really just for headless, might need tweaking later.
if (PSP_CoreParameter().mountIsoLoader != nullptr) {
std::shared_ptr<BlockDevice> bd(ConstructBlockDevice(PSP_CoreParameter().mountIsoLoader, error_string));
@@ -441,7 +441,9 @@ bool Load_PSP_ELF_PBP(FileLoader *fileLoader, std::string_view discId, std::stri
File::Rename(oldNamePrefix.WithExtraExtension(".jpg"), newPrefix.WithExtraExtension(".jpg"));
}
g_Config.LoadGameConfig(discID);
if (loadGameConfigs) {
g_Config.LoadGameConfig(discID);
}
return __KernelLoadExec(finalName.c_str(), 0, error_string);
}
+1 -1
View File
@@ -24,7 +24,7 @@ class FileLoader;
class BlockDevice;
bool Load_PSP_ISO(FileLoader *fileLoader, std::string *error_string);
bool Load_PSP_ELF_PBP(FileLoader *fileLoader, std::string_view discId, std::string *error_string);
bool Load_PSP_ELF_PBP(FileLoader *fileLoader, std::string_view discId, bool loadGameConfigs, std::string *error_string);
bool Load_PSP_GE_Dump(FileLoader *fileLoader, std::string *error_string);
bool MountGameISO(FileLoader *fileLoader, std::string *errorString);
+2 -2
View File
@@ -467,7 +467,7 @@ static bool CPU_Init(FileLoader *fileLoader, IdentifiedFileType type, std::strin
dir = ResolvePBPDirectory(Path(dir)).ToString();
pspFileSystem.SetStartingDirectory("ms0:/" + dir.substr(pos));
}
if (!Load_PSP_ELF_PBP(fileLoader, discId, errorString)) {
if (!Load_PSP_ELF_PBP(fileLoader, discId, g_CoreParameter.loadGameConfigs, errorString)) {
return false;
}
break;
@@ -478,7 +478,7 @@ static bool CPU_Init(FileLoader *fileLoader, IdentifiedFileType type, std::strin
case IdentifiedFileType::PSP_ELF:
{
INFO_LOG(Log::Loader, "File is an ELF or loose PBP %s", fileLoader->GetPath().c_str());
if (!Load_PSP_ELF_PBP(fileLoader, discId, errorString)) {
if (!Load_PSP_ELF_PBP(fileLoader, discId, g_CoreParameter.loadGameConfigs, errorString)) {
ERROR_LOG(Log::Loader, "Failed to load ELF or loose PBP: %s", errorString->c_str());
return false;
}
+11 -2
View File
@@ -7,6 +7,8 @@
// > --root pspautotests/tests/../ --compare --timeout=5 --graphics=software pspautotests/tests/cpu/cpu_alu/cpu_alu.prx
// Example command line for taking screenshots from a frame dump:
// > -l --graphics=vulkan --screenshot-save=vt_ref.bmp "D:\PSP ISO\dump\Depth\11578 Virtua Tennis pause menu ULES00126_0002.zip" --resolution-scale=2
// Example command line for messing with the vsh:
// > -l --vsh --memread=break --memwrite=break --break=break
//
// NOTE: In MSVC, don't forget to set the working directory to $ProjectDir\.. in debug settings.
@@ -251,7 +253,7 @@ struct AutoTestOptions {
bool bench;
};
bool RunAutoTest(HeadlessHost *headlessHost, CoreParameter &coreParameter, const AutoTestOptions &opt) {
static bool RunAutoTest(HeadlessHost *headlessHost, CoreParameter &coreParameter, const AutoTestOptions &opt) {
using namespace Draw;
// Kinda ugly, trying to guesstimate the test name from filename...
@@ -601,6 +603,7 @@ int main(int argc, const char* argv[]) {
coreParameter.mountRoot = mountRoot.empty() ? Path() : Path(mountRoot);
coreParameter.startBreak = false;
coreParameter.headLess = true;
coreParameter.loadGameConfigs = false;
coreParameter.renderScaleFactor = cmdLineOptions.resolutionScale.value_or(1);
coreParameter.renderWidth = 480 * coreParameter.renderScaleFactor;
coreParameter.renderHeight = 272 * coreParameter.renderScaleFactor;
@@ -680,9 +683,15 @@ int main(int argc, const char* argv[]) {
std::vector<std::string> failedTests;
std::vector<std::string> passedTests;
std::vector<std::string> missingTests;
for (size_t i = 0; i < testFilenames.size(); ++i) {
coreParameter.fileToStart = Path(testFilenames[i]);
if (!File::Exists(coreParameter.fileToStart)) {
fprintf(stderr, "File not found: %s\n", coreParameter.fileToStart.c_str());
missingTests.push_back(testFilenames[i]);
continue;
}
if (testOptions.compare)
printf("%s:\n", coreParameter.fileToStart.c_str());
bool passed = RunAutoTest(headlessHost, coreParameter, testOptions);
@@ -714,7 +723,7 @@ int main(int argc, const char* argv[]) {
}
if (testOptions.compare) {
printf("%d tests passed, %d tests failed.\n", (int)passedTests.size(), (int)failedTests.size());
printf("%d tests passed, %d tests failed, %d tests missing.\n", (int)passedTests.size(), (int)failedTests.size(), (int)missingTests.size());
if (!failedTests.empty())
{
printf("Failed tests:\n");