2 #include <pspdisplay.h>
6 #include "../common/lprintf.h"
8 PSP_MODULE_INFO("PicoDrive", 0, 1, 34);
10 void *psp_screen = PSP_VRAM_BASE0;
11 static int current_screen = 0; /* front bufer */
15 static int exit_callback(int arg1, int arg2, void *common)
22 static int callback_thread(SceSize args, void *argp)
26 lprintf("callback_thread started with id %i\n", sceKernelGetThreadId());
28 cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL);
29 sceKernelRegisterExitCallback(cbid);
31 sceKernelSleepThreadCB();
40 lprintf("entered psp_init, threadId %i\n", sceKernelGetThreadId());
42 thid = sceKernelCreateThread("update_thread", callback_thread, 0x11, 0xFA0, 0, 0);
45 sceKernelStartThread(thid, 0, 0);
49 sceDisplaySetMode(0, 480, 272);
50 sceDisplaySetFrameBuf(PSP_VRAM_BASE1, 512, PSP_DISPLAY_PIXEL_FORMAT_565, PSP_DISPLAY_SETBUF_NEXTFRAME);
52 psp_screen = PSP_VRAM_BASE0;
58 sceCtrlSetSamplingCycle(0);
59 sceCtrlSetSamplingMode(0);
66 //sceKernelSleepThread();
70 void psp_video_flip(void)
72 sceDisplaySetFrameBuf(psp_screen, 512, PSP_DISPLAY_PIXEL_FORMAT_565, PSP_DISPLAY_SETBUF_NEXTFRAME);
74 psp_screen = current_screen ? PSP_VRAM_BASE1 : PSP_VRAM_BASE0;
77 void psp_video_switch_to_single(void)
79 psp_screen = PSP_VRAM_BASE0;
80 sceDisplaySetFrameBuf(psp_screen, 512, PSP_DISPLAY_PIXEL_FORMAT_565, PSP_DISPLAY_SETBUF_NEXTFRAME);
84 void psp_msleep(int ms)
86 sceKernelDelayThread(ms * 1000);
89 unsigned int psp_pad_read(void)
92 sceCtrlReadBufferPositive(&pad, 1);