partially revived platform support for PSP (unfinished)

just to have a platform with an unusal screen resolution
- suspend/resume handling probably non-working
- no scaling settings
- no image generation
currently no intentions to finish this.
This commit is contained in:
kub 2021-01-10 12:09:18 +01:00
parent f821bb7011
commit cdc6aac4c0
17 changed files with 961 additions and 2468 deletions

View file

@ -21,24 +21,26 @@
#include "psp.h"
#include "emu.h"
#include <pico/pico_int.h>
#include "../common/emu.h"
#include "../common/version.h"
extern int pico_main(void);
extern int pico_main(int argc, char *argv[]);
#ifndef FW15
PSP_MODULE_INFO("PicoDrive", 0, 1, 51);
PSP_MODULE_INFO("PicoDrive", 0, 1, 97);
PSP_HEAP_SIZE_MAX();
int main() { return pico_main(); } /* just a wrapper */
int main(int argc, char *argv[]) { return pico_main(argc, argv); } /* just a wrapper */
#else
PSP_MODULE_INFO("PicoDrive", 0x1000, 1, 51);
PSP_MODULE_INFO("PicoDrive", 0x1000, 1, 97);
PSP_MAIN_THREAD_ATTR(0);
int main()
int main(int argc, char *argv[])
{
SceUID thid;
@ -47,7 +49,7 @@ int main()
thid = sceKernelCreateThread("pico_main", (SceKernelThreadEntry) pico_main, 32, 0x2000, PSP_THREAD_ATTR_USER, NULL);
if (thid >= 0)
sceKernelStartThread(thid, 0, 0);
sceKernelStartThread(thid, argc, argv);
#ifndef GCOV
sceKernelExitDeleteThread(0);
#else
@ -133,7 +135,7 @@ void psp_init(void)
lprintf("\n%s\n", "PicoDrive v" VERSION " " __DATE__ " " __TIME__);
lprintf("running on %08x kernel\n", sceKernelDevkitVersion()),
lprintf("entered psp_init, threadId %08x, priority %i\n", main_thread_id,
sceKernelGetThreadCurrentPriority());
sceKernelGetThreadCurrentPriority());
thid = sceKernelCreateThread("update_thread", callback_thread, 0x11, 0xFA0, 0, NULL);
if (thid >= 0)
@ -153,8 +155,8 @@ void psp_init(void)
sceGuStart(GU_DIRECT, guCmdList);
sceGuDrawBuffer(GU_PSM_5650, (void *)VRAMOFFS_FB0, 512);
sceGuDispBuffer(480, 272, (void *)VRAMOFFS_FB1, 512); // don't care
sceGuClear(GU_COLOR_BUFFER_BIT | GU_DEPTH_BUFFER_BIT);
sceGuDepthBuffer((void *)VRAMOFFS_DEPTH, 512);
sceGuClear(GU_COLOR_BUFFER_BIT | GU_DEPTH_BUFFER_BIT);
sceGuOffset(2048 - (480 / 2), 2048 - (272 / 2));
sceGuViewport(2048, 2048, 480, 272);
sceGuDepthRange(0xc350, 0x2710);
@ -226,11 +228,11 @@ unsigned int psp_pad_read(int blocking)
buttons = pad.Buttons;
// analog..
buttons &= ~(PBTN_NUB_UP|PBTN_NUB_DOWN|PBTN_NUB_LEFT|PBTN_NUB_RIGHT);
if (pad.Lx < 128 - ANALOG_DEADZONE) buttons |= PBTN_NUB_LEFT;
if (pad.Lx > 128 + ANALOG_DEADZONE) buttons |= PBTN_NUB_RIGHT;
if (pad.Ly < 128 - ANALOG_DEADZONE) buttons |= PBTN_NUB_UP;
if (pad.Ly > 128 + ANALOG_DEADZONE) buttons |= PBTN_NUB_DOWN;
buttons &= ~(PSP_NUB_UP|PSP_NUB_DOWN|PSP_NUB_LEFT|PSP_NUB_RIGHT);
if (pad.Lx < 128 - ANALOG_DEADZONE) buttons |= PSP_NUB_LEFT;
if (pad.Lx > 128 + ANALOG_DEADZONE) buttons |= PSP_NUB_RIGHT;
if (pad.Ly < 128 - ANALOG_DEADZONE) buttons |= PSP_NUB_UP;
if (pad.Ly > 128 + ANALOG_DEADZONE) buttons |= PSP_NUB_DOWN;
return buttons;
}