mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-10-22 00:22:57 -05:00
The export threw, and titles query the system name during startup. Parameter 6 (the system name) now writes the fixed name "PS5" into a buffer of at least SYSTEM_SERVICE_MAX_SYSTEM_NAME_LENGTH (65) bytes. A null buffer or a zero size returns SYSTEM_SERVICE_ERROR_PARAMETER, as in KytyPS5. Other parameter ids and buffers of 1 to 64 bytes still throw, because no PS5 source gives their result. guest_system_service covers the error rows, both throws and the returned name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
44 lines
1.8 KiB
C++
44 lines
1.8 KiB
C++
#include "SceTypes.hpp"
|
|
#include "prx/libSceSystemService/SystemService.hpp"
|
|
#include <cstddef>
|
|
#include <cstdlib>
|
|
#include <cstring>
|
|
#include <stdexcept>
|
|
|
|
extern "C" int APS5_VABI sceSystemServiceGetHdrToneMapLuminance(SystemServiceHdrToneMapLuminance* luminance);
|
|
extern "C" int APS5_VABI sceSystemServiceParamGetString(int paramId, char* buf, std::size_t bufSize);
|
|
|
|
namespace {
|
|
|
|
void Require(bool value) { if (!value) std::abort(); }
|
|
|
|
bool ParamGetStringThrows(int paramId, char* buf, std::size_t bufSize) {
|
|
try {
|
|
static_cast<void>(sceSystemServiceParamGetString(paramId, buf, bufSize));
|
|
} catch (const std::runtime_error&) {
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
}
|
|
|
|
int main() {
|
|
Require(sceSystemServiceGetHdrToneMapLuminance(nullptr) == SYSTEM_SERVICE_ERROR_PARAMETER);
|
|
SystemServiceHdrToneMapLuminance luminance{-1.0f, -1.0f, -1.0f};
|
|
Require(sceSystemServiceGetHdrToneMapLuminance(&luminance) == SYSTEM_SERVICE_OK);
|
|
Require(luminance.max_full_frame_tone_map_luminance == 100.0f);
|
|
Require(luminance.max_tone_map_luminance == 100.0f);
|
|
Require(luminance.min_tone_map_luminance == 0.0f);
|
|
|
|
char name[SYSTEM_SERVICE_MAX_SYSTEM_NAME_LENGTH];
|
|
std::memset(name, 'x', sizeof(name));
|
|
Require(sceSystemServiceParamGetString(SYSTEM_SERVICE_PARAM_ID_SYSTEM_NAME, nullptr, sizeof(name)) == SYSTEM_SERVICE_ERROR_PARAMETER);
|
|
Require(sceSystemServiceParamGetString(SYSTEM_SERVICE_PARAM_ID_SYSTEM_NAME, name, 0) == SYSTEM_SERVICE_ERROR_PARAMETER);
|
|
Require(ParamGetStringThrows(SYSTEM_SERVICE_PARAM_ID_SYSTEM_NAME, name, sizeof(name) - 1));
|
|
Require(ParamGetStringThrows(SYSTEM_SERVICE_PARAM_ID_LANG, name, sizeof(name)));
|
|
Require(name[0] == 'x');
|
|
Require(sceSystemServiceParamGetString(SYSTEM_SERVICE_PARAM_ID_SYSTEM_NAME, name, sizeof(name)) == SYSTEM_SERVICE_OK);
|
|
Require(std::strcmp(name, "PS5") == 0);
|
|
}
|