I've put together a simple program that's supposed to print the name of the current button being pressed. My program is able to compile and be installed on my Vita without issue, but I'm met with a black screen whenever I run it. The program exits when I press both start and select as it should (just like VitaTester), so I can tell that this isn't a matter of input going unrecognized.
Here's my code:
Code: Select all
#include <psp2/kernel/processmgr.h>
#include <psp2/ctrl.h>
#include <stdio.h>
#define TRUE 1
#define FALSE 0
#define EXIT_COMBO (SCE_CTRL_START | SCE_CTRL_SELECT)
SceCtrlData gamepad;
int main(int argc, char *argv[])
{
sceCtrlSetSamplingMode(SCE_CTRL_MODE_ANALOG_WIDE);
fflush(stdout);
while (TRUE)
{
sceKernelPowerTick(0);
sceCtrlPeekBufferPositive(0, &gamepad, 1);
if (gamepad.buttons == EXIT_COMBO)
{
break;
}
if (gamepad.buttons & SCE_CTRL_UP)
{
printf("DPAD Up\n");
}
else if (gamepad.buttons & SCE_CTRL_DOWN)
{
printf("DPAD Down\n");
}
else if (gamepad.buttons & SCE_CTRL_LEFT)
{
printf("DPAD Left\n");
}
else if (gamepad.buttons & SCE_CTRL_RIGHT)
{
printf("DPAD Right\n");
}
else if (gamepad.buttons & SCE_CTRL_CROSS)
{
printf("X\n");
}
else if (gamepad.buttons & SCE_CTRL_CIRCLE)
{
printf("O\n");
}
else if (gamepad.buttons & SCE_CTRL_SQUARE)
{
printf("[]\n");
}
else if (gamepad.buttons & SCE_CTRL_TRIANGLE)
{
printf("^\n");
}
else if (gamepad.buttons & SCE_CTRL_SELECT)
{
printf("Select\n");
}
else if (gamepad.buttons & SCE_CTRL_START)
{
printf("Start\n");
}
else if (gamepad.buttons & SCE_CTRL_LTRIGGER)
{
printf("L\n");
}
else if (gamepad.buttons & SCE_CTRL_RTRIGGER)
{
printf("R\n");
}
}
sceKernelExitProcess(0);
return 0;
}
Advertising