Skip to content

Commit

Permalink
[DBG] Add raw output print in JSON format
Browse files Browse the repository at this point in the history
  • Loading branch information
darthcloud committed Feb 26, 2023
1 parent 98d1d57 commit 5121d7f
Show file tree
Hide file tree
Showing 18 changed files with 106 additions and 0 deletions.
5 changes: 5 additions & 0 deletions main/Kconfig.projbuild
Expand Up @@ -197,6 +197,11 @@ menu "BlueRetro"
help
Select this to enable JSON raw input debug.

config BLUERETRO_RAW_OUTPUT
bool "Enable JSON raw output debug"
help
Select this to enable JSON raw output debug.

config BLUERETRO_JSON_DBG
bool "Display debug in JSON format"
help
Expand Down
5 changes: 5 additions & 0 deletions main/adapter/wired/cdi.c
Expand Up @@ -374,6 +374,11 @@ void cdi_ctrl_from_generic(struct generic_ctrl *ctrl_data, struct wired_data *wi
}

memcpy(wired_data->output, (void *)&map_tmp, sizeof(map_tmp) - 8);

#ifdef CONFIG_BLUERETRO_RAW_OUTPUT
printf("{\"log_type\": \"wired_output\", \"axes\": [%ld, %ld], \"btns\": %d}\n",
raw_axes[cdi_axes_idx[0]], raw_axes[cdi_axes_idx[1]], map_tmp.buttons);
#endif
}

static void cdi_mouse_from_generic(struct generic_ctrl *ctrl_data, struct wired_data *wired_data) {
Expand Down
6 changes: 6 additions & 0 deletions main/adapter/wired/dc.c
Expand Up @@ -263,6 +263,12 @@ static void dc_ctrl_from_generic(struct generic_ctrl *ctrl_data, struct wired_da
}

memcpy(wired_data->output, (void *)&map_tmp, sizeof(map_tmp));

#ifdef CONFIG_BLUERETRO_RAW_OUTPUT
printf("{\"log_type\": \"wired_output\", \"axes\": [%d, %d, %d, %d, %d, %d], \"btns\": %d}\n",
map_tmp.axes[dc_axes_idx[0]], map_tmp.axes[dc_axes_idx[1]], map_tmp.axes[dc_axes_idx[2]],
map_tmp.axes[dc_axes_idx[3]], map_tmp.axes[dc_axes_idx[4]], map_tmp.axes[dc_axes_idx[5]], map_tmp.buttons);
#endif
}

static void dc_mouse_from_generic(struct generic_ctrl *ctrl_data, struct wired_data *wired_data) {
Expand Down
6 changes: 6 additions & 0 deletions main/adapter/wired/gc.c
Expand Up @@ -184,6 +184,12 @@ static void gc_ctrl_from_generic(struct generic_ctrl *ctrl_data, struct wired_da
}

memcpy(wired_data->output, (void *)&map_tmp, sizeof(map_tmp));

#ifdef CONFIG_BLUERETRO_RAW_OUTPUT
printf("{\"log_type\": \"wired_output\", \"axes\": [%d, %d, %d, %d, %d, %d], \"btns\": %d}\n",
map_tmp.axes[gc_axes_idx[0]], map_tmp.axes[gc_axes_idx[1]], map_tmp.axes[gc_axes_idx[2]],
map_tmp.axes[gc_axes_idx[3]], map_tmp.axes[gc_axes_idx[4]], map_tmp.axes[gc_axes_idx[5]], map_tmp.buttons);
#endif
}

static void gc_kb_from_generic(struct generic_ctrl *ctrl_data, struct wired_data *wired_data) {
Expand Down
6 changes: 6 additions & 0 deletions main/adapter/wired/genesis.c
Expand Up @@ -284,6 +284,12 @@ static void genesis_std_from_generic(struct generic_ctrl *ctrl_data, struct wire
}

memcpy(wired_data->output, (void *)&map_tmp, sizeof(map_tmp));

#ifdef CONFIG_BLUERETRO_RAW_OUTPUT
printf("{\"log_type\": \"wired_output\", \"btns\": [%ld, %ld, %ld, %ld, %ld, %ld]}\n",
map_tmp.buttons[0], map_tmp.buttons[1], map_tmp.buttons[2],
map_tmp.buttons_high[0], map_tmp.buttons_high[1], map_tmp.buttons_high[2]);
#endif
}

