X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=psp%2Fpsp.c;h=c507e5dade43eb710b08b0911ae7f79f357b8290;hb=6d741b3258179dadc7890f45e155b0a6871ebdc5;hp=b7c8693469f4a72c8cd9fd9d0ba35c911d15e9bc;hpb=fe9e3b2544bdc6ba0fef167a949db4f90511f5ea;p=libpicofe.git diff --git a/psp/psp.c b/psp/psp.c index b7c8693..c507e5d 100644 --- a/psp/psp.c +++ b/psp/psp.c @@ -1,3 +1,8 @@ +// (c) Copyright 2007 notaz, All rights reserved. +// Free for non-commercial use. + +// For commercial use, separate licencing terms must be obtained. + #include #include #include @@ -9,14 +14,43 @@ #include #include #include +#include #include "psp.h" #include "emu.h" #include "../common/lprintf.h" -PSP_MODULE_INFO("PicoDrive", 0, 1, 34); +extern int pico_main(void); + +#ifndef FW15 + +PSP_MODULE_INFO("PicoDrive", 0, 1, 35); PSP_HEAP_SIZE_MAX(); +int main() { return pico_main(); } /* just a wrapper */ + +#else + +PSP_MODULE_INFO("PicoDrive", 0x1000, 1, 35); +PSP_MAIN_THREAD_ATTR(0); + +int main() +{ + SceUID thid; + + /* this is the thing we need the kernel mode for */ + pspSdkInstallNoDeviceCheckPatch(); + + thid = sceKernelCreateThread("pico_main", (SceKernelThreadEntry) pico_main, 32, 0x2000, PSP_THREAD_ATTR_USER, NULL); + if (thid >= 0) + sceKernelStartThread(thid, 0, 0); + sceKernelExitDeleteThread(0); + + return 0; +} + +#endif + unsigned int __attribute__((aligned(16))) guCmdList[GU_CMDLIST_SIZE]; void *psp_screen = VRAM_FB0; @@ -42,7 +76,7 @@ static int power_callback(int unknown, int pwrflags, void *common) lprintf("power_callback: flags: 0x%08X: suspending\n", pwrflags); engineState = PGS_Menu; } - sceDisplayWaitVblankStart(); + //sceDisplayWaitVblankStart(); return 0; } @@ -74,7 +108,7 @@ void psp_init(void) lprintf("entered psp_init, threadId %08x, priority %i\n", main_thread_id, sceKernelGetThreadCurrentPriority()); - thid = sceKernelCreateThread("update_thread", callback_thread, 0x11, 0xFA0, 0, 0); + thid = sceKernelCreateThread("update_thread", callback_thread, 0x11, 0xFA0, 0, NULL); if (thid >= 0) { sceKernelStartThread(thid, 0, 0); @@ -122,6 +156,7 @@ void psp_init(void) void psp_finish(void) { + lprintf("psp_finish..\n"); sceGuTerm(); //sceKernelSleepThread(); @@ -206,6 +241,7 @@ char *psp_get_status_line(void) /* alt logging */ #define LOG_FILE "log.txt" +#ifndef LPRINTF_STDIO typedef struct _log_entry { char buff[256]; @@ -213,6 +249,7 @@ typedef struct _log_entry } log_entry; static log_entry *le_root = NULL; +#endif void lprintf_f(const char *fmt, ...) {