mirror of
https://gitea.tendokyu.moe/Dniel97/segatools.git
synced 2024-11-27 22:40:48 +01:00
+ vol btns, / test and service remap, - gfx hook
This commit is contained in:
parent
3f41eb5b31
commit
12b523ad9f
8
dist/mercury/segatools.ini
vendored
8
dist/mercury/segatools.ini
vendored
@ -35,8 +35,8 @@ subnet=192.168.250.0
|
|||||||
|
|
||||||
[io4]
|
[io4]
|
||||||
; Input API selection for JVS input emulator.
|
; Input API selection for JVS input emulator.
|
||||||
test=0x31
|
test=0x2D
|
||||||
service=0x32
|
service=0x2E
|
||||||
|
volup=0x24
|
||||||
|
voldown=0x23
|
||||||
|
|
||||||
[gfx]
|
|
||||||
enable=0
|
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
#include "hooklib/config.h"
|
#include "hooklib/config.h"
|
||||||
#include "hooklib/dvd.h"
|
#include "hooklib/dvd.h"
|
||||||
#include "hooklib/gfx.h"
|
|
||||||
|
|
||||||
#include "mercuryhook/config.h"
|
#include "mercuryhook/config.h"
|
||||||
|
|
||||||
@ -34,7 +33,7 @@ void touch_config_load(
|
|||||||
assert(cfg != NULL);
|
assert(cfg != NULL);
|
||||||
assert(filename != NULL);
|
assert(filename != NULL);
|
||||||
|
|
||||||
GetPrivateProfileIntW(
|
cfg->enable = GetPrivateProfileIntW(
|
||||||
L"touch",
|
L"touch",
|
||||||
L"enable",
|
L"enable",
|
||||||
1,
|
1,
|
||||||
@ -52,7 +51,6 @@ void mercury_hook_config_load(
|
|||||||
aime_config_load(&cfg->aime, filename);
|
aime_config_load(&cfg->aime, filename);
|
||||||
dvd_config_load(&cfg->dvd, filename);
|
dvd_config_load(&cfg->dvd, filename);
|
||||||
io4_config_load(&cfg->io4, filename);
|
io4_config_load(&cfg->io4, filename);
|
||||||
gfx_config_load(&cfg->gfx, filename);
|
|
||||||
mercury_dll_config_load(&cfg->dll, filename);
|
mercury_dll_config_load(&cfg->dll, filename);
|
||||||
touch_config_load(&cfg->touch, filename);
|
touch_config_load(&cfg->touch, filename);
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
#include "board/config.h"
|
#include "board/config.h"
|
||||||
|
|
||||||
#include "hooklib/dvd.h"
|
#include "hooklib/dvd.h"
|
||||||
#include "hooklib/gfx.h"
|
|
||||||
|
|
||||||
#include "mercuryhook/mercury-dll.h"
|
#include "mercuryhook/mercury-dll.h"
|
||||||
#include "mercuryhook/touch.h"
|
#include "mercuryhook/touch.h"
|
||||||
@ -17,7 +16,6 @@ struct mercury_hook_config {
|
|||||||
struct aime_config aime;
|
struct aime_config aime;
|
||||||
struct dvd_config dvd;
|
struct dvd_config dvd;
|
||||||
struct io4_config io4;
|
struct io4_config io4;
|
||||||
struct gfx_config gfx;
|
|
||||||
struct mercury_dll_config dll;
|
struct mercury_dll_config dll;
|
||||||
struct touch_config touch;
|
struct touch_config touch;
|
||||||
};
|
};
|
||||||
|
@ -38,7 +38,6 @@ static DWORD CALLBACK mercury_pre_startup(void)
|
|||||||
/* Hook Win32 APIs */
|
/* Hook Win32 APIs */
|
||||||
|
|
||||||
dvd_hook_init(&mercury_hook_cfg.dvd, mercury_hook_mod);
|
dvd_hook_init(&mercury_hook_cfg.dvd, mercury_hook_mod);
|
||||||
gfx_hook_init(&mercury_hook_cfg.gfx, mercury_hook_mod);
|
|
||||||
serial_hook_init();
|
serial_hook_init();
|
||||||
|
|
||||||
/* Initialize emulation hooks */
|
/* Initialize emulation hooks */
|
||||||
|
@ -34,6 +34,7 @@ HRESULT mercury_io4_hook_init(const struct io4_config *cfg)
|
|||||||
static HRESULT mercury_io4_poll(void *ctx, struct io4_state *state)
|
static HRESULT mercury_io4_poll(void *ctx, struct io4_state *state)
|
||||||
{
|
{
|
||||||
uint8_t opbtn;
|
uint8_t opbtn;
|
||||||
|
uint8_t gamebtn;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
assert(mercury_dll.poll != NULL);
|
assert(mercury_dll.poll != NULL);
|
||||||
@ -49,8 +50,10 @@ static HRESULT mercury_io4_poll(void *ctx, struct io4_state *state)
|
|||||||
}
|
}
|
||||||
|
|
||||||
opbtn = 0;
|
opbtn = 0;
|
||||||
|
gamebtn = 0;
|
||||||
|
|
||||||
mercury_dll.get_opbtns(&opbtn);
|
mercury_dll.get_opbtns(&opbtn);
|
||||||
|
mercury_dll.get_gamebtns(&gamebtn);
|
||||||
|
|
||||||
if (opbtn & MERCURY_IO_OPBTN_TEST) {
|
if (opbtn & MERCURY_IO_OPBTN_TEST) {
|
||||||
state->buttons[0] |= IO4_BUTTON_TEST;
|
state->buttons[0] |= IO4_BUTTON_TEST;
|
||||||
@ -60,5 +63,13 @@ static HRESULT mercury_io4_poll(void *ctx, struct io4_state *state)
|
|||||||
state->buttons[0] |= IO4_BUTTON_SERVICE;
|
state->buttons[0] |= IO4_BUTTON_SERVICE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (gamebtn & MERCURY_IO_GAMEBTN_VOL_UP) {
|
||||||
|
state->buttons[0] |= 1 << 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gamebtn & MERCURY_IO_GAMEBTN_VOL_DOWN) {
|
||||||
|
state->buttons[0] |= 1 << 0;
|
||||||
|
}
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,9 @@ const struct dll_bind_sym mercury_dll_syms[] = {
|
|||||||
}, {
|
}, {
|
||||||
.sym = "mercury_io_touch_init",
|
.sym = "mercury_io_touch_init",
|
||||||
.off = offsetof(struct mercury_dll, touch_init),
|
.off = offsetof(struct mercury_dll, touch_init),
|
||||||
|
}, {
|
||||||
|
.sym = "mercury_io_touch_start",
|
||||||
|
.off = offsetof(struct mercury_dll, touch_start),
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -9,8 +9,9 @@ struct mercury_dll {
|
|||||||
HRESULT (*init)(void);
|
HRESULT (*init)(void);
|
||||||
HRESULT (*poll)(void);
|
HRESULT (*poll)(void);
|
||||||
void (*get_opbtns)(uint8_t *opbtn);
|
void (*get_opbtns)(uint8_t *opbtn);
|
||||||
void (*get_gamebtns)(uint16_t *player1, uint16_t *player2);
|
void (*get_gamebtns)(uint8_t *gamebtn);
|
||||||
HRESULT (*touch_init)(void);
|
HRESULT (*touch_init)(void);
|
||||||
|
HRESULT (*touch_start)(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct mercury_dll_config {
|
struct mercury_dll_config {
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
LIBRARY mercuryhook
|
LIBRARY mercuryhook
|
||||||
|
|
||||||
EXPORTS
|
EXPORTS
|
||||||
Direct3DCreate9
|
|
||||||
aime_io_get_api_version
|
aime_io_get_api_version
|
||||||
aime_io_init
|
aime_io_init
|
||||||
aime_io_led_set_color
|
aime_io_led_set_color
|
||||||
@ -16,5 +15,6 @@ EXPORTS
|
|||||||
mercury_io_get_gamebtns
|
mercury_io_get_gamebtns
|
||||||
mercury_io_get_opbtns
|
mercury_io_get_opbtns
|
||||||
mercury_io_touch_init
|
mercury_io_touch_init
|
||||||
|
mercury_io_touch_start
|
||||||
mercury_io_init
|
mercury_io_init
|
||||||
mercury_io_poll
|
mercury_io_poll
|
||||||
|
@ -31,9 +31,9 @@ static HRESULT touch_frame_decode(struct touch_req *dest, struct iobuf *iobuf, i
|
|||||||
static HRESULT touch_frame_encode(struct iobuf *dest, const void *ptr, size_t nbytes);
|
static HRESULT touch_frame_encode(struct iobuf *dest, const void *ptr, size_t nbytes);
|
||||||
static uint8_t calc_checksum(const void *ptr, size_t nbytes);
|
static uint8_t calc_checksum(const void *ptr, size_t nbytes);
|
||||||
|
|
||||||
static HRESULT touch_handle_get_rev_date(const struct touch_req *req);
|
static HRESULT touch_handle_get_sync_board_ver(const struct touch_req *req);
|
||||||
static HRESULT touch_handle_startup(const struct touch_req *req);
|
static HRESULT touch_handle_startup(const struct touch_req *req);
|
||||||
static HRESULT touch_handle_get_rev_date_detail(const struct touch_req *req);
|
static HRESULT touch_handle_get_unit_board_ver(const struct touch_req *req);
|
||||||
static HRESULT touch_handle_mystery1(const struct touch_req *req);
|
static HRESULT touch_handle_mystery1(const struct touch_req *req);
|
||||||
static HRESULT touch_handle_mystery2(const struct touch_req *req);
|
static HRESULT touch_handle_mystery2(const struct touch_req *req);
|
||||||
static HRESULT touch_handle_start_auto_scan(const struct touch_req *req);
|
static HRESULT touch_handle_start_auto_scan(const struct touch_req *req);
|
||||||
@ -55,10 +55,9 @@ HRESULT touch_hook_init(const struct touch_config *cfg)
|
|||||||
assert(cfg != NULL);
|
assert(cfg != NULL);
|
||||||
assert(mercury_dll.touch_init != NULL);
|
assert(mercury_dll.touch_init != NULL);
|
||||||
|
|
||||||
// not sure why this always returns false...
|
if (!cfg->enable) {
|
||||||
/*if (!cfg->enable) {
|
|
||||||
return S_FALSE;
|
return S_FALSE;
|
||||||
}*/
|
}
|
||||||
|
|
||||||
InitializeCriticalSection(&touch0_lock);
|
InitializeCriticalSection(&touch0_lock);
|
||||||
InitializeCriticalSection(&touch1_lock);
|
InitializeCriticalSection(&touch1_lock);
|
||||||
@ -200,12 +199,12 @@ static HRESULT touch1_handle_irp_locked(struct irp *irp)
|
|||||||
static HRESULT touch_req_dispatch(const struct touch_req *req)
|
static HRESULT touch_req_dispatch(const struct touch_req *req)
|
||||||
{
|
{
|
||||||
switch (req->cmd) {
|
switch (req->cmd) {
|
||||||
case CMD_GET_REV_DATE:
|
case CMD_GET_SYNC_BOARD_VER:
|
||||||
return touch_handle_get_rev_date(req);
|
return touch_handle_get_sync_board_ver(req);
|
||||||
case CMD_STARTUP:
|
case CMD_STARTUP:
|
||||||
return touch_handle_startup(req);
|
return touch_handle_startup(req);
|
||||||
case CMD_GET_REV_DATE_DETAIL:
|
case CMD_GET_UNIT_BOARD_VER:
|
||||||
return touch_handle_get_rev_date_detail(req);
|
return touch_handle_get_unit_board_ver(req);
|
||||||
case CMD_MYSTERY1:
|
case CMD_MYSTERY1:
|
||||||
return touch_handle_mystery1(req);
|
return touch_handle_mystery1(req);
|
||||||
case CMD_MYSTERY2:
|
case CMD_MYSTERY2:
|
||||||
@ -224,17 +223,19 @@ static HRESULT touch_req_dispatch(const struct touch_req *req)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT touch_handle_get_rev_date(const struct touch_req *req)
|
static HRESULT touch_handle_get_sync_board_ver(const struct touch_req *req)
|
||||||
{
|
{
|
||||||
struct touch_resp_get_rev_date resp;
|
struct touch_resp_get_sync_board_ver resp;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
uint8_t rev[6] = { 0x31, 0x39, 0x30, 0x35, 0x32, 0x33 };
|
uint8_t sync_board_ver[6] = { 0x31, 0x39, 0x30, 0x35, 0x32, 0x33 };
|
||||||
|
|
||||||
dprintf("Wacca Touch%d: Get board rev date\n", req->side);
|
dprintf("Wacca Touch%d: Get sync board version\n", req->side);
|
||||||
|
|
||||||
resp.cmd = 0xa0;
|
resp.cmd = 0xa0;
|
||||||
memcpy(resp.data, rev, sizeof(rev));
|
// TODO: Why does strcpy_s here give a runtime warning and not work????
|
||||||
//resp.data = rev;
|
//strcpy_s(resp.version, sizeof(resp.version), "190523");
|
||||||
|
memcpy(resp.version, sync_board_ver, sizeof(sync_board_ver));
|
||||||
|
|
||||||
|
|
||||||
if (req->side == 0) {
|
if (req->side == 0) {
|
||||||
hr = touch_frame_encode(&touch0_uart.readable, &resp, sizeof(resp));
|
hr = touch_frame_encode(&touch0_uart.readable, &resp, sizeof(resp));
|
||||||
@ -252,7 +253,8 @@ static HRESULT touch_handle_startup(const struct touch_req *req)
|
|||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
uint8_t *rev;
|
uint8_t *rev;
|
||||||
|
|
||||||
dprintf("Wacca Touch%d: Startup\n", req->side);
|
dprintf("Wacca Touch%d: Startup %2hx\n", req->side, req->data[2]);
|
||||||
|
|
||||||
|
|
||||||
switch (req->data[2]) {
|
switch (req->data[2]) {
|
||||||
case 0x30:
|
case 0x30:
|
||||||
@ -298,19 +300,19 @@ static HRESULT touch_handle_startup(const struct touch_req *req)
|
|||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT touch_handle_get_rev_date_detail(const struct touch_req *req)
|
static HRESULT touch_handle_get_unit_board_ver(const struct touch_req *req)
|
||||||
{
|
{
|
||||||
struct touch_resp_get_rev_date_detail resp;
|
struct touch_resp_get_unit_board_ver resp;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
uint8_t rev[43] = { 0x31, 0x39, 0x30, 0x35, 0x32, 0x33, 0x52, 0x31,
|
uint8_t unit_board_ver[43] = { 0x31, 0x39, 0x30, 0x35, 0x32, 0x33, 0x52, 0x31,
|
||||||
0x39, 0x30, 0x35, 0x31, 0x34, 0x31, 0x39, 0x30, 0x35, 0x31, 0x34, 0x31,
|
0x39, 0x30, 0x35, 0x31, 0x34, 0x31, 0x39, 0x30, 0x35, 0x31, 0x34, 0x31,
|
||||||
0x39, 0x30, 0x35, 0x31, 0x34, 0x31, 0x39, 0x30, 0x35, 0x31, 0x34, 0x31,
|
0x39, 0x30, 0x35, 0x31, 0x34, 0x31, 0x39, 0x30, 0x35, 0x31, 0x34, 0x31,
|
||||||
0x39, 0x30, 0x35, 0x31, 0x34, 0x31, 0x39, 0x30, 0x35, 0x31, 0x34 };
|
0x39, 0x30, 0x35, 0x31, 0x34, 0x31, 0x39, 0x30, 0x35, 0x31, 0x34 };
|
||||||
|
|
||||||
dprintf("Wacca Touch%d: get rev date detail\n", req->side);
|
dprintf("Wacca Touch%d: get unit board version\n", req->side);
|
||||||
|
|
||||||
resp.cmd = 0xa8;
|
resp.cmd = 0xa8;
|
||||||
memcpy(resp.data, rev, sizeof(rev));
|
memcpy(resp.version, unit_board_ver, sizeof(unit_board_ver));
|
||||||
|
|
||||||
if (req->side == 0) {
|
if (req->side == 0) {
|
||||||
hr = touch_frame_encode(&touch0_uart.readable, &resp, sizeof(resp));
|
hr = touch_frame_encode(&touch0_uart.readable, &resp, sizeof(resp));
|
||||||
@ -406,12 +408,7 @@ static HRESULT touch_frame_decode(struct touch_req *dest, struct iobuf *iobuf, i
|
|||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Encode and send the response.
|
/* Encode and send the response. */
|
||||||
* The last byte of every response is a checksum.
|
|
||||||
* This checksum is calculated by bitwise XORing
|
|
||||||
* every byte in the response, then dropping the MSB.
|
|
||||||
* Thanks the CrazyRedMachine for figuring that out!!
|
|
||||||
*/
|
|
||||||
static HRESULT touch_frame_encode(struct iobuf *dest, const void *ptr, size_t nbytes)
|
static HRESULT touch_frame_encode(struct iobuf *dest, const void *ptr, size_t nbytes)
|
||||||
{
|
{
|
||||||
const uint8_t *src;
|
const uint8_t *src;
|
||||||
@ -428,6 +425,11 @@ static HRESULT touch_frame_encode(struct iobuf *dest, const void *ptr, size_t nb
|
|||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* The last byte of every response is a checksum.
|
||||||
|
* This checksum is calculated by bitwise XORing
|
||||||
|
* every byte in the response, then dropping the MSB.
|
||||||
|
* Thanks the CrazyRedMachine for figuring that out!!
|
||||||
|
*/
|
||||||
static uint8_t calc_checksum(const void *ptr, size_t nbytes)
|
static uint8_t calc_checksum(const void *ptr, size_t nbytes)
|
||||||
{
|
{
|
||||||
const uint8_t *src;
|
const uint8_t *src;
|
||||||
|
@ -9,9 +9,9 @@ struct touch_config {
|
|||||||
};
|
};
|
||||||
|
|
||||||
enum touch_cmd {
|
enum touch_cmd {
|
||||||
CMD_GET_REV_DATE = 0xa0,
|
CMD_GET_SYNC_BOARD_VER = 0xa0,
|
||||||
CMD_STARTUP = 0x72,
|
CMD_STARTUP = 0x72,
|
||||||
CMD_GET_REV_DATE_DETAIL = 0xa8,
|
CMD_GET_UNIT_BOARD_VER = 0xa8,
|
||||||
CMD_MYSTERY1 = 0xa2,
|
CMD_MYSTERY1 = 0xa2,
|
||||||
CMD_MYSTERY2 = 0x94,
|
CMD_MYSTERY2 = 0x94,
|
||||||
CMD_START_AUTO_SCAN = 0xc9,
|
CMD_START_AUTO_SCAN = 0xc9,
|
||||||
@ -37,18 +37,18 @@ struct touch_input_frame {
|
|||||||
uint8_t checksum;
|
uint8_t checksum;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct touch_resp_get_rev_date {
|
struct touch_resp_get_sync_board_ver {
|
||||||
uint8_t cmd;
|
uint8_t cmd;
|
||||||
uint8_t data[6];
|
char version[6];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct touch_resp_startup {
|
struct touch_resp_startup {
|
||||||
uint8_t data[80];
|
char data[80];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct touch_resp_get_rev_date_detail {
|
struct touch_resp_get_unit_board_ver {
|
||||||
uint8_t cmd;
|
uint8_t cmd;
|
||||||
uint8_t data[43];
|
uint8_t version[43];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct touch_resp_mystery1 {
|
struct touch_resp_mystery1 {
|
||||||
|
@ -8,15 +8,48 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
Wacca Default key binding
|
Wacca Default key binding
|
||||||
|
Inner left
|
||||||
|
Inner right
|
||||||
|
2nd inner left
|
||||||
|
2nd inner right
|
||||||
|
3rd inner left
|
||||||
|
3rd inner right
|
||||||
|
outer left
|
||||||
|
outer right
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
static const int mercury_io_default_cells[] = {
|
||||||
|
'1','1','1','2','2','2','3','3','3','4','4','4','5','5','5','6','6','6','7','7','7','8','8','8','9','9','9','0','0','0',
|
||||||
|
'A','A','A','S','S','S','D','D','D','F','F','F','G','G','G','H','H','H','J','J','J','K','K','K','L','L','L',';',';',';',
|
||||||
|
'1','1','1','2','2','2','3','3','3','4','4','4','5','5','5','6','6','6','7','7','7','8','8','8','9','9','9','0','0','0',
|
||||||
|
'A','A','A','S','S','S','D','D','D','F','F','F','G','G','G','H','H','H','J','J','J','K','K','K','L','L','L',';',';',';',
|
||||||
|
'Q','Q','Q','W','W','W','E','E','E','R','R','R','T','T','T','Y','Y','Y','U','U','U','I','I','I','O','O','O','P','P','P',
|
||||||
|
'Z','Z','Z','X','X','X','C','C','C','V','V','V','B','B','B','N','N','N','M','M','M',',',',',',','.','.','.','/','/','/',
|
||||||
|
'Q','Q','Q','W','W','W','E','E','E','R','R','R','T','T','T','Y','Y','Y','U','U','U','I','I','I','O','O','O','P','P','P',
|
||||||
|
'Z','Z','Z','X','X','X','C','C','C','V','V','V','B','B','B','N','N','N','M','M','M',',',',',',','.','.','.','/','/','/',
|
||||||
|
};
|
||||||
|
|
||||||
void mercury_io_config_load(
|
void mercury_io_config_load(
|
||||||
struct mercury_io_config *cfg,
|
struct mercury_io_config *cfg,
|
||||||
const wchar_t *filename)
|
const wchar_t *filename)
|
||||||
{
|
{
|
||||||
|
wchar_t key[240];
|
||||||
|
int i;
|
||||||
|
|
||||||
assert(cfg != NULL);
|
assert(cfg != NULL);
|
||||||
assert(filename != NULL);
|
assert(filename != NULL);
|
||||||
|
|
||||||
cfg->vk_test = GetPrivateProfileIntW(L"io4", L"test", '1', filename);
|
cfg->vk_test = GetPrivateProfileIntW(L"io4", L"test", 0x2D, filename);
|
||||||
cfg->vk_service = GetPrivateProfileIntW(L"io4", L"service", '2', filename);
|
cfg->vk_service = GetPrivateProfileIntW(L"io4", L"service", 0x2E, filename);
|
||||||
|
cfg->vk_vol_up = GetPrivateProfileIntW(L"io4", L"volup", 0x24, filename);
|
||||||
|
cfg->vk_vol_down = GetPrivateProfileIntW(L"io4", L"voldown", 0x23, filename);
|
||||||
|
|
||||||
|
for (i = 0 ; i < 240 ; i++) {
|
||||||
|
swprintf_s(key, _countof(key), L"cell%i", i + 1);
|
||||||
|
cfg->vk_cell[i] = GetPrivateProfileIntW(
|
||||||
|
L"touch",
|
||||||
|
key,
|
||||||
|
mercury_io_default_cells[i],
|
||||||
|
filename);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,8 +8,9 @@
|
|||||||
struct mercury_io_config {
|
struct mercury_io_config {
|
||||||
uint8_t vk_test;
|
uint8_t vk_test;
|
||||||
uint8_t vk_service;
|
uint8_t vk_service;
|
||||||
uint8_t vk_1p_btn[9];
|
uint8_t vk_vol_up;
|
||||||
uint8_t vk_2p_btn[9];
|
uint8_t vk_vol_down;
|
||||||
|
uint8_t vk_cell[240];
|
||||||
};
|
};
|
||||||
|
|
||||||
void mercury_io_config_load(
|
void mercury_io_config_load(
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#include "mercuryio/config.h"
|
#include "mercuryio/config.h"
|
||||||
|
|
||||||
static uint8_t mercury_opbtn;
|
static uint8_t mercury_opbtn;
|
||||||
|
static uint8_t mercury_gamebtn;
|
||||||
static struct mercury_io_config mercury_io_cfg;
|
static struct mercury_io_config mercury_io_cfg;
|
||||||
|
|
||||||
uint16_t mercury_io_get_api_version(void)
|
uint16_t mercury_io_get_api_version(void)
|
||||||
@ -24,6 +25,7 @@ HRESULT mercury_io_init(void)
|
|||||||
HRESULT mercury_io_poll(void)
|
HRESULT mercury_io_poll(void)
|
||||||
{
|
{
|
||||||
mercury_opbtn = 0;
|
mercury_opbtn = 0;
|
||||||
|
mercury_gamebtn = 0;
|
||||||
|
|
||||||
if (GetAsyncKeyState(mercury_io_cfg.vk_test)) {
|
if (GetAsyncKeyState(mercury_io_cfg.vk_test)) {
|
||||||
mercury_opbtn |= MERCURY_IO_OPBTN_TEST;
|
mercury_opbtn |= MERCURY_IO_OPBTN_TEST;
|
||||||
@ -33,6 +35,14 @@ HRESULT mercury_io_poll(void)
|
|||||||
mercury_opbtn |= MERCURY_IO_OPBTN_SERVICE;
|
mercury_opbtn |= MERCURY_IO_OPBTN_SERVICE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (GetAsyncKeyState(mercury_io_cfg.vk_vol_up)) {
|
||||||
|
mercury_gamebtn |= MERCURY_IO_GAMEBTN_VOL_UP;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GetAsyncKeyState(mercury_io_cfg.vk_vol_down)) {
|
||||||
|
mercury_gamebtn |= MERCURY_IO_GAMEBTN_VOL_DOWN;
|
||||||
|
}
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,12 +53,19 @@ void mercury_io_get_opbtns(uint8_t *opbtn)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void mercury_io_get_gamebtns(uint16_t *player1, uint16_t *player2)
|
void mercury_io_get_gamebtns(uint8_t *gamebtn)
|
||||||
{
|
{
|
||||||
|
if (gamebtn != NULL) {
|
||||||
|
*gamebtn = mercury_gamebtn;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT mercury_io_touch_init(void)
|
HRESULT mercury_io_touch_init(void)
|
||||||
{
|
{
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HRESULT mercury_io_touch_start(void)
|
||||||
|
{
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
@ -10,15 +10,8 @@ enum {
|
|||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
MERCURY_IO_GAMEBTN_1 = 0x01,
|
MERCURY_IO_GAMEBTN_VOL_UP = 0x01,
|
||||||
MERCURY_IO_GAMEBTN_2 = 0x02,
|
MERCURY_IO_GAMEBTN_VOL_DOWN = 0x02,
|
||||||
MERCURY_IO_GAMEBTN_3 = 0x04,
|
|
||||||
MERCURY_IO_GAMEBTN_4 = 0x08,
|
|
||||||
MERCURY_IO_GAMEBTN_5 = 0x10,
|
|
||||||
MERCURY_IO_GAMEBTN_6 = 0x20,
|
|
||||||
MERCURY_IO_GAMEBTN_7 = 0x40,
|
|
||||||
MERCURY_IO_GAMEBTN_8 = 0x80,
|
|
||||||
MERCURY_IO_GAMEBTN_SELECT = 0x100,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Get the version of the Wacca IO API that this DLL supports. This
|
/* Get the version of the Wacca IO API that this DLL supports. This
|
||||||
@ -64,6 +57,8 @@ void mercury_io_get_opbtns(uint8_t *opbtn);
|
|||||||
|
|
||||||
Minimum API version: 0x0100 */
|
Minimum API version: 0x0100 */
|
||||||
|
|
||||||
void mercury_io_get_gamebtns(uint16_t *player1, uint16_t *player2);
|
void mercury_io_get_gamebtns(uint8_t *gamebtn);
|
||||||
|
|
||||||
HRESULT mercury_io_touch_init(void);
|
HRESULT mercury_io_touch_init(void);
|
||||||
|
|
||||||
|
HRESULT mercury_io_touch_start(void);
|
||||||
|
Loading…
Reference in New Issue
Block a user