static void genesis_twh_from_generic(struct generic_ctrl *ctrl_data, struct wired_data *wired_data) {
Expand Down
10 changes: 10 additions & 0 deletions main/adapter/wired/jag.c
Expand Up @@ -268,6 +268,11 @@ static void jag_ctrl_from_generic(struct generic_ctrl *ctrl_data, struct wired_d
}

memcpy(wired_data->output, (void *)&map_tmp, sizeof(map_tmp));

#ifdef CONFIG_BLUERETRO_RAW_OUTPUT
printf("{\"log_type\": \"wired_output\", \"btns\": [%ld, %ld, %ld, %ld]}\n",
map_tmp.buttons[0], map_tmp.buttons[1], map_tmp.buttons[2], map_tmp.buttons[3]);
#endif
}

static void jag_6d_from_generic(struct generic_ctrl *ctrl_data, struct wired_data *wired_data) {
Expand Down Expand Up @@ -325,6 +330,11 @@ static void jag_6d_from_generic(struct generic_ctrl *ctrl_data, struct wired_dat
}

memcpy(wired_data->output, (void *)&map_tmp, sizeof(map_tmp));

#ifdef CONFIG_BLUERETRO_RAW_OUTPUT
printf("{\"log_type\": \"wired_output\", \"btns\": [%ld, %ld, %ld, %ld]}\n",
map_tmp.buttons[0], map_tmp.buttons[1], map_tmp.buttons[2], map_tmp.buttons[3]);
#endif
}

void jag_from_generic(int32_t dev_mode, struct generic_ctrl *ctrl_data, struct wired_data *wired_data) {
Expand Down
6 changes: 6 additions & 0 deletions main/adapter/wired/jvs.c
Expand Up @@ -153,6 +153,12 @@ void jvs_from_generic(int32_t dev_mode, struct generic_ctrl *ctrl_data, struct w
}

memcpy(wired_data->output, (void *)&map_tmp, sizeof(map_tmp));

#ifdef CONFIG_BLUERETRO_RAW_OUTPUT
printf("{\"log_type\": \"wired_output\", \"axes\": [%d, %d], \"btns\": %d, \"COINS\": %d, \"TEST\": %d}\n",
map_tmp.axes[jvs_axes_idx[0]], map_tmp.axes[jvs_axes_idx[1]],
map_tmp.buttons, map_tmp.coins, map_tmp.test);
#endif
}

void IRAM_ATTR jvs_gen_turbo_mask(struct wired_data *wired_data) {
Expand Down
5 changes: 5 additions & 0 deletions main/adapter/wired/n64.c
Expand Up @@ -292,6 +292,11 @@ static void n64_ctrl_from_generic(struct generic_ctrl *ctrl_data, struct wired_d
}

memcpy(wired_data->output, (void *)&map_tmp, sizeof(map_tmp));

#ifdef CONFIG_BLUERETRO_RAW_OUTPUT
printf("{\"log_type\": \"wired_output\", \"axes\": [%d, %d], \"btns\": %d}\n",
map_tmp.axes[n64_axes_idx[0]], map_tmp.axes[n64_axes_idx[1]], map_tmp.buttons);
#endif
}

static void n64_mouse_from_generic(struct generic_ctrl *ctrl_data, struct wired_data *wired_data) {
Expand Down
4 changes: 4 additions & 0 deletions main/adapter/wired/npiso.c
Expand Up @@ -260,6 +260,10 @@ static void npiso_ctrl_from_generic(struct generic_ctrl *ctrl_data, struct wired
}

memcpy(wired_data->output, (void *)&map_tmp, sizeof(map_tmp));

#ifdef CONFIG_BLUERETRO_RAW_OUTPUT
printf("{\"log_type\": \"wired_output\", \"btns\": %d}\n", map_tmp.buttons);
#endif
}

