1
0
mirror of https://gitea.tendokyu.moe/Hay1tsme/segatools.git synced 2024-11-28 11:00:49 +01:00

idzhook/config.c: Consolidate config

This commit is contained in:
Tau 2019-05-17 23:48:21 -04:00
parent d44740647c
commit 96fe28b66c
4 changed files with 46 additions and 16 deletions

18
idzhook/config.c Normal file
View File

@ -0,0 +1,18 @@
#include <stddef.h>
#include "amex/config.h"
#include "idzhook/config.h"
#include "platform/config.h"
void idz_hook_config_load(
struct idz_hook_config *cfg,
const wchar_t *filename)
{
assert(cfg != NULL);
assert(filename != NULL);
nu_config_load(&cfg->nu, filename);
amex_config_load(&cfg->amex, filename);
}

16
idzhook/config.h Normal file
View File

@ -0,0 +1,16 @@
#pragma once
#include <stddef.h>
#include "amex/config.h"
#include "platform/config.h"
struct idz_hook_config {
struct nu_config nu;
struct amex_config amex;
};
void idz_hook_config_load(
struct idz_hook_config *cfg,
const wchar_t *filename);

View File

@ -4,7 +4,6 @@
#include <stdlib.h>
#include "amex/amex.h"
#include "amex/config.h"
#include "board/sg-reader.h"
@ -15,43 +14,38 @@
#include "hooklib/serial.h"
#include "hooklib/spike.h"
#include "idzhook/config.h"
#include "idzhook/jvs.h"
#include "platform/config.h"
#include "platform/platform.h"
#include "util/dprintf.h"
static HMODULE idz_hook_mod;
static process_entry_t idz_startup;
static struct idz_hook_config idz_hook_cfg;
static DWORD CALLBACK idz_pre_startup(void)
{
struct nu_config nu_cfg;
struct amex_config amex_cfg;
dprintf("--- Begin idz_pre_startup ---\n");
/* Config load */
idz_hook_config_load(&idz_hook_cfg, L".\\segatools.ini");
/* Hook Win32 APIs */
clock_hook_init();
serial_hook_init();
/* Initialize platform API emulation */
/* Initialize emulation hooks */
nu_config_load(&nu_cfg, L".\\segatools.ini");
platform_hook_init_nu(&nu_cfg, "SDDF", "AAV2", idz_hook_mod);
/* Initialize AMEX emulation */
amex_config_load(&amex_cfg, L".\\segatools.ini");
amex_hook_init(&amex_cfg);
/* Initialize Initial D Zero I/O board emulation */
platform_hook_init_nu(&idz_hook_cfg.nu, "SDDF", "AAV2", idz_hook_mod);
amex_hook_init(&idz_hook_cfg.amex);
sg_reader_hook_init(10);
if (amex_cfg.jvs.enable) {
if (idz_hook_cfg.amex.jvs.enable) {
idz_jvs_init();
}

View File

@ -21,6 +21,8 @@ shared_library(
util_lib,
],
sources : [
'config.c',
'config.h',
'dllmain.c',
'jvs.c',
'jvs.h',