mirror of
https://github.com/libretro/RetroArch
synced 2025-03-15 22:21:01 +00:00
Merge pull request #9964 from fjtrujy/psp/DevelopmentImprovements
[Psp] Development improvements
This commit is contained in:
commit
ea49348db2
27
.vscode/launch.json
vendored
27
.vscode/launch.json
vendored
@ -40,6 +40,31 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
{
|
||||
"name": "PSP-GDB Debugger",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/retroarchpsp.elf",
|
||||
"stopAtEntry": false,
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [],
|
||||
"setupCommands": [
|
||||
{
|
||||
"text": "symbol-file ${workspaceFolder}/retroarchpsp.elf",
|
||||
"description": "read symbols for elf file",
|
||||
"ignoreFailures": true
|
||||
},
|
||||
{
|
||||
"description": "Enable all-exceptions",
|
||||
"text": "-exec \"catch throw\"",
|
||||
"ignoreFailures": true
|
||||
}
|
||||
],
|
||||
"showDisplayString": true,
|
||||
"targetArchitecture": "mips",
|
||||
"MIMode": "gdb",
|
||||
"miDebuggerPath": "/usr/local/pspdev/bin/psp-gdb",
|
||||
"miDebuggerServerAddress": "127.0.0.1:10001",
|
||||
}
|
||||
]
|
||||
}
|
@ -56,5 +56,20 @@ PSP_OBJECTS = griffin/griffin.o bootstrap/psp1/kernel_functions.o
|
||||
|
||||
OBJS = $(PSP_OBJECTS)
|
||||
|
||||
pspsh-debug:
|
||||
pspsh -e reset
|
||||
read -p "Start debugger in VSCode and press any key to continue... \n" -n1 -s
|
||||
# pspsh -e debug ./retroarchpsp.prx
|
||||
pspsh
|
||||
|
||||
pspsh-run:
|
||||
pspsh -e reset
|
||||
pspsh -e ./retroarchpsp.prx
|
||||
pspsh
|
||||
|
||||
debug: clean all pspsh-debug
|
||||
|
||||
run: clean all pspsh-run
|
||||
|
||||
PSPSDK=$(shell psp-config --pspsdk-path)
|
||||
include $(PSPSDK)/lib/build.mak
|
||||
|
@ -29,6 +29,8 @@ void genode_free_secondary_stack(void *stack);
|
||||
#include "ppc.c"
|
||||
#elif defined(__aarch64__)
|
||||
#include "aarch64.c"
|
||||
#elif defined(PSP)
|
||||
#include "psp1.c"
|
||||
#elif defined VITA
|
||||
#include "scefiber.c"
|
||||
#elif defined(__ARM_EABI__) || defined(__arm__)
|
||||
|
45
libretro-common/libco/psp1.c
Normal file
45
libretro-common/libco/psp1.c
Normal file
@ -0,0 +1,45 @@
|
||||
#define LIBCO_C
|
||||
#include "libco.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <pspthreadman.h>
|
||||
|
||||
/* Since cothread_t is a void pointer it must contain an address. We can't return a reference to a local variable
|
||||
* because it would go out of scope, so we create a static variable instead so we can return a reference to it.
|
||||
*/
|
||||
static SceUID active_thread_id = 0;
|
||||
|
||||
cothread_t co_active()
|
||||
{
|
||||
active_thread_id = sceKernelGetThreadId();
|
||||
return &active_thread_id;
|
||||
}
|
||||
|
||||
cothread_t co_create(unsigned int size, void (*entrypoint)(void))
|
||||
{
|
||||
/* Similar scenario as with active_thread_id except there will only be one active_thread_id while there could be many
|
||||
* new threads each with their own handle, so we create them on the heap instead and delete them manually when they're
|
||||
* no longer needed in co_delete().
|
||||
*/
|
||||
cothread_t handle = malloc(sizeof(cothread_t));
|
||||
|
||||
/* SceKernelThreadEntry has a different signature than entrypoint, but in practice this seems to work */
|
||||
SceUID new_thread_id = sceKernelCreateThread("cothread", (SceKernelThreadEntry)entrypoint, 0x12, size, 0, NULL);
|
||||
sceKernelStartThread(new_thread_id, 0, NULL);
|
||||
|
||||
*(SceUID *)handle = new_thread_id;
|
||||
return handle;
|
||||
}
|
||||
|
||||
void co_delete(cothread_t handle)
|
||||
{
|
||||
sceKernelTerminateDeleteThread(*(SceUID *)handle);
|
||||
free(handle);
|
||||
}
|
||||
|
||||
void co_switch(cothread_t handle)
|
||||
{
|
||||
sceKernelWakeupThread(*(SceUID *)handle);
|
||||
/* Sleep the currently active thread so the new thread can start */
|
||||
sceKernelSleepThread();
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user