Make PSP version to render the image it-self instead of using RetroArch
This commit is contained in:
parent
5afe4c2a39
commit
e040afd35d
43
libretro.c
43
libretro.c
|
@ -93,6 +93,46 @@ static inline void deinit_context_switch(void)
|
||||||
co_delete(cpu_thread);
|
co_delete(cpu_thread);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static uint32_t next_pow2(uint32_t v)
|
||||||
|
{
|
||||||
|
v--;
|
||||||
|
v |= v >> 1;
|
||||||
|
v |= v >> 2;
|
||||||
|
v |= v >> 4;
|
||||||
|
v |= v >> 8;
|
||||||
|
v |= v >> 16;
|
||||||
|
v++;
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void video_run(void) {
|
||||||
|
#if defined(PSP)
|
||||||
|
static unsigned int __attribute__((aligned(16))) d_list[32];
|
||||||
|
void* texture_vram_p = NULL;
|
||||||
|
int texture_size = (GBA_SCREEN_WIDTH*GBA_SCREEN_HEIGHT*2);
|
||||||
|
|
||||||
|
texture_vram_p = (void*) (0x44200000 - texture_size); /* max VRAM address - frame size */
|
||||||
|
|
||||||
|
sceKernelDcacheWritebackRange(gba_screen_pixels, texture_size);
|
||||||
|
|
||||||
|
sceGuStart(GU_DIRECT, d_list);
|
||||||
|
sceGuTexMode(GU_PSM_5650, 0, 0, GU_FALSE);
|
||||||
|
sceGuCopyImage(GU_PSM_5650, 0, 0, GBA_SCREEN_WIDTH, GBA_SCREEN_HEIGHT, GBA_SCREEN_WIDTH,
|
||||||
|
gba_screen_pixels, 0, 0, GBA_SCREEN_WIDTH, texture_vram_p);
|
||||||
|
sceGuTexImage(0, next_pow2(GBA_SCREEN_WIDTH), next_pow2(GBA_SCREEN_HEIGHT), GBA_SCREEN_WIDTH, texture_vram_p);
|
||||||
|
sceGuTexFunc(GU_TFX_REPLACE, GU_TCC_RGB);
|
||||||
|
sceGuDisable(GU_BLEND);
|
||||||
|
|
||||||
|
sceGuFinish();
|
||||||
|
|
||||||
|
video_cb(texture_vram_p, GBA_SCREEN_WIDTH, GBA_SCREEN_HEIGHT,
|
||||||
|
GBA_SCREEN_PITCH * 2);
|
||||||
|
#else
|
||||||
|
video_cb(gba_screen_pixels, GBA_SCREEN_WIDTH, GBA_SCREEN_HEIGHT,
|
||||||
|
GBA_SCREEN_PITCH * 2);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef PERF_TEST
|
#ifdef PERF_TEST
|
||||||
|
|
||||||
extern struct retro_perf_callback perf_cb;
|
extern struct retro_perf_callback perf_cb;
|
||||||
|
@ -585,8 +625,7 @@ void retro_run(void)
|
||||||
|
|
||||||
render_audio();
|
render_audio();
|
||||||
|
|
||||||
video_cb(gba_screen_pixels, GBA_SCREEN_WIDTH, GBA_SCREEN_HEIGHT,
|
video_run();
|
||||||
GBA_SCREEN_PITCH * 2);
|
|
||||||
|
|
||||||
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE_UPDATE, &updated) && updated)
|
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE_UPDATE, &updated) && updated)
|
||||||
check_variables(0);
|
check_variables(0);
|
||||||
|
|
Loading…
Reference in New Issue