From 7a5f5d35be4159aac076993f00ced6f32a079138 Mon Sep 17 00:00:00 2001 From: kub Date: Tue, 20 Feb 2024 22:01:47 +0100 Subject: [PATCH] psp, rendering fix, some build changes --- platform/base_readme.txt | 2 -- platform/psp/Makefile | 39 +++++++++++++++++---------------------- platform/psp/plat.c | 7 ++++--- platform/psp/psp.c | 8 ++++---- platform/psp/psp.h | 10 ++++++---- 5 files changed, 31 insertions(+), 35 deletions(-) diff --git a/platform/base_readme.txt b/platform/base_readme.txt index 5925a4725..d45752157 100644 --- a/platform/base_readme.txt +++ b/platform/base_readme.txt @@ -26,8 +26,6 @@ the root of SD, etc). If you are running a custom firmware, just copy the whole PicoDrive directory to /PSP/GAME or /PSP/GAMEXXX directory in your memory stick (it shouldn't matter which one GAME* directory to use). - -If you are on 1.5, there is a separate KXploited version for it. #endif #ifdef PANDORA Just copy the .pnd to /pandora/menu or /pandora/desktop. diff --git a/platform/psp/Makefile b/platform/psp/Makefile index 6231d1eaf..2caf4aedf 100644 --- a/platform/psp/Makefile +++ b/platform/psp/Makefile @@ -6,32 +6,27 @@ $(error need VER) endif endif +include ../../config.mak + +#PSPSDK ?= $(shell psp-config --pspsdk-path) +#include $(PSPSDK)/lib/build.mak + +#PSP_EBOOT_TITLE = PicoDrive +#PSP_EBOOT_ICON = data/icon.png + +#EBOOT.PBP: + ../../tools/textfilter: ../../tools/textfilter.c make -C ../../tools/ textfilter readme.txt: ../../tools/textfilter ../base_readme.txt ../../ChangeLog ../../tools/textfilter ../base_readme.txt $@ PSP -# ? rel: ../../EBOOT.PBP readme.txt ../game_def.cfg - mkdir -p PicoDrive/skin/ - cp $^ PicoDrive/ - cp skin/* PicoDrive/skin/ - zip -9 -r ../../PicoDrive_psp_$(VER).zip PicoDrive - rm -rf PicoDrive - mkdir bin_to_cso_mp3 - cp ../../tools/bin_to_cso_mp3/* bin_to_cso_mp3/ - zip -9 -r ../../PicoDrive_psp_$(VER).zip bin_to_cso_mp3 - rm -rf bin_to_cso_mp3 - -rel_kxploit: readme.txt ../game_def.cfg - mkdir -p PicoDrive/skin/ - cp $^ PicoDrive/ - cp skin/* PicoDrive/skin/ - zip -9 -r ../../PicoDrive_psp_$(VER)_kxploit.zip PicoDrive - zip -9 -r ../../PicoDrive_psp_$(VER)_kxploit.zip PicoDrive% - mkdir bin_to_cso_mp3 - cp ../../tools/bin_to_cso_mp3/* bin_to_cso_mp3/ - zip -9 -r ../../PicoDrive_psp_$(VER)_kxploit.zip bin_to_cso_mp3 - rm -rf bin_to_cso_mp3 - + mkdir -p out/PicoDrive/skin/ out/bin_to_cso_mp3 + cp $^ out/PicoDrive/ + cp ../../skin/* out/PicoDrive/skin/ + #mkdir -p out/bin_to_cso_mp3 + #cp ../../tools/bin_to_cso_mp3/* out/bin_to_cso_mp3/ + cd out && zip -9 -r ../../../PicoDrive_psp_$(VER).zip * + rm -rf out diff --git a/platform/psp/plat.c b/platform/psp/plat.c index 64ae04325..374799652 100644 --- a/platform/psp/plat.c +++ b/platform/psp/plat.c @@ -70,15 +70,16 @@ void plat_target_finish(void) /* display a completed frame buffer and prepare a new render buffer */ void plat_video_flip(void) { - int offs = (psp_screen == VRAM_FB0) ? VRAMOFFS_FB0 : VRAMOFFS_FB1; + unsigned long offs; g_menubg_src_ptr = psp_screen; sceGuSync(0, 0); // sync with prev psp_video_flip(currentConfig.EmuOpt & EOPT_VSYNC, 0); + offs = (unsigned long)psp_screen - VRAM_ADDR; // back buffer offset sceGuStart(GU_DIRECT, guCmdList); - sceGuDrawBuffer(GU_PSM_5650, (void *)offs, 512); // point to back buffer + sceGuDrawBuffer(GU_PSM_5650, (void *)offs, 512); sceGuClearColor(0); sceGuClearDepth(0); sceGuClear(GU_COLOR_BUFFER_BIT | GU_DEPTH_BUFFER_BIT); @@ -87,7 +88,7 @@ void plat_video_flip(void) sceGuFinish(); - g_screen_ptr = VRAM_CACHED_STUFF + (psp_screen - VRAM_FB0); + g_screen_ptr = VRAM_CACHED_STUFF + offs; plat_video_set_buffer(g_screen_ptr); } diff --git a/platform/psp/psp.c b/platform/psp/psp.c index 0a53cce7e..36aaea337 100644 --- a/platform/psp/psp.c +++ b/platform/psp/psp.c @@ -65,9 +65,9 @@ int psp_unhandled_suspend = 0; unsigned int __attribute__((aligned(16))) guCmdList[GU_CMDLIST_SIZE]; -void *psp_screen = VRAM_FB0; +void *psp_screen = VRAM_FB0; /* back buffer */ -static int current_screen = 0; /* front bufer */ +static int current_screen = 1; /* front buffer */ static SceUID main_thread_id = -1; @@ -195,8 +195,8 @@ void psp_finish(void) void psp_video_flip(int wait_vsync, int other) { - unsigned long fb = (unsigned long)psp_screen & ~0x40000000; - if (other) fb ^= 0x44000; + unsigned long fb = (unsigned long)psp_screen - VRAM_ADDR; + if (other) fb ^= (VRAMOFFS_FB0 ^ VRAMOFFS_FB1); if (wait_vsync) sceDisplayWaitVblankStart(); sceDisplaySetFrameBuf((void *)fb, 512, PSP_DISPLAY_PIXEL_FORMAT_565, PSP_DISPLAY_SETBUF_IMMEDIATE); diff --git a/platform/psp/psp.h b/platform/psp/psp.h index c8d4de829..f003ba39d 100644 --- a/platform/psp/psp.h +++ b/platform/psp/psp.h @@ -25,11 +25,13 @@ void psp_msleep(int ms); #define VRAMOFFS_DEPTH 0x00088000 #define VRAMOFFS_STUFF 0x000cc000 -#define VRAM_FB0 ((void *) (0x44000000+VRAMOFFS_FB0)) -#define VRAM_FB1 ((void *) (0x44000000+VRAMOFFS_FB1)) -#define VRAM_STUFF ((void *) (0x44000000+VRAMOFFS_STUFF)) +#define VRAM_ADDR 0x44000000 +#define VRAM_FB0 ((void *) (VRAM_ADDR+VRAMOFFS_FB0)) +#define VRAM_FB1 ((void *) (VRAM_ADDR+VRAMOFFS_FB1)) +#define VRAM_STUFF ((void *) (VRAM_ADDR+VRAMOFFS_STUFF)) -#define VRAM_CACHED_STUFF ((void *) (0x04000000+VRAMOFFS_STUFF)) +#define VRAM_CACHEDADDR 0x04000000 +#define VRAM_CACHED_STUFF ((void *) (VRAM_CACHEDADDR+VRAMOFFS_STUFF)) #define GU_CMDLIST_SIZE (16*1024)