mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-10-10 01:28:44 +02:00
feat(agc): expose legacy register defaults entry point
This commit is contained in:
@@ -9,6 +9,11 @@
|
||||
|
||||
extern "C" {
|
||||
|
||||
void* APS5_VABI sceAgcGetRegisterDefaults() {
|
||||
// The legacy API has no version argument; use the baseline public table.
|
||||
return Agc::Command::GetRegisterDefaults(0, false, __func__);
|
||||
}
|
||||
|
||||
void* APS5_VABI sceAgcGetRegisterDefaults2(std::uint32_t version) {
|
||||
return Agc::Command::GetRegisterDefaults(version, false, __func__);
|
||||
}
|
||||
|
||||
@@ -5,9 +5,28 @@
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
extern "C" int APS5_VABI sceAgcLinkShaders(ShaderRegister*, ShaderRegister*, const void*, const Shader*, const Shader*, std::uint32_t);
|
||||
extern "C" void* APS5_VABI sceAgcGetRegisterDefaults();
|
||||
extern "C" void* APS5_VABI sceAgcGetRegisterDefaults2(std::uint32_t);
|
||||
static void Require(bool value) { if (!value) std::abort(); }
|
||||
int main() {
|
||||
using namespace ShaderRegs;
|
||||
auto* defaults = static_cast<unsigned char*>(sceAgcGetRegisterDefaults());
|
||||
Require(defaults && defaults == sceAgcGetRegisterDefaults());
|
||||
Require(defaults == sceAgcGetRegisterDefaults2(0));
|
||||
// These are the byte offsets used by native callers, independent of the
|
||||
// private C++ structure used to construct the defaults object.
|
||||
ShaderRegister** contextBlocks = nullptr;
|
||||
std::uint32_t contextCount = 0;
|
||||
std::memcpy(&contextBlocks, defaults, sizeof(contextBlocks));
|
||||
std::memcpy(&contextCount, defaults + 0x20, sizeof(contextCount));
|
||||
Require(contextBlocks && contextBlocks[0] && contextCount == 523);
|
||||
bool hasRenderTarget = false;
|
||||
bool hasRasterizer = false;
|
||||
for (std::uint32_t i = 0; i < contextCount; ++i) {
|
||||
hasRenderTarget |= contextBlocks[0][i].offset == 0x318;
|
||||
hasRasterizer |= contextBlocks[0][i].offset == 0x205;
|
||||
}
|
||||
Require(hasRenderTarget && hasRasterizer);
|
||||
ShaderSpecialRegs special{};
|
||||
special.vgt_shader_stages_en = {VGT_SHADER_STAGES_EN, VGT_SHADER_STAGES_NGG_BIT};
|
||||
special.vgt_gs_out_prim_type = {VGT_GS_OUT_PRIM_TYPE, 0};
|
||||
|
||||
@@ -448,3 +448,21 @@ The unchanged game resolves sceAgcLinkShaders and stops at `Wi82ArQtAwg`
|
||||
(`sceAgcGetRegisterDefaults`). The project already has a versioned defaults
|
||||
implementation; the legacy entry point still needs its contract verified.
|
||||
Guest entry-point execution and rendered output remain unverified.
|
||||
|
||||
## Follow-up: legacy register-defaults entry point
|
||||
|
||||
Added the no-argument sceAgcGetRegisterDefaults export using the existing
|
||||
baseline public table. The legacy caller reads its context-block pointer at
|
||||
offset 0 and its context-record count at offset 0x20; tests now exercise that
|
||||
layout directly, scan all 523 context records, check render-target/rasterizer
|
||||
register presence, and verify stable pointers across calls.
|
||||
|
||||
Selecting public version zero is a compatibility assumption based on the legacy
|
||||
API lacking a version parameter; it has not been compared with a captured
|
||||
console response. Versioned APIs remain available. All twenty-five tests pass.
|
||||
|
||||
The unchanged game now stops at `0MtUJ3BpGhE`
|
||||
(`sceAgcDriverGetWaitRenderingPacketSizeInDwords`). The corresponding
|
||||
sceAgcDriverWaitUntilSafeForRendering import is also absent. These need a real
|
||||
command-packet and buffer-ownership implementation, not a zero-size/no-op shim.
|
||||
Guest entry-point execution and rendered output are still unverified.
|
||||
|
||||
Reference in New Issue
Block a user