1
0
mirror of https://gitea.tendokyu.moe/Dniel97/segatools.git synced 2024-11-24 05:20:10 +01:00

added VFD toggle to config

This commit is contained in:
Dniel97 2024-02-06 12:34:11 +01:00
parent dae3018411
commit 451a7ec49d
No known key found for this signature in database
GPG Key ID: 6180B3C768FB2E08
33 changed files with 111 additions and 15 deletions

View File

@ -8,6 +8,7 @@
#include "board/aime-dll.h" #include "board/aime-dll.h"
#include "board/config.h" #include "board/config.h"
#include "board/sg-reader.h" #include "board/sg-reader.h"
#include "board/vfd.h"
#include "util/dprintf.h" #include "util/dprintf.h"
@ -82,3 +83,11 @@ void io4_config_load(struct io4_config *cfg, const wchar_t *filename)
cfg->enable = GetPrivateProfileIntW(L"io4", L"enable", 1, filename); cfg->enable = GetPrivateProfileIntW(L"io4", L"enable", 1, filename);
} }
void vfd_config_load(struct vfd_config *cfg, const wchar_t *filename)
{
assert(cfg != NULL);
assert(filename != NULL);
cfg->enable = GetPrivateProfileIntW(L"vfd", L"enable", 1, filename);
}

View File

@ -5,6 +5,8 @@
#include "board/io4.h" #include "board/io4.h"
#include "board/sg-reader.h" #include "board/sg-reader.h"
#include "board/vfd.h"
void aime_config_load(struct aime_config *cfg, const wchar_t *filename); void aime_config_load(struct aime_config *cfg, const wchar_t *filename);
void io4_config_load(struct io4_config *cfg, const wchar_t *filename); void io4_config_load(struct io4_config *cfg, const wchar_t *filename);
void vfd_config_load(struct vfd_config *cfg, const wchar_t *filename);

View File

@ -27,14 +27,22 @@ static struct uart vfd_uart;
static uint8_t vfd_written[512]; static uint8_t vfd_written[512];
static uint8_t vfd_readable[512]; static uint8_t vfd_readable[512];
HRESULT vfd_hook_init(unsigned int port_no) HRESULT vfd_hook_init(const struct vfd_config *cfg, unsigned int port_no)
{ {
assert(cfg != NULL);
if (!cfg->enable) {
return S_FALSE;
}
uart_init(&vfd_uart, port_no); uart_init(&vfd_uart, port_no);
vfd_uart.written.bytes = vfd_written; vfd_uart.written.bytes = vfd_written;
vfd_uart.written.nbytes = sizeof(vfd_written); vfd_uart.written.nbytes = sizeof(vfd_written);
vfd_uart.readable.bytes = vfd_readable; vfd_uart.readable.bytes = vfd_readable;
vfd_uart.readable.nbytes = sizeof(vfd_readable); vfd_uart.readable.nbytes = sizeof(vfd_readable);
dprintf("VFD: hook enabled.\n");
return iohook_push_handler(vfd_handle_irp); return iohook_push_handler(vfd_handle_irp);
} }

View File

@ -2,4 +2,9 @@
#include <windows.h> #include <windows.h>
HRESULT vfd_hook_init(unsigned int port_no); struct vfd_config {
bool enable;
};
HRESULT vfd_hook_init(const struct vfd_config *cfg, unsigned int port_no);

View File

