27 lines
706 B
C
27 lines
706 B
C
/**
|
|
* Copyright (c) 2025 Dominic Masters
|
|
*
|
|
* This software is released under the MIT License.
|
|
* https://opensource.org/licenses/MIT
|
|
*/
|
|
|
|
#include "duskpsp.h"
|
|
#include "input.h"
|
|
|
|
uint8_t inputStateGet() {
|
|
SceCtrlData pad;
|
|
sceCtrlReadBufferPositive(&pad, 1);
|
|
|
|
if(pad.Buttons == 0) return 0;
|
|
|
|
uint8_t state = 0;
|
|
if(pad.Buttons & PSP_CTRL_UP) state |= INPUT_BIND_UP;
|
|
if(pad.Buttons & PSP_CTRL_DOWN) state |= INPUT_BIND_DOWN;
|
|
if(pad.Buttons & PSP_CTRL_LEFT) state |= INPUT_BIND_LEFT;
|
|
if(pad.Buttons & PSP_CTRL_RIGHT) state |= INPUT_BIND_RIGHT;
|
|
|
|
if(pad.Buttons & PSP_CTRL_CROSS) state |= INPUT_BIND_ACTION;
|
|
if(pad.Buttons & PSP_CTRL_CIRCLE) state |= INPUT_BIND_CANCEL;
|
|
|
|
return state;
|
|
} |