mirror of
https://gitea.tendokyu.moe/Dniel97/segatools.git
synced 2024-11-11 23:17:08 +01:00
add default port fallback for vfd
This commit is contained in:
parent
54cbbffae9
commit
e6794807a6
11
board/vfd.c
11
board/vfd.c
@ -50,7 +50,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)
|
||||
HRESULT vfd_hook_init(struct vfd_config *cfg, int default_port)
|
||||
{
|
||||
if (!cfg->enable){
|
||||
return S_FALSE;
|
||||
@ -58,8 +58,13 @@ HRESULT vfd_hook_init(struct vfd_config *cfg)
|
||||
|
||||
utf_enabled = cfg->utf_conversion;
|
||||
|
||||
dprintf("VFD: enabling (port=%d)\n", cfg->port);
|
||||
uart_init(&vfd_uart, cfg->port);
|
||||
int port = cfg->port;
|
||||
if (port == 0){
|
||||
port = default_port;
|
||||
}
|
||||
|
||||
dprintf("VFD: enabling (port=%d)\n", port);
|
||||
uart_init(&vfd_uart, port);
|
||||
vfd_uart.written.bytes = vfd_written;
|
||||
vfd_uart.written.nbytes = sizeof(vfd_written);
|
||||
vfd_uart.readable.bytes = vfd_readable;
|
||||
|
@ -9,5 +9,5 @@ struct vfd_config {
|
||||
};
|
||||
|
||||
|
||||
HRESULT vfd_hook_init(struct vfd_config *cfg);
|
||||
HRESULT vfd_hook_init(struct vfd_config *cfg, int default_port);
|
||||
|
||||
|
@ -146,7 +146,7 @@ static DWORD CALLBACK chusan_pre_startup(void)
|
||||
unsigned int first_port = is_cvt ? 2 : 20;
|
||||
|
||||
if (!is_cvt) {
|
||||
hr = vfd_hook_init(&chusan_hook_cfg.vfd);
|
||||
hr = vfd_hook_init(&chusan_hook_cfg.vfd, 2);
|
||||
|
||||
if (FAILED(hr)) {
|
||||
goto fail;
|
||||
|
@ -84,7 +84,7 @@ static DWORD CALLBACK cm_pre_startup(void)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
hr = vfd_hook_init(&cm_hook_cfg.vfd);
|
||||
hr = vfd_hook_init(&cm_hook_cfg.vfd, 2);
|
||||
|
||||
if (FAILED(hr)) {
|
||||
goto fail;
|
||||
|
@ -84,7 +84,7 @@ static DWORD CALLBACK fgo_pre_startup(void)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
hr = vfd_hook_init(&fgo_hook_cfg.vfd);
|
||||
hr = vfd_hook_init(&fgo_hook_cfg.vfd, 1);
|
||||
|
||||
if (FAILED(hr)) {
|
||||
goto fail;
|
||||
|
@ -79,7 +79,7 @@ static DWORD CALLBACK mai2_pre_startup(void)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
hr = vfd_hook_init(&mai2_hook_cfg.vfd);
|
||||
hr = vfd_hook_init(&mai2_hook_cfg.vfd, 2);
|
||||
|
||||
if (FAILED(hr)) {
|
||||
goto fail;
|
||||
|
@ -77,7 +77,7 @@ static DWORD CALLBACK mercury_pre_startup(void)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
hr = vfd_hook_init(&mercury_hook_cfg.vfd);
|
||||
hr = vfd_hook_init(&mercury_hook_cfg.vfd, 2);
|
||||
|
||||
if (FAILED(hr)) {
|
||||
goto fail;
|
||||
|
@ -93,7 +93,7 @@ static DWORD CALLBACK mu3_pre_startup(void)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
hr = vfd_hook_init(&mu3_hook_cfg.vfd);
|
||||
hr = vfd_hook_init(&mu3_hook_cfg.vfd, 2);
|
||||
|
||||
if (FAILED(hr)) {
|
||||
goto fail;
|
||||
|
@ -79,7 +79,7 @@ static DWORD CALLBACK swdc_pre_startup(void)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
hr = vfd_hook_init(&swdc_hook_cfg.vfd);
|
||||
hr = vfd_hook_init(&swdc_hook_cfg.vfd, 4);
|
||||
|
||||
if (FAILED(hr)) {
|
||||
return hr;
|
||||
|
Loading…
Reference in New Issue
Block a user