Fix GPUCMD_Add with more than 256 words (thanks to iMackshun for testing)
This commit is contained in:
parent
5f3b369a81
commit
b9b4d486a3
@ -22,14 +22,13 @@ void GPUCMD_AddRawCommands(const u32* cmd, u32 size)
|
||||
gpuCmdBufOffset+=size;
|
||||
}
|
||||
|
||||
void GPUCMD_Add(u32 header, const u32* param, u32 paramlength)
|
||||
static void GPUCMD_AddInternal(u32 header, const u32* param, u32 paramlength)
|
||||
{
|
||||
if(!paramlength)paramlength=1;
|
||||
if(!gpuCmdBuf || gpuCmdBufOffset+paramlength+1>gpuCmdBufSize)
|
||||
svcBreak(USERBREAK_PANIC); // Shouldn't happen.
|
||||
|
||||
paramlength--;
|
||||
header|=(paramlength&0x7ff)<<20;
|
||||
header|=(paramlength&0xff)<<20;
|
||||
|
||||
gpuCmdBuf[gpuCmdBufOffset]=param ? param[0] : 0;
|
||||
gpuCmdBuf[gpuCmdBufOffset+1]=header;
|
||||
@ -45,6 +44,20 @@ void GPUCMD_Add(u32 header, const u32* param, u32 paramlength)
|
||||
if(paramlength&1)gpuCmdBuf[gpuCmdBufOffset++]=0x00000000; //alignment
|
||||
}
|
||||
|
||||
void GPUCMD_Add(u32 header, const u32* param, u32 paramlength)
|
||||
{
|
||||
if(!paramlength)paramlength=1;
|
||||
|
||||
while(paramlength)
|
||||
{
|
||||
u32 remaining = paramlength > 0x100 ? 0x100 : paramlength;
|
||||
GPUCMD_AddInternal(header, param, remaining);
|
||||
param += remaining;
|
||||
paramlength -= remaining;
|
||||
if(header & BIT(31)) header += remaining;
|
||||
}
|
||||
}
|
||||
|
||||
void GPUCMD_Split(u32** addr, u32* size)
|
||||
{
|
||||
GPUCMD_AddWrite(GPUREG_FINALIZE, 0x12345678);
|
||||
|
Loading…
Reference in New Issue
Block a user