mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-09 07:18:34 -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))
|
||||
OBJS := $(addprefix $(BUILD_DIR)/, $(notdir $(C_FILES:%.c=%.o)))
|
||||
|
||||
# Needed by psvDebugScreenPrintf
|
||||
LIBS += -lm -lSceDisplay_stub -lSceCtrl_stub -lSceTouch_stub -lSceGxm_stub
|
||||
LIBS += -lm -lSceDisplay_stub -lSceCtrl_stub -lSceTouch_stub -lSceGxm_stub -lSceCommonDialog_stub
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
|
@ -90,7 +90,7 @@ int File_Exists(const cc_string* path) {
|
||||
char str[NATIVE_STR_LEN];
|
||||
SceIoStat sb;
|
||||
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) {
|
||||
|
@ -103,17 +103,28 @@ static void HandleButtons(int mods) {
|
||||
Input_SetNonRepeatable(CCPAD_R, mods & SCE_CTRL_RTRIGGER);
|
||||
}
|
||||
|
||||
static void ProcessCircleInput(SceCtrlData* pad, double delta) {
|
||||
float scale = (delta * 60.0) / 16.0f;
|
||||
static void ProcessLCircleInput(SceCtrlData* pad) {
|
||||
int dx = pad->lx - 127;
|
||||
int dy = pad->ly - 127;
|
||||
|
||||
if (Math_AbsI(dx) <= 8) dx = 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) {
|
||||
if (!frontPanel.maxDispX || !frontPanel.maxDispY) {
|
||||
@ -154,12 +165,15 @@ static void ProcessPadInput(double delta) {
|
||||
// TODO: need to use cached version still? like GameCube/Wii
|
||||
|
||||
HandleButtons(pad.buttons);
|
||||
if (Input.RawMode)
|
||||
ProcessCircleInput(&pad, delta);
|
||||
if (Input.RawMode) {
|
||||
ProcessLCircleInput(&pad);
|
||||
ProcessRCircleInput(&pad, delta);
|
||||
}
|
||||
}
|
||||
|
||||
void Window_ProcessEvents(double delta) {
|
||||
/* TODO implement */
|
||||
Input.JoystickMovement = false;
|
||||
|
||||
ProcessPadInput(delta);
|
||||
ProcessTouchInput();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user