Files
dusk/src/duskpsp/main.c
2025-08-05 15:59:12 -05:00

46 lines
933 B
C

/**
* Copyright (c) 2025 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#include "display/render.h"
#include "game.h"
int_t exit_callback(int arg1, int arg2, void *common) {
sceKernelExitGame();
return 0;
}
int_t callback_thread(SceSize args, void *argp) {
int cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL);
sceKernelRegisterExitCallback(cbid);
sceKernelSleepThreadCB();
return 0;
}
int_t setup_callbacks(void) {
int thid = sceKernelCreateThread("update_thread", callback_thread, 0x11, 0xFA0, 0, 0);
if(thid >= 0) {
sceKernelStartThread(thid, 0, 0);
}
return thid;
}
void main(void) {
setup_callbacks();
renderInit();
gameInit();
sceCtrlSetSamplingCycle(0);
sceCtrlSetSamplingMode(PSP_CTRL_MODE_ANALOG);
while(true) {
gameUpdate();
renderDraw();
}
gameDispose();
renderDispose();
}