mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-10-28 12:05:06 +00:00
The PS5 3.20 export inventory lists _err, _warn and _getprogname in libSceLibcInternal next to err, warn and getprogname, with the NIDs UhKI6z9WWuo, XQFE8Y58WZM and iI6kGxgXzcU. In FreeBSD 11.4 libc the underscore names are the definitions and the public names are weak references to them (lib/libc/gen/err.c, lib/libc/gen/getprogname.c), and libthr interposes none of them, so each pair is one function. _err and _warn now hand their arguments to verr and vwarn, which use errno at the call as err and warn do; _getprogname returns getprogname(). The debt file records that the console's module was not read. guest_err checks the _warn and _err text for errno 13 with a formatted message, that _err passes its status to the err_set_exit hook, and that _warn without a format returns without calling the hook. guest_program_name checks that _getprogname returns the current __progname pointer. Co-Authored-By: Claude Opus 5.5 <[email protected]>
36 lines
1.1 KiB
C++
36 lines
1.1 KiB
C++
#include "SceTypes.hpp"
|
|
#include <cstdlib>
|
|
#include <cstring>
|
|
|
|
extern "C" {
|
|
const char* APS5_VABI getprogname_nid_postfix();
|
|
const char* APS5_VABI _getprogname_nid_postfix();
|
|
extern const char* __progname_nid_postfix;
|
|
int* APS5_VABI __error_nid_postfix();
|
|
}
|
|
|
|
static void Require(bool value) { if (!value) std::abort(); }
|
|
|
|
int main() {
|
|
const char* const original = __progname_nid_postfix;
|
|
*__error_nid_postfix() = 45;
|
|
Require(getprogname_nid_postfix() == original);
|
|
Require(_getprogname_nid_postfix() == original);
|
|
Require(std::strcmp(getprogname_nid_postfix(), "eboot.bin") == 0);
|
|
Require(*__error_nid_postfix() == 45);
|
|
|
|
char renamed[] = "quake2";
|
|
__progname_nid_postfix = renamed;
|
|
Require(getprogname_nid_postfix() == renamed);
|
|
Require(_getprogname_nid_postfix() == renamed);
|
|
renamed[0] = 'Q';
|
|
Require(std::strcmp(getprogname_nid_postfix(), "Quake2") == 0);
|
|
|
|
__progname_nid_postfix = "";
|
|
Require(getprogname_nid_postfix()[0] == '\0');
|
|
|
|
__progname_nid_postfix = original;
|
|
Require(getprogname_nid_postfix() == original);
|
|
Require(*__error_nid_postfix() == 45);
|
|
}
|