static void npiso_mouse_from_generic(struct generic_ctrl *ctrl_data, struct wired_data *wired_data) {
Expand Down
5 changes: 5 additions & 0 deletions main/adapter/wired/parallel_1p.c
Expand Up @@ -104,6 +104,11 @@ void para_1p_from_generic(int32_t dev_mode, struct generic_ctrl *ctrl_data, stru
GPIO.out1.val = map_tmp.buttons_high | turbo_map_mask->buttons_high;

memcpy(wired_data->output, (void *)&map_tmp, sizeof(map_tmp));

#ifdef CONFIG_BLUERETRO_RAW_OUTPUT
printf("{\"log_type\": \"wired_output\", \"btns\": [%ld, %ld]}\n",
map_tmp.buttons, map_tmp.buttons_high);
#endif
}
}

Expand Down
5 changes: 5 additions & 0 deletions main/adapter/wired/parallel_2p.c
Expand Up @@ -132,6 +132,11 @@ void para_2p_from_generic(int32_t dev_mode, struct generic_ctrl *ctrl_data, stru

GPIO.out = (map1->buttons | map1_mask->buttons) & (map2->buttons | map2_mask->buttons);
GPIO.out1.val = (map1->buttons_high | map1_mask->buttons_high) & (map2->buttons_high | map2_mask->buttons_high);

#ifdef CONFIG_BLUERETRO_RAW_OUTPUT
printf("{\"log_type\": \"wired_output\", \"btns\": [%ld, %ld]}\n",
map_tmp.buttons, map_tmp.buttons_high);
#endif
}
}

Expand Down
5 changes: 5 additions & 0 deletions main/adapter/wired/pce.c
Expand Up @@ -226,6 +226,11 @@ static void pce_ctrl_from_generic(struct generic_ctrl *ctrl_data, struct wired_d
}

memcpy(wired_data->output, (void *)&map_tmp, sizeof(map_tmp));

#ifdef CONFIG_BLUERETRO_RAW_OUTPUT
printf("{\"log_type\": \"wired_output\", \"btns\": [%ld, %ld, %ld, %ld, %ld]}\n",
map_tmp.buttons[0], map_tmp.buttons[1], map_tmp.buttons[2], map_tmp.buttons[3], map_tmp.buttons[4]);
#endif
}

void IRAM_ATTR pce_init_buffer(int32_t dev_mode, struct wired_data *wired_data) {
Expand Down
4 changes: 4 additions & 0 deletions main/adapter/wired/pcfx.c
Expand Up @@ -189,6 +189,10 @@ void pcfx_ctrl_from_generic(struct generic_ctrl *ctrl_data, struct wired_data *w
}

memcpy(wired_data->output, (void *)&map_tmp, sizeof(map_tmp));

#ifdef CONFIG_BLUERETRO_RAW_OUTPUT
printf("{\"log_type\": \"wired_output\", \"btns\": %d}\n", map_tmp.buttons);
#endif
}

static void pcfx_mouse_from_generic(struct generic_ctrl *ctrl_data, struct wired_data *wired_data) {
Expand Down
7 changes: 7 additions & 0 deletions main/adapter/wired/ps.c
Expand Up @@ -268,6 +268,13 @@ static void ps_ctrl_from_generic(struct generic_ctrl *ctrl_data, struct wired_da
}

memcpy(wired_data->output, (void *)&map_tmp, sizeof(map_tmp));

#ifdef CONFIG_BLUERETRO_RAW_OUTPUT
printf("{\"log_type\": \"wired_output\", \"axes\": [%d, %d, %d, %d], \"btns\": [%d, %d]}\n",
map_tmp.axes[ps_axes_idx[0]], map_tmp.axes[ps_axes_idx[1]],
map_tmp.axes[ps_axes_idx[2]], map_tmp.axes[ps_axes_idx[3]],
map_tmp.buttons, map_tmp.analog_btn);
#endif
}

