From 1f53f885d42bdfec2b8a2469e3d8861f0b9fbe49 Mon Sep 17 00:00:00 2001 From: JAB-dev <68183649+JAB-dev@users.noreply.github.com> Date: Tue, 6 Oct 2026 18:26:54 +0200 Subject: [PATCH] feat(libSceAgcDriver): implement sceAgcDriverGetResourceRegistrationMaxNameLength The query writes the maximum resource name length (0xfc) through its output pointer and returns 0, as prosper does from a title's registration configuration. The parameter follows the SDK wrapper sce::Agc::ResourceRegistration::getMaxNameLength(unsigned int*). Resource registration itself stays unavailable. Co-Authored-By: Claude Opus 5.5 --- .../libs/prx/libSceAgcDriver/Resource/src/Registration.cpp | 7 +++++++ core/libs/prx/libSceAgcDriver/Unimplemented.cpp | 5 ----- core/libs/tests/GuestAgcDriverResources.cpp | 3 +++ docs/dev/TechnicalDebt.md | 2 +- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/core/libs/prx/libSceAgcDriver/Resource/src/Registration.cpp b/core/libs/prx/libSceAgcDriver/Resource/src/Registration.cpp index 4e5eaa6ab..ff798fca2 100644 --- a/core/libs/prx/libSceAgcDriver/Resource/src/Registration.cpp +++ b/core/libs/prx/libSceAgcDriver/Resource/src/Registration.cpp @@ -7,6 +7,7 @@ // Resource registration feeds GPU debugging tools, none of which are attached; the game treats this code as benign. static constexpr int SCE_AGC_ERROR_RESOURCE_REGISTRATION_UNAVAILABLE = static_cast(0x8A6C9018); +static constexpr uint32_t RESOURCE_REGISTRATION_MAX_NAME_LENGTH = 0xfc; extern "C" { @@ -69,6 +70,12 @@ int APS5_VABI sceAgcDriverGetDefaultOwner(uint32_t* owner_handle) { return SCE_AGC_ERROR_RESOURCE_REGISTRATION_UNAVAILABLE; } +int APS5_VABI sceAgcDriverGetResourceRegistrationMaxNameLength(uint32_t* max_length) { + if (max_length == nullptr) APS5_INVALID_ARG_EX; + *max_length = RESOURCE_REGISTRATION_MAX_NAME_LENGTH; + return 0; +} + int APS5_VABI sceAgcDriverGetOwnerName(uint32_t owner_handle, const char** name) { (void)owner_handle; (void)name; diff --git a/core/libs/prx/libSceAgcDriver/Unimplemented.cpp b/core/libs/prx/libSceAgcDriver/Unimplemented.cpp index 8add7f045..7b2d31ea6 100644 --- a/core/libs/prx/libSceAgcDriver/Unimplemented.cpp +++ b/core/libs/prx/libSceAgcDriver/Unimplemented.cpp @@ -5,11 +5,6 @@ extern "C" { -int APS5_VABI sceAgcDriverGetResourceRegistrationMaxNameLength() { - NotImplemented_nid_no_patch(__func__); - return 0; -} - int APS5_VABI sceAgcDriverGetShaderDebuggingStatus() { NotImplemented_nid_no_patch(__func__); return 0; diff --git a/core/libs/tests/GuestAgcDriverResources.cpp b/core/libs/tests/GuestAgcDriverResources.cpp index d476831c1..eb97484c7 100644 --- a/core/libs/tests/GuestAgcDriverResources.cpp +++ b/core/libs/tests/GuestAgcDriverResources.cpp @@ -12,6 +12,7 @@ int APS5_VABI sceAgcDriverUnregisterAllResourcesForOwner(std::uint32_t); int APS5_VABI sceAgcDriverRegisterWorkloadStream(std::uint32_t, const void*); int APS5_VABI sceAgcDriverUnregisterWorkloadStream(std::uint32_t); int APS5_VABI sceAgcDriverGetDefaultOwner(std::uint32_t*); +int APS5_VABI sceAgcDriverGetResourceRegistrationMaxNameLength(std::uint32_t*); int APS5_VABI sceAgcDriverGetOwnerName(std::uint32_t, const char**); int APS5_VABI sceAgcDriverGetResourceName(std::uint32_t, const char**); int APS5_VABI sceAgcDriverGetResourceType(std::uint32_t, std::uint32_t*); @@ -37,6 +38,8 @@ int main() { Require(sceAgcDriverRegisterGdsResource(&resource, owner, 0u, 64u, "gds", 1u, 2u) == Unavailable); Require(owner == 7u && resource == 9u); Require(sceAgcDriverGetDefaultOwner(&owner) == Unavailable && owner == 7u); + std::uint32_t maxNameLength = 8u; + Require(sceAgcDriverGetResourceRegistrationMaxNameLength(&maxNameLength) == 0 && maxNameLength == 0xfcu); const char* name = "unchanged"; Require(sceAgcDriverGetOwnerName(owner, &name) == Unavailable); Require(sceAgcDriverGetResourceName(resource, &name) == Unavailable); diff --git a/docs/dev/TechnicalDebt.md b/docs/dev/TechnicalDebt.md index 645d976a4..8f115f126 100644 --- a/docs/dev/TechnicalDebt.md +++ b/docs/dev/TechnicalDebt.md @@ -130,7 +130,7 @@ Throughout the project, every function at every stage either **does exactly what - [_sceUlobjmgrRegisterObject](../../core/libs/prx/ulobjmgr/Export.cpp) (ulobjmgr) - parameters taken from shadPS4 (PS4): a nonzero 64-bit object, a nonzero 32-bit kind and a 32-bit id output; the meaning of the first two and the PS5 signature are unverified. The id bound of `_sceUlobjmgrUnregisterObject` (below 0x4000) and the raw `EINVAL` (22) return also come from shadPS4 - [sceShareGetCurrentStatus](../../core/libs/prx/libSceShare/Export.cpp) (libSceShare) - validation (feature flag non-zero, status non-null) and the all-zero 16-byte status taken from the [KytyPS5](https://github.com/KytyPS5/KytyPS5) reimplementation, not confirmed on a PS5 title; the meaning of the recording status values is unknown - [sceAgcDcbSetZPassPredicationEnableGetSize, sceAgcDcbSetPredicationDisableGetSize, sceAgcDcbSetBoolPredicationEnableGetSize](../../core/libs/prx/libSceAgc/DcbState/src/Predication.cpp) (libSceAgc) - the builders are inline in the SDK and not exported; the size is assumed to be that of the SET_PREDICATION packet `sceAgcDcbSetPredication` writes (16 bytes) -- [Resource registration](../../core/libs/prx/libSceAgcDriver/Resource/src/Registration.cpp) (libSceAgcDriver) - registration always fails with `RESOURCE_REGISTRATION_UNAVAILABLE`, so the owner and resource queries, `sceAgcDriverSetResourceUserData`, `sceAgcDriverFindResourcesPublic` and `sceAgcDriverUnregisterAllResourcesForOwner` return the same error without reading their arguments. Their parameter lists follow the libSceGnmDriver counterparts and are unverified +- [Resource registration](../../core/libs/prx/libSceAgcDriver/Resource/src/Registration.cpp) (libSceAgcDriver) - registration always fails with `RESOURCE_REGISTRATION_UNAVAILABLE`, so the owner and resource queries, `sceAgcDriverSetResourceUserData`, `sceAgcDriverFindResourcesPublic` and `sceAgcDriverUnregisterAllResourcesForOwner` return the same error without reading their arguments. Their parameter lists follow the libSceGnmDriver counterparts and are unverified. `sceAgcDriverGetResourceRegistrationMaxNameLength` writes 0xfc and returns 0, as [prosper](https://github.com/mattias800/prosper) does from a title's registration configuration; the `uint32_t*` parameter matches the SDK wrapper `sce::Agc::ResourceRegistration::getMaxNameLength(unsigned int*)`. sharpemu writes 256 and KytyPS5 returns `RESOURCE_REGISTRATION_UNAVAILABLE`, so the value is unverified; a null output throws - [sceNgs2VoiceControl sampler filter](../../core/libs/prx/libSceNgs2.native/src/Voice.cpp) (libSceNgs2.native) - param `0x1000000a`, its layout and meaning follow KytyPS5 only: location 1 type 1 is an RBJ low-pass biquad at the system sample rate after resampling, scaled by `level`, a set `channel_mask` bit bypasses that channel, type 0 turns the filter off. Other locations and types throw. The voice keeps playing a filter tail after its last block until the history is zero, with outputs below 1e-20 flushed to zero (a KytyPS5 choice); the console's tail length is unknown ### Functional