From 3d6669dff15c2a237d9736ae8eaf01e6f306a8f7 Mon Sep 17 00:00:00 2001 From: Tau Date: Sun, 3 Nov 2019 09:52:33 -0500 Subject: [PATCH] platform: Re-fuse Nu and ALLS platforms There's basically no difference at the platform level except for the addition of the ALLS PCBID hook, which is harmless on Nu. --- chunihook/config.c | 2 +- chunihook/config.h | 2 +- chunihook/dllmain.c | 7 ++++- divahook/config.c | 2 +- divahook/config.h | 2 +- divahook/dllmain.c | 7 ++++- idzhook/config.c | 2 +- idzhook/config.h | 2 +- idzhook/dllmain.c | 2 +- mu3hook/config.c | 2 +- mu3hook/config.h | 2 +- mu3hook/dllmain.c | 2 +- platform/config.c | 17 +----------- platform/config.h | 18 +++--------- platform/platform.c | 68 ++------------------------------------------- platform/platform.h | 10 ++----- 16 files changed, 31 insertions(+), 116 deletions(-) diff --git a/chunihook/config.c b/chunihook/config.c index 293496d..3c6632e 100644 --- a/chunihook/config.c +++ b/chunihook/config.c @@ -29,7 +29,7 @@ void chuni_hook_config_load( memset(cfg, 0, sizeof(*cfg)); - nu_config_load(&cfg->nu, filename); + platform_config_load(&cfg->platform, filename); amex_config_load(&cfg->amex, filename); gfx_config_load(&cfg->gfx, filename); slider_config_load(&cfg->slider, filename); diff --git a/chunihook/config.h b/chunihook/config.h index 43614ea..1185992 100644 --- a/chunihook/config.h +++ b/chunihook/config.h @@ -14,7 +14,7 @@ struct slider_config { }; struct chuni_hook_config { - struct nu_config nu; + struct platform_config platform; struct amex_config amex; struct gfx_config gfx; struct slider_config slider; diff --git a/chunihook/dllmain.c b/chunihook/dllmain.c index 4b94df1..973c5e7 100644 --- a/chunihook/dllmain.c +++ b/chunihook/dllmain.c @@ -52,7 +52,12 @@ static DWORD CALLBACK chuni_pre_startup(void) /* Initialize emulation hooks */ - platform_hook_init_nu(&chuni_hook_cfg.nu, "SDBT", "AAV1", chuni_hook_mod); + platform_hook_init( + &chuni_hook_cfg.platform, + "SDBT", + "AAV1", + chuni_hook_mod); + amex_hook_init(&chuni_hook_cfg.amex); if (chuni_hook_cfg.amex.jvs.enable) { diff --git a/divahook/config.c b/divahook/config.c index 9bc046d..b72b1a0 100644 --- a/divahook/config.c +++ b/divahook/config.c @@ -16,7 +16,7 @@ void diva_hook_config_load( assert(cfg != NULL); assert(filename != NULL); - nu_config_load(&cfg->nu, filename); + platform_config_load(&cfg->platform, filename); amex_config_load(&cfg->amex, filename); aime_config_load(&cfg->aime, filename); } diff --git a/divahook/config.h b/divahook/config.h index 9e0a0dc..d71bb79 100644 --- a/divahook/config.h +++ b/divahook/config.h @@ -7,7 +7,7 @@ #include "platform/config.h" struct diva_hook_config { - struct nu_config nu; + struct platform_config platform; struct amex_config amex; struct aime_config aime; }; diff --git a/divahook/dllmain.c b/divahook/dllmain.c index f0b77ca..60eb385 100644 --- a/divahook/dllmain.c +++ b/divahook/dllmain.c @@ -39,7 +39,12 @@ static DWORD CALLBACK diva_pre_startup(void) /* Initialize emulation hooks */ - platform_hook_init_nu(&diva_hook_cfg.nu, "SBZV", "AAV0", diva_hook_mod); + platform_hook_init( + &diva_hook_cfg.platform, + "SBZV", + "AAV0", + diva_hook_mod); + amex_hook_init(&diva_hook_cfg.amex); if (diva_hook_cfg.amex.jvs.enable) { diff --git a/idzhook/config.c b/idzhook/config.c index 3c7ac5e..899a29e 100644 --- a/idzhook/config.c +++ b/idzhook/config.c @@ -16,7 +16,7 @@ void idz_hook_config_load( assert(cfg != NULL); assert(filename != NULL); - nu_config_load(&cfg->nu, filename); + platform_config_load(&cfg->platform, filename); amex_config_load(&cfg->amex, filename); aime_config_load(&cfg->aime, filename); } diff --git a/idzhook/config.h b/idzhook/config.h index 7a5f7d4..d26d28c 100644 --- a/idzhook/config.h +++ b/idzhook/config.h @@ -9,7 +9,7 @@ #include "platform/config.h" struct idz_hook_config { - struct nu_config nu; + struct platform_config platform; struct amex_config amex; struct aime_config aime; }; diff --git a/idzhook/dllmain.c b/idzhook/dllmain.c index f50ab49..aabcc3d 100644 --- a/idzhook/dllmain.c +++ b/idzhook/dllmain.c @@ -38,7 +38,7 @@ static DWORD CALLBACK idz_pre_startup(void) /* Initialize emulation hooks */ - platform_hook_init_nu(&idz_hook_cfg.nu, "SDDF", "AAV2", idz_hook_mod); + platform_hook_init(&idz_hook_cfg.platform, "SDDF", "AAV2", idz_hook_mod); amex_hook_init(&idz_hook_cfg.amex); if (idz_hook_cfg.amex.jvs.enable) { diff --git a/mu3hook/config.c b/mu3hook/config.c index c1550f0..c2391c8 100644 --- a/mu3hook/config.c +++ b/mu3hook/config.c @@ -14,6 +14,6 @@ void mu3_hook_config_load( assert(cfg != NULL); assert(filename != NULL); - alls_config_load(&cfg->alls, filename); + platform_config_load(&cfg->platform, filename); aime_config_load(&cfg->aime, filename); } diff --git a/mu3hook/config.h b/mu3hook/config.h index c2f0de9..cd1def4 100644 --- a/mu3hook/config.h +++ b/mu3hook/config.h @@ -7,7 +7,7 @@ #include "platform/config.h" struct mu3_hook_config { - struct alls_config alls; + struct platform_config platform; struct aime_config aime; }; diff --git a/mu3hook/dllmain.c b/mu3hook/dllmain.c index 8b1be6d..11a0fbc 100644 --- a/mu3hook/dllmain.c +++ b/mu3hook/dllmain.c @@ -34,7 +34,7 @@ static DWORD CALLBACK mu3_pre_startup(void) /* Initialize emulation hooks */ - platform_hook_init_alls(&mu3_hook_cfg.alls, "SDDT", "AAV2", mu3_hook_mod); + platform_hook_init(&mu3_hook_cfg.platform, "SDDT", "AAV2", mu3_hook_mod); sg_reader_hook_init(&mu3_hook_cfg.aime, 1); vfd_hook_init(2); mu3_io4_hook_init(); diff --git a/platform/config.c b/platform/config.c index f682079..6e29e1a 100644 --- a/platform/config.c +++ b/platform/config.c @@ -11,7 +11,7 @@ #include "platform/config.h" -void alls_config_load(struct alls_config *cfg, const wchar_t *filename) +void platform_config_load(struct platform_config *cfg, const wchar_t *filename) { assert(cfg != NULL); assert(filename != NULL); @@ -27,21 +27,6 @@ void alls_config_load(struct alls_config *cfg, const wchar_t *filename) vfs_config_load(&cfg->vfs, filename); } -void nu_config_load(struct nu_config *cfg, const wchar_t *filename) -{ - assert(cfg != NULL); - assert(filename != NULL); - - amvideo_config_load(&cfg->amvideo, filename); - clock_config_load(&cfg->clock, filename); - dns_config_load(&cfg->dns, filename); - hwmon_config_load(&cfg->hwmon, filename); - misc_config_load(&cfg->misc, filename); - netenv_config_load(&cfg->netenv, filename); - nusec_config_load(&cfg->nusec, filename); - vfs_config_load(&cfg->vfs, filename); -} - void amvideo_config_load(struct amvideo_config *cfg, const wchar_t *filename) { assert(cfg != NULL); diff --git a/platform/config.h b/platform/config.h index 4acc181..7fcd377 100644 --- a/platform/config.h +++ b/platform/config.h @@ -62,18 +62,7 @@ struct vfs_config { wchar_t appdata[MAX_PATH]; }; -struct nu_config { - struct amvideo_config amvideo; - struct clock_config clock; - struct dns_config dns; - struct hwmon_config hwmon; - struct misc_config misc; - struct netenv_config netenv; - struct nusec_config nusec; - struct vfs_config vfs; -}; - -struct alls_config { +struct platform_config { struct amvideo_config amvideo; struct clock_config clock; struct dns_config dns; @@ -85,8 +74,9 @@ struct alls_config { struct vfs_config vfs; }; -void alls_config_load(struct alls_config *cfg, const wchar_t *filename); -void nu_config_load(struct nu_config *cfg, const wchar_t *filename); +void platform_config_load( + struct platform_config *cfg, + const wchar_t *filename); void amvideo_config_load(struct amvideo_config *cfg, const wchar_t *filename); void clock_config_load(struct clock_config *cfg, const wchar_t *filename); diff --git a/platform/platform.c b/platform/platform.c index b778904..73a0afa 100644 --- a/platform/platform.c +++ b/platform/platform.c @@ -14,8 +14,8 @@ #include "platform/platform.h" #include "platform/vfs.h" -HRESULT platform_hook_init_alls( - const struct alls_config *cfg, +HRESULT platform_hook_init( + const struct platform_config *cfg, const char *game_id, const char *platform_id, HMODULE redir_mod) @@ -79,67 +79,3 @@ HRESULT platform_hook_init_alls( return S_OK; } - -HRESULT platform_hook_init_nu( - const struct nu_config *cfg, - const char *game_id, - const char *platform_id, - HMODULE redir_mod) -{ - HRESULT hr; - - assert(cfg != NULL); - assert(game_id != NULL); - assert(platform_id != NULL); - assert(redir_mod != NULL); - - hr = amvideo_hook_init(&cfg->amvideo, redir_mod); - - if (FAILED(hr)) { - return hr; - } - - hr = clock_hook_init(&cfg->clock); - - if (FAILED(hr)) { - return hr; - } - - hr = dns_platform_hook_init(&cfg->dns); - - if (FAILED(hr)) { - return hr; - } - - hr = hwmon_hook_init(&cfg->hwmon); - - if (FAILED(hr)) { - return hr; - } - - hr = misc_hook_init(&cfg->misc, platform_id); - - if (FAILED(hr)) { - return hr; - } - - hr = netenv_hook_init(&cfg->netenv, &cfg->nusec); - - if (FAILED(hr)) { - return hr; - } - - hr = nusec_hook_init(&cfg->nusec, game_id, platform_id); - - if (FAILED(hr)) { - return hr; - } - - hr = vfs_hook_init(&cfg->vfs); - - if (FAILED(hr)) { - return hr; - } - - return S_OK; -} diff --git a/platform/platform.h b/platform/platform.h index a610c6d..4f3f7a4 100644 --- a/platform/platform.h +++ b/platform/platform.h @@ -4,14 +4,8 @@ #include "platform/config.h" -HRESULT platform_hook_init_alls( - const struct alls_config *cfg, - const char *game_id, - const char *platform_id, - HMODULE redir_mod); - -HRESULT platform_hook_init_nu( - const struct nu_config *cfg, +HRESULT platform_hook_init( + const struct platform_config *cfg, const char *game_id, const char *platform_id, HMODULE redir_mod);