* Make the GSP event handler signal events in the right order (essential for proper PICA200 sync)

* Add some comments about the GSP events (based on my observations, may not be right)
This commit is contained in:
StapleButter 2014-09-13 17:01:20 +02:00
parent ad08977e37
commit 8b27dbe623
2 changed files with 7 additions and 7 deletions

View File

@ -37,12 +37,12 @@ typedef struct
typedef enum typedef enum
{ {
GSPEVENT_PSC0 = 0, GSPEVENT_PSC0 = 0, // memory fill completed
GSPEVENT_PSC1, GSPEVENT_PSC1,
GSPEVENT_VBlank0, GSPEVENT_VBlank0,
GSPEVENT_VBlank1, GSPEVENT_VBlank1,
GSPEVENT_PPF, GSPEVENT_PPF, // display transfer finished
GSPEVENT_P3D, GSPEVENT_P3D, // command list processing finished
GSPEVENT_DMA, GSPEVENT_DMA,
GSPEVENT_MAX, // used to know how many events there are GSPEVENT_MAX, // used to know how many events there are

View File

@ -85,15 +85,15 @@ void gspEventThreadMain(u32 arg)
svcClearEvent(gspEvent); svcClearEvent(gspEvent);
int count = gspEventData[1]; int count = gspEventData[1];
int last = gspEventData[0] + count; int cur = gspEventData[0];
int last = cur + count;
while (last >= 0x34) last -= 0x34; while (last >= 0x34) last -= 0x34;
int cur = last;
int i; int i;
for (i = 0; i < count; i ++) for (i = 0; i < count; i ++)
{ {
int curEvt = gspEventData[0xC + cur]; int curEvt = gspEventData[0xC + cur];
cur --; cur ++;
if (cur < 0) cur += 0x34; if (cur >= 0x34) cur -= 0x34;
if (curEvt >= GSPEVENT_MAX) continue; if (curEvt >= GSPEVENT_MAX) continue;
svcSignalEvent(gspEvents[curEvt]); svcSignalEvent(gspEvents[curEvt]);
} }