forked from TeamTofuShop/segatools
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:
@ -1,37 +0,0 @@
|
||||
#include <windows.h>
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include "board/sg-reader.h"
|
||||
|
||||
#include "cardhook/_com12.h"
|
||||
|
||||
#include "hook/iohook.h"
|
||||
|
||||
static HRESULT com12_handle_irp(struct irp *irp);
|
||||
|
||||
static struct sg_reader com12_reader;
|
||||
|
||||
HRESULT com12_hook_init(void)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
hr = sg_reader_init(&com12_reader, 12);
|
||||
|
||||
if (FAILED(hr)) {
|
||||
return hr;
|
||||
}
|
||||
|
||||
return iohook_push_handler(com12_handle_irp);
|
||||
}
|
||||
|
||||
static HRESULT com12_handle_irp(struct irp *irp)
|
||||
{
|
||||
assert(irp != NULL);
|
||||
|
||||
if (!sg_reader_match_irp(&com12_reader, irp)) {
|
||||
return iohook_invoke_next(irp);
|
||||
}
|
||||
|
||||
return sg_reader_handle_irp(&com12_reader, irp);
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
HRESULT com12_hook_init(void);
|
@ -1,6 +1,6 @@
|
||||
#include <windows.h>
|
||||
|
||||
#include "cardhook/_com12.h"
|
||||
#include "board/sg-reader.h"
|
||||
|
||||
#include "hook/process.h"
|
||||
|
||||
@ -15,9 +15,10 @@ static DWORD CALLBACK app_pre_startup(void)
|
||||
{
|
||||
dprintf("--- Begin %s ---\n", __func__);
|
||||
|
||||
serial_hook_init();
|
||||
spike_hook_init("cardspike.txt");
|
||||
com12_hook_init();
|
||||
|
||||
serial_hook_init();
|
||||
sg_reader_hook_init(12);
|
||||
|
||||
dprintf("--- End %s ---\n", __func__);
|
||||
|
||||
|
@ -14,7 +14,6 @@ shared_library(
|
||||
util_lib,
|
||||
],
|
||||
sources : [
|
||||
'_com12.c',
|
||||
'dllmain.c',
|
||||
],
|
||||
)
|
||||
|
Reference in New Issue
Block a user