Is there any sample code around for using the headphone remote? I cant find any in the sdk so.
Thanks
PSP Headphone Remote
I used the PSPMediaCenter gui.c as an example to test a piece of code on the PSP which would detect if the PLAYPAUSE key was pressed however I get the following message from the PSP "The game could not be started (80020001)". I am using make kxploit as I have a 1.5fw PSP and dont get any errors when compiling.
main.c
makefile
Any help would be appreciated I am scratching my head on this one and will probably go bald if I keep it up :)
main.c
Code: Select all
#include <pspkernel.h>
#include <pspdebug.h>
#include <pspctrl.h>
#include <psphprm.h>
PSP_MODULE_INFO("Remote Code Display", 0, 1, 1);
#define printf pspDebugScreenPrintf
/* Exit callback */
int exit_callback(int arg1, int arg2, void *common) {
sceKernelExitGame();
return 0;
}
/* Callback thread */
int CallbackThread(SceSize args, void *argp) {
int cbid;
cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL);
sceKernelRegisterExitCallback(cbid);
sceKernelSleepThreadCB();
return 0;
}
/* Sets up the callback thread and returns its thread id */
int SetupCallbacks(void) {
int thid = 0;
thid = sceKernelCreateThread("update_thread", CallbackThread, 0x11, 0xFA0, 0, 0);
if(thid >= 0) {
sceKernelStartThread(thid, 0, 0);
}
return thid;
}
int main() {
pspDebugScreenInit();
SetupCallbacks();
u32 remoteButtons;
printf("Please Press The Pause Key");
while(1) {
sceHprmPeekCurrentKey(&remoteButtons);
if(remoteButtons & PSP_HPRM_PLAYPAUSE){
break;
}
}
printf("Pause Key Pressed");
sceKernelSleepThread();
return 0;
}
Code: Select all
TARGET = remote
OBJS = main.o
CFLAGS = -O2 -G0 -Wall
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)
EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = Remote Code Display
PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak
LIBS += -lpsphprm_driver
Any help would be appreciated I am scratching my head on this one and will probably go bald if I keep it up :)