mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-10 07:49:57 -04:00
Vita: Add proper left/right circle pad support and fix 'some resources missing' menu always appearing
This commit is contained in:
parent
e6f897dbf3
commit
740c2416d7
@ -9,8 +9,7 @@ CFLAGS += -Wl,-q -Ithird_party/bearssl/inc -O1
|
|||||||
C_FILES := $(foreach dir,$(SOURCE_DIRS),$(wildcard $(dir)/*.c))
|
C_FILES := $(foreach dir,$(SOURCE_DIRS),$(wildcard $(dir)/*.c))
|
||||||
OBJS := $(addprefix $(BUILD_DIR)/, $(notdir $(C_FILES:%.c=%.o)))
|
OBJS := $(addprefix $(BUILD_DIR)/, $(notdir $(C_FILES:%.c=%.o)))
|
||||||
|
|
||||||
# Needed by psvDebugScreenPrintf
|
LIBS += -lm -lSceDisplay_stub -lSceCtrl_stub -lSceTouch_stub -lSceGxm_stub -lSceCommonDialog_stub
|
||||||
LIBS += -lm -lSceDisplay_stub -lSceCtrl_stub -lSceTouch_stub -lSceGxm_stub
|
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
|
@ -90,7 +90,7 @@ int File_Exists(const cc_string* path) {
|
|||||||
char str[NATIVE_STR_LEN];
|
char str[NATIVE_STR_LEN];
|
||||||
SceIoStat sb;
|
SceIoStat sb;
|
||||||
GetNativePath(str, path);
|
GetNativePath(str, path);
|
||||||
return sceIoGetstat(str, &sb) == 0 && (sb.st_attr & SCE_SO_IFREG) != 0;
|
return sceIoGetstat(str, &sb) == 0 && SCE_S_ISREG(sb.st_mode) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
cc_result Directory_Enum(const cc_string* dirPath, void* obj, Directory_EnumCallback callback) {
|
cc_result Directory_Enum(const cc_string* dirPath, void* obj, Directory_EnumCallback callback) {
|
||||||
|
@ -103,17 +103,28 @@ static void HandleButtons(int mods) {
|
|||||||
Input_SetNonRepeatable(CCPAD_R, mods & SCE_CTRL_RTRIGGER);
|
Input_SetNonRepeatable(CCPAD_R, mods & SCE_CTRL_RTRIGGER);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ProcessCircleInput(SceCtrlData* pad, double delta) {
|
static void ProcessLCircleInput(SceCtrlData* pad) {
|
||||||
float scale = (delta * 60.0) / 16.0f;
|
|
||||||
int dx = pad->lx - 127;
|
int dx = pad->lx - 127;
|
||||||
int dy = pad->ly - 127;
|
int dy = pad->ly - 127;
|
||||||
|
|
||||||
if (Math_AbsI(dx) <= 8) dx = 0;
|
if (Math_AbsI(dx) <= 8) dx = 0;
|
||||||
if (Math_AbsI(dy) <= 8) dy = 0;
|
if (Math_AbsI(dy) <= 8) dy = 0;
|
||||||
|
|
||||||
Event_RaiseRawMove(&PointerEvents.RawMoved, dx * scale, dy * scale);
|
if (dx == 0 && dy == 0) return;
|
||||||
|
Input.JoystickMovement = true;
|
||||||
|
Input.JoystickAngle = Math_Atan2(dx, dy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void ProcessRCircleInput(SceCtrlData* pad, double delta) {
|
||||||
|
float scale = (delta * 60.0) / 16.0f;
|
||||||
|
int dx = pad->rx - 127;
|
||||||
|
int dy = pad->ry - 127;
|
||||||
|
|
||||||
|
if (Math_AbsI(dx) <= 8) dx = 0;
|
||||||
|
if (Math_AbsI(dy) <= 8) dy = 0;
|
||||||
|
|
||||||
|
Event_RaiseRawMove(&PointerEvents.RawMoved, dx * scale, dy * scale);
|
||||||
|
}
|
||||||
|
|
||||||
static void ProcessTouchPress(int x, int y) {
|
static void ProcessTouchPress(int x, int y) {
|
||||||
if (!frontPanel.maxDispX || !frontPanel.maxDispY) {
|
if (!frontPanel.maxDispX || !frontPanel.maxDispY) {
|
||||||
@ -154,12 +165,15 @@ static void ProcessPadInput(double delta) {
|
|||||||
// TODO: need to use cached version still? like GameCube/Wii
|
// TODO: need to use cached version still? like GameCube/Wii
|
||||||
|
|
||||||
HandleButtons(pad.buttons);
|
HandleButtons(pad.buttons);
|
||||||
if (Input.RawMode)
|
if (Input.RawMode) {
|
||||||
ProcessCircleInput(&pad, delta);
|
ProcessLCircleInput(&pad);
|
||||||
|
ProcessRCircleInput(&pad, delta);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window_ProcessEvents(double delta) {
|
void Window_ProcessEvents(double delta) {
|
||||||
/* TODO implement */
|
Input.JoystickMovement = false;
|
||||||
|
|
||||||
ProcessPadInput(delta);
|
ProcessPadInput(delta);
|
||||||
ProcessTouchInput();
|
ProcessTouchInput();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user