static void ps_mouse_from_generic(struct generic_ctrl *ctrl_data, struct wired_data *wired_data) {
Expand Down
10 changes: 10 additions & 0 deletions main/adapter/wired/real.c
Expand Up @@ -210,6 +210,10 @@ void real_ctrl_from_generic(struct generic_ctrl *ctrl_data, struct wired_data *w
}

memcpy(wired_data->output, (void *)&map_tmp, sizeof(map_tmp));

#ifdef CONFIG_BLUERETRO_RAW_OUTPUT
printf("{\"log_type\": \"wired_output\", \"btns\": %d}\n", map_tmp.buttons);
#endif
}

/* I didn't RE this one my self, base on : */
Expand Down Expand Up @@ -271,6 +275,12 @@ void real_fs_from_generic(struct generic_ctrl *ctrl_data, struct wired_data *wir
}

memcpy(wired_data->output, (void *)&map_tmp, sizeof(map_tmp));

#ifdef CONFIG_BLUERETRO_RAW_OUTPUT
printf("{\"log_type\": \"wired_output\", \"axes\": [%d, %d, %d, %d], \"btns\": %d}\n",
map_tmp.axes[0], map_tmp.axes[1], map_tmp.axes[2], map_tmp.axes[3],
map_tmp.buttons);
#endif
}

static void real_mouse_from_generic(struct generic_ctrl *ctrl_data, struct wired_data *wired_data) {
Expand Down
6 changes: 6 additions & 0 deletions main/adapter/wired/saturn.c
Expand Up @@ -278,6 +278,12 @@ void saturn_ctrl_from_generic(struct generic_ctrl *ctrl_data, struct wired_data
}

memcpy(wired_data->output, (void *)&map_tmp, sizeof(map_tmp));

#ifdef CONFIG_BLUERETRO_RAW_OUTPUT
printf("{\"log_type\": \"wired_output\", \"axes\": [%d, %d, %d, %d], \"btns\": %d}\n",
map_tmp.axes[saturn_axes_idx[0]], map_tmp.axes[saturn_axes_idx[1]],
map_tmp.axes[saturn_axes_idx[4]], map_tmp.axes[saturn_axes_idx[5]], map_tmp.buttons);
#endif
}

static void saturn_mouse_from_generic(struct generic_ctrl *ctrl_data, struct wired_data *wired_data) {
Expand Down
5 changes: 5 additions & 0 deletions main/adapter/wired/sea.c
Expand Up @@ -149,6 +149,11 @@ void sea_from_generic(int32_t dev_mode, struct generic_ctrl *ctrl_data, struct w
sea_tx_byte(map_tmp.buttons_osd);

memcpy(wired_data->output, (void *)&map_tmp, sizeof(map_tmp));

#ifdef CONFIG_BLUERETRO_RAW_OUTPUT
printf("{\"log_type\": \"wired_output\", \"btns\": [%ld, %ld, %d]}\n",
map_tmp.buttons, map_tmp.buttons_high, map_tmp.buttons_osd);
#endif
}
}

Expand Down
6 changes: 6 additions & 0 deletions main/adapter/wired/wii.c
Expand Up @@ -153,6 +153,12 @@ void wii_from_generic(int32_t dev_mode, struct generic_ctrl *ctrl_data, struct w
}

memcpy(wired_data->output, (void *)&map_tmp, sizeof(map_tmp));

#ifdef CONFIG_BLUERETRO_RAW_OUTPUT
printf("{\"log_type\": \"wired_output\", \"axes\": [%d, %d, %d, %d, %d, %d], \"btns\": %d}\n",
map_tmp.axes[wiic_axes_idx[0]], map_tmp.axes[wiic_axes_idx[1]], map_tmp.axes[wiic_axes_idx[2]],
map_tmp.axes[wiic_axes_idx[3]], map_tmp.axes[wiic_axes_idx[4]], map_tmp.axes[wiic_axes_idx[5]], map_tmp.buttons);
#endif
}

void IRAM_ATTR wii_gen_turbo_mask(struct wired_data *wired_data) {
Expand Down

0 comments on commit 5121d7f

Please sign in to comment.