Skip to content

Commit

Permalink
psp, rendering fix, some build changes
Browse files Browse the repository at this point in the history
  • Loading branch information
irixxxx committed Feb 20, 2024
1 parent f3ae9cb commit 7a5f5d3
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 35 deletions.
2 changes: 0 additions & 2 deletions platform/base_readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 <sd card>/pandora/menu or <sd card>/pandora/desktop.
Expand Down
39 changes: 17 additions & 22 deletions platform/psp/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
7 changes: 4 additions & 3 deletions platform/psp/plat.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
}

Expand Down
8 changes: 4 additions & 4 deletions platform/psp/psp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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);
Expand Down
10 changes: 6 additions & 4 deletions platform/psp/psp.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 7a5f5d3

Please sign in to comment.