GX2: Fix several missing/incorrect cmd reserve calls

This commit is contained in:
Exzap 2026-03-23 17:11:49 +01:00
parent f893e2928c
commit f2f70e5df8
5 changed files with 6 additions and 2 deletions

View File

@ -294,6 +294,8 @@ void gx2Export_GX2SetSemaphore(PPCInterpreter_t* hCPU)
}
uint32 semaphoreControl = (SEM_SEL << 29);
semaphoreControl |= 0x1000; // WAIT_ON_SIGNAL
GX2::GX2ReserveCmdSpace(3);
gx2WriteGather_submitU32AsBE(pm4HeaderType3(IT_MEM_SEMAPHORE, 2));
gx2WriteGather_submitU32AsBE(memory_virtualToPhysical(semaphoreMPTR)); // semaphore physical address
gx2WriteGather_submitU32AsBE(semaphoreControl); // control

View File

@ -56,7 +56,7 @@ namespace GX2
void GX2DrawIndexedEx2(GX2PrimitiveMode2 primitiveMode, uint32 count, GX2IndexType indexType, void* indexData, uint32 baseVertex, uint32 numInstances, uint32 baseInstance)
{
GX2ReserveCmdSpace(3 + 3 + 2 + 2 + 6);
GX2ReserveCmdSpace(3 + 3 + 3 + 2 + 2 + 6 + 3);
gx2WriteGather_submit(
// IT_SET_CTL_CONST
pm4HeaderType3(IT_SET_CTL_CONST, 2), 0,

View File

@ -38,7 +38,7 @@ namespace GX2
void GX2SubmitUserTimeStamp(uint64* timestampOut, uint64 value, GX2PipeEventType eventType, uint32 triggerInterrupt)
{
GX2ReserveCmdSpace(7);
GX2ReserveCmdSpace(11);
MPTR physTimestampAddr = memory_virtualToPhysical(memory_getVirtualOffsetFromPointer(timestampOut));
uint32 valHigh = (uint32)(value >> 32);

View File

@ -69,6 +69,7 @@ void gx2Export_GX2SampleBottomGPUCycle(PPCInterpreter_t* hCPU)
// Whats a good solution here? Should we implement it correctly and instead rely on graphic pack patches to patch out the dynamic scaling?
// some known affected games: Wind Waker HD, Super Mario 3D World
GX2::GX2ReserveCmdSpace(2);
gx2WriteGather_submitU32AsBE(pm4HeaderType3(IT_HLE_SAMPLE_TIMER, 1));
gx2WriteGather_submitU32AsBE(hCPU->gpr[3]);
osLib_returnFromFunction(hCPU, 0);

View File

@ -648,6 +648,7 @@ namespace GX2
else
{
// legacy style
GX2ReserveCmdSpace(3);
gx2WriteGather_submitU32AsBE(pm4HeaderType3(IT_HLE_SPECIAL_STATE, 2));
gx2WriteGather_submitU32AsBE((uint32)stateId); // state id
gx2WriteGather_submitU32AsBE(isEnabled); // enable/disable bool