From bc297b248098111148aa59686b6eac2f7b0d7fb1 Mon Sep 17 00:00:00 2001 From: Tau Date: Mon, 4 Mar 2019 17:22:38 -0500 Subject: [PATCH] Split libnu into libplatform, libamex Going to add some ALLS stuff to libplatform and the ALLS hardware does not contain an AMEX board. --- {nu => amex}/ds.c | 6 +++--- {nu => amex}/ds.h | 0 {nu => amex}/eeprom.c | 6 +++--- {nu => amex}/eeprom.h | 0 {nu => amex}/gpio.c | 4 ++-- {nu => amex}/gpio.h | 0 amex/guid.c | 8 ++++++++ {nu => amex}/jvs.c | 4 ++-- {nu => amex}/jvs.h | 0 {nu => amex}/meson.build | 9 ++------- {nu => amex}/nvram.c | 4 ++-- {nu => amex}/nvram.h | 0 {nu => amex}/sram.c | 6 +++--- {nu => amex}/sram.h | 0 chunihook/dllmain.c | 30 +++++++++++++++++------------- chunihook/jvs.c | 4 ++-- chunihook/meson.build | 3 ++- meson.build | 3 ++- minihook/dllmain.c | 9 +++++---- minihook/meson.build | 3 ++- nu/guid.c | 8 -------- {nu => platform}/hwmon.c | 2 +- {nu => platform}/hwmon.h | 0 platform/meson.build | 18 ++++++++++++++++++ {nu => platform}/nusec.c | 2 ++ {nu => platform}/nusec.h | 0 26 files changed, 76 insertions(+), 53 deletions(-) rename {nu => amex}/ds.c (99%) rename {nu => amex}/ds.h (100%) rename {nu => amex}/eeprom.c (98%) rename {nu => amex}/eeprom.h (100%) rename {nu => amex}/gpio.c (99%) rename {nu => amex}/gpio.h (100%) create mode 100644 amex/guid.c rename {nu => amex}/jvs.c (99%) rename {nu => amex}/jvs.h (100%) rename {nu => amex}/meson.build (75%) rename {nu => amex}/nvram.c (98%) rename {nu => amex}/nvram.h (100%) rename {nu => amex}/sram.c (98%) rename {nu => amex}/sram.h (100%) delete mode 100644 nu/guid.c rename {nu => platform}/hwmon.c (98%) rename {nu => platform}/hwmon.h (100%) create mode 100644 platform/meson.build rename {nu => platform}/nusec.c (99%) rename {nu => platform}/nusec.h (100%) diff --git a/nu/ds.c b/amex/ds.c similarity index 99% rename from nu/ds.c rename to amex/ds.c index c7f3445..1130b77 100644 --- a/nu/ds.c +++ b/amex/ds.c @@ -18,12 +18,12 @@ #include #include +#include "amex/ds.h" +#include "amex/nvram.h" + #include "hook/iobuf.h" #include "hook/iohook.h" -#include "nu/ds.h" -#include "nu/nvram.h" - #include "util/crc.h" #include "util/dprintf.h" #include "util/setupapi.h" diff --git a/nu/ds.h b/amex/ds.h similarity index 100% rename from nu/ds.h rename to amex/ds.h diff --git a/nu/eeprom.c b/amex/eeprom.c similarity index 98% rename from nu/eeprom.c rename to amex/eeprom.c index 807b2d4..da173cc 100644 --- a/nu/eeprom.c +++ b/amex/eeprom.c @@ -10,10 +10,10 @@ #include -#include "hook/iohook.h" +#include "amex/eeprom.h" +#include "amex/nvram.h" -#include "nu/eeprom.h" -#include "nu/nvram.h" +#include "hook/iohook.h" #include "util/dprintf.h" #include "util/setupapi.h" diff --git a/nu/eeprom.h b/amex/eeprom.h similarity index 100% rename from nu/eeprom.h rename to amex/eeprom.h diff --git a/nu/gpio.c b/amex/gpio.c similarity index 99% rename from nu/gpio.c rename to amex/gpio.c index 0eee74a..6e1236d 100644 --- a/nu/gpio.c +++ b/amex/gpio.c @@ -4,9 +4,9 @@ #include #include -#include "hook/iohook.h" +#include "amex/gpio.h" -#include "nu/gpio.h" +#include "hook/iohook.h" #include "util/dprintf.h" #include "util/setupapi.h" diff --git a/nu/gpio.h b/amex/gpio.h similarity index 100% rename from nu/gpio.h rename to amex/gpio.h diff --git a/amex/guid.c b/amex/guid.c new file mode 100644 index 0000000..de51804 --- /dev/null +++ b/amex/guid.c @@ -0,0 +1,8 @@ +#include +#include + +#include "amex/ds.h" +#include "amex/eeprom.h" +#include "amex/gpio.h" +#include "amex/jvs.h" +#include "amex/sram.h" diff --git a/nu/jvs.c b/amex/jvs.c similarity index 99% rename from nu/jvs.c rename to amex/jvs.c index 31a4b59..f220bf7 100644 --- a/nu/jvs.c +++ b/amex/jvs.c @@ -8,13 +8,13 @@ #include #include +#include "amex/jvs.h" + #include "hook/iobuf.h" #include "hook/iohook.h" #include "jvs/jvs-bus.h" -#include "nu/jvs.h" - #include "util/dprintf.h" #include "util/dump.h" #include "util/setupapi.h" diff --git a/nu/jvs.h b/amex/jvs.h similarity index 100% rename from nu/jvs.h rename to amex/jvs.h diff --git a/nu/meson.build b/amex/meson.build similarity index 75% rename from nu/meson.build rename to amex/meson.build index c82912f..4b5c3a3 100644 --- a/nu/meson.build +++ b/amex/meson.build @@ -1,5 +1,5 @@ -nu_lib = static_library( - 'nu', +amex_lib = static_library( + 'amex', include_directories : inc, implicit_include_directories : false, c_pch : [ @@ -8,7 +8,6 @@ nu_lib = static_library( ], dependencies : [ capnhook.get_variable('hook_dep'), - capnhook.get_variable('hooklib_dep'), ], sources : [ 'ds.c', @@ -20,10 +19,6 @@ nu_lib = static_library( 'guid.c', 'jvs.c', 'jvs.h', - 'hwmon.c', - 'hwmon.h', - 'nusec.c', - 'nusec.h', 'nvram.c', 'nvram.h', 'sram.c', diff --git a/nu/nvram.c b/amex/nvram.c similarity index 98% rename from nu/nvram.c rename to amex/nvram.c index 1f34d61..5e4286a 100644 --- a/nu/nvram.c +++ b/amex/nvram.c @@ -4,9 +4,9 @@ #include #include -#include "util/dprintf.h" +#include "amex/nvram.h" -#include "nu/nvram.h" +#include "util/dprintf.h" HRESULT nvram_open_file(HANDLE *out, wchar_t *path, size_t size) { diff --git a/nu/nvram.h b/amex/nvram.h similarity index 100% rename from nu/nvram.h rename to amex/nvram.h diff --git a/nu/sram.c b/amex/sram.c similarity index 98% rename from nu/sram.c rename to amex/sram.c index 8424eac..c069c18 100644 --- a/nu/sram.c +++ b/amex/sram.c @@ -10,10 +10,10 @@ #include -#include "hook/iohook.h" +#include "amex/sram.h" +#include "amex/nvram.h" -#include "nu/sram.h" -#include "nu/nvram.h" +#include "hook/iohook.h" #include "util/dprintf.h" #include "util/setupapi.h" diff --git a/nu/sram.h b/amex/sram.h similarity index 100% rename from nu/sram.h rename to amex/sram.h diff --git a/chunihook/dllmain.c b/chunihook/dllmain.c index c6781fd..5179a62 100644 --- a/chunihook/dllmain.c +++ b/chunihook/dllmain.c @@ -3,6 +3,12 @@ #include #include +#include "amex/ds.h" +#include "amex/eeprom.h" +#include "amex/gpio.h" +#include "amex/jvs.h" +#include "amex/sram.h" + #include "chunihook/jvs.h" #include "chunihook/slider-hook.h" @@ -10,13 +16,8 @@ #include "hooklib/serial.h" -#include "nu/ds.h" -#include "nu/eeprom.h" -#include "nu/gpio.h" -#include "nu/jvs.h" -#include "nu/hwmon.h" -#include "nu/nusec.h" -#include "nu/sram.h" +#include "platform/hwmon.h" +#include "platform/nusec.h" #include "util/clock.h" #include "util/dprintf.h" @@ -47,16 +48,19 @@ static DWORD CALLBACK chuni_pre_startup(void) gfx_hook_init(); serial_hook_init(); - /* Initialize Nu emulation */ + /* Initialize platform API emulation */ - eeprom_hook_init(); - sram_hook_init(); - ds_hook_init(); - gpio_hook_init(); - jvs_hook_init(); hwmon_hook_init(); nusec_hook_init(); + /* Initialize AMEX emulation */ + + ds_hook_init(); + gpio_hook_init(); + eeprom_hook_init(); + jvs_hook_init(); + sram_hook_init(); + /* Initialize Chunithm board emulation */ slider_hook_init(); diff --git a/chunihook/jvs.c b/chunihook/jvs.c index 86fec1e..b46e844 100644 --- a/chunihook/jvs.c +++ b/chunihook/jvs.c @@ -5,12 +5,12 @@ #include #include +#include "amex/jvs.h" + #include "board/io3.h" #include "jvs/jvs-bus.h" -#include "nu/jvs.h" - #include "util/dprintf.h" static void chunithm_jvs_read_switches(void *ctx, struct io3_switch_state *out); diff --git a/chunihook/meson.build b/chunihook/meson.build index 3c299a6..40a7ad4 100644 --- a/chunihook/meson.build +++ b/chunihook/meson.build @@ -12,9 +12,10 @@ shared_library( capnhook.get_variable('hooklib_dep'), ], link_with : [ + amex_lib, board_lib, jvs_lib, - nu_lib, + platform_lib, util_lib, ], sources : [ diff --git a/meson.build b/meson.build index de254f6..9a2a757 100644 --- a/meson.build +++ b/meson.build @@ -30,9 +30,10 @@ xinput_lib = cc.find_library('xinput') inc = include_directories('.') capnhook = subproject('capnhook') +subdir('amex') subdir('board') subdir('jvs') -subdir('nu') +subdir('platform') subdir('util') subdir('aimeio') diff --git a/minihook/dllmain.c b/minihook/dllmain.c index 76de549..556f320 100644 --- a/minihook/dllmain.c +++ b/minihook/dllmain.c @@ -1,9 +1,10 @@ #include +#include "amex/ds.h" + #include "hook/process.h" -#include "nu/ds.h" -#include "nu/nusec.h" +#include "platform/nusec.h" #include "util/clock.h" #include "util/dprintf.h" @@ -15,10 +16,10 @@ static DWORD CALLBACK app_pre_startup(void) { dprintf("--- Begin %s ---\n", __func__); + spike_hook_init("minispike.txt"); + clock_hook_init(); ds_hook_init(); nusec_hook_init(); - clock_hook_init(); - spike_hook_init("minispike.txt"); dprintf("--- End %s ---\n", __func__); diff --git a/minihook/meson.build b/minihook/meson.build index 6972271..c3a78ba 100644 --- a/minihook/meson.build +++ b/minihook/meson.build @@ -11,7 +11,8 @@ shared_library( capnhook.get_variable('hook_dep'), ], link_with : [ - nu_lib, + amex_lib, + platform_lib, util_lib, ], sources : [ diff --git a/nu/guid.c b/nu/guid.c deleted file mode 100644 index 8a81fa8..0000000 --- a/nu/guid.c +++ /dev/null @@ -1,8 +0,0 @@ -#include -#include - -#include "nu/ds.h" -#include "nu/eeprom.h" -#include "nu/gpio.h" -#include "nu/jvs.h" -#include "nu/sram.h" diff --git a/nu/hwmon.c b/platform/hwmon.c similarity index 98% rename from nu/hwmon.c rename to platform/hwmon.c index ded2d48..fe7aeb6 100644 --- a/nu/hwmon.c +++ b/platform/hwmon.c @@ -7,7 +7,7 @@ #include "hook/iohook.h" -#include "nu/hwmon.h" +#include "platform/hwmon.h" enum { HWMON_IOCTL_READ_CPU_TEMP = 0x80006000, diff --git a/nu/hwmon.h b/platform/hwmon.h similarity index 100% rename from nu/hwmon.h rename to platform/hwmon.h diff --git a/platform/meson.build b/platform/meson.build new file mode 100644 index 0000000..bdaef9d --- /dev/null +++ b/platform/meson.build @@ -0,0 +1,18 @@ +platform_lib = static_library( + 'platform', + include_directories : inc, + implicit_include_directories : false, + c_pch : [ + '../precompiled.c', + '../precompiled.h', + ], + dependencies : [ + capnhook.get_variable('hook_dep'), + ], + sources : [ + 'hwmon.c', + 'hwmon.h', + 'nusec.c', + 'nusec.h', + ], +) diff --git a/nu/nusec.c b/platform/nusec.c similarity index 99% rename from nu/nusec.c rename to platform/nusec.c index cfb3b4d..33df179 100644 --- a/nu/nusec.c +++ b/platform/nusec.c @@ -7,6 +7,8 @@ #include "hook/iohook.h" +#include "platform/nusec.h" + enum { NUSEC_IOCTL_PING = 0x22A114, NUSEC_IOCTL_ERASE_TRACE_LOG = 0x22E188, diff --git a/nu/nusec.h b/platform/nusec.h similarity index 100% rename from nu/nusec.h rename to platform/nusec.h