diff --git a/misc/dreamcast/Makefile b/misc/dreamcast/Makefile index f8b71eeb4..4fc838323 100644 --- a/misc/dreamcast/Makefile +++ b/misc/dreamcast/Makefile @@ -2,15 +2,32 @@ BUILD_DIR := build-dreamcast SOURCE_DIRS := src third_party/bearssl/src C_FILES := $(foreach dir,$(SOURCE_DIRS),$(wildcard $(dir)/*.c)) -OBJS := $(notdir $(C_FILES:%.c=%.o)) +OBJS := $(addprefix $(BUILD_DIR)/, $(notdir $(C_FILES:%.c=%.o))) +CFLAGS :=-g -O1 -pipe -fno-math-errno -TARGET := ClassiCube-dc.elf +TARGET := ClassiCube-dc ifeq ($(strip $(KOS_BASE)),) $(error "Please set KOS variables in your environment.") endif -include $(KOS_BASE)/Makefile.rules +default: $(BUILD_DIR) $(TARGET)-scr.bin +$(BUILD_DIR): + mkdir -p $(BUILD_DIR) -$(TARGET): $(OBJS) - kos-cc -o $(TARGET) $(OBJS) \ No newline at end of file +$(BUILD_DIR)/%.o: src/%.c + kos-cc $(CFLAGS) -c $< -o $@ + +$(BUILD_DIR)/%.o: third_party/bearssl/src/%.c + kos-cc $(CFLAGS) -c $< -o $@ + + +$(TARGET).elf: $(OBJS) + kos-cc $< -o $@ + +$(TARGET).bin: $(TARGET).elf + sh-elf-objcopy -R .stack -O binary $(TARGET).elf $(TARGET).bin + +# https://dcemulation.org/phpBB/viewtopic.php?t=105269 +$(TARGET)-scr.bin: $(TARGET).bin + $(KOS_BASE)/utils/scramble/scramble $(TARGET).bin $(TARGET)-scr.bin \ No newline at end of file diff --git a/misc/vita/Makefile b/misc/vita/Makefile index 0f4a2a279..781d89a66 100644 --- a/misc/vita/Makefile +++ b/misc/vita/Makefile @@ -5,7 +5,7 @@ TARGET := ClassiCube-vita BUILD_DIR := build-vita SOURCE_DIRS := src third_party/bearssl/src -CFLAGS += -Wl,-q -Ithird_party/bearssl/inc -O1 +CFLAGS += -Wl,-q -O1 C_FILES := $(foreach dir,$(SOURCE_DIRS),$(wildcard $(dir)/*.c)) OBJS := $(addprefix $(BUILD_DIR)/, $(notdir $(C_FILES:%.c=%.o))) @@ -41,7 +41,7 @@ $(BUILD_DIR)/%.o : src/%.c arm-vita-eabi-gcc -c $(CFLAGS) -o $@ $< $(BUILD_DIR)/%.o : third_party/bearssl/src/%.c - arm-vita-eabi-gcc -c $(CFLAGS) -o $@ $< + arm-vita-eabi-gcc -c $(CFLAGS) -Ithird_party/bearssl/inc -o $@ $< # TODO: There's gotta be a better way of .o to .c than this diff --git a/src/Input.c b/src/Input.c index 7ce09ab19..69a4c01f0 100644 --- a/src/Input.c +++ b/src/Input.c @@ -191,7 +191,8 @@ static void ClearTouches(void) { } #define Pad_Names \ "PAD_A", "PAD_B", "PAD_X", "PAD_Y", "PAD_L", "PAD_R", \ "PAD_LEFT", "PAD_RIGHT", "PAD_UP", "PAD_DOWN", \ -"PAD_START", "PAD_SELECT", "PAD_ZL", "PAD_ZR" +"PAD_START", "PAD_SELECT", "PAD_ZL", "PAD_ZR", \ +"PAD_LSTICK", "PAD_RSTICK" /* Names for each input button when stored to disc */ static const char* const storageNames[INPUT_COUNT] = { diff --git a/src/Input.h b/src/Input.h index 448435d4d..8651275a2 100644 --- a/src/Input.h +++ b/src/Input.h @@ -48,6 +48,7 @@ enum InputButtons { CCPAD_A, CCPAD_B, CCPAD_X, CCPAD_Y, CCPAD_L, CCPAD_R, CCPAD_LEFT, CCPAD_RIGHT, CCPAD_UP, CCPAD_DOWN, CCPAD_START, CCPAD_SELECT, CCPAD_ZL, CCPAD_ZR, + CCPAD_LSTICK, CCPAD_RSTICK, INPUT_COUNT, diff --git a/src/Window_Android.c b/src/Window_Android.c index 4f5e2e572..602061c9c 100644 --- a/src/Window_Android.c +++ b/src/Window_Android.c @@ -26,6 +26,7 @@ static void RefreshWindowBounds(void) { Event_RaiseVoid(&WindowEvents.Resized); } +// https://developer.android.com/ndk/reference/group/input static int MapNativeKey(int code) { if (code >= AKEYCODE_0 && code <= AKEYCODE_9) return (code - AKEYCODE_0) + '0'; if (code >= AKEYCODE_A && code <= AKEYCODE_Z) return (code - AKEYCODE_A) + 'A'; @@ -96,6 +97,8 @@ static int MapNativeKey(int code) { case AKEYCODE_BUTTON_START: return CCPAD_START; case AKEYCODE_BUTTON_SELECT: return CCPAD_SELECT; + case AKEYCODE_BUTTON_THUMBL: return CCPAD_LSTICK; + case AKEYCODE_BUTTON_THUMBR: return CCPAD_RSTICK; } return INPUT_NONE; } diff --git a/src/Window_Web.c b/src/Window_Web.c index 1aadbfe7f..7db422ef7 100644 --- a/src/Window_Web.c +++ b/src/Window_Web.c @@ -540,8 +540,10 @@ static void ProcessGamepadButtons(EmscriptenGamepadEvent* ev) { Input_SetNonRepeatable(CCPAD_ZL, GetGamepadButton(6)); Input_SetNonRepeatable(CCPAD_ZR, GetGamepadButton(7)); - Input_SetNonRepeatable(CCPAD_SELECT, GetGamepadButton(8)); - Input_SetNonRepeatable(CCPAD_START, GetGamepadButton(9)); + Input_SetNonRepeatable(CCPAD_SELECT, GetGamepadButton( 8)); + Input_SetNonRepeatable(CCPAD_START, GetGamepadButton( 9)); + Input_SetNonRepeatable(CCPAD_LSTICK, GetGamepadButton(10)); + Input_SetNonRepeatable(CCPAD_RSTICK, GetGamepadButton(11)); Input_SetNonRepeatable(CCPAD_UP, GetGamepadButton(12)); Input_SetNonRepeatable(CCPAD_DOWN, GetGamepadButton(13)); diff --git a/src/Window_Xbox.c b/src/Window_Xbox.c index d15ab221f..4f7b65ea4 100644 --- a/src/Window_Xbox.c +++ b/src/Window_Xbox.c @@ -130,6 +130,8 @@ static void HandleButtons(xid_gamepad_in* gp) { Input_SetNonRepeatable(CCPAD_START, mods & XINPUT_GAMEPAD_START); Input_SetNonRepeatable(CCPAD_SELECT, mods & XINPUT_GAMEPAD_BACK); + Input_SetNonRepeatable(CCPAD_LSTICK, mods & XINPUT_GAMEPAD_LEFT_THUMB); + Input_SetNonRepeatable(CCPAD_RSTICK, mods & XINPUT_GAMEPAD_RIGHT_THUMB); Input_SetNonRepeatable(CCPAD_LEFT, mods & XINPUT_GAMEPAD_DPAD_LEFT); Input_SetNonRepeatable(CCPAD_RIGHT, mods & XINPUT_GAMEPAD_DPAD_RIGHT);