I want to write an application which reads Dualshock 3 buttons input on a PSP go and display the result. here is one:
http://en.wikibooks.org/wiki/PSP_Progra ... tton_Input
but the problem is i need one using sceCtrlPeekBufferPositiveExtra() instead of sceCtrlPeekBufferPositive() as sceCtrlPeekBufferPositive() only returns psp pad values. I know that if you pass arg 1 as "1" to sceCtrlPeekBufferPositiveExtra() it reads ds3 inputs. You might ask how you know this as it isn't documented even in uofw. It is from the DS3 Remapper source code. http://uofw.github.io/uofw/group__Contr ... 4606e13027 viewtopic.php?f=28&t=39588&start=50 (have a look at the spoiler part and see how the sceCtrlReadBuf is patched to pass arg1 (a2) as 1. This works for DS3. have a look at line 980 https://github.com/uofw/uofw/blob/maste ... trl/ctrl.c)
anyways the problem is i have to use SceCtrlExtendInternalCtrlBuffers() before calling sceCtrlPeekBufferPositive() but i have no idea how to do that.
thanks in advance.
tldr; i need a sample button input program which uses SceCtrlPeekBufferPositiveExtra()
EDIT: Tried something but still getting errors. here is my main.c
[spoiler]#include <pspkernel.h>
#include <pspdebug.h>
#include <pspctrl.h>
#include "callback.h"
#define VERS 1
#define REVS 1
PSP_MODULE_INFO("Button Input", PSP_MODULE_USER, VERS, REVS);
PSP_MAIN_THREAD_ATTR(PSP_THREAD_ATTR_USER);
PSP_HEAP_SIZE_MAX();
#define printf pspDebugScreenPrintf
int main()
{
pspDebugScreenInit();
setupExitCallback();
int running = isRunning();
SceCtrlDataExt buttonInput;
sceCtrlSetSamplingCycle(0);
sceCtrlSetSamplingMode(PSP_CTRL_MODE_ANALOG);
while(running)
{
running = isRunning();
pspDebugScreenSetXY(0, 0);
printf("Analog X = %d ", buttonInput.Lx);
printf("Analog Y = %d \n", buttonInput.Ly);
sceCtrlPeekBufferPositiveExtra (1, &buttonInput, 1);
if(buttonInput.Buttons != 0)
{
if(buttonInput.Buttons & PSP_CTRL_START){
printf("Start");
running = 0;
}
if(buttonInput.Buttons & PSP_CTRL_SELECT) printf("Select");
if(buttonInput.Buttons & PSP_CTRL_UP) printf("Up");
if(buttonInput.Buttons & PSP_CTRL_DOWN) printf("Down");
if(buttonInput.Buttons & PSP_CTRL_RIGHT) printf("Right");
if(buttonInput.Buttons & PSP_CTRL_LEFT) printf("Left");
if(buttonInput.Buttons & PSP_CTRL_CROSS) printf("Cross");
if(buttonInput.Buttons & PSP_CTRL_CIRCLE) printf("Circle");
if(buttonInput.Buttons & PSP_CTRL_SQUARE) printf("Square");
if(buttonInput.Buttons & PSP_CTRL_TRIANGLE) printf("Triangle");
if(buttonInput.Buttons & PSP_CTRL_RTRIGGER) printf("R-Trigger");
if(buttonInput.Buttons & PSP_CTRL_LTRIGGER) printf("L-Trigger");
}
}
sceKernelExitGame();
return 0;
}[/spoiler]
i added these lines to pspctrl.h
[spoiler]typedef struct SceCtrlDataExt {
/** The current read frame. */
unsigned int TimeStamp;
/** Bit mask containing zero or more of ::PspCtrlButtons. */
unsigned int Buttons;
/** Analogue stick, X axis. */
unsigned char Lx;
/** Analogue stick, Y axis. */
unsigned char Ly;
/** Reserved. */
unsigned char Rsrv[6];
unsigned int unk1;
unsigned int unk2;
unsigned int unk3;
unsigned int unk4;
unsigned int unk5;
unsigned int unk6;
unsigned int unk7;
unsigned int unk8;
} SceCtrlDataExt;
int sceCtrlPeekBufferPositiveExtra(int arg1, SceCtrlDataExt *pad_data, int count);
int sceCtrlPeekBufferNegativeExtra(int arg1, SceCtrlDataExt *pad_data, int count);
int sceCtrlReadBufferPositiveExtra(int arg1, SceCtrlDataExt *pad_data, int count);
int sceCtrlReadBufferNegativeExtra(int arg1, SceCtrlDataExt *pad_data, int count);[/spoiler]
i still get this. What is wrong?
main.c:(.text+0xcc): undefined reference to `sceCtrlPeekBufferPositiveExtra'
make: *** [ButtonInput.elf] Error 1
Advertising

