Commit dd9b2daf8dd5bfa4ccdddf1f740aea712cb2e369

Sylvain 2021-10-04T21:56:42

PSP: fixed build

diff --git a/Makefile.psp b/Makefile.psp
index 7ccc809..69d7312 100644
--- a/Makefile.psp
+++ b/Makefile.psp
@@ -1,6 +1,7 @@
 TARGET_LIB = libSDL2.a
 OBJS= src/SDL.o \
       src/SDL_assert.o \
+      src/SDL_dataqueue.o \
       src/SDL_error.o \
       src/SDL_hints.o \
       src/SDL_log.o \
@@ -15,6 +16,7 @@ OBJS= src/SDL.o \
       src/audio/psp/SDL_pspaudio.o \
       src/cpuinfo/SDL_cpuinfo.o \
       src/events/SDL_clipboardevents.o \
+      src/events/SDL_displayevents.o \
       src/events/SDL_dropevents.o \
       src/events/SDL_events.o \
       src/events/SDL_gesture.o \
@@ -29,6 +31,7 @@ OBJS= src/SDL.o \
       src/joystick/SDL_joystick.o \
       src/joystick/SDL_gamecontroller.o \
       src/joystick/psp/SDL_sysjoystick.o \
+      src/joystick/virtual/SDL_virtualjoystick.o \
       src/power/SDL_power.o \
       src/power/psp/SDL_syspower.o \
       src/filesystem/dummy/SDL_sysfilesystem.o \
@@ -77,10 +80,12 @@ OBJS= src/SDL.o \
       src/video/SDL_stretch.o \
       src/video/SDL_surface.o \
       src/video/SDL_video.o \
+      src/video/SDL_yuv.o \
       src/video/psp/SDL_pspevents.o \
       src/video/psp/SDL_pspvideo.o \
       src/video/psp/SDL_pspgl.o \
-      src/video/psp/SDL_pspmouse.o
+      src/video/psp/SDL_pspmouse.o \
+      src/video/yuv2rgb/yuv_rgb.o
 
 INCDIR = ./include
 CFLAGS = -g -O2 -G0 -Wall -D__PSP__ -DHAVE_OPENGL
diff --git a/src/render/psp/SDL_render_psp.c b/src/render/psp/SDL_render_psp.c
index e662704..6a6f585 100644
--- a/src/render/psp/SDL_render_psp.c
+++ b/src/render/psp/SDL_render_psp.c
@@ -56,6 +56,15 @@ static unsigned int __attribute__((aligned(16))) DisplayList[262144];
 #define COL4444(r,g,b,a)    ((r>>4) | ((g>>4)<<4) | ((b>>4)<<8) | ((a>>4)<<12))
 #define COL8888(r,g,b,a)    ((r) | ((g)<<8) | ((b)<<16) | ((a)<<24))
 
+typedef struct
+{
+    SDL_bool viewport_dirty;
+    SDL_Rect viewport;
+    SDL_bool cliprect_enabled_dirty;
+    SDL_bool cliprect_enabled;
+    SDL_bool cliprect_dirty;
+    SDL_Rect cliprect;
+} PSP_DrawStateCache;
 
 typedef struct
 {
@@ -70,6 +79,7 @@ typedef struct
     unsigned int    currentColor;
     int             currentBlendMode;
 
+    PSP_DrawStateCache drawstate;
 } PSP_RenderData;
 
 
@@ -346,12 +356,6 @@ PSP_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
     return 0;
 }
 
-static int
-PSP_SetTextureColorMod(SDL_Renderer * renderer, SDL_Texture * texture)
-{
-    return SDL_Unsupported();
-}
-
 void
 TextureActivate(SDL_Texture * texture)
 {
@@ -373,6 +377,9 @@ TextureActivate(SDL_Texture * texture)
     sceGuTexFunc(GU_TFX_REPLACE, GU_TCC_RGBA);
 }
 
+static int
+PSP_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
+                 const SDL_Rect * rect, void **pixels, int *pitch);
 
 static int
 PSP_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
@@ -469,7 +476,7 @@ PSP_QueueDrawPoints(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL_F
 static int
 PSP_QueueFillRects(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL_FRect * rects, int count)
 {
-    VertV *verts = (GLfloat *) SDL_AllocateRenderVertices(renderer, count * 2 * sizeof (VertV), 4, &cmd->data.draw.first);
+    VertV *verts = (VertV *) SDL_AllocateRenderVertices(renderer, count * 2 * sizeof (VertV), 4, &cmd->data.draw.first);
     int i;
 
     if (!verts) {
@@ -691,7 +698,6 @@ static int
 PSP_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *vertices, size_t vertsize)
 {
     PSP_RenderData *data = (PSP_RenderData *) renderer->driverdata;
-    size_t i;
 
     StartDrawing(renderer);
 
@@ -952,7 +958,6 @@ PSP_CreateRenderer(SDL_Window * window, Uint32 flags)
 
     renderer->WindowEvent = PSP_WindowEvent;
     renderer->CreateTexture = PSP_CreateTexture;
-    renderer->SetTextureColorMod = PSP_SetTextureColorMod;
     renderer->UpdateTexture = PSP_UpdateTexture;
     renderer->LockTexture = PSP_LockTexture;
     renderer->UnlockTexture = PSP_UnlockTexture;