1
0
mirror of https://gitea.tendokyu.moe/Dniel97/segatools.git synced 2024-11-24 05:20:10 +01:00

Diva: Fix slider detection & sensor order

This commit is contained in:
5d3b9130281102eb36519ddd0a2c6868ff061a3b 2019-12-29 20:59:35 -04:00
parent d32f6ab18b
commit 180dc3378a
3 changed files with 23 additions and 3 deletions

View File

@ -5,9 +5,11 @@
enum {
SLIDER_CMD_AUTO_SCAN = 0x01,
SLIDER_CMD_SET_LED_CHUNI = 0x02,
SLIDER_CMD_SET_LED_DIVA = 0x02,
SLIDER_CMD_AUTO_SCAN_START = 0x03,
SLIDER_CMD_AUTO_SCAN_STOP = 0x04,
SLIDER_CMD_SET_LED_DIVA = 0x9,
SLIDER_CMD_DIVA_UNK_09 = 0x09,
SLIDER_CMD_DIVA_UNK_0A = 0x0A,
SLIDER_CMD_RESET = 0x10,
SLIDER_CMD_GET_BOARD_INFO = 0xF0,
};

View File

@ -24,6 +24,7 @@ static HRESULT slider_handle_irp(struct irp *irp);
static HRESULT slider_handle_irp_locked(struct irp *irp);
static HRESULT slider_req_dispatch(const union slider_req_any *req);
static HRESULT slider_req_nop(uint8_t cmd);
static HRESULT slider_req_reset(void);
static HRESULT slider_req_get_board_info(void);
static HRESULT slider_req_auto_scan_start(void);
@ -146,6 +147,10 @@ static HRESULT slider_req_dispatch(const union slider_req_any *req)
case SLIDER_CMD_SET_LED_DIVA:
return slider_req_set_led(&req->set_led);
case SLIDER_CMD_DIVA_UNK_09:
case SLIDER_CMD_DIVA_UNK_0A:
return slider_req_nop(req->hdr.cmd);
default:
dprintf("Unhandled command %02x\n", req->hdr.cmd);
@ -153,6 +158,19 @@ static HRESULT slider_req_dispatch(const union slider_req_any *req)
}
}
static HRESULT slider_req_nop(uint8_t cmd)
{
struct slider_hdr resp;
dprintf("Diva slider: No-op cmd 0x%02x\n", cmd);
resp.sync = SLIDER_FRAME_SYNC;
resp.cmd = cmd;
resp.nbytes = 0;
return slider_frame_encode(&slider_uart.readable, &resp, sizeof(resp));
}
static HRESULT slider_req_reset(void)
{
struct slider_hdr resp;
@ -181,7 +199,7 @@ static HRESULT slider_req_get_board_info(void)
strcpy_s(
resp.version,
sizeof(resp.version),
"15275 \xA0" "06712\xFF" "\x90");
"15275 \xA0" "06687\xFF" "\x90");
return slider_frame_encode(&slider_uart.readable, &resp, sizeof(resp));
}

View File

@ -122,7 +122,7 @@ static unsigned int __stdcall diva_io_slider_thread_proc(void *ctx)
pressure_val = 0;
}
memset(&pressure[28 - 4 * i], pressure_val, 4);
memset(&pressure[4 * i], pressure_val, 4);
}
callback(pressure);