Adapt everything in BT5 to new capnhook API

This includes:
- Renaming of functions (iohook_invoke_next)
- Slight interface changes (com_proxy_wrap, iohook_push_handler)
- De-duplicate stuff from utils (iobuf, hr)
This commit is contained in:
icex2
2020-09-02 19:35:15 +00:00
parent b777396efd
commit 5de9fdee43
52 changed files with 265 additions and 333 deletions
+1 -1
View File
@@ -52,7 +52,7 @@ ac_io_bus_dispatch_irp(struct irp *irp)
log_assert(irp != NULL);
if (!ac_io_emu_match_irp(&ac_io_emu, irp)) {
return irp_invoke_next(irp);
return iohook_invoke_next(irp);
}
for (;;) {
+1 -5
View File
@@ -20,10 +20,6 @@
#include "util/defs.h"
#include "util/log.h"
static const irp_handler_t bsthook_handlers[] = {
ac_io_bus_dispatch_irp,
};
static bool my_dll_entry_init(char *sidcode, struct property_node *config);
static bool my_dll_entry_main(void);
@@ -116,7 +112,7 @@ BOOL WINAPI DllMain(HMODULE self, DWORD reason, void *ctx)
args_free(argc, argv);
app_hook_init(my_dll_entry_init, my_dll_entry_main);
iohook_init(bsthook_handlers, lengthof(bsthook_handlers));
iohook_push_handler(ac_io_bus_dispatch_irp);
rs232_hook_init();
gfx_init();
+8 -2
View File
@@ -41,7 +41,7 @@ static HRESULT STDCALL my_CreateDevice(
D3DPRESENT_PARAMETERS *pp,
IDirect3DDevice9 **pdev)
{
IDirect3D9 *real = COM_PROXY_UNWRAP(self);
IDirect3D9 *real = com_proxy_downcast(self)->real;
HRESULT hr;
log_misc("IDirect3D9::CreateDevice hook hit");
@@ -61,11 +61,17 @@ static IDirect3D9 *STDCALL my_Direct3DCreate9(UINT sdk_ver)
IDirect3D9 *api;
IDirect3D9Vtbl *api_vtbl;
struct com_proxy *api_proxy;
HRESULT res;
log_info("Direct3DCreate9 hook hit");
api = real_Direct3DCreate9(sdk_ver);
api_proxy = com_proxy_wrap(api, sizeof(*api->lpVtbl));
res = com_proxy_wrap(&api_proxy, api, sizeof(*api->lpVtbl));
if (res != S_OK) {
log_fatal("Wrapping com proxy failed: 0x%ld", res);
}
api_vtbl = api_proxy->vptr;
api_vtbl->CreateDevice = my_CreateDevice;