hkb: formatting

This commit is contained in:
kyoubate-haruka
2026-08-11 11:33:56 +02:00
parent 71fd8eed7f
commit b1529f73ef
22 changed files with 106 additions and 154 deletions
+2 -4
View File
@@ -10,7 +10,6 @@
#include "hook/procaddr.h"
#include "hook/table.h"
#include "hooklib/touch.h"
#include "util/dprintf.h"
static int hook_Amptw_getResult(void* pContext, int* pResult);
@@ -34,11 +33,10 @@ void amptw_hook_init(const struct touch_screen_config* cfg, HMODULE hmodule) {
void amptw_apply_hooks(HMODULE module) {
hook_table_apply(module, "amptw.dll", touch_hooks, _countof(touch_hooks));
proc_addr_table_push(module, "amptw.dll", touch_hooks,
_countof(touch_hooks));
proc_addr_table_push(module, "amptw.dll", touch_hooks, _countof(touch_hooks));
}
static int hook_Amptw_getResult(void* pContext, int* pResult) {
*pResult = 0;
return 0;
}
}
+1 -1
View File
@@ -3,4 +3,4 @@
#include "hooklib/touch.h"
void amptw_hook_init(const struct touch_screen_config* cfg, HMODULE hmodule);
void amptw_apply_hooks(HMODULE module);
void amptw_apply_hooks(HMODULE module);
+11 -21
View File
@@ -14,12 +14,10 @@ void hkb_dll_config_load(struct hkb_dll_config* cfg, const wchar_t* filename) {
assert(cfg != NULL);
assert(filename != NULL);
GetPrivateProfileStringW(L"hkbio", L"path", L"", cfg->path,
_countof(cfg->path), filename);
GetPrivateProfileStringW(L"hkbio", L"path", L"", cfg->path, _countof(cfg->path), filename);
}
void led15093_config_load(struct led15093_config* cfg,
const wchar_t* filename) {
void led15093_config_load(struct led15093_config* cfg, const wchar_t* filename) {
assert(cfg != NULL);
assert(filename != NULL);
@@ -30,34 +28,27 @@ void led15093_config_load(struct led15093_config* cfg,
memset(cfg->boot_chip_number, ' ', sizeof(cfg->boot_chip_number));
cfg->enable = GetPrivateProfileIntW(L"led15093", L"enable", 1, filename);
cfg->port_no[0] = GetPrivateProfileIntW(L"led15093", L"portNo1", 0,
filename);
cfg->port_no[1] = GetPrivateProfileIntW(L"led15093", L"portNo2", 0,
filename);
cfg->high_baudrate = GetPrivateProfileIntW(L"led15093", L"highBaud", 0,
filename);
cfg->port_no[0] = GetPrivateProfileIntW(L"led15093", L"portNo1", 0, filename);
cfg->port_no[1] = GetPrivateProfileIntW(L"led15093", L"portNo2", 0, filename);
cfg->high_baudrate = GetPrivateProfileIntW(L"led15093", L"highBaud", 0, filename);
cfg->fw_ver = GetPrivateProfileIntW(L"led15093", L"fwVer", 0xA0, filename);
cfg->fw_sum =
GetPrivateProfileIntW(L"led15093", L"fwSum", 0xAA53, filename);
cfg->fw_sum = GetPrivateProfileIntW(L"led15093", L"fwSum", 0xAA53, filename);
GetPrivateProfileStringW(L"led15093", L"boardNumber", L"15093-06", tmpstr,
_countof(tmpstr), filename);
GetPrivateProfileStringW(L"led15093", L"boardNumber", L"15093-06", tmpstr, _countof(tmpstr), filename);
size_t n = wcstombs(cfg->board_number, tmpstr, sizeof(cfg->board_number));
for (int i = n; i < sizeof(cfg->board_number); i++) {
cfg->board_number[i] = ' ';
}
GetPrivateProfileStringW(L"led15093", L"chipNumber", L"6710A", tmpstr,
_countof(tmpstr), filename);
GetPrivateProfileStringW(L"led15093", L"chipNumber", L"6710A", tmpstr, _countof(tmpstr), filename);
n = wcstombs(cfg->chip_number, tmpstr, sizeof(cfg->chip_number));
for (int i = n; i < sizeof(cfg->chip_number); i++) {
cfg->chip_number[i] = ' ';
}
GetPrivateProfileStringW(L"led15093", L"bootChipNumber", L"6709 ", tmpstr,
_countof(tmpstr), filename);
GetPrivateProfileStringW(L"led15093", L"bootChipNumber", L"6709 ", tmpstr, _countof(tmpstr), filename);
n = wcstombs(cfg->boot_chip_number, tmpstr, sizeof(cfg->boot_chip_number));
for (int i = n; i < sizeof(cfg->boot_chip_number); i++) {
@@ -65,8 +56,7 @@ void led15093_config_load(struct led15093_config* cfg,
}
}
void hkb_hook_config_load(struct hkb_hook_config* cfg,
const wchar_t* filename) {
void hkb_hook_config_load(struct hkb_hook_config* cfg, const wchar_t* filename) {
assert(cfg != NULL);
assert(filename != NULL);
@@ -79,4 +69,4 @@ void hkb_hook_config_load(struct hkb_hook_config* cfg,
unity_config_load(&cfg->unity, filename);
hkb_dll_config_load(&cfg->dll, filename);
vfd_config_load(&cfg->vfd, filename);
}
}
+1 -1
View File
@@ -29,4 +29,4 @@ struct hkb_hook_config {
void hkb_dll_config_load(struct hkb_dll_config* cfg, const wchar_t* filename);
void hkb_hook_config_load(struct hkb_hook_config* cfg, const wchar_t* filename);
void hkb_hook_config_load(struct hkb_hook_config* cfg, const wchar_t* filename);
+10 -12
View File
@@ -78,14 +78,12 @@ static DWORD CALLBACK hkb_pre_startup(void) {
if (strncmp(hkb_hook_cfg.platform.nusec.platform_id, "ACA4", 4) == 0) {
// Terminal
is_terminal = true;
} else if (strncmp(hkb_hook_cfg.platform.nusec.platform_id, "ACA2", 4) ==
0) {
} else if (strncmp(hkb_hook_cfg.platform.nusec.platform_id, "ACA2", 4) == 0) {
// Satellite
is_terminal = false;
} else {
// Unknown
dprintf("Unknown platform ID: %s\n",
hkb_hook_cfg.platform.nusec.platform_id);
dprintf("Unknown platform ID: %s\n", hkb_hook_cfg.platform.nusec.platform_id);
goto fail;
}
@@ -97,15 +95,13 @@ static DWORD CALLBACK hkb_pre_startup(void) {
/* Initialize emulation hooks */
hr = platform_hook_init(&hkb_hook_cfg.platform, "SDEC",
is_terminal ? "ACA4" : "ACA2", hkb_hook_mod);
hr = platform_hook_init(&hkb_hook_cfg.platform, "SDEC", is_terminal ? "ACA4" : "ACA2", hkb_hook_mod);
if (FAILED(hr)) {
goto fail;
}
hr = sg_reader_hook_init(&hkb_hook_cfg.aime, is_terminal ? 1 : 3, 3,
hkb_hook_mod);
hr = sg_reader_hook_init(&hkb_hook_cfg.aime, is_terminal ? 1 : 3, 3, hkb_hook_mod);
if (FAILED(hr)) {
goto fail;
@@ -129,9 +125,11 @@ static DWORD CALLBACK hkb_pre_startup(void) {
goto fail;
}
unsigned int led_port_no[2] = {is_terminal ? 3 : 2, 0};
hr = led15093_hook_init(&hkb_hook_cfg.led15093, hkb_dll.led_init,
hkb_dll.led_set_leds, led_port_no);
unsigned int led_port_no[2] = {
is_terminal ? 3 : 2,
0
};
hr = led15093_hook_init(&hkb_hook_cfg.led15093, hkb_dll.led_init, hkb_dll.led_set_leds, led_port_no);
if (FAILED(hr)) {
goto fail;
@@ -167,4 +165,4 @@ BOOL WINAPI DllMain(HMODULE mod, DWORD cause, void* ctx) {
}
return SUCCEEDED(hr);
}
}
+4 -13
View File
@@ -76,18 +76,12 @@ HRESULT hkb_dll_init(const struct hkb_dll_config* cfg, HINSTANCE self) {
hkb_dll.api_version = get_api_version();
} else {
hkb_dll.api_version = 0x0100;
dprintf(
"Custom IO DLL does not expose hkb_io_get_api_version, "
"assuming API version 1.0.\n"
"Please ask the developer to update their DLL.\n");
dprintf("Custom IO DLL does not expose hkb_io_get_api_version, " "assuming API version 1.0.\n" "Please ask the developer to update their DLL.\n");
}
if (hkb_dll.api_version >= 0x0200) {
hr = E_NOTIMPL;
dprintf(
"HKB IO: Custom IO DLL implements an unsupported "
"API version (%04x). Please update Segatools.\n",
hkb_dll.api_version);
dprintf("HKB IO: Custom IO DLL implements an unsupported " "API version (%04x). Please update Segatools.\n", hkb_dll.api_version);
goto end;
}
@@ -97,10 +91,7 @@ HRESULT hkb_dll_init(const struct hkb_dll_config* cfg, HINSTANCE self) {
if (FAILED(hr)) {
if (src != self) {
dprintf(
"HKB IO: Custom IO DLL does not provide function "
"\"%s\". Please contact your IO DLL's developer for "
"further assistance.\n", sym->sym);
dprintf("HKB IO: Custom IO DLL does not provide function " "\"%s\". Please contact your IO DLL's developer for " "further assistance.\n", sym->sym);
goto end;
} else {
@@ -116,4 +107,4 @@ end:
}
return hr;
}
}
+1 -1
View File
@@ -20,4 +20,4 @@ struct hkb_dll_config {
extern struct hkb_dll hkb_dll;
HRESULT hkb_dll_init(const struct hkb_dll_config* cfg, HINSTANCE self);
HRESULT hkb_dll_init(const struct hkb_dll_config* cfg, HINSTANCE self);
+4 -2
View File
@@ -14,7 +14,9 @@ static HRESULT hkb_io4_poll(void* ctx, struct io4_state* state);
static uint16_t coins;
static bool io_is_terminal;
static const struct io4_ops hkb_io4_ops = {.poll = hkb_io4_poll,};
static const struct io4_ops hkb_io4_ops = {
.poll = hkb_io4_poll,
};
HRESULT hkb_io4_hook_init(const struct io4_config* cfg, bool is_terminal) {
HRESULT hr;
@@ -103,4 +105,4 @@ static HRESULT hkb_io4_poll(void* ctx, struct io4_state* state) {
}
return S_OK;
}
}
+1 -1
View File
@@ -4,4 +4,4 @@
#include "board/io4.h"
HRESULT hkb_io4_hook_init(const struct io4_config* cfg, bool is_terminal);
HRESULT hkb_io4_hook_init(const struct io4_config* cfg, bool is_terminal);
+1 -1
View File
@@ -7,4 +7,4 @@
struct hkb_io_backend {
void (*get_gamebtns)(uint16_t* gamebtn);
void (*get_opbtns)(uint8_t* opbtn);
};
};
+12 -24
View File
@@ -10,31 +10,21 @@
void hkb_kb_config_load(struct hkb_kb_config* cfg, const wchar_t* filename) {
cfg->vk_terminal_decide = GetPrivateProfileIntW(
L"keyboard", L"decide", 'A', filename);
cfg->vk_terminal_cancel = GetPrivateProfileIntW(
L"keyboard", L"cancel", 'S', filename);
cfg->vk_terminal_up = GetPrivateProfileIntW(L"keyboard", L"up", VK_UP,
filename);
cfg->vk_terminal_right = GetPrivateProfileIntW(
L"keyboard", L"right", VK_RIGHT, filename);
cfg->vk_terminal_down = GetPrivateProfileIntW(
L"keyboard", L"down", VK_DOWN, filename);
cfg->vk_terminal_left = GetPrivateProfileIntW(
L"keyboard", L"left", VK_LEFT, filename);
cfg->vk_terminal_left_2 = GetPrivateProfileIntW(
L"keyboard", L"left2", 'Q', filename);
cfg->vk_terminal_right_2 = GetPrivateProfileIntW(
L"keyboard", L"right2", 'W', filename);
cfg->vk_terminal_decide = GetPrivateProfileIntW(L"keyboard", L"decide", 'A', filename);
cfg->vk_terminal_cancel = GetPrivateProfileIntW(L"keyboard", L"cancel", 'S', filename);
cfg->vk_terminal_up = GetPrivateProfileIntW(L"keyboard", L"up", VK_UP, filename);
cfg->vk_terminal_right = GetPrivateProfileIntW(L"keyboard", L"right", VK_RIGHT, filename);
cfg->vk_terminal_down = GetPrivateProfileIntW(L"keyboard", L"down", VK_DOWN, filename);
cfg->vk_terminal_left = GetPrivateProfileIntW(L"keyboard", L"left", VK_LEFT, filename);
cfg->vk_terminal_left_2 = GetPrivateProfileIntW(L"keyboard", L"left2", 'Q', filename);
cfg->vk_terminal_right_2 = GetPrivateProfileIntW(L"keyboard", L"right2", 'W', filename);
}
void hkb_di_config_load(struct hkb_di_config* cfg, const wchar_t* filename) {
assert(cfg != NULL);
assert(filename != NULL);
GetPrivateProfileStringW(L"dinput", L"deviceName", L"", cfg->device_name,
_countof(cfg->device_name), filename);
GetPrivateProfileStringW(L"dinput", L"deviceName", L"", cfg->device_name, _countof(cfg->device_name), filename);
cfg->test = GetPrivateProfileIntW(L"dinput", L"test", 0, filename);
cfg->service = GetPrivateProfileIntW(L"dinput", L"service", 0, filename);
@@ -55,13 +45,11 @@ void hkb_io_config_load(struct hkb_io_config* cfg, const wchar_t* filename) {
assert(filename != NULL);
cfg->vk_test = GetPrivateProfileIntW(L"io4", L"test", VK_F1, filename);
cfg->vk_service =
GetPrivateProfileIntW(L"io4", L"service", VK_F2, filename);
cfg->vk_service = GetPrivateProfileIntW(L"io4", L"service", VK_F2, filename);
cfg->vk_coin = GetPrivateProfileIntW(L"io4", L"coin", VK_F3, filename);
GetPrivateProfileStringW(L"io4", L"mode", L"keyboard", cfg->mode,
_countof(cfg->mode), filename);
GetPrivateProfileStringW(L"io4", L"mode", L"keyboard", cfg->mode, _countof(cfg->mode), filename);
hkb_kb_config_load(&cfg->kb, filename);
hkb_di_config_load(&cfg->di, filename);
}
}
+1 -1
View File
@@ -41,4 +41,4 @@ struct hkb_io_config {
};
void hkb_kb_config_load(struct hkb_kb_config* cfg, const wchar_t* filename);
void hkb_io_config_load(struct hkb_io_config* cfg, const wchar_t* filename);
void hkb_io_config_load(struct hkb_io_config* cfg, const wchar_t* filename);
+3 -5
View File
@@ -11,8 +11,7 @@ HRESULT hkb_di_dev_start(IDirectInputDevice8W* dev, HWND wnd) {
assert(dev != NULL);
assert(wnd != NULL);
HRESULT hr = IDirectInputDevice8_SetCooperativeLevel(
dev, wnd, DISCL_BACKGROUND | DISCL_EXCLUSIVE);
HRESULT hr = IDirectInputDevice8_SetCooperativeLevel(dev, wnd, DISCL_BACKGROUND | DISCL_EXCLUSIVE);
if (FAILED(hr)) {
dprintf("DirectInput: SetCooperativeLevel failed: %08x\n", (int)hr);
@@ -40,8 +39,7 @@ HRESULT hkb_di_dev_start(IDirectInputDevice8W* dev, HWND wnd) {
}
HRESULT hkb_di_dev_poll(IDirectInputDevice8W* dev, HWND wnd,
union hkb_di_state* out) {
HRESULT hkb_di_dev_poll(IDirectInputDevice8W* dev, HWND wnd, union hkb_di_state* out) {
MSG msg;
assert(dev != NULL);
@@ -68,4 +66,4 @@ HRESULT hkb_di_dev_poll(IDirectInputDevice8W* dev, HWND wnd,
responses, so this ends up returning zeroed input state instead. */
return hr;
}
}
+1 -2
View File
@@ -11,5 +11,4 @@ union hkb_di_state {
};
HRESULT hkb_di_dev_start(IDirectInputDevice8W* dev, HWND wnd);
HRESULT hkb_di_dev_poll(IDirectInputDevice8W* dev, HWND wnd,
union hkb_di_state* out);
HRESULT hkb_di_dev_poll(IDirectInputDevice8W* dev, HWND wnd, union hkb_di_state* out);
+28 -33
View File
@@ -11,8 +11,7 @@
#include "util/str.h"
static HRESULT hkb_di_config_apply(const struct hkb_di_config* cfg);
static BOOL CALLBACK hkb_di_enum_callback(const DIDEVICEINSTANCEW* dev,
void* ctx);
static BOOL CALLBACK hkb_di_enum_callback(const DIDEVICEINSTANCEW* dev, void* ctx);
static void hkb_di_get_gamebtns(uint16_t* gamebtn_out);
static void hkb_di_get_opbtns(uint8_t* opbtn_out);
static uint8_t hkb_di_decode_pov(DWORD pov);
@@ -36,10 +35,11 @@ static uint8_t hkb_di_extra_left;
static uint8_t hkb_di_left_2;
static uint8_t hkb_di_right_2;
static union hkb_di_state state = {0};
static union hkb_di_state state = {
0
};
HRESULT hkb_di_init(const struct hkb_di_config* cfg, HINSTANCE inst,
const struct hkb_io_backend** backend) {
HRESULT hkb_di_init(const struct hkb_di_config* cfg, HINSTANCE inst, const struct hkb_io_backend** backend) {
assert(cfg != NULL);
assert(backend != NULL);
@@ -57,17 +57,14 @@ HRESULT hkb_di_init(const struct hkb_di_config* cfg, HINSTANCE inst,
return hr;
}
hr = DirectInput8Create(inst, DIRECTINPUT_VERSION, &IID_IDirectInput8W,
(void**)&hkb_di_api, NULL);
hr = DirectInput8Create(inst, DIRECTINPUT_VERSION, &IID_IDirectInput8W, (void**)&hkb_di_api, NULL);
if (FAILED(hr)) {
dprintf("DirectInput: DirectInput8Create failed: %08x\n", (int)hr);
return hr;
}
hr = IDirectInput8_EnumDevices(hkb_di_api, DI8DEVCLASS_GAMECTRL,
hkb_di_enum_callback, (void *) cfg,
DIEDFL_ATTACHEDONLY);
hr = IDirectInput8_EnumDevices(hkb_di_api, DI8DEVCLASS_GAMECTRL, hkb_di_enum_callback, (void *) cfg, DIEDFL_ATTACHEDONLY);
if (FAILED(hr)) {
dprintf("DirectInput: EnumDevices failed: %08x\n", (int)hr);
@@ -146,8 +143,7 @@ static HRESULT hkb_di_config_apply(const struct hkb_di_config* cfg) {
return S_OK;
}
static BOOL CALLBACK hkb_di_enum_callback(const DIDEVICEINSTANCEW* dev,
void* ctx) {
static BOOL CALLBACK hkb_di_enum_callback(const DIDEVICEINSTANCEW* dev, void* ctx) {
const struct hkb_di_config* cfg = ctx;
if (wcsstr(dev->tszProductName, cfg->device_name) == NULL) {
@@ -156,8 +152,7 @@ static BOOL CALLBACK hkb_di_enum_callback(const DIDEVICEINSTANCEW* dev,
dprintf("Stick: Using DirectInput device \"%S\"\n", dev->tszProductName);
HRESULT hr = IDirectInput8_CreateDevice(hkb_di_api, &dev->guidInstance,
&hkb_di_dev, NULL);
HRESULT hr = IDirectInput8_CreateDevice(hkb_di_api, &dev->guidInstance, &hkb_di_dev, NULL);
if (FAILED(hr)) {
dprintf("Stick: CreateDevice failed: %08x\n", (int)hr);
@@ -214,24 +209,24 @@ static void hkb_di_get_gamebtns(uint16_t* gamebtn_out) {
static uint8_t hkb_di_decode_pov(DWORD pov) {
switch (pov) {
case 0:
return HKB_IO_GAMEBTN_TERMINAL_UP;
case 4500:
return HKB_IO_GAMEBTN_TERMINAL_UP | HKB_IO_GAMEBTN_TERMINAL_RIGHT;
case 9000:
return HKB_IO_GAMEBTN_TERMINAL_RIGHT;
case 13500:
return HKB_IO_GAMEBTN_TERMINAL_RIGHT | HKB_IO_GAMEBTN_TERMINAL_DOWN;
case 18000:
return HKB_IO_GAMEBTN_TERMINAL_DOWN;
case 22500:
return HKB_IO_GAMEBTN_TERMINAL_DOWN | HKB_IO_GAMEBTN_TERMINAL_LEFT;
case 27000:
return HKB_IO_GAMEBTN_TERMINAL_LEFT;
case 31500:
return HKB_IO_GAMEBTN_TERMINAL_LEFT | HKB_IO_GAMEBTN_TERMINAL_UP;
default:
return 0;
case 0:
return HKB_IO_GAMEBTN_TERMINAL_UP;
case 4500:
return HKB_IO_GAMEBTN_TERMINAL_UP | HKB_IO_GAMEBTN_TERMINAL_RIGHT;
case 9000:
return HKB_IO_GAMEBTN_TERMINAL_RIGHT;
case 13500:
return HKB_IO_GAMEBTN_TERMINAL_RIGHT | HKB_IO_GAMEBTN_TERMINAL_DOWN;
case 18000:
return HKB_IO_GAMEBTN_TERMINAL_DOWN;
case 22500:
return HKB_IO_GAMEBTN_TERMINAL_DOWN | HKB_IO_GAMEBTN_TERMINAL_LEFT;
case 27000:
return HKB_IO_GAMEBTN_TERMINAL_LEFT;
case 31500:
return HKB_IO_GAMEBTN_TERMINAL_LEFT | HKB_IO_GAMEBTN_TERMINAL_UP;
default:
return 0;
}
}
@@ -246,4 +241,4 @@ static void hkb_di_get_opbtns(uint8_t* opbtn_out) {
}
*opbtn_out = opbtn;
}
}
+1 -2
View File
@@ -3,5 +3,4 @@
#include "hkbio/backend.h"
#include "hkbio/config.h"
HRESULT hkb_di_init(const struct hkb_di_config* cfg, HINSTANCE inst,
const struct hkb_io_backend** backend);
HRESULT hkb_di_init(const struct hkb_di_config* cfg, HINSTANCE inst, const struct hkb_io_backend** backend);
+2 -3
View File
@@ -45,8 +45,7 @@ HRESULT hkb_io_init(void) {
hr = hkb_di_init(&hkb_io_cfg.di, inst, &hkb_io_backend);
} else {
hr = E_INVALIDARG;
dprintf("HKB IO: Invalid IO mode \"%S\", use keyboard or dinput\n",
hkb_io_cfg.mode);
dprintf("HKB IO: Invalid IO mode \"%S\", use keyboard or dinput\n", hkb_io_cfg.mode);
}
return hr;
@@ -100,4 +99,4 @@ HRESULT hkb_io_led_init(void) {
void hkb_io_led_set_colors(uint8_t board, uint8_t* rgb) {
return;
}
}
+10 -10
View File
@@ -5,20 +5,20 @@
#include <stdint.h>
enum {
HKB_IO_OPBTN_TEST = 0x01,
HKB_IO_OPBTN_TEST = 0x01,
HKB_IO_OPBTN_SERVICE = 0x02,
HKB_IO_OPBTN_COIN = 0x04,
HKB_IO_OPBTN_COIN = 0x04,
};
enum {
HKB_IO_GAMEBTN_TERMINAL_LEFT = 0x01,
HKB_IO_GAMEBTN_TERMINAL_UP = 0x02,
HKB_IO_GAMEBTN_TERMINAL_RIGHT = 0x04,
HKB_IO_GAMEBTN_TERMINAL_DOWN = 0x08,
HKB_IO_GAMEBTN_TERMINAL_LEFT_2 = 0x10,
HKB_IO_GAMEBTN_TERMINAL_LEFT = 0x01,
HKB_IO_GAMEBTN_TERMINAL_UP = 0x02,
HKB_IO_GAMEBTN_TERMINAL_RIGHT = 0x04,
HKB_IO_GAMEBTN_TERMINAL_DOWN = 0x08,
HKB_IO_GAMEBTN_TERMINAL_LEFT_2 = 0x10,
HKB_IO_GAMEBTN_TERMINAL_RIGHT_2 = 0x20,
HKB_IO_GAMEBTN_TERMINAL_DECIDE = 0x40,
HKB_IO_GAMEBTN_TERMINAL_CANCEL = 0x80,
HKB_IO_GAMEBTN_TERMINAL_DECIDE = 0x40,
HKB_IO_GAMEBTN_TERMINAL_CANCEL = 0x80,
};
/* Get the version of the Chrono Regalia IO API that this DLL supports. This
@@ -82,4 +82,4 @@ HRESULT hkb_io_led_init(void);
Exact layout is TBD. */
void hkb_io_led_set_colors(uint8_t board, uint8_t* rgb);
void hkb_io_led_set_colors(uint8_t board, uint8_t* rgb);
+4 -4
View File
@@ -13,12 +13,12 @@
static void hkb_kb_get_gamebtns(uint16_t* gamebtn_out);
static const struct hkb_io_backend hkb_kb_backend = {
.get_gamebtns = hkb_kb_get_gamebtns};
.get_gamebtns = hkb_kb_get_gamebtns
};
static struct hkb_kb_config config;
HRESULT hkb_kb_init(const struct hkb_kb_config* cfg,
const struct hkb_io_backend** backend) {
HRESULT hkb_kb_init(const struct hkb_kb_config* cfg, const struct hkb_io_backend** backend) {
assert(cfg != NULL);
assert(backend != NULL);
@@ -67,4 +67,4 @@ static void hkb_kb_get_gamebtns(uint16_t* gamebtn_out) {
}
*gamebtn_out = gamebtn;
}
}
+1 -2
View File
@@ -5,5 +5,4 @@
#include "hkbio/backend.h"
#include "hkbio/config.h"
HRESULT hkb_kb_init(const struct hkb_kb_config* cfg,
const struct hkb_io_backend** backend);
HRESULT hkb_kb_init(const struct hkb_kb_config* cfg, const struct hkb_io_backend** backend);
+6 -10
View File
@@ -9,8 +9,7 @@
feedback), so this source file provides some utilities for creating a
generic message-only window. */
static LRESULT WINAPI hkb_io_wnd_proc(HWND hwnd, UINT msg, WPARAM wparam,
LPARAM lparam);
static LRESULT WINAPI hkb_io_wnd_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
HRESULT hkb_io_wnd_create(HINSTANCE inst, HWND* out) {
HRESULT hr;
@@ -37,9 +36,7 @@ HRESULT hkb_io_wnd_create(HINSTANCE inst, HWND* out) {
goto fail;
}
hwnd = CreateWindowExW(0, (wchar_t*)(intptr_t)atom, L"", 0, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
HWND_MESSAGE, NULL, inst, NULL);
hwnd = CreateWindowExW(0, (wchar_t*)(intptr_t)atom, L"", 0, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, HWND_MESSAGE, NULL, inst, NULL);
if (hwnd == NULL) {
hr = HRESULT_FROM_WIN32(GetLastError());
@@ -58,10 +55,9 @@ fail:
return hr;
}
static LRESULT WINAPI hkb_io_wnd_proc(HWND hwnd, UINT msg, WPARAM wparam,
LPARAM lparam) {
static LRESULT WINAPI hkb_io_wnd_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) {
switch (msg) {
default:
return DefWindowProcW(hwnd, msg, wparam, lparam);
default:
return DefWindowProcW(hwnd, msg, wparam, lparam);
}
}
}
+1 -1
View File
@@ -2,4 +2,4 @@
#include <windows.h>
HRESULT hkb_io_wnd_create(HINSTANCE inst, HWND* out);
HRESULT hkb_io_wnd_create(HINSTANCE inst, HWND* out);