diff --git a/main/adapter/adapter.c b/main/adapter/adapter.c index 2f624da9..ab5f367f 100644 --- a/main/adapter/adapter.c +++ b/main/adapter/adapter.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2022, Jacques Gagnon + * Copyright (c) 2019-2023, Jacques Gagnon * SPDX-License-Identifier: Apache-2.0 */ @@ -341,8 +341,6 @@ void adapter_bridge(struct bt_data *bt_data) { return; } - sys_macro_hdl(ctrl_input, &bt_data->base.flags[PAD]); - #ifdef CONFIG_BLUERETRO_ADAPTER_INPUT_DBG #ifdef CONFIG_BLUERETRO_JSON_DBG printf("{\"log_type\": \"generic_input\""); @@ -372,6 +370,7 @@ void adapter_bridge(struct bt_data *bt_data) { for (uint32_t i = 0; out_mask; i++, out_mask >>= 1) { if (out_mask & 0x1) { ctrl_output[i].index = i; + sys_macro_hdl(&ctrl_output[i], &bt_data->base.flags[PAD]); wired_from_generic(config.out_cfg[i].dev_mode, &ctrl_output[i], &wired_adapter.data[i]); } } diff --git a/main/adapter/adapter.h b/main/adapter/adapter.h index 78499425..3282d706 100644 --- a/main/adapter/adapter.h +++ b/main/adapter/adapter.h @@ -259,6 +259,21 @@ enum { KBM_MAX, }; +enum { + BR_COMBO_BASE_1 = 119, + BR_COMBO_BASE_2, + BR_COMBO_BASE_3, + BR_COMBO_BASE_4, + BR_COMBO_SYS_RESET, + BR_COMBO_BT_INQUIRY, + BR_COMBO_SYS_POWER_OFF, + BR_COMBO_FACTORY_RESET, + BR_COMBO_DEEP_SLEEP, + BR_COMBO_MAX, +}; +#define BR_COMBO_CNT (BR_COMBO_MAX - BR_COMBO_BASE_1) +#define BR_COMBO_MASK 0xFF800000 + enum { AXIS_NONE = -1, AXIS_LX, diff --git a/main/adapter/config.c b/main/adapter/config.c index ce5e28e7..8db661c4 100644 --- a/main/adapter/config.c +++ b/main/adapter/config.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2022, Jacques Gagnon + * Copyright (c) 2019-2023, Jacques Gagnon * SPDX-License-Identifier: Apache-2.0 */ @@ -19,6 +19,10 @@ static uint32_t config_version_magic[] = { CONFIG_MAGIC_V0, CONFIG_MAGIC_V1, CONFIG_MAGIC_V2, + CONFIG_MAGIC_V3, +}; +static uint8_t config_default_combo[BR_COMBO_CNT] = { + PAD_LM, PAD_RM, PAD_MM, PAD_RB_UP, PAD_RB_LEFT, PAD_RB_RIGHT, PAD_RB_DOWN, PAD_LD_UP, PAD_LD_DOWN }; static void config_init_struct(struct config *data); @@ -26,10 +30,12 @@ static int32_t config_load_from_file(struct config *data, char *filename); static int32_t config_store_on_file(struct config *data, char *filename); static int32_t config_v0_update(struct config *data, char *filename); static int32_t config_v1_update(struct config *data, char *filename); +static int32_t config_v2_update(struct config *data, char *filename); static int32_t (*config_ver_update[])(struct config *data, char *filename) = { config_v0_update, config_v1_update, + config_v2_update, NULL, }; @@ -85,6 +91,27 @@ static int32_t config_get_version(uint32_t magic) { return -1; } +static int32_t config_v2_update(struct config *data, char *filename) { + data->magic = CONFIG_MAGIC; + + for (uint32_t i = 0; i < WIRED_MAX_DEV; i++) { + uint32_t j = data->in_cfg[i].map_size; + data->in_cfg[i].map_size += BR_COMBO_CNT; + for (uint32_t k = 0; k < BR_COMBO_CNT; j++, k++) { + data->in_cfg[i].map_cfg[j].src_btn = config_default_combo[k]; + data->in_cfg[i].map_cfg[j].dst_btn = k + BR_COMBO_BASE_1; + data->in_cfg[i].map_cfg[j].dst_id = i; + data->in_cfg[i].map_cfg[j].perc_max = 100; + data->in_cfg[i].map_cfg[j].perc_threshold = 50; + data->in_cfg[i].map_cfg[j].perc_deadzone = 135; + data->in_cfg[i].map_cfg[j].turbo = 0; + data->in_cfg[i].map_cfg[j].algo = 0; + } + } + + return config_store_on_file(data, filename); +} + static void config_init_struct(struct config *data) { data->magic = CONFIG_MAGIC; data->global_cfg.system_cfg = WIRED_AUTO; @@ -97,8 +124,9 @@ static void config_init_struct(struct config *data) { data->out_cfg[i].acc_mode = ACC_NONE; data->in_cfg[i].bt_dev_id = 0x00; /* Not used placeholder */ data->in_cfg[i].bt_subdev_id = 0x00; /* Not used placeholder */ - data->in_cfg[i].map_size = KBM_MAX; - for (uint32_t j = 0; j < KBM_MAX; j++) { + data->in_cfg[i].map_size = KBM_MAX + BR_COMBO_CNT; + uint32_t j = 0; + for (; j < KBM_MAX; j++) { data->in_cfg[i].map_cfg[j].src_btn = j; data->in_cfg[i].map_cfg[j].dst_btn = j; data->in_cfg[i].map_cfg[j].dst_id = i; @@ -108,6 +136,16 @@ static void config_init_struct(struct config *data) { data->in_cfg[i].map_cfg[j].turbo = 0; data->in_cfg[i].map_cfg[j].algo = 0; } + for (uint32_t k = 0; k < BR_COMBO_CNT; j++, k++) { + data->in_cfg[i].map_cfg[j].src_btn = config_default_combo[k]; + data->in_cfg[i].map_cfg[j].dst_btn = k + BR_COMBO_BASE_1; + data->in_cfg[i].map_cfg[j].dst_id = i; + data->in_cfg[i].map_cfg[j].perc_max = 100; + data->in_cfg[i].map_cfg[j].perc_threshold = 50; + data->in_cfg[i].map_cfg[j].perc_deadzone = 135; + data->in_cfg[i].map_cfg[j].turbo = 0; + data->in_cfg[i].map_cfg[j].algo = 0; + } } } diff --git a/main/adapter/config.h b/main/adapter/config.h index 0bbef288..925203dd 100644 --- a/main/adapter/config.h +++ b/main/adapter/config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2022, Jacques Gagnon + * Copyright (c) 2019-2023, Jacques Gagnon * SPDX-License-Identifier: Apache-2.0 */ @@ -11,8 +11,9 @@ #define CONFIG_MAGIC_V0 0xA5A5A5A5 #define CONFIG_MAGIC_V1 0xF380D824 #define CONFIG_MAGIC_V2 0x1782DB8A -#define CONFIG_MAGIC CONFIG_MAGIC_V2 -#define CONFIG_VERSION 2 +#define CONFIG_MAGIC_V3 0xAB89C69A +#define CONFIG_MAGIC CONFIG_MAGIC_V3 +#define CONFIG_VERSION 3 #define ADAPTER_MAPPING_MAX 128 enum { diff --git a/main/adapter/macro.c b/main/adapter/macro.c index fb35d38e..a3a71935 100644 --- a/main/adapter/macro.c +++ b/main/adapter/macro.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2022, Jacques Gagnon + * Copyright (c) 2019-2023, Jacques Gagnon * SPDX-License-Identifier: Apache-2.0 */ @@ -8,12 +8,14 @@ #include "system/manager.h" #include "macro.h" -#define MACRO_BASE (BIT(PAD_MM) | BIT(PAD_LM) | BIT(PAD_RM)) -#define SYS_RESET (MACRO_BASE | BIT(PAD_RB_LEFT)) -#define BT_INQUIRY (MACRO_BASE | BIT(PAD_RB_RIGHT)) -#define SYS_POWER_OFF (MACRO_BASE | BIT(PAD_RB_DOWN)) -#define FACTORY_RESET (MACRO_BASE | BIT(PAD_LD_UP) | BIT(PAD_RB_UP)) -#define DEEP_SLEEP (MACRO_BASE | BIT(PAD_LD_DOWN) | BIT(PAD_RB_UP)) +#define BIT32(n) (1UL << ((n) & 0x1F)) + +#define MACRO_BASE (BIT32(BR_COMBO_BASE_1) | BIT32(BR_COMBO_BASE_2) | BIT32(BR_COMBO_BASE_3)) +#define SYS_RESET (MACRO_BASE | BIT32(BR_COMBO_SYS_RESET)) +#define BT_INQUIRY (MACRO_BASE | BIT32(BR_COMBO_BT_INQUIRY)) +#define SYS_POWER_OFF (MACRO_BASE | BIT32(BR_COMBO_SYS_POWER_OFF)) +#define FACTORY_RESET (MACRO_BASE | BIT32(BR_COMBO_BASE_4) | BIT32(BR_COMBO_FACTORY_RESET)) +#define DEEP_SLEEP (MACRO_BASE | BIT32(BR_COMBO_BASE_4) | BIT32(BR_COMBO_DEEP_SLEEP)) struct macro { uint32_t macro; @@ -43,24 +45,8 @@ static void check_macro(int32_t value, struct macro *macro, atomic_t *flags) { } } -void sys_macro_hdl(struct wireless_ctrl *ctrl_data, atomic_t *flags) { - int32_t value = ctrl_data->btns[0].value; - - if (ctrl_data->axes[TRIG_L].meta && *ctrl_data->desc & BIT(PAD_LM)) { - int32_t threshold = (int32_t)(((float)50.0/100) * ctrl_data->axes[TRIG_L].meta->abs_max); - - if (ctrl_data->axes[TRIG_L].value > threshold) { - value |= BIT(PAD_LM); - } - } - - if (ctrl_data->axes[TRIG_R].meta && *ctrl_data->desc & BIT(PAD_RM)) { - int32_t threshold = (int32_t)(((float)50.0/100) * ctrl_data->axes[TRIG_R].meta->abs_max); - - if (ctrl_data->axes[TRIG_R].value > threshold) { - value |= BIT(PAD_RM); - } - } +void sys_macro_hdl(struct wired_ctrl *ctrl_data, atomic_t *flags) { + int32_t value = ctrl_data->btns[3].value; for (uint32_t i = 0; i < sizeof(macros)/sizeof(macros[0]); i++) { struct macro *macro = ¯os[i]; diff --git a/main/adapter/macro.h b/main/adapter/macro.h index 264b1269..ed6e4a8c 100644 --- a/main/adapter/macro.h +++ b/main/adapter/macro.h @@ -8,6 +8,6 @@ #include "adapter/adapter.h" -void sys_macro_hdl(struct wireless_ctrl *ctrl_data, atomic_t *flags); +void sys_macro_hdl(struct wired_ctrl *ctrl_data, atomic_t *flags); #endif /* _SYS_MACRO_H_ */ diff --git a/main/adapter/wired/cdi.c b/main/adapter/wired/cdi.c index 4ae460c5..dc495682 100644 --- a/main/adapter/wired/cdi.c +++ b/main/adapter/wired/cdi.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2022, Jacques Gagnon + * Copyright (c) 2019-2023, Jacques Gagnon * SPDX-License-Identifier: Apache-2.0 */ @@ -43,7 +43,7 @@ struct cdi_map { int32_t raw_axes[2]; } __packed; -static const uint32_t cdi_mask[4] = {0x0005000F, 0x00000000, 0x00000000, 0x00000000}; +static const uint32_t cdi_mask[4] = {0x0005000F, 0x00000000, 0x00000000, BR_COMBO_MASK}; static const uint32_t cdi_desc[4] = {0x0000000F, 0x00000000, 0x00000000, 0x00000000}; static DRAM_ATTR const uint32_t cdi_btns_mask[32] = { 0, 0, 0, 0, @@ -56,7 +56,7 @@ static DRAM_ATTR const uint32_t cdi_btns_mask[32] = { 0, 0, 0, 0, }; -static const uint32_t cdi_mouse_mask[4] = {0x190000F0, 0x00000000, 0x00000000, 0x00000000}; +static const uint32_t cdi_mouse_mask[4] = {0x190000F0, 0x00000000, 0x00000000, BR_COMBO_MASK}; static const uint32_t cdi_mouse_desc[4] = {0x000000F0, 0x00000000, 0x00000000, 0x00000000}; static const uint32_t cdi_mouse_btns_mask[32] = { 0, 0, 0, 0, @@ -69,7 +69,7 @@ static const uint32_t cdi_mouse_btns_mask[32] = { BIT(CDI_1), 0, 0, 0, }; -static const uint32_t cdi_kb_mask[4] = {0xE6FF0F0F, 0xFFFFFFFF, 0xFFFFFFFF, 0x0007FFFF}; +static const uint32_t cdi_kb_mask[4] = {0xE6FF0F0F, 0xFFFFFFFF, 0xFFFFFFFF, 0x0007FFFF | BR_COMBO_MASK}; static const uint32_t cdi_kb_desc[4] = {0x00000000, 0x00000000, 0x00000000, 0x00000000}; /* Flash bite the bullet here, their is no dominant pattern between the special */ diff --git a/main/adapter/wired/dc.c b/main/adapter/wired/dc.c index 9028b0c2..37ce79dd 100644 --- a/main/adapter/wired/dc.c +++ b/main/adapter/wired/dc.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2022, Jacques Gagnon + * Copyright (c) 2019-2023, Jacques Gagnon * SPDX-License-Identifier: Apache-2.0 */ @@ -99,7 +99,7 @@ struct dc_kb_map { }; } __packed; -static const uint32_t dc_mask[4] = {0x333FFFFF, 0x00000000, 0x00000000, 0x00000000}; +static const uint32_t dc_mask[4] = {0x333FFFFF, 0x00000000, 0x00000000, BR_COMBO_MASK}; static const uint32_t dc_desc[4] = {0x110000FF, 0x00000000, 0x00000000, 0x00000000}; static DRAM_ATTR const uint32_t dc_btns_mask[32] = { 0, 0, 0, 0, @@ -112,7 +112,7 @@ static DRAM_ATTR const uint32_t dc_btns_mask[32] = { 0, BIT(DC_C), 0, 0, }; -static const uint32_t dc_mouse_mask[4] = {0x1901C0F0, 0x00000000, 0x00000000, 0x00000000}; +static const uint32_t dc_mouse_mask[4] = {0x1901C0F0, 0x00000000, 0x00000000, BR_COMBO_MASK}; static const uint32_t dc_mouse_desc[4] = {0x0000C0F0, 0x00000000, 0x00000000, 0x00000000}; static const uint32_t dc_mouse_btns_mask[32] = { 0, 0, 0, 0, @@ -125,7 +125,7 @@ static const uint32_t dc_mouse_btns_mask[32] = { BIT(DC_X), 0, 0, 0, }; -static const uint32_t dc_kb_mask[4] = {0xE6FF0F0F, 0xFFFFFFFF, 0xFFFFFFFF, 0x0007FFFF}; +static const uint32_t dc_kb_mask[4] = {0xE6FF0F0F, 0xFFFFFFFF, 0xFFFFFFFF, 0x0007FFFF | BR_COMBO_MASK}; static const uint32_t dc_kb_desc[4] = {0x00000000, 0x00000000, 0x00000000, 0x00000000}; static const uint8_t dc_kb_scancode[KBM_MAX] = { /* KB_A, KB_D, KB_S, KB_W, MOUSE_X_LEFT, MOUSE_X_RIGHT, MOUSE_Y_DOWN MOUSE_Y_UP */ diff --git a/main/adapter/wired/gc.c b/main/adapter/wired/gc.c index 1636c562..3b9066c9 100644 --- a/main/adapter/wired/gc.c +++ b/main/adapter/wired/gc.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2022, Jacques Gagnon + * Copyright (c) 2019-2023, Jacques Gagnon * SPDX-License-Identifier: Apache-2.0 */ @@ -53,7 +53,7 @@ struct gc_kb_map { uint8_t xor; } __packed; -static const uint32_t gc_mask[4] = {0x771F0FFF, 0x00000000, 0x00000000, 0x00000000}; +static const uint32_t gc_mask[4] = {0x771F0FFF, 0x00000000, 0x00000000, BR_COMBO_MASK}; static const uint32_t gc_desc[4] = {0x110000FF, 0x00000000, 0x00000000, 0x00000000}; static DRAM_ATTR const uint32_t gc_btns_mask[32] = { 0, 0, 0, 0, @@ -66,7 +66,7 @@ static DRAM_ATTR const uint32_t gc_btns_mask[32] = { 0, BIT(GC_Z), BIT(GC_R), 0, }; -static const uint32_t gc_kb_mask[4] = {0xE6FF0F0F, 0xFFFFFFFF, 0x1FBFFFFF, 0x0003C000}; +static const uint32_t gc_kb_mask[4] = {0xE6FF0F0F, 0xFFFFFFFF, 0x1FBFFFFF, 0x0003C000 | BR_COMBO_MASK}; static const uint32_t gc_kb_desc[4] = {0x00000000, 0x00000000, 0x00000000, 0x00000000}; static const uint8_t gc_kb_scancode[KBM_MAX] = { /* KB_A, KB_D, KB_S, KB_W, MOUSE_X_LEFT, MOUSE_X_RIGHT, MOUSE_Y_DOWN MOUSE_Y_UP */ diff --git a/main/adapter/wired/genesis.c b/main/adapter/wired/genesis.c index 35b3a2fa..20e68506 100644 --- a/main/adapter/wired/genesis.c +++ b/main/adapter/wired/genesis.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020-2022, Jacques Gagnon + * Copyright (c) 2020-2023, Jacques Gagnon * SPDX-License-Identifier: Apache-2.0 */ @@ -103,7 +103,7 @@ struct sega_mouse_map { int32_t raw_axes[2]; } __packed; -static const uint32_t sega_mouse_mask[4] = {0x190100F0, 0x00000000, 0x00000000, 0x00000000}; +static const uint32_t sega_mouse_mask[4] = {0x190100F0, 0x00000000, 0x00000000, BR_COMBO_MASK}; static const uint32_t sega_mouse_desc[4] = {0x000000F0, 0x00000000, 0x00000000, 0x00000000}; static const uint32_t sega_mouse_btns_mask[32] = { 0, 0, 0, 0, @@ -122,7 +122,7 @@ struct genesis_map { uint16_t twh_buttons; } __packed; -static const uint32_t genesis_mask[4] = {0x333F0F00, 0x00000000, 0x00000000, 0x00000000}; +static const uint32_t genesis_mask[4] = {0x333F0F00, 0x00000000, 0x00000000, BR_COMBO_MASK}; static const uint32_t genesis_desc[4] = {0x00000000, 0x00000000, 0x00000000, 0x00000000}; static DRAM_ATTR const uint32_t genesis_btns_mask[2][3][32] = { { diff --git a/main/adapter/wired/jag.c b/main/adapter/wired/jag.c index dcb7ab0c..3d29b16b 100644 --- a/main/adapter/wired/jag.c +++ b/main/adapter/wired/jag.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022, Jacques Gagnon + * Copyright (c) 2021-2023, Jacques Gagnon * SPDX-License-Identifier: Apache-2.0 */ @@ -68,7 +68,7 @@ struct jag_map { uint32_t buttons_s1[3][4]; } __packed; -static const uint32_t jag_mask[4] = {0xBB7F0FFF, 0x00000000, 0x00000000, 0x00000000}; +static const uint32_t jag_mask[4] = {0xBB7F0FFF, 0x00000000, 0x00000000, BR_COMBO_MASK}; static const uint32_t jag_desc[4] = {0x00000000, 0x00000000, 0x00000000, 0x00000000}; static DRAM_ATTR const uint32_t jag_btns_mask[][32] = { /* Pause, A, Up, Down, Left, Right */ @@ -117,7 +117,7 @@ static DRAM_ATTR const uint32_t jag_btns_mask[][32] = { }, }; -static const uint32_t jag_6d_mask[4] = {0xFFFF7FFF, 0x00000000, 0x00000000, 0x00000000}; +static const uint32_t jag_6d_mask[4] = {0xFFFF7FFF, 0x00000000, 0x00000000, BR_COMBO_MASK}; static const uint32_t jag_6d_desc[4] = {0x110000FF, 0x00000000, 0x00000000, 0x00000000}; static DRAM_ATTR const uint32_t jag_6d_btns_mask[][32] = { /* Pause, A, Up, Down, Left, Right */ diff --git a/main/adapter/wired/jvs.c b/main/adapter/wired/jvs.c index 341e951b..a33d60c7 100644 --- a/main/adapter/wired/jvs.c +++ b/main/adapter/wired/jvs.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2022, Jacques Gagnon + * Copyright (c) 2019-2023, Jacques Gagnon * SPDX-License-Identifier: Apache-2.0 */ @@ -50,7 +50,7 @@ struct jvs_map { uint8_t test; } __packed; -static const uint32_t jvs_mask[4] = {0xBBFF0F0F, 0x00000000, 0x00000000, 0x00000000}; +static const uint32_t jvs_mask[4] = {0xBBFF0F0F, 0x00000000, 0x00000000, BR_COMBO_MASK}; static const uint32_t jvs_desc[4] = {0x0000000F, 0x00000000, 0x00000000, 0x00000000}; static DRAM_ATTR const uint32_t jvs_btns_mask[32] = { 0, 0, 0, 0, diff --git a/main/adapter/wired/n64.c b/main/adapter/wired/n64.c index 471e5479..835cabf1 100644 --- a/main/adapter/wired/n64.c +++ b/main/adapter/wired/n64.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2022, Jacques Gagnon + * Copyright (c) 2019-2023, Jacques Gagnon * SPDX-License-Identifier: Apache-2.0 */ @@ -64,7 +64,7 @@ struct n64_kb_map { uint8_t bitfield; } __packed; -static const uint32_t n64_mask[4] = {0x33DFAFFF, 0x00000000, 0x00000000, 0x00000000}; +static const uint32_t n64_mask[4] = {0x33DFAFFF, 0x00000000, 0x00000000, BR_COMBO_MASK}; static const uint32_t n64_desc[4] = {0x0000000F, 0x00000000, 0x00000000, 0x00000000}; static DRAM_ATTR const uint32_t n64_btns_mask[32] = { 0, 0, 0, 0, @@ -77,7 +77,7 @@ static DRAM_ATTR const uint32_t n64_btns_mask[32] = { BIT(N64_Z), BIT(N64_R), 0, 0, }; -static const uint32_t n64_mouse_mask[4] = {0x110000F0, 0x00000000, 0x00000000, 0x00000000}; +static const uint32_t n64_mouse_mask[4] = {0x110000F0, 0x00000000, 0x00000000, BR_COMBO_MASK}; static const uint32_t n64_mouse_desc[4] = {0x000000F0, 0x00000000, 0x00000000, 0x00000000}; static const uint32_t n64_mouse_btns_mask[32] = { 0, 0, 0, 0, @@ -90,7 +90,7 @@ static const uint32_t n64_mouse_btns_mask[32] = { BIT(N64_A), 0, 0, 0, }; -static const uint32_t n64_kb_mask[4] = {0xE6FF0F0F, 0xFFFFFFFF, 0x2D7FFFFF, 0x0007C000}; +static const uint32_t n64_kb_mask[4] = {0xE6FF0F0F, 0xFFFFFFFF, 0x2D7FFFFF, 0x0007C000 | BR_COMBO_MASK}; static const uint32_t n64_kb_desc[4] = {0x00000000, 0x00000000, 0x00000000, 0x00000000}; static const uint16_t n64_kb_scancode[KBM_MAX] = { /* KB_A, KB_D, KB_S, KB_W, MOUSE_X_LEFT, MOUSE_X_RIGHT, MOUSE_Y_DOWN MOUSE_Y_UP */ diff --git a/main/adapter/wired/npiso.c b/main/adapter/wired/npiso.c index 9b6e5e26..1660d43e 100644 --- a/main/adapter/wired/npiso.c +++ b/main/adapter/wired/npiso.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2022, Jacques Gagnon + * Copyright (c) 2019-2023, Jacques Gagnon * SPDX-License-Identifier: Apache-2.0 */ @@ -77,7 +77,7 @@ struct npiso_trackball_map { int32_t raw_axes[2]; } __packed; -static const uint32_t npiso_mask[4] = {0x333F0F00, 0x00000000, 0x00000000, 0x00000000}; +static const uint32_t npiso_mask[4] = {0x333F0F00, 0x00000000, 0x00000000, BR_COMBO_MASK}; static const uint32_t npiso_desc[4] = {0x00000000, 0x00000000, 0x00000000, 0x00000000}; static DRAM_ATTR const uint32_t npiso_btns_mask[32] = { 0, 0, 0, 0, @@ -90,7 +90,7 @@ static DRAM_ATTR const uint32_t npiso_btns_mask[32] = { BIT(NPISO_R), BIT(NPISO_R), 0, 0, }; -static const uint32_t npiso_vb_mask[4] = {0xBBF50FF0, 0x00000000, 0x00000000, 0x00000000}; +static const uint32_t npiso_vb_mask[4] = {0xBBF50FF0, 0x00000000, 0x00000000, BR_COMBO_MASK}; static const uint32_t npiso_vb_desc[4] = {0x00000000, 0x00000000, 0x00000000, 0x00000000}; static DRAM_ATTR const uint32_t npiso_vb_btns_mask[32] = { 0, 0, 0, 0, @@ -103,7 +103,7 @@ static DRAM_ATTR const uint32_t npiso_vb_btns_mask[32] = { BIT(NPISO_R), BIT(NPISO_R), 0, 0, }; -static const uint32_t npiso_mouse_mask[4] = {0x110000F0, 0x00000000, 0x00000000, 0x00000000}; +static const uint32_t npiso_mouse_mask[4] = {0x110000F0, 0x00000000, 0x00000000, BR_COMBO_MASK}; static const uint32_t npiso_mouse_desc[4] = {0x000000F0, 0x00000000, 0x00000000, 0x00000000}; static const uint32_t npiso_mouse_btns_mask[32] = { 0, 0, 0, 0, @@ -116,7 +116,7 @@ static const uint32_t npiso_mouse_btns_mask[32] = { BIT(NPISO_Y), 0, 0, 0, }; -static const uint32_t npiso_trackball_mask[4] = {0x1907C0F0, 0x00000000, 0x00000000, 0x00000000}; +static const uint32_t npiso_trackball_mask[4] = {0x1907C0F0, 0x00000000, 0x00000000, BR_COMBO_MASK}; static const uint32_t npiso_trackball_desc[4] = {0x000000F0, 0x00000000, 0x00000000, 0x00000000}; static const uint32_t npiso_trackball_btns_mask[32] = { 0, 0, 0, 0, diff --git a/main/adapter/wired/parallel_1p.c b/main/adapter/wired/parallel_1p.c index 95ff01f5..e0a2fc07 100644 --- a/main/adapter/wired/parallel_1p.c +++ b/main/adapter/wired/parallel_1p.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2022, Jacques Gagnon + * Copyright (c) 2019-2023, Jacques Gagnon * SPDX-License-Identifier: Apache-2.0 */ @@ -30,7 +30,7 @@ struct para_1p_map { uint32_t buttons_high; } __packed; -static const uint32_t para_1p_mask[4] = {0x337F0F00, 0x00000000, 0x00000000, 0x00000000}; +static const uint32_t para_1p_mask[4] = {0x337F0F00, 0x00000000, 0x00000000, BR_COMBO_MASK}; static const uint32_t para_1p_desc[4] = {0x00000000, 0x00000000, 0x00000000, 0x00000000}; static DRAM_ATTR const uint32_t para_1p_btns_mask[32] = { 0, 0, 0, 0, diff --git a/main/adapter/wired/parallel_2p.c b/main/adapter/wired/parallel_2p.c index 67313b9c..3178d0bb 100644 --- a/main/adapter/wired/parallel_2p.c +++ b/main/adapter/wired/parallel_2p.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2022, Jacques Gagnon + * Copyright (c) 2019-2023, Jacques Gagnon * SPDX-License-Identifier: Apache-2.0 */ @@ -44,7 +44,7 @@ struct para_2p_map { uint32_t buttons_high; } __packed; -static const uint32_t para_2p_mask[4] = {0x00050F00, 0x00000000, 0x00000000, 0x00000000}; +static const uint32_t para_2p_mask[4] = {0x00050F00, 0x00000000, 0x00000000, BR_COMBO_MASK}; static const uint32_t para_2p_desc[4] = {0x00000000, 0x00000000, 0x00000000, 0x00000000}; static DRAM_ATTR const uint32_t para_2p_btns_mask[2][32] = { { diff --git a/main/adapter/wired/pce.c b/main/adapter/wired/pce.c index aa6213cf..73b942b2 100644 --- a/main/adapter/wired/pce.c +++ b/main/adapter/wired/pce.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022, Jacques Gagnon + * Copyright (c) 2021-2023, Jacques Gagnon * SPDX-License-Identifier: Apache-2.0 */ @@ -75,7 +75,7 @@ struct pce_mouse_map { uint8_t relative[2]; } __packed; -static const uint32_t pce_mouse_mask[4] = {0x190100F0, 0x00000000, 0x00000000, 0x00000000}; +static const uint32_t pce_mouse_mask[4] = {0x190100F0, 0x00000000, 0x00000000, BR_COMBO_MASK}; static const uint32_t pce_mouse_desc[4] = {0x000000F0, 0x00000000, 0x00000000, 0x00000000}; static const uint32_t pce_mouse_btns_mask[32] = { 0, 0, 0, 0, @@ -88,7 +88,7 @@ static const uint32_t pce_mouse_btns_mask[32] = { P1_R_II_MASK, 0, 0, 0, }; -static const uint32_t pce_mask[4] = {0x00350F00, 0x00000000, 0x00000000, 0x00000000}; +static const uint32_t pce_mask[4] = {0x00350F00, 0x00000000, 0x00000000, BR_COMBO_MASK}; static const uint32_t pce_desc[4] = {0x00000000, 0x00000000, 0x00000000, 0x00000000}; static DRAM_ATTR const uint32_t pce_btns_mask[][32] = { /* URDL */ @@ -126,7 +126,7 @@ static DRAM_ATTR const uint32_t pce_btns_mask[][32] = { }, }; -static const uint32_t pce_6btns_mask[4] = {0x333F0F00, 0x00000000, 0x00000000, 0x00000000}; +static const uint32_t pce_6btns_mask[4] = {0x333F0F00, 0x00000000, 0x00000000, BR_COMBO_MASK}; static const uint32_t pce_6btns_desc[4] = {0x00000000, 0x00000000, 0x00000000, 0x00000000}; static DRAM_ATTR const uint32_t pce_6btns_btns_mask[][32] = { /* URDL */ diff --git a/main/adapter/wired/pcfx.c b/main/adapter/wired/pcfx.c index 581a7ff0..e039ca36 100644 --- a/main/adapter/wired/pcfx.c +++ b/main/adapter/wired/pcfx.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2022, Jacques Gagnon + * Copyright (c) 2019-2023, Jacques Gagnon * SPDX-License-Identifier: Apache-2.0 */ @@ -62,7 +62,7 @@ struct pcfx_mouse_map { int32_t raw_axes[2]; } __packed; -static const uint32_t pcfx_mask[4] = {0xBB3F0F00, 0x00000000, 0x00000000, 0x00000000}; +static const uint32_t pcfx_mask[4] = {0xBB3F0F00, 0x00000000, 0x00000000, BR_COMBO_MASK}; static const uint32_t pcfx_desc[4] = {0x00000000, 0x00000000, 0x00000000, 0x00000000}; static DRAM_ATTR const uint32_t pcfx_btns_mask[32] = { 0, 0, 0, 0, @@ -75,7 +75,7 @@ static DRAM_ATTR const uint32_t pcfx_btns_mask[32] = { BIT(PCFX_VI), BIT(PCFX_VI), 0, 0, }; -static const uint32_t pcfx_mouse_mask[4] = {0x110000F0, 0x00000000, 0x00000000, 0x00000000}; +static const uint32_t pcfx_mouse_mask[4] = {0x110000F0, 0x00000000, 0x00000000, BR_COMBO_MASK}; static const uint32_t pcfx_mouse_desc[4] = {0x000000F0, 0x00000000, 0x00000000, 0x00000000}; static const uint32_t pcfx_mouse_btns_mask[32] = { 0, 0, 0, 0, diff --git a/main/adapter/wired/ps.c b/main/adapter/wired/ps.c index ce31f307..27cf3f8f 100644 --- a/main/adapter/wired/ps.c +++ b/main/adapter/wired/ps.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2022, Jacques Gagnon + * Copyright (c) 2019-2023, Jacques Gagnon * SPDX-License-Identifier: Apache-2.0 */ @@ -80,7 +80,7 @@ struct ps_mouse_map { int32_t raw_axes[2]; } __packed; -static const uint32_t ps_mask[4] = {0xBB7F0FFF, 0x00000000, 0x00000000, 0x00000000}; +static const uint32_t ps_mask[4] = {0xBB7F0FFF, 0x00000000, 0x00000000, BR_COMBO_MASK}; static const uint32_t ps_desc[4] = {0x000000FF, 0x00000000, 0x00000000, 0x00000000}; static DRAM_ATTR const uint32_t ps_btns_mask[32] = { 0, 0, 0, 0, @@ -103,7 +103,7 @@ static const uint8_t ps_btns_idx[32] = { 15, 13, 0, 0, }; -static const uint32_t ps_mouse_mask[4] = {0x110000F0, 0x00000000, 0x00000000, 0x00000000}; +static const uint32_t ps_mouse_mask[4] = {0x110000F0, 0x00000000, 0x00000000, BR_COMBO_MASK}; static const uint32_t ps_mouse_desc[4] = {0x000000F0, 0x00000000, 0x00000000, 0x00000000}; static const uint32_t ps_mouse_btns_mask[32] = { 0, 0, 0, 0, @@ -116,7 +116,7 @@ static const uint32_t ps_mouse_btns_mask[32] = { BIT(PS_R1), 0, 0, 0, }; -static const uint32_t ps_kb_mask[4] = {0xE6FF0F0F, 0xFFFFFFFF, 0xFFFFFFFF, 0x0007FFFF}; +static const uint32_t ps_kb_mask[4] = {0xE6FF0F0F, 0xFFFFFFFF, 0xFFFFFFFF, 0x0007FFFF | BR_COMBO_MASK}; static const uint32_t ps_kb_desc[4] = {0x00000000, 0x00000000, 0x00000000, 0x00000000}; static const uint8_t ps_kb_scancode[KBM_MAX] = { /* KB_A, KB_D, KB_S, KB_W, MOUSE_X_LEFT, MOUSE_X_RIGHT, MOUSE_Y_DOWN MOUSE_Y_UP */ diff --git a/main/adapter/wired/real.c b/main/adapter/wired/real.c index 7951df13..c7dede15 100644 --- a/main/adapter/wired/real.c +++ b/main/adapter/wired/real.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2022, Jacques Gagnon + * Copyright (c) 2019-2023, Jacques Gagnon * SPDX-License-Identifier: Apache-2.0 */ @@ -85,7 +85,7 @@ struct real_mouse_map { int32_t raw_axes[2]; } __packed; -static const uint32_t real_mask[4] = {0x33370F00, 0x00000000, 0x00000000, 0x00000000}; +static const uint32_t real_mask[4] = {0x33370F00, 0x00000000, 0x00000000, BR_COMBO_MASK}; static const uint32_t real_desc[4] = {0x00000000, 0x00000000, 0x00000000, 0x00000000}; static DRAM_ATTR const uint32_t real_btns_mask[32] = { 0, 0, 0, 0, @@ -98,7 +98,7 @@ static DRAM_ATTR const uint32_t real_btns_mask[32] = { BIT(REAL_R), BIT(REAL_R), 0, 0, }; -static const uint32_t real_fs_mask[4] = {0x333F0FCF, 0x00000000, 0x00000000, 0x00000000}; +static const uint32_t real_fs_mask[4] = {0x333F0FCF, 0x00000000, 0x00000000, BR_COMBO_MASK}; static const uint32_t real_fs_desc[4] = {0x000000CF, 0x00000000, 0x00000000, 0x00000000}; static DRAM_ATTR const uint32_t real_fs_btns_mask[32] = { 0, 0, 0, 0, @@ -111,7 +111,7 @@ static DRAM_ATTR const uint32_t real_fs_btns_mask[32] = { BIT(REAL_FS_R), BIT(REAL_FS_R), 0, 0, }; -static const uint32_t real_mouse_mask[4] = {0x190000F0, 0x00000000, 0x00000000, 0x00000000}; +static const uint32_t real_mouse_mask[4] = {0x190000F0, 0x00000000, 0x00000000, BR_COMBO_MASK}; static const uint32_t real_mouse_desc[4] = {0x000000F0, 0x00000000, 0x00000000, 0x00000000}; static const uint32_t real_mouse_btns_mask[32] = { 0, 0, 0, 0, diff --git a/main/adapter/wired/saturn.c b/main/adapter/wired/saturn.c index ef351103..e5de28ee 100644 --- a/main/adapter/wired/saturn.c +++ b/main/adapter/wired/saturn.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2022, Jacques Gagnon + * Copyright (c) 2019-2023, Jacques Gagnon * SPDX-License-Identifier: Apache-2.0 */ @@ -84,9 +84,9 @@ struct sega_mouse_map { int32_t raw_axes[2]; } __packed; -static const uint32_t saturn_mask[4] = {0x331F0F00, 0x00000000, 0x00000000, 0x00000000}; +static const uint32_t saturn_mask[4] = {0x331F0F00, 0x00000000, 0x00000000, BR_COMBO_MASK}; static const uint32_t saturn_desc[4] = {0x00000000, 0x00000000, 0x00000000, 0x00000000}; -static const uint32_t saturn_3d_mask[4] = {0x331F0F0F, 0x00000000, 0x00000000, 0x00000000}; +static const uint32_t saturn_3d_mask[4] = {0x331F0F0F, 0x00000000, 0x00000000, BR_COMBO_MASK}; static const uint32_t saturn_3d_desc[4] = {0x1100000F, 0x00000000, 0x00000000, 0x00000000}; static DRAM_ATTR const uint32_t saturn_btns_mask[32] = { 0, 0, 0, 0, @@ -99,7 +99,7 @@ static DRAM_ATTR const uint32_t saturn_btns_mask[32] = { BIT(SATURN_R), BIT(SATURN_Z), 0, 0, }; -static const uint32_t sega_mouse_mask[4] = {0x190100F0, 0x00000000, 0x00000000, 0x00000000}; +static const uint32_t sega_mouse_mask[4] = {0x190100F0, 0x00000000, 0x00000000, BR_COMBO_MASK}; static const uint32_t sega_mouse_desc[4] = {0x000000F0, 0x00000000, 0x00000000, 0x00000000}; static const uint32_t sega_mouse_btns_mask[32] = { 0, 0, 0, 0, @@ -112,7 +112,7 @@ static const uint32_t sega_mouse_btns_mask[32] = { BIT(SATURN_B), 0, 0, 0, }; -static const uint32_t saturn_kb_mask[4] = {0xE6FF0F0F, 0xFFFFFFFF, 0xFFFFFFFF, 0x0007FFFF}; +static const uint32_t saturn_kb_mask[4] = {0xE6FF0F0F, 0xFFFFFFFF, 0xFFFFFFFF, 0x0007FFFF | BR_COMBO_MASK}; static const uint32_t saturn_kb_desc[4] = {0x00000000, 0x00000000, 0x00000000, 0x00000000}; static const uint8_t saturn_kb_scancode[KBM_MAX] = { /* Source: https://plutiedev.com/saturn-keyboard */ diff --git a/main/adapter/wired/sea.c b/main/adapter/wired/sea.c index 6fbfc001..7f595f0a 100644 --- a/main/adapter/wired/sea.c +++ b/main/adapter/wired/sea.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2022, Jacques Gagnon + * Copyright (c) 2019-2023, Jacques Gagnon * SPDX-License-Identifier: Apache-2.0 */ @@ -42,7 +42,7 @@ struct sea_map { uint8_t buttons_osd; } __packed; -static const uint32_t sea_mask[4] = {0x337F0F00, 0x00000000, 0x00000000, 0x00000000}; +static const uint32_t sea_mask[4] = {0x337F0F00, 0x00000000, 0x00000000, BR_COMBO_MASK}; static const uint32_t sea_desc[4] = {0x00000000, 0x00000000, 0x00000000, 0x00000000}; static DRAM_ATTR const uint32_t sea_btns_mask[32] = { 0, 0, 0, 0, diff --git a/main/adapter/wired/wii.c b/main/adapter/wired/wii.c index a11c6e69..c0d12427 100644 --- a/main/adapter/wired/wii.c +++ b/main/adapter/wired/wii.c @@ -49,7 +49,7 @@ static DRAM_ATTR const uint8_t wiic_axes_idx[ADAPTER_MAX_AXES] = 0, 2, 1, 3, 4, 5 }; -static const uint32_t wiic_mask[4] = {0xFFFFFFFF, 0x00000000, 0x00000000, 0x00000000}; +static const uint32_t wiic_mask[4] = {0xFFFFFFFF, 0x00000000, 0x00000000, BR_COMBO_MASK}; static const uint32_t wiic_pro_desc[4] = {0x000000FF, 0x00000000, 0x00000000, 0x00000000}; static const uint32_t wiic_desc[4] = {0x110000FF, 0x00000000, 0x00000000, 0x00000000}; static DRAM_ATTR const uint32_t wiic_btns_mask[32] = {