mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-10-10 01:28:44 +02:00
Merge pull request #791 from CnRJay/feat/agc-driver-resource-queries
feat(libSceAgcDriver): answer the resource registration queries
This commit is contained in:
@@ -676,6 +676,15 @@ if(BUILD_TESTING)
|
||||
set_tests_properties(linear_display_buffer PROPERTIES ENVIRONMENT_MODIFICATION
|
||||
"PATH=path_list_prepend:$<TARGET_FILE_DIR:libc>")
|
||||
endif()
|
||||
add_test_executable(guest_agc_driver_resources_tests ${LIBS_INCLUDE_DIR}/tests/GuestAgcDriverResources.cpp)
|
||||
target_include_directories(guest_agc_driver_resources_tests PRIVATE ${LIBS_INCLUDE_DIR})
|
||||
target_link_libraries(guest_agc_driver_resources_tests PRIVATE libSceAgcDriver libc)
|
||||
configure_windows_unwind(guest_agc_driver_resources_tests)
|
||||
add_test(NAME guest_agc_driver_resources COMMAND guest_agc_driver_resources_tests)
|
||||
if(WIN32)
|
||||
set_tests_properties(guest_agc_driver_resources PROPERTIES ENVIRONMENT_MODIFICATION
|
||||
"PATH=path_list_prepend:$<TARGET_FILE_DIR:libc>")
|
||||
endif()
|
||||
add_test_executable(guest_rendering_wait_tests ${LIBS_INCLUDE_DIR}/tests/GuestRenderingWait.cpp)
|
||||
target_include_directories(guest_rendering_wait_tests PRIVATE ${LIBS_INCLUDE_DIR})
|
||||
target_link_libraries(guest_rendering_wait_tests PRIVATE libSceAgcDriver libc)
|
||||
|
||||
@@ -43,4 +43,79 @@ int APS5_VABI sceAgcDriverUnregisterResource(uint32_t resource_handle) {
|
||||
return SCE_AGC_ERROR_RESOURCE_REGISTRATION_UNAVAILABLE;
|
||||
}
|
||||
|
||||
int APS5_VABI sceAgcDriverRegisterGdsResource(uint32_t* resource_handle, uint32_t owner_handle, uint32_t gds_offset, uint32_t gds_size, const char* name, uint32_t type, uint64_t user_data) {
|
||||
(void)resource_handle;
|
||||
(void)owner_handle;
|
||||
(void)gds_offset;
|
||||
(void)gds_size;
|
||||
(void)name;
|
||||
(void)type;
|
||||
(void)user_data;
|
||||
return SCE_AGC_ERROR_RESOURCE_REGISTRATION_UNAVAILABLE;
|
||||
}
|
||||
|
||||
int APS5_VABI sceAgcDriverUnregisterAllResourcesForOwner(uint32_t owner_handle) {
|
||||
(void)owner_handle;
|
||||
return SCE_AGC_ERROR_RESOURCE_REGISTRATION_UNAVAILABLE;
|
||||
}
|
||||
|
||||
int APS5_VABI sceAgcDriverUnregisterWorkloadStream(uint32_t stream_id) {
|
||||
(void)stream_id;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int APS5_VABI sceAgcDriverGetDefaultOwner(uint32_t* owner_handle) {
|
||||
(void)owner_handle;
|
||||
return SCE_AGC_ERROR_RESOURCE_REGISTRATION_UNAVAILABLE;
|
||||
}
|
||||
|
||||
int APS5_VABI sceAgcDriverGetOwnerName(uint32_t owner_handle, const char** name) {
|
||||
(void)owner_handle;
|
||||
(void)name;
|
||||
return SCE_AGC_ERROR_RESOURCE_REGISTRATION_UNAVAILABLE;
|
||||
}
|
||||
|
||||
int APS5_VABI sceAgcDriverGetResourceName(uint32_t resource_handle, const char** name) {
|
||||
(void)resource_handle;
|
||||
(void)name;
|
||||
return SCE_AGC_ERROR_RESOURCE_REGISTRATION_UNAVAILABLE;
|
||||
}
|
||||
|
||||
int APS5_VABI sceAgcDriverGetResourceType(uint32_t resource_handle, uint32_t* type) {
|
||||
(void)resource_handle;
|
||||
(void)type;
|
||||
return SCE_AGC_ERROR_RESOURCE_REGISTRATION_UNAVAILABLE;
|
||||
}
|
||||
|
||||
int APS5_VABI sceAgcDriverGetResourceUserData(uint32_t resource_handle, uint64_t* user_data) {
|
||||
(void)resource_handle;
|
||||
(void)user_data;
|
||||
return SCE_AGC_ERROR_RESOURCE_REGISTRATION_UNAVAILABLE;
|
||||
}
|
||||
|
||||
int APS5_VABI sceAgcDriverSetResourceUserData(uint32_t resource_handle, uint64_t user_data) {
|
||||
(void)resource_handle;
|
||||
(void)user_data;
|
||||
return SCE_AGC_ERROR_RESOURCE_REGISTRATION_UNAVAILABLE;
|
||||
}
|
||||
|
||||
int APS5_VABI sceAgcDriverGetResourceBaseAddressAndSizeInBytes(uint32_t resource_handle, void** memory, size_t* size) {
|
||||
(void)resource_handle;
|
||||
(void)memory;
|
||||
(void)size;
|
||||
return SCE_AGC_ERROR_RESOURCE_REGISTRATION_UNAVAILABLE;
|
||||
}
|
||||
|
||||
int APS5_VABI sceAgcDriverGetResourceShaderGuid(uint32_t resource_handle, void* guid) {
|
||||
(void)resource_handle;
|
||||
(void)guid;
|
||||
return SCE_AGC_ERROR_RESOURCE_REGISTRATION_UNAVAILABLE;
|
||||
}
|
||||
|
||||
int APS5_VABI sceAgcDriverFindResourcesPublic(const void* callback, void* user_data) {
|
||||
(void)callback;
|
||||
(void)user_data;
|
||||
return SCE_AGC_ERROR_RESOURCE_REGISTRATION_UNAVAILABLE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,18 +8,15 @@
|
||||
extern "C" {
|
||||
|
||||
bool APS5_VABI sceAgcDriverIsCaptureInProgress(void) {
|
||||
NotImplemented_nid_no_patch(__func__);
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool APS5_VABI sceAgcDriverIsTraceInProgress(void) {
|
||||
NotImplemented_nid_no_patch(__func__);
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool APS5_VABI sceAgcDriverIsSubmitValidationEnabled(void) {
|
||||
NotImplemented_nid_no_patch(__func__);
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
int APS5_VABI sceAgcDriverRequestCaptureStart(const char* path) {
|
||||
|
||||
@@ -5,51 +5,11 @@
|
||||
|
||||
extern "C" {
|
||||
|
||||
int APS5_VABI sceAgcDriverFindResourcesPublic() {
|
||||
NotImplemented_nid_no_patch(__func__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int APS5_VABI sceAgcDriverGetDefaultOwner() {
|
||||
NotImplemented_nid_no_patch(__func__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int APS5_VABI sceAgcDriverGetOwnerName() {
|
||||
NotImplemented_nid_no_patch(__func__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int APS5_VABI sceAgcDriverGetResourceBaseAddressAndSizeInBytes() {
|
||||
NotImplemented_nid_no_patch(__func__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int APS5_VABI sceAgcDriverGetResourceName() {
|
||||
NotImplemented_nid_no_patch(__func__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int APS5_VABI sceAgcDriverGetResourceRegistrationMaxNameLength() {
|
||||
NotImplemented_nid_no_patch(__func__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int APS5_VABI sceAgcDriverGetResourceShaderGuid() {
|
||||
NotImplemented_nid_no_patch(__func__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int APS5_VABI sceAgcDriverGetResourceType() {
|
||||
NotImplemented_nid_no_patch(__func__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int APS5_VABI sceAgcDriverGetResourceUserData() {
|
||||
NotImplemented_nid_no_patch(__func__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int APS5_VABI sceAgcDriverGetShaderDebuggingStatus() {
|
||||
NotImplemented_nid_no_patch(__func__);
|
||||
return 0;
|
||||
@@ -60,31 +20,11 @@ int APS5_VABI sceAgcDriverRegisterDefaultOwner(uint32_t* owner_handle) {
|
||||
return static_cast<int>(0x8A6C9018);
|
||||
}
|
||||
|
||||
int APS5_VABI sceAgcDriverRegisterGdsResource() {
|
||||
NotImplemented_nid_no_patch(__func__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int APS5_VABI sceAgcDriverSetResourceUserData() {
|
||||
NotImplemented_nid_no_patch(__func__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int APS5_VABI sceAgcDriverSetValidationErrorOutputFrequency() {
|
||||
NotImplemented_nid_no_patch(__func__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int APS5_VABI sceAgcDriverUnregisterAllResourcesForOwner() {
|
||||
NotImplemented_nid_no_patch(__func__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int APS5_VABI sceAgcDriverUnregisterWorkloadStream() {
|
||||
NotImplemented_nid_no_patch(__func__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int APS5_VABI sceAgcDriverSetSubmitValidationMode() {
|
||||
NotImplemented_nid_no_patch(__func__);
|
||||
return 0;
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
#include "SceTypes.hpp"
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <cstdlib>
|
||||
#include <string_view>
|
||||
|
||||
extern "C" {
|
||||
int APS5_VABI sceAgcDriverRegisterOwner(std::uint32_t*, const char*);
|
||||
int APS5_VABI sceAgcDriverRegisterResource(std::uint32_t*, std::uint32_t, const void*, std::size_t, const char*, std::uint32_t, std::uint64_t);
|
||||
int APS5_VABI sceAgcDriverRegisterGdsResource(std::uint32_t*, std::uint32_t, std::uint32_t, std::uint32_t, const char*, std::uint32_t, std::uint64_t);
|
||||
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 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*);
|
||||
int APS5_VABI sceAgcDriverGetResourceUserData(std::uint32_t, std::uint64_t*);
|
||||
int APS5_VABI sceAgcDriverSetResourceUserData(std::uint32_t, std::uint64_t);
|
||||
int APS5_VABI sceAgcDriverGetResourceBaseAddressAndSizeInBytes(std::uint32_t, void**, std::size_t*);
|
||||
int APS5_VABI sceAgcDriverGetResourceShaderGuid(std::uint32_t, void*);
|
||||
int APS5_VABI sceAgcDriverFindResourcesPublic(const void*, void*);
|
||||
bool APS5_VABI sceAgcDriverIsCaptureInProgress(void);
|
||||
bool APS5_VABI sceAgcDriverIsTraceInProgress(void);
|
||||
bool APS5_VABI sceAgcDriverIsSubmitValidationEnabled(void);
|
||||
}
|
||||
|
||||
static constexpr int Unavailable = static_cast<int>(0x8A6C9018);
|
||||
static void Require(bool value) { if (!value) std::abort(); }
|
||||
|
||||
int main() {
|
||||
std::uint32_t owner = 7u;
|
||||
std::uint32_t resource = 9u;
|
||||
const std::uint32_t memory[4]{};
|
||||
Require(sceAgcDriverRegisterOwner(&owner, "owner") == Unavailable);
|
||||
Require(sceAgcDriverRegisterResource(&resource, owner, memory, sizeof(memory), "resource", 1u, 2u) == Unavailable);
|
||||
Require(sceAgcDriverRegisterGdsResource(&resource, owner, 0u, 64u, "gds", 1u, 2u) == Unavailable);
|
||||
Require(owner == 7u && resource == 9u);
|
||||
Require(sceAgcDriverGetDefaultOwner(&owner) == Unavailable && owner == 7u);
|
||||
const char* name = "unchanged";
|
||||
Require(sceAgcDriverGetOwnerName(owner, &name) == Unavailable);
|
||||
Require(sceAgcDriverGetResourceName(resource, &name) == Unavailable);
|
||||
std::uint32_t type = 3u;
|
||||
Require(sceAgcDriverGetResourceType(resource, &type) == Unavailable && type == 3u);
|
||||
std::uint64_t userData = 4u;
|
||||
Require(sceAgcDriverGetResourceUserData(resource, &userData) == Unavailable && userData == 4u);
|
||||
Require(sceAgcDriverSetResourceUserData(resource, 5u) == Unavailable);
|
||||
void* base = nullptr;
|
||||
std::size_t size = 6u;
|
||||
Require(sceAgcDriverGetResourceBaseAddressAndSizeInBytes(resource, &base, &size) == Unavailable && base == nullptr && size == 6u);
|
||||
std::uint8_t guid[16]{};
|
||||
Require(sceAgcDriverGetResourceShaderGuid(resource, guid) == Unavailable);
|
||||
Require(sceAgcDriverFindResourcesPublic(nullptr, nullptr) == Unavailable);
|
||||
Require(sceAgcDriverUnregisterAllResourcesForOwner(owner) == Unavailable);
|
||||
Require(std::string_view(name) == "unchanged");
|
||||
Require(sceAgcDriverRegisterWorkloadStream(1u, memory) == 0);
|
||||
Require(sceAgcDriverUnregisterWorkloadStream(1u) == 0);
|
||||
Require(!sceAgcDriverIsCaptureInProgress());
|
||||
Require(!sceAgcDriverIsTraceInProgress());
|
||||
Require(!sceAgcDriverIsSubmitValidationEnabled());
|
||||
}
|
||||
@@ -122,6 +122,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
|
||||
|
||||
### Functional
|
||||
|
||||
|
||||
Reference in New Issue
Block a user