PSP: Launcher now doesn't immediately crash

This commit is contained in:
UnknownShadow200 2023-04-06 21:08:56 +10:00
parent 1cd954e31c
commit c07d34a5fc
3 changed files with 47 additions and 8 deletions

View file

@ -244,6 +244,7 @@ typedef cc_uint8 cc_bool;
#define CC_BUILD_CURL
#define CC_BUILD_OPENAL
#define CC_BUILD_PSP
#undef CC_BUILD_FREETYPE
#undef EXTENDED_BLOCKS
#endif
#endif

View file

@ -228,7 +228,8 @@ void Thread_Sleep(cc_uint32 milliseconds) {
}
static int ExecThread(unsigned int argc, void *argv) {
((Thread_StartFunc)argv)();
Thread_StartFunc* func = (Thread_StartFunc*)argv;
(*func)();
return 0;
}
@ -247,7 +248,7 @@ void Thread_Start2(void* handle, Thread_StartFunc func) {
}
void Thread_Detach(void* handle) {
sceKernelDeleteThread((int)handle);
sceKernelDeleteThread((int)handle); // TODO don't call this??
}
void Thread_Join(void* handle) {

View file

@ -6,6 +6,8 @@
#include "Funcs.h"
#include "Bitmap.h"
#include "Errors.h"
#include <pspdisplay.h>
#include <pspge.h>
#define BUFFER_WIDTH 512
#define SCREEN_WIDTH 480
@ -18,8 +20,9 @@ void Window_Init(void) {
DisplayInfo.ScaleX = 1;
DisplayInfo.ScaleY = 1;
WindowInfo.Width = SCREEN_WIDTH;
WindowInfo.Height = SCREEN_HEIGHT;
WindowInfo.Width = SCREEN_WIDTH;
WindowInfo.Height = SCREEN_HEIGHT;
//WindowInfo.Focused = true;
}
static void DoCreateWindow(int _3d) {
@ -72,18 +75,52 @@ cc_result Window_SaveFileDialog(const struct SaveFileDialogArgs* args) {
return ERR_NOT_SUPPORTED;
}
static struct Bitmap fb_bmp;
void Window_AllocFramebuffer(struct Bitmap* bmp) {
/* TODO implement */
bmp->scan0 = (BitmapCol*)Mem_Alloc(bmp->width * bmp->height, 4, "window pixels");
fb_bmp = *bmp;
}
void Window_DrawFramebuffer(Rect2D r) {
/* TODO implement */
void* fb = sceGeEdramGetAddr();
cc_uint32* src;
cc_uint32* dst;
int y;
/* TODO: This probably isn't great and tears, and stuff like that.. */
sceDisplayWaitVblankStart();
sceDisplaySetMode(0, SCREEN_WIDTH, SCREEN_HEIGHT);
sceDisplaySetFrameBuf(fb, BUFFER_WIDTH, PSP_DISPLAY_PIXEL_FORMAT_8888, PSP_DISPLAY_SETBUF_IMMEDIATE);
src = (cc_uint32*)fb_bmp.scan0 + r.X;
dst = (cc_uint32*)fb + r.X;
for (y = r.Y; y < r.Y + r.Height; y++) {
Mem_Copy(dst + y * BUFFER_WIDTH, src + y * fb_bmp.width, r.Width * 4);
}
}
void Window_FreeFramebuffer(struct Bitmap* bmp) {
/* TODO implement */
Mem_Free(bmp->scan0);
}
/*void Window_AllocFramebuffer(struct Bitmap* bmp) {
void* fb = sceGeEdramGetAddr();
bmp->scan0 = fb;
bmp->width = BUFFER_WIDTH;
bmp->height = SCREEN_HEIGHT;
}
void Window_DrawFramebuffer(Rect2D r) {
//sceDisplayWaitVblankStart();
//sceDisplaySetMode(0, SCREEN_WIDTH, SCREEN_HEIGHT);
//sceDisplaySetFrameBuf(sceGeEdramGetAddr(), BUFFER_WIDTH, PSP_DISPLAY_PIXEL_FORMAT_8888, PSP_DISPLAY_SETBUF_IMMEDIATE);
}
void Window_FreeFramebuffer(struct Bitmap* bmp) {
}*/
void Window_OpenKeyboard(struct OpenKeyboardArgs* args) { /* TODO implement */ }
void Window_SetKeyboardText(const cc_string* text) { }
void Window_CloseKeyboard(void) { /* TODO implement */ }
@ -98,4 +135,4 @@ void Window_DisableRawMouse(void) {
RegrabMouse();
Input_RawMode = false;
}
#endif
#endif