gspWaitForEvent(): add nextEvent parameter; GSPEVENT_count -> '_MAX
This commit is contained in:
parent
0d3ed55b88
commit
af93d8e10c
@ -36,7 +36,8 @@ typedef enum
|
||||
GSPEVENT_PPF,
|
||||
GSPEVENT_P3D,
|
||||
GSPEVENT_DMA,
|
||||
GSPEVENT_count, // used to know how many events there are
|
||||
|
||||
GSPEVENT_MAX, // used to know how many events there are
|
||||
} GSP_Event;
|
||||
|
||||
Result gspInit();
|
||||
@ -44,15 +45,15 @@ void gspExit();
|
||||
|
||||
Result gspInitEventHandler(Handle gspEvent, vu8* gspSharedMem, u8 gspThreadId);
|
||||
void gspExitEventHandler();
|
||||
void gspWaitForEvent(GSP_Event id);
|
||||
#define gspWaitForPSC0() gspWaitForEvent(GSPEVENT_PSC0)
|
||||
#define gspWaitForPSC1() gspWaitForEvent(GSPEVENT_PSC1)
|
||||
void gspWaitForEvent(GSP_Event id, bool nextEvent);
|
||||
#define gspWaitForPSC0() gspWaitForEvent(GSPEVENT_PSC0, false)
|
||||
#define gspWaitForPSC1() gspWaitForEvent(GSPEVENT_PSC1, false)
|
||||
#define gspWaitForVBlank() gspWaitForVBlank0()
|
||||
#define gspWaitForVBlank0() gspWaitForEvent(GSPEVENT_VBlank0)
|
||||
#define gspWaitForVBlank1() gspWaitForEvent(GSPEVENT_VBlank1)
|
||||
#define gspWaitForPPF() gspWaitForEvent(GSPEVENT_PPF)
|
||||
#define gspWaitForP3D() gspWaitForEvent(GSPEVENT_P3D)
|
||||
#define gspWaitForDMA() gspWaitForEvent(GSPEVENT_DMA)
|
||||
#define gspWaitForVBlank0() gspWaitForEvent(GSPEVENT_VBlank0, true)
|
||||
#define gspWaitForVBlank1() gspWaitForEvent(GSPEVENT_VBlank1, true)
|
||||
#define gspWaitForPPF() gspWaitForEvent(GSPEVENT_PPF, false)
|
||||
#define gspWaitForP3D() gspWaitForEvent(GSPEVENT_P3D, false)
|
||||
#define gspWaitForDMA() gspWaitForEvent(GSPEVENT_DMA, false)
|
||||
|
||||
Result GSPGPU_AcquireRight(Handle *handle, u8 flags);
|
||||
Result GSPGPU_ReleaseRight(Handle *handle);
|
||||
|
@ -8,7 +8,7 @@
|
||||
#define GSP_EVENT_STACK_SIZE 0x1000
|
||||
|
||||
Handle gspGpuHandle=0;
|
||||
Handle gspEvents[GSPEVENT_count];
|
||||
Handle gspEvents[GSPEVENT_MAX];
|
||||
u64 gspEventStack[GSP_EVENT_STACK_SIZE/sizeof(u64)]; //u64 so that it's 8-byte aligned
|
||||
volatile bool gspRunEvents;
|
||||
Handle gspEventThread;
|
||||
@ -32,7 +32,7 @@ Result gspInitEventHandler(Handle _gspEvent, vu8* _gspSharedMem, u8 gspThreadId)
|
||||
{
|
||||
// Create events
|
||||
int i;
|
||||
for (i = 0; i < GSPEVENT_count; i ++)
|
||||
for (i = 0; i < GSPEVENT_MAX; i ++)
|
||||
{
|
||||
Result rc = svcCreateEvent(&gspEvents[i], 0);
|
||||
if (rc != 0)
|
||||
@ -60,14 +60,17 @@ void gspExitEventHandler()
|
||||
|
||||
// Free events
|
||||
int i;
|
||||
for (i = 0; i < GSPEVENT_count; i ++)
|
||||
for (i = 0; i < GSPEVENT_MAX; i ++)
|
||||
svcCloseHandle(gspEvents[i]);
|
||||
}
|
||||
|
||||
void gspWaitForEvent(GSP_Event id)
|
||||
void gspWaitForEvent(GSP_Event id, bool nextEvent)
|
||||
{
|
||||
svcClearEvent(gspEvents[id]);
|
||||
if (nextEvent)
|
||||
svcClearEvent(gspEvents[id]);
|
||||
svcWaitSynchronization(gspEvents[id], U64_MAX);
|
||||
if (!nextEvent)
|
||||
svcClearEvent(gspEvents[id]);
|
||||
}
|
||||
|
||||
void gspEventThreadMain(u32 arg)
|
||||
@ -87,7 +90,7 @@ void gspEventThreadMain(u32 arg)
|
||||
int curEvt = gspEventData[0xC + cur];
|
||||
cur --;
|
||||
if (cur < 0) cur += 0x34;
|
||||
if (curEvt >= GSPEVENT_count) continue;
|
||||
if (curEvt >= GSPEVENT_MAX) continue;
|
||||
svcSignalEvent(gspEvents[curEvt]);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user