mirror of
https://github.com/djhackersdev/bemanitools.git
synced 2025-02-26 22:49:28 +01:00
Add ddrhook "COM4" passthrough mode
This commit is contained in:
parent
4132463c6c
commit
1ae3048aa8
@ -85,10 +85,6 @@ void com4_init(void)
|
||||
{
|
||||
uint8_t i;
|
||||
|
||||
/* This isn't a real COM port, we configure the core P3IO emulator code to
|
||||
generate IRPs addressed to COM4 and then we intercept them. */
|
||||
|
||||
p3io_uart_set_path(0, L"COM4");
|
||||
ac_io_emu_init(&com4_ac_io_emu, L"COM4");
|
||||
ac_io_emu_hdxs_init(&com4_hdxs, &com4_ac_io_emu, lights_dispatcher);
|
||||
|
||||
|
@ -32,7 +32,7 @@ static bool my_dll_entry_main(void);
|
||||
bool standard_def;
|
||||
bool _15khz;
|
||||
|
||||
static const irp_handler_t ddrhook_handlers[] = {
|
||||
static const irp_handler_t ddrhook_com4_handlers[] = {
|
||||
p3io_emu_dispatch_irp,
|
||||
extio_dispatch_irp,
|
||||
spike_dispatch_irp,
|
||||
@ -40,15 +40,27 @@ static const irp_handler_t ddrhook_handlers[] = {
|
||||
com4_dispatch_irp,
|
||||
};
|
||||
|
||||
static const irp_handler_t ddrhook_handlers[] = {
|
||||
/* Same as above, but without COM4 emulation.
|
||||
See ddrhook/p3io.c for details. */
|
||||
|
||||
p3io_emu_dispatch_irp,
|
||||
extio_dispatch_irp,
|
||||
spike_dispatch_irp,
|
||||
usbmem_dispatch_irp,
|
||||
};
|
||||
|
||||
static bool my_dll_entry_init(char *sidcode, struct property_node *param)
|
||||
{
|
||||
int argc;
|
||||
char **argv;
|
||||
bool com4;
|
||||
bool ok;
|
||||
int i;
|
||||
|
||||
log_info("--- Begin ddrhook dll_entry_init ---");
|
||||
|
||||
com4 = true;
|
||||
args_recover(&argc, &argv);
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
@ -65,13 +77,25 @@ static bool my_dll_entry_init(char *sidcode, struct property_node *param)
|
||||
case 'w':
|
||||
gfx_set_windowed();
|
||||
|
||||
break;
|
||||
|
||||
case 'u':
|
||||
/* Don't emulate P3IO COM4 and its downstream devices, use the
|
||||
Windows COM4 port instead. */
|
||||
com4 = false;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
args_free(argc, argv);
|
||||
|
||||
iohook_init(ddrhook_handlers, lengthof(ddrhook_handlers));
|
||||
if (com4) {
|
||||
iohook_init(ddrhook_com4_handlers, lengthof(ddrhook_com4_handlers));
|
||||
} else {
|
||||
iohook_init(ddrhook_handlers, lengthof(ddrhook_handlers));
|
||||
}
|
||||
|
||||
rs232_hook_init();
|
||||
|
||||
master_insert_hooks(NULL);
|
||||
@ -92,15 +116,17 @@ static bool my_dll_entry_init(char *sidcode, struct property_node *param)
|
||||
return false;
|
||||
}
|
||||
|
||||
log_info("Initializing card reader backend");
|
||||
if (com4) {
|
||||
log_info("Initializing card reader backend");
|
||||
|
||||
eam_io_set_loggers(
|
||||
log_body_misc, log_body_info, log_body_warning, log_body_fatal);
|
||||
eam_io_set_loggers(
|
||||
log_body_misc, log_body_info, log_body_warning, log_body_fatal);
|
||||
|
||||
ok = eam_io_init(avs_thread_create, avs_thread_join, avs_thread_destroy);
|
||||
ok = eam_io_init(avs_thread_create, avs_thread_join, avs_thread_destroy);
|
||||
|
||||
if (!ok) {
|
||||
return false;
|
||||
if (!ok) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
log_info("--- End ddrhook dll_entry_init ---");
|
||||
|
@ -29,6 +29,12 @@ static const struct p3io_ops p3io_ddr_ops = {
|
||||
|
||||
void p3io_ddr_init(void)
|
||||
{
|
||||
/* COM4 isn't a real COM port, we configure the core P3IO emulator code to
|
||||
generate IRPs addressed to COM4 and then we possibly intercept them in
|
||||
_com4.c (or possibly don't, in which case the communications will be
|
||||
sent to the real COM4 on your system) */
|
||||
|
||||
p3io_uart_set_path(0, L"COM4");
|
||||
p3io_emu_init(&p3io_ddr_ops, NULL);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user