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.
This commit is contained in:
Tau 2019-11-03 09:52:33 -05:00
parent 06df306c52
commit 3d6669dff1
16 changed files with 31 additions and 116 deletions

View File

@ -29,7 +29,7 @@ void chuni_hook_config_load(
memset(cfg, 0, sizeof(*cfg)); memset(cfg, 0, sizeof(*cfg));
nu_config_load(&cfg->nu, filename); platform_config_load(&cfg->platform, filename);
amex_config_load(&cfg->amex, filename); amex_config_load(&cfg->amex, filename);
gfx_config_load(&cfg->gfx, filename); gfx_config_load(&cfg->gfx, filename);
slider_config_load(&cfg->slider, filename); slider_config_load(&cfg->slider, filename);

View File

@ -14,7 +14,7 @@ struct slider_config {
}; };
struct chuni_hook_config { struct chuni_hook_config {
struct nu_config nu; struct platform_config platform;
struct amex_config amex; struct amex_config amex;
struct gfx_config gfx; struct gfx_config gfx;
struct slider_config slider; struct slider_config slider;

View File

@ -52,7 +52,12 @@ static DWORD CALLBACK chuni_pre_startup(void)
/* Initialize emulation hooks */ /* 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); amex_hook_init(&chuni_hook_cfg.amex);
if (chuni_hook_cfg.amex.jvs.enable) { if (chuni_hook_cfg.amex.jvs.enable) {

View File

@ -16,7 +16,7 @@ void diva_hook_config_load(
assert(cfg != NULL); assert(cfg != NULL);
assert(filename != NULL); assert(filename != NULL);
nu_config_load(&cfg->nu, filename); platform_config_load(&cfg->platform, filename);
amex_config_load(&cfg->amex, filename); amex_config_load(&cfg->amex, filename);
aime_config_load(&cfg->aime, filename); aime_config_load(&cfg->aime, filename);
} }

View File

@ -7,7 +7,7 @@
#include "platform/config.h" #include "platform/config.h"
struct diva_hook_config { struct diva_hook_config {
struct nu_config nu; struct platform_config platform;
struct amex_config amex; struct amex_config amex;
struct aime_config aime; struct aime_config aime;
}; };

View File

@ -39,7 +39,12 @@ static DWORD CALLBACK diva_pre_startup(void)
/* Initialize emulation hooks */ /* 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); amex_hook_init(&diva_hook_cfg.amex);
if (diva_hook_cfg.amex.jvs.enable) { if (diva_hook_cfg.amex.jvs.enable) {

View File

@ -16,7 +16,7 @@ void idz_hook_config_load(
assert(cfg != NULL); assert(cfg != NULL);
assert(filename != NULL); assert(filename != NULL);
nu_config_load(&cfg->nu, filename); platform_config_load(&cfg->platform, filename);
amex_config_load(&cfg->amex, filename); amex_config_load(&cfg->amex, filename);
aime_config_load(&cfg->aime, filename); aime_config_load(&cfg->aime, filename);
} }

View File

@ -9,7 +9,7 @@
#include "platform/config.h" #include "platform/config.h"
struct idz_hook_config { struct idz_hook_config {
struct nu_config nu; struct platform_config platform;
struct amex_config amex; struct amex_config amex;
struct aime_config aime; struct aime_config aime;
}; };

View File

@ -38,7 +38,7 @@ static DWORD CALLBACK idz_pre_startup(void)
/* Initialize emulation hooks */ /* 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); amex_hook_init(&idz_hook_cfg.amex);
if (idz_hook_cfg.amex.jvs.enable) { if (idz_hook_cfg.amex.jvs.enable) {

View File

@ -14,6 +14,6 @@ void mu3_hook_config_load(
assert(cfg != NULL); assert(cfg != NULL);
assert(filename != NULL); assert(filename != NULL);
alls_config_load(&cfg->alls, filename); platform_config_load(&cfg->platform, filename);
aime_config_load(&cfg->aime, filename); aime_config_load(&cfg->aime, filename);
} }

View File

@ -7,7 +7,7 @@
#include "platform/config.h" #include "platform/config.h"
struct mu3_hook_config { struct mu3_hook_config {
struct alls_config alls; struct platform_config platform;
struct aime_config aime; struct aime_config aime;
}; };

View File

@ -34,7 +34,7 @@ static DWORD CALLBACK mu3_pre_startup(void)
/* Initialize emulation hooks */ /* 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); sg_reader_hook_init(&mu3_hook_cfg.aime, 1);
vfd_hook_init(2); vfd_hook_init(2);
mu3_io4_hook_init(); mu3_io4_hook_init();

View File

@ -11,7 +11,7 @@
#include "platform/config.h" #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(cfg != NULL);
assert(filename != 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); 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) void amvideo_config_load(struct amvideo_config *cfg, const wchar_t *filename)
{ {
assert(cfg != NULL); assert(cfg != NULL);

View File

@ -62,18 +62,7 @@ struct vfs_config {
wchar_t appdata[MAX_PATH]; wchar_t appdata[MAX_PATH];
}; };
struct nu_config { struct platform_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 amvideo_config amvideo; struct amvideo_config amvideo;
struct clock_config clock; struct clock_config clock;
struct dns_config dns; struct dns_config dns;
@ -85,8 +74,9 @@ struct alls_config {
struct vfs_config vfs; struct vfs_config vfs;
}; };
void alls_config_load(struct alls_config *cfg, const wchar_t *filename); void platform_config_load(
void nu_config_load(struct nu_config *cfg, const wchar_t *filename); struct platform_config *cfg,
const wchar_t *filename);
void amvideo_config_load(struct amvideo_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); void clock_config_load(struct clock_config *cfg, const wchar_t *filename);

View File

@ -14,8 +14,8 @@
#include "platform/platform.h" #include "platform/platform.h"
#include "platform/vfs.h" #include "platform/vfs.h"
HRESULT platform_hook_init_alls( HRESULT platform_hook_init(
const struct alls_config *cfg, const struct platform_config *cfg,
const char *game_id, const char *game_id,
const char *platform_id, const char *platform_id,
HMODULE redir_mod) HMODULE redir_mod)
@ -79,67 +79,3 @@ HRESULT platform_hook_init_alls(
return S_OK; 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;
}

View File

@ -4,14 +4,8 @@
#include "platform/config.h" #include "platform/config.h"
HRESULT platform_hook_init_alls( HRESULT platform_hook_init(
const struct alls_config *cfg, const struct platform_config *cfg,
const char *game_id,
const char *platform_id,
HMODULE redir_mod);
HRESULT platform_hook_init_nu(
const struct nu_config *cfg,
const char *game_id, const char *game_id,
const char *platform_id, const char *platform_id,
HMODULE redir_mod); HMODULE redir_mod);