board/sg-reader.c: Streamline further

Remove remaining pointless boilerplate, turn it into a free-
standing hook, since its aimeio.dll dependency forces it to be a
singleton anyway.
This commit is contained in:
Tau
2019-05-03 17:21:38 -04:00
parent 8158d01ed9
commit b172c22322
14 changed files with 50 additions and 209 deletions

View File

@ -1,38 +0,0 @@
#include <windows.h>
#include <assert.h>
#include <stdint.h>
#include "board/sg-reader.h"
#include "hook/iohook.h"
#include "idzhook/_com10.h"
static HRESULT com10_handle_irp(struct irp *irp);
static struct sg_reader com10_reader;
HRESULT com10_hook_init(void)
{
HRESULT hr;
hr = sg_reader_init(&com10_reader, 10);
if (FAILED(hr)) {
return hr;
}
return iohook_push_handler(com10_handle_irp);
}
static HRESULT com10_handle_irp(struct irp *irp)
{
assert(irp != NULL);
if (!sg_reader_match_irp(&com10_reader, irp)) {
return iohook_invoke_next(irp);
}
return sg_reader_handle_irp(&com10_reader, irp);
}

View File

@ -1,5 +0,0 @@
#pragma once
#include <windows.h>
HRESULT com10_hook_init(void);

View File

@ -9,11 +9,12 @@
#include "amex/jvs.h"
#include "amex/sram.h"
#include "board/sg-reader.h"
#include "hook/process.h"
#include "hooklib/serial.h"
#include "idzhook/_com10.h"
#include "idzhook/jvs.h"
#include "platform/hwmon.h"
@ -50,8 +51,8 @@ static DWORD CALLBACK idz_pre_startup(void)
/* Initialize Initial D Zero I/O board emulation */
com10_hook_init();
idz_jvs_init();
sg_reader_hook_init(10);
/* Initialize debug helpers */

View File

@ -19,7 +19,6 @@ shared_library(
util_lib,
],
sources : [
'_com10.c',
'dllmain.c',
'jvs.c',
'jvs.h',