From b1529f73ef8f1d95e767ef83d00e60f7fbe81658 Mon Sep 17 00:00:00 2001 From: kyoubate-haruka <46010460+kyoubate-haruka@users.noreply.github.com> Date: Tue, 21 Jul 2026 11:51:33 +0200 Subject: [PATCH] hkb: formatting --- games/hkbhook/amptw.c | 6 ++-- games/hkbhook/amptw.h | 2 +- games/hkbhook/config.c | 32 ++++++++------------- games/hkbhook/config.h | 2 +- games/hkbhook/dllmain.c | 22 +++++++-------- games/hkbhook/hkb-dll.c | 17 +++--------- games/hkbhook/hkb-dll.h | 2 +- games/hkbhook/io4.c | 6 ++-- games/hkbhook/io4.h | 2 +- games/hkbio/backend.h | 2 +- games/hkbio/config.c | 36 ++++++++---------------- games/hkbio/config.h | 2 +- games/hkbio/di-dev.c | 8 ++---- games/hkbio/di-dev.h | 3 +- games/hkbio/di.c | 61 +++++++++++++++++++---------------------- games/hkbio/di.h | 3 +- games/hkbio/hkbio.c | 5 ++-- games/hkbio/hkbio.h | 20 +++++++------- games/hkbio/keyboard.c | 8 +++--- games/hkbio/keyboard.h | 3 +- games/hkbio/wnd.c | 16 ++++------- games/hkbio/wnd.h | 2 +- 22 files changed, 106 insertions(+), 154 deletions(-) diff --git a/games/hkbhook/amptw.c b/games/hkbhook/amptw.c index 3dd419c..d1512bb 100644 --- a/games/hkbhook/amptw.c +++ b/games/hkbhook/amptw.c @@ -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; -} \ No newline at end of file +} diff --git a/games/hkbhook/amptw.h b/games/hkbhook/amptw.h index 13c1cc9..fc33525 100644 --- a/games/hkbhook/amptw.h +++ b/games/hkbhook/amptw.h @@ -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); \ No newline at end of file +void amptw_apply_hooks(HMODULE module); diff --git a/games/hkbhook/config.c b/games/hkbhook/config.c index f0b314d..090df0d 100644 --- a/games/hkbhook/config.c +++ b/games/hkbhook/config.c @@ -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); -} \ No newline at end of file +} diff --git a/games/hkbhook/config.h b/games/hkbhook/config.h index 528803b..7216a8e 100644 --- a/games/hkbhook/config.h +++ b/games/hkbhook/config.h @@ -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); \ No newline at end of file +void hkb_hook_config_load(struct hkb_hook_config* cfg, const wchar_t* filename); diff --git a/games/hkbhook/dllmain.c b/games/hkbhook/dllmain.c index 0a26449..6671f7d 100644 --- a/games/hkbhook/dllmain.c +++ b/games/hkbhook/dllmain.c @@ -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); -} \ No newline at end of file +} diff --git a/games/hkbhook/hkb-dll.c b/games/hkbhook/hkb-dll.c index 64b50e9..18f0c38 100644 --- a/games/hkbhook/hkb-dll.c +++ b/games/hkbhook/hkb-dll.c @@ -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; -} \ No newline at end of file +} diff --git a/games/hkbhook/hkb-dll.h b/games/hkbhook/hkb-dll.h index 30f2b13..48f8f52 100644 --- a/games/hkbhook/hkb-dll.h +++ b/games/hkbhook/hkb-dll.h @@ -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); \ No newline at end of file +HRESULT hkb_dll_init(const struct hkb_dll_config* cfg, HINSTANCE self); diff --git a/games/hkbhook/io4.c b/games/hkbhook/io4.c index b66b70f..3dbe8c9 100644 --- a/games/hkbhook/io4.c +++ b/games/hkbhook/io4.c @@ -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; -} \ No newline at end of file +} diff --git a/games/hkbhook/io4.h b/games/hkbhook/io4.h index 78b2220..e9672cd 100644 --- a/games/hkbhook/io4.h +++ b/games/hkbhook/io4.h @@ -4,4 +4,4 @@ #include "board/io4.h" -HRESULT hkb_io4_hook_init(const struct io4_config* cfg, bool is_terminal); \ No newline at end of file +HRESULT hkb_io4_hook_init(const struct io4_config* cfg, bool is_terminal); diff --git a/games/hkbio/backend.h b/games/hkbio/backend.h index e30b78c..3565b2f 100644 --- a/games/hkbio/backend.h +++ b/games/hkbio/backend.h @@ -7,4 +7,4 @@ struct hkb_io_backend { void (*get_gamebtns)(uint16_t* gamebtn); void (*get_opbtns)(uint8_t* opbtn); -}; \ No newline at end of file +}; diff --git a/games/hkbio/config.c b/games/hkbio/config.c index 940a219..857bb5f 100644 --- a/games/hkbio/config.c +++ b/games/hkbio/config.c @@ -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); -} \ No newline at end of file +} diff --git a/games/hkbio/config.h b/games/hkbio/config.h index 7eb542e..9fbe20c 100644 --- a/games/hkbio/config.h +++ b/games/hkbio/config.h @@ -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); \ No newline at end of file +void hkb_io_config_load(struct hkb_io_config* cfg, const wchar_t* filename); diff --git a/games/hkbio/di-dev.c b/games/hkbio/di-dev.c index 2cb3d76..780bf4d 100644 --- a/games/hkbio/di-dev.c +++ b/games/hkbio/di-dev.c @@ -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; -} \ No newline at end of file +} diff --git a/games/hkbio/di-dev.h b/games/hkbio/di-dev.h index f530a87..faf1b62 100644 --- a/games/hkbio/di-dev.h +++ b/games/hkbio/di-dev.h @@ -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); \ No newline at end of file +HRESULT hkb_di_dev_poll(IDirectInputDevice8W* dev, HWND wnd, union hkb_di_state* out); diff --git a/games/hkbio/di.c b/games/hkbio/di.c index 2386a80..13ef16f 100644 --- a/games/hkbio/di.c +++ b/games/hkbio/di.c @@ -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; -} \ No newline at end of file +} diff --git a/games/hkbio/di.h b/games/hkbio/di.h index a900ef3..05fb712 100644 --- a/games/hkbio/di.h +++ b/games/hkbio/di.h @@ -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); \ No newline at end of file +HRESULT hkb_di_init(const struct hkb_di_config* cfg, HINSTANCE inst, const struct hkb_io_backend** backend); diff --git a/games/hkbio/hkbio.c b/games/hkbio/hkbio.c index 8e34e3a..dd3b23a 100644 --- a/games/hkbio/hkbio.c +++ b/games/hkbio/hkbio.c @@ -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; -} \ No newline at end of file +} diff --git a/games/hkbio/hkbio.h b/games/hkbio/hkbio.h index 2b5a00f..31aee17 100644 --- a/games/hkbio/hkbio.h +++ b/games/hkbio/hkbio.h @@ -5,20 +5,20 @@ #include 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); \ No newline at end of file +void hkb_io_led_set_colors(uint8_t board, uint8_t* rgb); diff --git a/games/hkbio/keyboard.c b/games/hkbio/keyboard.c index c8fb3ee..f564807 100644 --- a/games/hkbio/keyboard.c +++ b/games/hkbio/keyboard.c @@ -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; -} \ No newline at end of file +} diff --git a/games/hkbio/keyboard.h b/games/hkbio/keyboard.h index 567cd62..93b3bd1 100644 --- a/games/hkbio/keyboard.h +++ b/games/hkbio/keyboard.h @@ -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); \ No newline at end of file +HRESULT hkb_kb_init(const struct hkb_kb_config* cfg, const struct hkb_io_backend** backend); diff --git a/games/hkbio/wnd.c b/games/hkbio/wnd.c index 8f5e770..57d1b7e 100644 --- a/games/hkbio/wnd.c +++ b/games/hkbio/wnd.c @@ -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); } -} \ No newline at end of file +} diff --git a/games/hkbio/wnd.h b/games/hkbio/wnd.h index c3d0bd3..dd16bd9 100644 --- a/games/hkbio/wnd.h +++ b/games/hkbio/wnd.h @@ -2,4 +2,4 @@ #include -HRESULT hkb_io_wnd_create(HINSTANCE inst, HWND* out); \ No newline at end of file +HRESULT hkb_io_wnd_create(HINSTANCE inst, HWND* out);