1
0
mirror of https://gitea.tendokyu.moe/Dniel97/segatools.git synced 2024-11-27 22:40:48 +01:00

Statically link idzio

This commit is contained in:
Tau 2021-06-12 12:41:37 -04:00
parent 1fdeeb9139
commit bead904f1e
3 changed files with 13 additions and 14 deletions

View File

@ -15,7 +15,7 @@ shared_library(
amex_lib, amex_lib,
board_lib, board_lib,
hooklib_lib, hooklib_lib,
idzio_dll, idzio_lib,
jvs_lib, jvs_lib,
platform_lib, platform_lib,
util_lib, util_lib,

View File

@ -13,7 +13,6 @@
#include "util/dprintf.h" #include "util/dprintf.h"
#include "util/str.h" #include "util/str.h"
static HMODULE idz_io_hmodule;
static struct idz_io_config idz_io_cfg; static struct idz_io_config idz_io_cfg;
static const struct idz_io_backend *idz_io_backend; static const struct idz_io_backend *idz_io_backend;
static bool idz_io_coin; static bool idz_io_coin;
@ -21,14 +20,24 @@ static uint16_t idz_io_coins;
HRESULT idz_io_jvs_init(void) HRESULT idz_io_jvs_init(void)
{ {
HINSTANCE inst;
HRESULT hr; HRESULT hr;
assert(idz_io_backend == NULL); assert(idz_io_backend == NULL);
inst = GetModuleHandleW(NULL);
if (inst == NULL) {
hr = HRESULT_FROM_WIN32(GetLastError());
dprintf("GetModuleHandleW failed: %x\n", hr);
return hr;
}
idz_io_config_load(&idz_io_cfg, L".\\segatools.ini"); idz_io_config_load(&idz_io_cfg, L".\\segatools.ini");
if (wstr_ieq(idz_io_cfg.mode, L"dinput")) { if (wstr_ieq(idz_io_cfg.mode, L"dinput")) {
hr = idz_di_init(&idz_io_cfg.di, idz_io_hmodule, &idz_io_backend); hr = idz_di_init(&idz_io_cfg.di, inst, &idz_io_backend);
} else if (wstr_ieq(idz_io_cfg.mode, L"xinput")) { } else if (wstr_ieq(idz_io_cfg.mode, L"xinput")) {
hr = idz_xi_init(&idz_io_cfg.xi, &idz_io_backend); hr = idz_xi_init(&idz_io_cfg.xi, &idz_io_backend);
} else { } else {
@ -109,12 +118,3 @@ void idz_io_jvs_read_coin_counter(uint16_t *out)
*out = idz_io_coins; *out = idz_io_coins;
} }
BOOL WINAPI DllMain(HMODULE self, DWORD reason, void *ctx)
{
if (reason == DLL_PROCESS_ATTACH) {
idz_io_hmodule = self;
}
return TRUE;
}

View File

@ -1,9 +1,8 @@
idzio_dll = shared_library( idzio_lib = static_library(
'idzio', 'idzio',
name_prefix : '', name_prefix : '',
include_directories : inc, include_directories : inc,
implicit_include_directories : false, implicit_include_directories : false,
vs_module_defs : 'idzio.def',
c_pch : '../precompiled.h', c_pch : '../precompiled.h',
dependencies : [ dependencies : [
dinput8_lib, dinput8_lib,