Fixed com port config and added led hook

This commit is contained in:
Kayori 2024-08-21 11:39:54 +02:00
parent e6fd5e0583
commit bf00108224
7 changed files with 90 additions and 8 deletions

View File

@ -1,4 +1,8 @@
{
"editor.formatOnSave": false,
"mesonbuild.configureOnOpen": false,
"files.associations": {
"*.embeddedhtml": "html",
"config.h": "c"
},
}

View File

@ -257,6 +257,7 @@ $(BUILD_DIR_ZIP)/segatools.zip: \
$(BUILD_DIR_ZIP)/mu3.zip \
$(BUILD_DIR_ZIP)/mai2.zip \
$(BUILD_DIR_ZIP)/cm.zip \
$(BUILD_DIR_ZIP)/apm3.zip \
$(BUILD_DIR_ZIP)/tokyo.zip \
$(BUILD_DIR_ZIP)/fgo.zip \
CHANGELOG.md \

View File

@ -18,6 +18,12 @@ const struct dll_bind_sym apm3_dll_syms[] = {
}, {
.sym = "apm3_io_get_opbtns",
.off = offsetof(struct apm3_dll, get_opbtns),
}, {
.sym = "apm3_io_led_init",
.off = offsetof(struct apm3_dll, led_init),
}, {
.sym = "apm3_io_led_set_colors",
.off = offsetof(struct apm3_dll, led_set_leds),
}
};

View File

@ -9,6 +9,8 @@ struct apm3_dll {
HRESULT (*init)(void);
HRESULT (*poll)(void);
void (*get_opbtns)(uint8_t *opbtn);
HRESULT (*led_init)(void);
void (*led_set_leds)(uint8_t board, uint8_t *rgb);
};
struct apm3_dll_config {

View File

@ -26,6 +26,66 @@ void apm3_dll_config_load(
filename);
}
void led15093_config_load(struct led15093_config *cfg, const wchar_t *filename)
{
assert(cfg != NULL);
assert(filename != NULL);
wchar_t tmpstr[16];
memset(cfg->board_number, ' ', sizeof(cfg->board_number));
memset(cfg->chip_number, ' ', sizeof(cfg->chip_number));
memset(cfg->boot_chip_number, ' ', sizeof(cfg->boot_chip_number));
cfg->enable = GetPrivateProfileIntW(L"led15093", L"enable", 1, filename);
cfg->port_no = GetPrivateProfileIntW(L"led15093", L"portNo", 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);
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);
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);
n = wcstombs(cfg->boot_chip_number, tmpstr, sizeof(cfg->boot_chip_number));
for (int i = n; i < sizeof(cfg->boot_chip_number); i++)
{
cfg->boot_chip_number[i] = ' ';
}
}
void apm3_hook_config_load(
struct apm3_hook_config *cfg,
const wchar_t *filename)
@ -37,8 +97,9 @@ void apm3_hook_config_load(
aime_config_load(&cfg->aime, filename);
dvd_config_load(&cfg->dvd, filename);
io4_config_load(&cfg->io4, filename);
led15093_config_load(&cfg->led15093, filename);
vfd_config_load(&cfg->vfd, filename);
touch_screen_config_load(&cfg->touch, filename);
apm3_dll_config_load(&cfg->dll, filename);
unity_config_load(&cfg->unity, filename);
}
}

View File

@ -3,6 +3,7 @@
#include <stddef.h>
#include "board/config.h"
#include "board/led15093.h"
#include "hooklib/dvd.h"
#include "hooklib/touch.h"
@ -19,6 +20,7 @@ struct apm3_hook_config {
struct aime_config aime;
struct dvd_config dvd;
struct io4_config io4;
struct led15093_config led15093;
struct vfd_config vfd;
struct apm3_dll_config dll;
struct touch_screen_config touch;

View File

@ -1,14 +1,13 @@
/*
"Card Maker" (apm3) hook
"ALLS.NET PRAS MULTI 3" (apm3) hook
Devices
USB: 837-15257-01 "Type 4" I/O Board
USB: 838-20006 "WinTouch" Controller Board
USB: 630-00009 Sinfonia CHC-C310 Printer
COM1: 837-15396 "Gen 3" Aime Reader
COM2: 200-6275 VFD GP1232A02A FUTABA Board
COM3: 220-5872 AS-6DB Coin Selector
COM1: 200-6275 VFD GP1232A02A FUTABA Board
COM2: 837-15093-06 LED Controller Board
COM3: 837-15396 "Gen 3" Aime Reader
*/
#include <windows.h>
@ -74,13 +73,20 @@ static DWORD CALLBACK apm3_pre_startup(void)
goto fail;
}
hr = sg_reader_hook_init(&apm3_hook_cfg.aime, 1, 1, apm3_hook_mod);
hr = led15093_hook_init(&apm3_hook_cfg.led15093,
apm3_dll.led_init, apm3_dll.led_set_leds, 2, 1, 1, 2);
if (FAILED(hr)) {
return hr;
}
hr = sg_reader_hook_init(&apm3_hook_cfg.aime, 3, 3, apm3_hook_mod);
if (FAILED(hr)) {
goto fail;
}
hr = vfd_hook_init(&apm3_hook_cfg.vfd, 2);
hr = vfd_hook_init(&apm3_hook_cfg.vfd, 1);
if (FAILED(hr)) {
goto fail;