diff --git a/src/Graphics_PSP.c b/src/Graphics_PSP.c index d4df3befc..1d6df08cc 100644 --- a/src/Graphics_PSP.c +++ b/src/Graphics_PSP.c @@ -5,6 +5,7 @@ #include "Logger.h" #include "Window.h" +#include #include #include #include @@ -71,7 +72,7 @@ static void guInit(void) { sceGuDisplay(GU_TRUE); } -static void GLBackend_Init(void); +static GfxResourceID white_square; void Gfx_Create(void) { Gfx.MaxTexWidth = 512; Gfx.MaxTexHeight = 512; @@ -79,11 +80,20 @@ void Gfx_Create(void) { MakeIndices(gfx_indices, GFX_MAX_INDICES); guInit(); InitDefaultResources(); + + // 1x1 dummy white texture + struct Bitmap bmp; + BitmapCol pixels[1] = { BITMAPCOLOR_WHITE }; + Bitmap_Init(bmp, 1, 1, pixels); + white_square = Gfx_CreateTexture(&bmp, 0, false); +} + +void Gfx_Free(void) { + FreeDefaultResources(); + Gfx_DeleteTexture(&white_square); } cc_bool Gfx_TryRestoreContext(void) { return true; } - -void Gfx_Free(void) { FreeDefaultResources(); } void Gfx_RestoreState(void) { } void Gfx_FreeState(void) { } #define GU_Toggle(cap) if (enabled) { sceGuEnable(cap); } else { sceGuDisable(cap); } @@ -139,6 +149,8 @@ void Gfx_DisableMipmaps(void) { } void Gfx_BindTexture(GfxResourceID texId) { CCTexture* tex = (CCTexture*)texId; + if (!tex) tex = white_square; + sceGuTexMode(GU_PSM_8888,0,0,0); sceGuTexImage(0, tex->width, tex->height, tex->width, tex->pixels); } diff --git a/src/Platform_PSP.c b/src/Platform_PSP.c index 15201673e..b55664398 100644 --- a/src/Platform_PSP.c +++ b/src/Platform_PSP.c @@ -15,10 +15,8 @@ #include #include #include -#include #include #include -#include #include #include #include @@ -33,6 +31,8 @@ const cc_result ReturnCode_DirectoryExists = EEXIST; PSP_MODULE_INFO("ClassiCube", PSP_MODULE_USER, 1, 0); PSP_MAIN_THREAD_ATTR(PSP_THREAD_ATTR_USER); +PSP_DISABLE_AUTOSTART_PTHREAD() // reduces .elf size by 140 kb + /*########################################################################################################################* *---------------------------------------------------------Memory----------------------------------------------------------*