@ -160,6 +160,7 @@ void chusan_hook_config_load(
dvd_config_load(&cfg->dvd, filename); dvd_config_load(&cfg->dvd, filename);
io4_config_load(&cfg->io4, filename); io4_config_load(&cfg->io4, filename);
gfx_config_load(&cfg->gfx, filename); gfx_config_load(&cfg->gfx, filename);
vfd_config_load(&cfg->vfd, filename);
chuni_dll_config_load(&cfg->dll, filename); chuni_dll_config_load(&cfg->dll, filename);
slider_config_load(&cfg->slider, filename); slider_config_load(&cfg->slider, filename);
led15093_config_load(&cfg->led15093, filename); led15093_config_load(&cfg->led15093, filename);

View File

@ -20,6 +20,7 @@ struct chusan_hook_config {
struct dvd_config dvd; struct dvd_config dvd;
struct io4_config io4; struct io4_config io4;
struct gfx_config gfx; struct gfx_config gfx;
struct vfd_config vfd;
struct chuni_dll_config dll; struct chuni_dll_config dll;
struct slider_config slider; struct slider_config slider;
struct led15093_config led15093; struct led15093_config led15093;

View File

@ -122,7 +122,7 @@ static DWORD CALLBACK chusan_pre_startup(void)
unsigned int first_port = is_cvt ? 2 : 20; unsigned int first_port = is_cvt ? 2 : 20;
if (!is_cvt) { if (!is_cvt) {
hr = vfd_hook_init(2); hr = vfd_hook_init(&chusan_hook_cfg.vfd, 2);
if (FAILED(hr)) { if (FAILED(hr)) {
goto fail; goto fail;

View File

@ -37,6 +37,7 @@ void cm_hook_config_load(
aime_config_load(&cfg->aime, filename); aime_config_load(&cfg->aime, filename);
dvd_config_load(&cfg->dvd, filename); dvd_config_load(&cfg->dvd, filename);
io4_config_load(&cfg->io4, filename); io4_config_load(&cfg->io4, filename);
vfd_config_load(&cfg->vfd, filename);
touch_screen_config_load(&cfg->touch, filename); touch_screen_config_load(&cfg->touch, filename);
cm_dll_config_load(&cfg->dll, filename); cm_dll_config_load(&cfg->dll, filename);
} }

View File

@ -16,6 +16,7 @@ struct cm_hook_config {
struct aime_config aime; struct aime_config aime;
struct dvd_config dvd; struct dvd_config dvd;
struct io4_config io4; struct io4_config io4;
struct vfd_config vfd;
struct cm_dll_config dll; struct cm_dll_config dll;
struct touch_screen_config touch; struct touch_screen_config touch;
}; };

View File

@ -60,7 +60,7 @@ static DWORD CALLBACK cm_pre_startup(void)
goto fail; goto fail;
} }
hr = vfd_hook_init(2); hr = vfd_hook_init(&cm_hook_cfg.vfd, 2);
if (FAILED(hr)) { if (FAILED(hr)) {
goto fail; goto fail;

View File

@ -9,12 +9,18 @@ option=
appdata= appdata=
[aime] [aime]
; Enable aime reader emulation. ; Enable Aime card reader assembly emulation. Disable to use a real SEGA Aime
; reader.
enable=1 enable=1
aimePath=DEVICE\aime.txt aimePath=DEVICE\aime.txt
; Enable high baud rate. ; Enable high baud rate.
;highBaud=1 ;highBaud=1
[vfd]
; Enable VFD emulation (currently just stubbed). Disable to use a real VFD
; GP1232A02A FUTABA assembly.
enable=1
[aimeio] [aimeio]
; Uncomment this if you have custom (x64) aime implementation. ; Uncomment this if you have custom (x64) aime implementation.
; Leave empty if you want to use Segatools built-in keyboard input. ; Leave empty if you want to use Segatools built-in keyboard input.

View File

@ -9,10 +9,16 @@ option=
appdata= appdata=
[aime] [aime]
; Enable aime reader emulation. ; Enable Aime card reader assembly emulation. Disable to use a real SEGA Aime
; reader.
enable=1 enable=1
aimePath=DEVICE\aime.txt aimePath=DEVICE\aime.txt
[vfd]
; Enable VFD emulation (currently just stubbed). Disable to use a real VFD
; GP1232A02A FUTABA assembly.
enable=1
[dns] [dns]
; Insert the hostname or IP address of the server you wish to use here. ; Insert the hostname or IP address of the server you wish to use here.
; Note that 127.0.0.1, localhost etc are specifically rejected. ; Note that 127.0.0.1, localhost etc are specifically rejected.

View File

@ -9,10 +9,16 @@ option=
appdata= appdata=
[aime] [aime]
; Controls emulation of the Aime card reader assembly. ; Enable Aime card reader assembly emulation. Disable to use a real SEGA Aime
; reader.
enable=1 enable=1
aimePath=DEVICE\aime.txt aimePath=DEVICE\aime.txt
[vfd]
; Enable VFD emulation (currently just stubbed). Disable to use a real VFD
; GP1232A02A FUTABA assembly.
enable=1
[dns] [dns]
; Insert the hostname or IP address of the server you wish to use here. ; Insert the hostname or IP address of the server you wish to use here.
; Note that 127.0.0.1, localhost etc are specifically rejected. ; Note that 127.0.0.1, localhost etc are specifically rejected.

View File

@ -9,10 +9,16 @@ option=
appdata= appdata=
[aime] [aime]
; Enable aime reader emulation. ; Enable Aime card reader assembly emulation. Disable to use a real SEGA Aime
; reader.
enable=1 enable=1
aimePath=DEVICE\aime.txt aimePath=DEVICE\aime.txt
[vfd]
; Enable VFD emulation (currently just stubbed). Disable to use a real VFD
; GP1232A02A FUTABA assembly.
enable=1
[dns] [dns]
; Insert the hostname or IP address of the server you wish to use here. ; Insert the hostname or IP address of the server you wish to use here.
; Note that 127.0.0.1, localhost etc are specifically rejected. ; Note that 127.0.0.1, localhost etc are specifically rejected.

View File

@ -7,6 +7,17 @@ amfs=amfs
appdata=appdata appdata=appdata
option=option option=option
[aime]
; Enable Aime card reader assembly emulation. Disable to use a real SEGA Aime
; reader.
enable=1
aimePath=DEVICE\aime.txt
[vfd]
; Enable VFD emulation (currently just stubbed). Disable to use a real VFD
; GP1232A02A FUTABA assembly.
enable=1
[dns] [dns]
; Insert the hostname or IP address of the server you wish to use here. ; Insert the hostname or IP address of the server you wish to use here.
; Note that 127.0.0.1, localhost etc are specifically rejected. ; Note that 127.0.0.1, localhost etc are specifically rejected.

View File

@ -9,10 +9,16 @@ option=
appdata= appdata=
[aime] [aime]
; Controls emulation of the Aime card reader assembly. ; Enable Aime card reader assembly emulation. Disable to use a real SEGA Aime
; reader.
enable=1 enable=1
aimePath=DEVICE\aime.txt aimePath=DEVICE\aime.txt
[vfd]
; Enable VFD emulation (currently just stubbed). Disable to use a real VFD
; GP1232A02A FUTABA assembly.
enable=1
[dns] [dns]
; Insert the hostname or IP address of the server you wish to use here. ; Insert the hostname or IP address of the server you wish to use here.
; Note that 127.0.0.1, localhost etc are specifically rejected. ; Note that 127.0.0.1, localhost etc are specifically rejected.

View File

@ -9,10 +9,16 @@ option=
appdata=appdata appdata=appdata
[aime] [aime]
; Controls emulation of the Aime card reader assembly. ; Enable Aime card reader assembly emulation. Disable to use a real SEGA Aime
; reader.
enable=1 enable=1
aimePath=DEVICE\aime.txt aimePath=DEVICE\aime.txt
[vfd]
; Enable VFD emulation (currently just stubbed). Disable to use a real VFD
; GP1232A02A FUTABA assembly.
enable=1
[dns] [dns]
; Insert the hostname or IP address of the server you wish to use here. ; Insert the hostname or IP address of the server you wish to use here.
; Note that 127.0.0.1, localhost etc are specifically rejected. ; Note that 127.0.0.1, localhost etc are specifically rejected.

View File

@ -84,6 +84,17 @@ emulates an IC card in its proximity. A variety of different IC cards can be
emulated; the exact choice of card that is emulated depends on the presence or emulated; the exact choice of card that is emulated depends on the presence or
absence of the configured card ID files. absence of the configured card ID files.
## `[vfd]`
Controls emulation of the VFD GP1232A02A FUTABA assembly.
### `enable`
Default: `1`
Enable VFD emulation (currently just stubbed). Disable to use a real VFD
GP1232A02A FUTABA assembly (COM port number varies by game).
## `[amvideo]` ## `[amvideo]`
Controls the `amvideo.dll` stub built into Segatools. This is a DLL that is Controls the `amvideo.dll` stub built into Segatools. This is a DLL that is

View File

@ -116,6 +116,7 @@ void fgo_hook_config_load(
aime_config_load(&cfg->aime, filename); aime_config_load(&cfg->aime, filename);
dvd_config_load(&cfg->dvd, filename); dvd_config_load(&cfg->dvd, filename);
io4_config_load(&cfg->io4, filename); io4_config_load(&cfg->io4, filename);
vfd_config_load(&cfg->vfd, filename);
touch_screen_config_load(&cfg->touch, filename); touch_screen_config_load(&cfg->touch, filename);
printer_config_load(&cfg->printer, filename); printer_config_load(&cfg->printer, filename);
fgo_deck_config_load(&cfg->deck, filename); fgo_deck_config_load(&cfg->deck, filename);

View File

@ -20,6 +20,7 @@ struct fgo_hook_config {
struct aime_config aime; struct aime_config aime;
struct dvd_config dvd; struct dvd_config dvd;
struct io4_config io4; struct io4_config io4;
struct vfd_config vfd;
struct touch_screen_config touch; struct touch_screen_config touch;
struct printer_config printer; struct printer_config printer;
struct deck_config deck; struct deck_config deck;

View File

@ -67,7 +67,7 @@ static DWORD CALLBACK fgo_pre_startup(void)
goto fail; goto fail;
} }
hr = vfd_hook_init(1); hr = vfd_hook_init(&fgo_hook_cfg.vfd, 1);
if (FAILED(hr)) { if (FAILED(hr)) {
goto fail; goto fail;

View File

@ -37,5 +37,6 @@ void mai2_hook_config_load(
aime_config_load(&cfg->aime, filename); aime_config_load(&cfg->aime, filename);
dvd_config_load(&cfg->dvd, filename); dvd_config_load(&cfg->dvd, filename);
io4_config_load(&cfg->io4, filename); io4_config_load(&cfg->io4, filename);
vfd_config_load(&cfg->vfd, filename);
mai2_dll_config_load(&cfg->dll, filename); mai2_dll_config_load(&cfg->dll, filename);
} }

View File

@ -15,6 +15,7 @@ struct mai2_hook_config {
struct aime_config aime; struct aime_config aime;
struct dvd_config dvd; struct dvd_config dvd;
struct io4_config io4; struct io4_config io4;
struct vfd_config vfd;
struct mai2_dll_config dll; struct mai2_dll_config dll;
}; };

View File

@ -57,7 +57,7 @@ static DWORD CALLBACK mai2_pre_startup(void)
goto fail; goto fail;
} }
hr = vfd_hook_init(2); hr = vfd_hook_init(&mai2_hook_cfg.vfd, 2);
if (FAILED(hr)) { if (FAILED(hr)) {
goto fail; goto fail;

View File

@ -68,6 +68,7 @@ void mercury_hook_config_load(
dvd_config_load(&cfg->dvd, filename); dvd_config_load(&cfg->dvd, filename);
io4_config_load(&cfg->io4, filename); io4_config_load(&cfg->io4, filename);
gfx_config_load(&cfg->gfx, filename); gfx_config_load(&cfg->gfx, filename);
vfd_config_load(&cfg->vfd, filename);
mercury_dll_config_load(&cfg->dll, filename); mercury_dll_config_load(&cfg->dll, filename);
touch_config_load(&cfg->touch, filename); touch_config_load(&cfg->touch, filename);
elisabeth_config_load(&cfg->elisabeth, filename); elisabeth_config_load(&cfg->elisabeth, filename);

View File

@ -19,6 +19,7 @@ struct mercury_hook_config {
struct dvd_config dvd; struct dvd_config dvd;
struct io4_config io4; struct io4_config io4;
struct gfx_config gfx; struct gfx_config gfx;
struct vfd_config vfd;
struct mercury_dll_config dll; struct mercury_dll_config dll;
struct touch_config touch; struct touch_config touch;
struct elisabeth_config elisabeth; struct elisabeth_config elisabeth;

View File

@ -64,7 +64,7 @@ static DWORD CALLBACK mercury_pre_startup(void)
goto fail; goto fail;
} }
hr = vfd_hook_init(2); hr = vfd_hook_init(&mercury_hook_cfg.vfd, 2);
if (FAILED(hr)) { if (FAILED(hr)) {
goto fail; goto fail;

View File

@ -40,5 +40,6 @@ void mu3_hook_config_load(
dvd_config_load(&cfg->dvd, filename); dvd_config_load(&cfg->dvd, filename);
io4_config_load(&cfg->io4, filename); io4_config_load(&cfg->io4, filename);
gfx_config_load(&cfg->gfx, filename); gfx_config_load(&cfg->gfx, filename);
vfd_config_load(&cfg->vfd, filename);
mu3_dll_config_load(&cfg->dll, filename); mu3_dll_config_load(&cfg->dll, filename);
} }

View File

@ -20,6 +20,7 @@ struct mu3_hook_config {
struct io4_config io4; struct io4_config io4;
struct gfx_config gfx; struct gfx_config gfx;
// struct led15093_config led15093; // struct led15093_config led15093;
struct vfd_config vfd;
struct mu3_dll_config dll; struct mu3_dll_config dll;
}; };

View File

@ -76,7 +76,7 @@ static DWORD CALLBACK mu3_pre_startup(void)
goto fail; goto fail;
} }
hr = vfd_hook_init(2); hr = vfd_hook_init(&mu3_hook_cfg.vfd, 2);
if (FAILED(hr)) { if (FAILED(hr)) {
goto fail; goto fail;

View File

@ -42,6 +42,7 @@ void swdc_hook_config_load(
zinput_config_load(&cfg->zinput, filename); zinput_config_load(&cfg->zinput, filename);
dvd_config_load(&cfg->dvd, filename); dvd_config_load(&cfg->dvd, filename);
io4_config_load(&cfg->io4, filename); io4_config_load(&cfg->io4, filename);
vfd_config_load(&cfg->vfd, filename);
} }
void zinput_config_load(struct zinput_config *cfg, const wchar_t *filename) void zinput_config_load(struct zinput_config *cfg, const wchar_t *filename)

View File

@ -17,6 +17,7 @@ struct swdc_hook_config {
struct aime_config aime; struct aime_config aime;
struct dvd_config dvd; struct dvd_config dvd;
struct io4_config io4; struct io4_config io4;
struct vfd_config vfd;
struct swdc_dll_config dll; struct swdc_dll_config dll;
struct zinput_config zinput; struct zinput_config zinput;
}; };

View File

@ -64,7 +64,7 @@ static DWORD CALLBACK swdc_pre_startup(void)
goto fail; goto fail;
} }
hr = vfd_hook_init(4); hr = vfd_hook_init(&swdc_hook_cfg.vfd, 4);
if (FAILED(hr)) { if (FAILED(hr)) {
return hr; return hr;