From 5f817c8a36a187e6ba349c1aa7650bcd5b9df2ec Mon Sep 17 00:00:00 2001 From: Dniel97 Date: Mon, 30 Sep 2024 23:17:37 +0200 Subject: [PATCH] swdc: minor improvements --- swdchook/config.c | 21 +++++++++++---------- swdchook/dllmain.c | 7 ++++--- swdchook/io4.c | 2 ++ 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/swdchook/config.c b/swdchook/config.c index 62115fa..269a450 100644 --- a/swdchook/config.c +++ b/swdchook/config.c @@ -30,7 +30,7 @@ void led15070_config_load(struct led15070_config *cfg, const wchar_t *filename) GetPrivateProfileStringW( L"led15070", L"boardNumber", - L"15070-02", + L"15070-04", tmpstr, _countof(tmpstr), filename); @@ -66,6 +66,14 @@ void swdc_dll_config_load( filename); } +void zinput_config_load(struct zinput_config *cfg, const wchar_t *filename) +{ + assert(cfg != NULL); + assert(filename != NULL); + + cfg->enable = GetPrivateProfileIntW(L"zinput", L"enable", 1, filename); +} + void swdc_hook_config_load( struct swdc_hook_config *cfg, const wchar_t *filename) @@ -79,14 +87,7 @@ void swdc_hook_config_load( zinput_config_load(&cfg->zinput, filename); dvd_config_load(&cfg->dvd, filename); io4_config_load(&cfg->io4, filename); - vfd_config_load(&cfg->vfd, filename); + ffb_config_load(&cfg->ffb, filename); led15070_config_load(&cfg->led15070, filename); -} - -void zinput_config_load(struct zinput_config *cfg, const wchar_t *filename) -{ - assert(cfg != NULL); - assert(filename != NULL); - - cfg->enable = GetPrivateProfileIntW(L"zinput", L"enable", 1, filename); + vfd_config_load(&cfg->vfd, filename); } diff --git a/swdchook/dllmain.c b/swdchook/dllmain.c index f9c6081..bd6a1b3 100644 --- a/swdchook/dllmain.c +++ b/swdchook/dllmain.c @@ -8,8 +8,8 @@ WITH 838-15416 Indicator BD LED Board COM1: 838-15069 MOTOR DRIVE BD RS232/422 board - COM2: 837-15396 "Gen 3" Aime reader - COM3: 837-15070-04 IC BD LED controller board + COM2: 837-15070-04 IC BD LED controller board + COM3: 837-15396 "Gen 3" Aime reader COM4: 200-6275 VFD GP1232A02A FUTABA board */ @@ -97,7 +97,8 @@ static DWORD CALLBACK swdc_pre_startup(void) if (FAILED(hr)) { goto fail; } - + + /* Not working, different board -04 instead of -02? */ hr = led15070_hook_init(&swdc_hook_cfg.led15070, swdc_dll.led_init, swdc_dll.led_set_fet_output, NULL, swdc_dll.led_gs_update, 2, 1); diff --git a/swdchook/io4.c b/swdchook/io4.c index 5221f63..be1d4b9 100644 --- a/swdchook/io4.c +++ b/swdchook/io4.c @@ -177,6 +177,8 @@ static HRESULT swdc_io4_poll(void *ctx, struct io4_state *state) { static HRESULT swdc_io4_write_gpio(uint8_t* payload, size_t len) { + assert(swdc_dll.led_set_leds != NULL); + // Just fast fail if there aren't enough bytes in the payload if (len < 3) return S_OK;