From 774a639bb7236d2ecac0d698aa630b1deb18bf00 Mon Sep 17 00:00:00 2001 From: Dniel97 Date: Thu, 14 Mar 2024 00:14:51 +0100 Subject: [PATCH] cxb: fixed configs --- cxbhook/config.c | 21 +++++++++++++++------ cxbhook/config.h | 3 --- cxbhook/dllmain.c | 7 ------- cxbhook/led.c | 8 +++++++- cxbhook/meson.build | 2 -- cxbhook/network.c | 13 ------------- cxbhook/network.h | 13 ------------- cxbhook/revio.c | 8 +++++++- dist/cxb/segatools.ini | 2 +- platform/dns.c | 2 +- 10 files changed, 31 insertions(+), 48 deletions(-) delete mode 100644 cxbhook/network.c delete mode 100644 cxbhook/network.h diff --git a/cxbhook/config.c b/cxbhook/config.c index 9a513d1..c83694d 100644 --- a/cxbhook/config.c +++ b/cxbhook/config.c @@ -23,22 +23,32 @@ void cxb_dll_config_load( struct cxb_dll_config *cfg, const wchar_t *filename) { + assert(cfg != NULL); + assert(filename != NULL); + GetPrivateProfileStringW( + L"cxbio", + L"path", + L"", + cfg->path, + _countof(cfg->path), + filename); } void revio_config_load(struct revio_config *cfg, const wchar_t *filename) { + assert(cfg != NULL); + assert(filename != NULL); -} - -void network_config_load(struct network_config *cfg, const wchar_t *filename) -{ - + cfg->enable = GetPrivateProfileIntW(L"revio", L"enable", 1, filename); } void led_config_load(struct led_config *cfg, const wchar_t *filename) { + assert(cfg != NULL); + assert(filename != NULL); + cfg->enable = GetPrivateProfileIntW(L"led", L"enable", 1, filename); } void cxb_hook_config_load( @@ -56,6 +66,5 @@ void cxb_hook_config_load( gfx_config_load(&cfg->gfx, filename); cxb_dll_config_load(&cfg->dll, filename); revio_config_load(&cfg->revio, filename); - network_config_load(&cfg->network, filename); led_config_load(&cfg->led, filename); } \ No newline at end of file diff --git a/cxbhook/config.h b/cxbhook/config.h index f2bb8ca..4c7d3af 100644 --- a/cxbhook/config.h +++ b/cxbhook/config.h @@ -10,7 +10,6 @@ #include "cxbhook/cxb-dll.h" #include "cxbhook/revio.h" #include "cxbhook/led.h" -#include "cxbhook/network.h" #include "gfxhook/gfx.h" @@ -23,7 +22,6 @@ struct cxb_hook_config { struct gfx_config gfx; struct cxb_dll_config dll; struct revio_config revio; - struct network_config network; struct led_config led; }; @@ -32,7 +30,6 @@ void cxb_dll_config_load( const wchar_t *filename); void revio_config_load(struct revio_config *cfg, const wchar_t *filename); -void network_config_load(struct network_config *cfg, const wchar_t *filename); void led_config_load(struct led_config *cfg, const wchar_t *filename); void cxb_hook_config_load( diff --git a/cxbhook/dllmain.c b/cxbhook/dllmain.c index ba0bb7b..18aaa7f 100644 --- a/cxbhook/dllmain.c +++ b/cxbhook/dllmain.c @@ -9,7 +9,6 @@ #include "cxbhook/config.h" #include "cxbhook/revio.h" #include "cxbhook/led.h" -#include "cxbhook/network.h" #include "cxbio/cxbio.h" @@ -103,12 +102,6 @@ static DWORD CALLBACK cxb_pre_startup(void) goto fail; } - hr = network_hook_init(&cxb_hook_cfg.network); - - if (FAILED(hr)) { - goto fail; - } - hr = led_hook_init(&cxb_hook_cfg.led); if (FAILED(hr)) { diff --git a/cxbhook/led.c b/cxbhook/led.c index 39d6d4f..be3f26f 100644 --- a/cxbhook/led.c +++ b/cxbhook/led.c @@ -49,7 +49,13 @@ static struct hook_symbol lamp_syms[] = { HRESULT led_hook_init(struct led_config *cfg) { - dprintf("LED: Init\n"); + assert(cfg != NULL); + + if (!cfg->enable) { + return S_FALSE; + } + + dprintf("LED: Hook enabled.\n"); return proc_addr_table_push("CommLamp.dll", lamp_syms, _countof(lamp_syms)); } diff --git a/cxbhook/meson.build b/cxbhook/meson.build index 1c23a00..68f8f76 100644 --- a/cxbhook/meson.build +++ b/cxbhook/meson.build @@ -30,7 +30,5 @@ shared_library( 'revio.h', 'led.c', 'led.h', - 'network.c', - 'network.h', ], ) diff --git a/cxbhook/network.c b/cxbhook/network.c deleted file mode 100644 index e9a832a..0000000 --- a/cxbhook/network.c +++ /dev/null @@ -1,13 +0,0 @@ -#include -#include -#include - -#include "cxbhook/network.h" - -#include "util/dprintf.h" - -HRESULT network_hook_init(struct network_config *cfg) -{ - dprintf("Network: Init\n"); - return S_OK; -} \ No newline at end of file diff --git a/cxbhook/network.h b/cxbhook/network.h deleted file mode 100644 index a2ae7ce..0000000 --- a/cxbhook/network.h +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once - -#include -#include -#include - -struct network_config { - bool enable; - bool disable_ssl; - char title_server[PATH_MAX]; -}; - -HRESULT network_hook_init(struct network_config *cfg); \ No newline at end of file diff --git a/cxbhook/revio.c b/cxbhook/revio.c index 15e2260..601c75a 100644 --- a/cxbhook/revio.c +++ b/cxbhook/revio.c @@ -82,7 +82,13 @@ static struct hook_symbol revio_syms[] = { HRESULT revio_hook_init(struct revio_config *cfg) { - dprintf("Revio: Init\n"); + assert(cfg != NULL); + + if (!cfg->enable) { + return S_FALSE; + } + + dprintf("Revio: Hook enabled.\n"); return proc_addr_table_push("CommIo.dll", revio_syms, _countof(revio_syms)); } diff --git a/dist/cxb/segatools.ini b/dist/cxb/segatools.ini index 40f0ad6..6d9e5e0 100644 --- a/dist/cxb/segatools.ini +++ b/dist/cxb/segatools.ini @@ -110,7 +110,7 @@ path= [revio] ; Enable emulation of the rev IO board -enabe=1 +enable=1 ; Test button virtual-key code. Default is the F1 key. test=0x70 ; Service button virtual-key code. Default is the F2 key. diff --git a/platform/dns.c b/platform/dns.c index a658b58..692ee13 100644 --- a/platform/dns.c +++ b/platform/dns.c @@ -82,7 +82,7 @@ HRESULT dns_platform_hook_init(const struct dns_config *cfg) return hr; } - // croosbeats REV. + // crossbeats REV. hr = dns_hook_push(L"https://rev-ent.ac.capcom.jp:443", cfg->title); if (FAILED(hr)) {