mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-10-10 01:28:44 +02:00
fix(relinker): return unpacked exit status and wait for a single Enter in autorun
std::system returns a wait status on POSIX, so returning it from main truncated a guest exit code of 1 (status 256) to 0. The prompt also required pressing Enter twice because cin.get followed cin.ignore. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -19,17 +19,18 @@ int Autorun(const std::string& absPath, bool toWindows) {
|
||||
const std::string cmd = "\"" + absPath + "\"";
|
||||
const int rawCode = std::system(cmd.c_str());
|
||||
|
||||
int exitCode = rawCode;
|
||||
if (toWindows) {
|
||||
std::cout << "\nExit code: " << rawCode << '\n';
|
||||
} else {
|
||||
std::cout << "\nRaw exit code: " << rawCode << "; Unpacked: " << (rawCode >> 8) << '\n';
|
||||
if (rawCode != -1) exitCode = (rawCode >> 8) & 0xFF;
|
||||
std::cout << "\nRaw exit code: " << rawCode << "; Unpacked: " << exitCode << '\n';
|
||||
}
|
||||
|
||||
std::cout << "\nPress Enter to exit...\n";
|
||||
std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
|
||||
std::cin.get();
|
||||
|
||||
return rawCode;
|
||||
return exitCode;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user