forked from TeamTofuShop/segatools
Improve JVS bus life cycle handling
This commit is contained in:
@ -58,12 +58,7 @@ static DWORD CALLBACK chuni_pre_startup(void)
|
||||
"AAV1",
|
||||
chuni_hook_mod);
|
||||
|
||||
amex_hook_init(&chuni_hook_cfg.amex);
|
||||
|
||||
if (chuni_hook_cfg.amex.jvs.enable) {
|
||||
chunithm_jvs_init();
|
||||
}
|
||||
|
||||
amex_hook_init(&chuni_hook_cfg.amex, chunithm_jvs_init);
|
||||
slider_hook_init(&chuni_hook_cfg.slider);
|
||||
|
||||
/* Initialize debug helpers */
|
||||
@ -72,10 +67,6 @@ static DWORD CALLBACK chuni_pre_startup(void)
|
||||
|
||||
dprintf("--- End chuni_pre_startup ---\n");
|
||||
|
||||
/* Initialize IO DLL */
|
||||
|
||||
chuni_io_init();
|
||||
|
||||
/* Jump to EXE start address */
|
||||
|
||||
return chuni_startup();
|
||||
|
@ -42,10 +42,25 @@ static const struct chunithm_jvs_ir_mask chunithm_jvs_ir_masks[] = {
|
||||
|
||||
static struct io3 chunithm_jvs_io3;
|
||||
|
||||
void chunithm_jvs_init(void)
|
||||
HRESULT chunithm_jvs_init(struct jvs_node **out)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
assert(out != NULL);
|
||||
|
||||
dprintf("JVS I/O: Starting Chunithm backend DLL\n");
|
||||
hr = chuni_io_jvs_init();
|
||||
|
||||
if (FAILED(hr)) {
|
||||
dprintf("JVS I/O: Backend error, I/O disconnected: %x\n", (int) hr);
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
io3_init(&chunithm_jvs_io3, NULL, &chunithm_jvs_io3_ops, NULL);
|
||||
jvs_attach(&chunithm_jvs_io3.jvs);
|
||||
*out = io3_to_jvs_node(&chunithm_jvs_io3);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static void chunithm_jvs_read_switches(void *ctx, struct io3_switch_state *out)
|
||||
|
@ -1,3 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
void chunithm_jvs_init(void);
|
||||
#include <windows.h>
|
||||
|
||||
#include "jvs/jvs-bus.h"
|
||||
|
||||
HRESULT chunithm_jvs_init(struct jvs_node **root);
|
||||
|
@ -81,6 +81,17 @@ static HRESULT slider_handle_irp_locked(struct irp *irp)
|
||||
struct iobuf req_iobuf;
|
||||
HRESULT hr;
|
||||
|
||||
if (irp->op == IRP_OP_OPEN) {
|
||||
dprintf("Chunithm slider: Starting backend DLL\n");
|
||||
hr = chuni_io_slider_init();
|
||||
|
||||
if (FAILED(hr)) {
|
||||
dprintf("Chunithm slider: Backend DLL error: %x\n", (int) hr);
|
||||
|
||||
return hr;
|
||||
}
|
||||
}
|
||||
|
||||
hr = uart_handle_irp(&slider_uart, irp);
|
||||
|
||||
if (FAILED(hr) || irp->op != IRP_OP_WRITE) {
|
||||
|
Reference in New Issue
Block a user