diff --git a/board/config.c b/board/config.c index 95eeecf..19d47bc 100644 --- a/board/config.c +++ b/board/config.c @@ -72,6 +72,7 @@ void aime_config_load(struct aime_config *cfg, const wchar_t *filename) aime_dll_config_load(&cfg->dll, filename); cfg->enable = GetPrivateProfileIntW(L"aime", L"enable", 1, filename); + cfg->port_no = GetPrivateProfileIntW(L"aime", L"portNo", 0, filename); cfg->high_baudrate = GetPrivateProfileIntW(L"aime", L"highBaud", 1, filename); cfg->gen = GetPrivateProfileIntW(L"aime", L"gen", 0, filename); } @@ -90,7 +91,7 @@ void vfd_config_load(struct vfd_config *cfg, const wchar_t *filename) assert(filename != NULL); cfg->enable = GetPrivateProfileIntW(L"vfd", L"enable", 1, filename); - cfg->port = GetPrivateProfileIntW(L"vfd", L"portNo", 0, filename); + cfg->port_no = GetPrivateProfileIntW(L"vfd", L"portNo", 0, filename); cfg->utf_conversion = GetPrivateProfileIntW(L"vfd", L"utfConversion", 0, filename); } diff --git a/board/sg-reader.c b/board/sg-reader.c index bcbef56..bcc9701 100644 --- a/board/sg-reader.c +++ b/board/sg-reader.c @@ -47,7 +47,7 @@ static struct sg_led sg_reader_led; HRESULT sg_reader_hook_init( const struct aime_config *cfg, - unsigned int port_no, + unsigned int default_port_no, unsigned int gen, HINSTANCE self) { @@ -66,6 +66,11 @@ HRESULT sg_reader_hook_init( return hr; } + unsigned int port_no = cfg->port_no; + if (port_no == 0){ + port_no = default_port_no; + } + if (cfg->gen != 0) { gen = cfg->gen; } @@ -85,6 +90,7 @@ HRESULT sg_reader_hook_init( sg_reader_uart.baud.BaudRate = 38400; } + dprintf("NFC Assembly: enabling (port=%d)\n", port_no); uart_init(&sg_reader_uart, port_no); sg_reader_uart.written.bytes = sg_reader_written_bytes; sg_reader_uart.written.nbytes = sizeof(sg_reader_written_bytes); diff --git a/board/sg-reader.h b/board/sg-reader.h index 01eb0b3..1824e28 100644 --- a/board/sg-reader.h +++ b/board/sg-reader.h @@ -9,12 +9,13 @@ struct aime_config { struct aime_dll_config dll; bool enable; + unsigned int port_no; bool high_baudrate; unsigned int gen; }; HRESULT sg_reader_hook_init( const struct aime_config *cfg, - unsigned int port_no, + unsigned int default_port_no, unsigned int gen, HINSTANCE self); diff --git a/board/vfd.c b/board/vfd.c index 34b89d4..4cfb20b 100644 --- a/board/vfd.c +++ b/board/vfd.c @@ -51,7 +51,7 @@ HRESULT vfd_handle_create_char2(struct const_iobuf* reader, struct iobuf* writer static bool utf_enabled; -HRESULT vfd_hook_init(struct vfd_config *cfg, int default_port) +HRESULT vfd_hook_init(struct vfd_config *cfg, unsigned int default_port_no) { if (!cfg->enable){ return S_FALSE; @@ -59,13 +59,13 @@ HRESULT vfd_hook_init(struct vfd_config *cfg, int default_port) utf_enabled = cfg->utf_conversion; - int port = cfg->port; - if (port == 0){ - port = default_port; + unsigned int port_no = cfg->port_no; + if (port_no == 0){ + port_no = default_port_no; } - dprintf("VFD: enabling (port=%d)\n", port); - uart_init(&vfd_uart, port); + dprintf("VFD: enabling (port=%d)\n", port_no); + uart_init(&vfd_uart, port_no); vfd_uart.written.bytes = vfd_written; vfd_uart.written.nbytes = sizeof(vfd_written); vfd_uart.readable.bytes = vfd_readable; diff --git a/board/vfd.h b/board/vfd.h index 3e67061..5d3664c 100644 --- a/board/vfd.h +++ b/board/vfd.h @@ -4,10 +4,10 @@ struct vfd_config { bool enable; - int port; + unsigned int port_no; bool utf_conversion; }; -HRESULT vfd_hook_init(struct vfd_config *cfg, int default_port); +HRESULT vfd_hook_init(struct vfd_config *cfg, unsigned int default_port_no); diff --git a/doc/config/common.md b/doc/config/common.md index db866b2..5368bec 100644 --- a/doc/config/common.md +++ b/doc/config/common.md @@ -42,6 +42,12 @@ Default: `1` Enable Aime card reader assembly emulation. Disable to use a real SEGA Aime reader (COM port number varies by game). +### `portNo` + +Default: (game specific) + +Sets the COM port to use for the aime card reader assembly. + ### `highBaud` Default: `1`