cxb: fixed configs

This commit is contained in:
Dniel97 2024-03-14 00:14:51 +01:00
parent 097b74d849
commit 774a639bb7
Signed by untrusted user: Dniel97
GPG Key ID: 6180B3C768FB2E08
10 changed files with 31 additions and 48 deletions

View File

@ -23,22 +23,32 @@ void cxb_dll_config_load(
struct cxb_dll_config *cfg, struct cxb_dll_config *cfg,
const wchar_t *filename) 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) void revio_config_load(struct revio_config *cfg, const wchar_t *filename)
{ {
assert(cfg != NULL);
assert(filename != NULL);
} cfg->enable = GetPrivateProfileIntW(L"revio", L"enable", 1, 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 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( void cxb_hook_config_load(
@ -56,6 +66,5 @@ void cxb_hook_config_load(
gfx_config_load(&cfg->gfx, filename); gfx_config_load(&cfg->gfx, filename);
cxb_dll_config_load(&cfg->dll, filename); cxb_dll_config_load(&cfg->dll, filename);
revio_config_load(&cfg->revio, filename); revio_config_load(&cfg->revio, filename);
network_config_load(&cfg->network, filename);
led_config_load(&cfg->led, filename); led_config_load(&cfg->led, filename);
} }

View File

@ -10,7 +10,6 @@
#include "cxbhook/cxb-dll.h" #include "cxbhook/cxb-dll.h"
#include "cxbhook/revio.h" #include "cxbhook/revio.h"
#include "cxbhook/led.h" #include "cxbhook/led.h"
#include "cxbhook/network.h"
#include "gfxhook/gfx.h" #include "gfxhook/gfx.h"
@ -23,7 +22,6 @@ struct cxb_hook_config {
struct gfx_config gfx; struct gfx_config gfx;
struct cxb_dll_config dll; struct cxb_dll_config dll;
struct revio_config revio; struct revio_config revio;
struct network_config network;
struct led_config led; struct led_config led;
}; };
@ -32,7 +30,6 @@ void cxb_dll_config_load(
const wchar_t *filename); const wchar_t *filename);
void revio_config_load(struct revio_config *cfg, 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 led_config_load(struct led_config *cfg, const wchar_t *filename);
void cxb_hook_config_load( void cxb_hook_config_load(

View File

@ -9,7 +9,6 @@
#include "cxbhook/config.h" #include "cxbhook/config.h"
#include "cxbhook/revio.h" #include "cxbhook/revio.h"
#include "cxbhook/led.h" #include "cxbhook/led.h"
#include "cxbhook/network.h"
#include "cxbio/cxbio.h" #include "cxbio/cxbio.h"
@ -103,12 +102,6 @@ static DWORD CALLBACK cxb_pre_startup(void)
goto fail; goto fail;
} }
hr = network_hook_init(&cxb_hook_cfg.network);
if (FAILED(hr)) {
goto fail;
}
hr = led_hook_init(&cxb_hook_cfg.led); hr = led_hook_init(&cxb_hook_cfg.led);
if (FAILED(hr)) { if (FAILED(hr)) {

View File

@ -49,7 +49,13 @@ static struct hook_symbol lamp_syms[] = {
HRESULT led_hook_init(struct led_config *cfg) 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)); return proc_addr_table_push("CommLamp.dll", lamp_syms, _countof(lamp_syms));
} }

View File

@ -30,7 +30,5 @@ shared_library(
'revio.h', 'revio.h',
'led.c', 'led.c',
'led.h', 'led.h',
'network.c',
'network.h',
], ],
) )

View File

@ -1,13 +0,0 @@
#include <windows.h>
#include <stdbool.h>
#include <stdint.h>
#include "cxbhook/network.h"
#include "util/dprintf.h"
HRESULT network_hook_init(struct network_config *cfg)
{
dprintf("Network: Init\n");
return S_OK;
}

View File

@ -1,13 +0,0 @@
#pragma once
#include <windows.h>
#include <stdbool.h>
#include <stdint.h>
struct network_config {
bool enable;
bool disable_ssl;
char title_server[PATH_MAX];
};
HRESULT network_hook_init(struct network_config *cfg);

View File

@ -82,7 +82,13 @@ static struct hook_symbol revio_syms[] = {
HRESULT revio_hook_init(struct revio_config *cfg) 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)); return proc_addr_table_push("CommIo.dll", revio_syms, _countof(revio_syms));
} }

View File

@ -110,7 +110,7 @@ path=
[revio] [revio]
; Enable emulation of the rev IO board ; Enable emulation of the rev IO board
enabe=1 enable=1
; Test button virtual-key code. Default is the F1 key. ; Test button virtual-key code. Default is the F1 key.
test=0x70 test=0x70
; Service button virtual-key code. Default is the F2 key. ; Service button virtual-key code. Default is the F2 key.

View File

@ -82,7 +82,7 @@ HRESULT dns_platform_hook_init(const struct dns_config *cfg)
return hr; return hr;
} }
// croosbeats REV. // crossbeats REV.
hr = dns_hook_push(L"https://rev-ent.ac.capcom.jp:443", cfg->title); hr = dns_hook_push(L"https://rev-ent.ac.capcom.jp:443", cfg->title);
if (FAILED(hr)) { if (FAILED(hr)) {