+ vol btns, / test and service remap, - gfx hook

This commit is contained in:
Hay1tsme
2022-01-08 02:25:42 -05:00
parent 3f41eb5b31
commit 12b523ad9f
14 changed files with 120 additions and 62 deletions

View File

@ -8,15 +8,48 @@
/*
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(
struct mercury_io_config *cfg,
const wchar_t *filename)
{
wchar_t key[240];
int i;
assert(cfg != NULL);
assert(filename != NULL);
cfg->vk_test = GetPrivateProfileIntW(L"io4", L"test", '1', filename);
cfg->vk_service = GetPrivateProfileIntW(L"io4", L"service", '2', filename);
cfg->vk_test = GetPrivateProfileIntW(L"io4", L"test", 0x2D, 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);
}
}

View File

@ -8,8 +8,9 @@
struct mercury_io_config {
uint8_t vk_test;
uint8_t vk_service;
uint8_t vk_1p_btn[9];
uint8_t vk_2p_btn[9];
uint8_t vk_vol_up;
uint8_t vk_vol_down;
uint8_t vk_cell[240];
};
void mercury_io_config_load(

View File

@ -7,6 +7,7 @@
#include "mercuryio/config.h"
static uint8_t mercury_opbtn;
static uint8_t mercury_gamebtn;
static struct mercury_io_config mercury_io_cfg;
uint16_t mercury_io_get_api_version(void)
@ -24,6 +25,7 @@ HRESULT mercury_io_init(void)
HRESULT mercury_io_poll(void)
{
mercury_opbtn = 0;
mercury_gamebtn = 0;
if (GetAsyncKeyState(mercury_io_cfg.vk_test)) {
mercury_opbtn |= MERCURY_IO_OPBTN_TEST;
@ -33,6 +35,14 @@ HRESULT mercury_io_poll(void)
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;
}
@ -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)
{
return S_OK;
}
HRESULT mercury_io_touch_start(void)
{
return S_OK;
}

View File

@ -10,15 +10,8 @@ enum {
};
enum {
MERCURY_IO_GAMEBTN_1 = 0x01,
MERCURY_IO_GAMEBTN_2 = 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,
MERCURY_IO_GAMEBTN_VOL_UP = 0x01,
MERCURY_IO_GAMEBTN_VOL_DOWN = 0x02,
};
/* 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 */
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_start(void);