diff --git a/.gitignore b/.gitignore index 03468a05c..2940b34a7 100644 --- a/.gitignore +++ b/.gitignore @@ -400,4 +400,11 @@ ZAPDUtils/build/ ZAPD/BuildInfo.h DebugObj/* -ReleaseObj/* \ No newline at end of file +ReleaseObj/* + +// Switch Stuff + +*.nro +*.nacp +ZAPDTR/ZAPDUtils/lib/* +!/soh/icon.jpg \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 000000000..75929fc48 --- /dev/null +++ b/Makefile @@ -0,0 +1,27 @@ +#------------------------------------------------------------------------------- +.SUFFIXES: +#------------------------------------------------------------------------------- + +export SOH_TOP_DIR := $(CURDIR) + +.PHONY: all clean ZAPDUtils libultraship soh + +all: soh + @echo "Done!" + +ZAPDUtils: + @echo "Building $@..." + @$(MAKE) --no-print-directory -C $(CURDIR)/ZAPDTR/ZAPDUtils -f $(CURDIR)/ZAPDTR/ZAPDUtils/Makefile.switch + +libultraship: ZAPDUtils + @echo "Building $@..." + @$(MAKE) --no-print-directory -C $(CURDIR)/libultraship -f $(CURDIR)/libultraship/Makefile.switch + +soh: libultraship + @echo "Building $@..." + @$(MAKE) --no-print-directory -C $(CURDIR)/soh -f $(CURDIR)/soh/Makefile.switch + +clean: + @$(MAKE) --no-print-directory -C $(CURDIR)/ZAPDTR/ZAPDUtils -f $(CURDIR)/ZAPDTR/ZAPDUtils/Makefile.switch clean + @$(MAKE) --no-print-directory -C $(CURDIR)/libultraship -f $(CURDIR)/libultraship/Makefile.switch clean + @$(MAKE) --no-print-directory -C $(CURDIR)/soh -f $(CURDIR)/soh/Makefile.switch clean \ No newline at end of file diff --git a/ZAPDTR/ZAPDUtils/Makefile.switch b/ZAPDTR/ZAPDUtils/Makefile.switch new file mode 100644 index 000000000..ed173c44f --- /dev/null +++ b/ZAPDTR/ZAPDUtils/Makefile.switch @@ -0,0 +1,171 @@ +#--------------------------------------------------------------------------------- +.SUFFIXES: +#--------------------------------------------------------------------------------- + +ifeq ($(strip $(DEVKITPRO)),) +$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=/devkitpro") +endif + +TOPDIR ?= $(CURDIR) +include $(DEVKITPRO)/libnx/switch_rules + +#--------------------------------------------------------------------------------- +# TARGET is the name of the output +# BUILD is the directory where object files & intermediate files will be placed +# SOURCES is a list of directories containing source code +# DATA is a list of directories containing data files +# INCLUDES is a list of directories containing header files +# ROMFS is the directory containing data to be added to RomFS, relative to the Makefile (Optional) +# +# NO_ICON: if set to anything, do not use icon. +# NO_NACP: if set to anything, no .nacp file is generated. +# APP_TITLE is the name of the app stored in the .nacp file (Optional) +# APP_AUTHOR is the author of the app stored in the .nacp file (Optional) +# APP_VERSION is the version of the app stored in the .nacp file (Optional) +# APP_TITLEID is the titleID of the app stored in the .nacp file (Optional) +# ICON is the filename of the icon (.jpg), relative to the project folder. +# If not set, it attempts to use one of the following (in this order): +# - .jpg +# - icon.jpg +# - /default_icon.jpg +# +# CONFIG_JSON is the filename of the NPDM config file (.json), relative to the project folder. +# If not set, it attempts to use one of the following (in this order): +# - .json +# - config.json +# If a JSON file is provided or autodetected, an ExeFS PFS0 (.nsp) is built instead +# of a homebrew executable (.nro). This is intended to be used for sysmodules. +# NACP building is skipped as well. +#--------------------------------------------------------------------------------- +TARGET := ZAPDUtils +BUILD := build +SOURCES := Utils +DATA := +INCLUDES := + +#------------------------------------------------------------------------------- +# source files +#------------------------------------------------------------------------------- +SOURCEFILES_C := + +SOURCEFILES_CPP := + +#--------------------------------------------------------------------------------- +# options for code generation +#--------------------------------------------------------------------------------- +ARCH := -march=armv8-a+crc+crypto -mtune=cortex-a57 -mtp=soft -fPIE + +CFLAGS := -g -Wall -O2 -ffunction-sections \ + $(ARCH) $(DEFINES) + +CFLAGS += $(INCLUDE) -D__SWITCH__ + +CXXFLAGS := $(CFLAGS) -fno-rtti -fexceptions -std=gnu++20 +CFLAGS += -std=gnu11 + +ASFLAGS := -g $(ARCH) +LDFLAGS = -specs=$(DEVKITPRO)/libnx/switch.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map) + +LIBS := -lnx + +#--------------------------------------------------------------------------------- +# list of directories containing libraries, this must be the top level containing +# include and lib +#--------------------------------------------------------------------------------- +LIBDIRS := $(PORTLIBS) $(LIBNX) + + +#--------------------------------------------------------------------------------- +# no real need to edit anything past this point unless you need to add additional +# rules for different file extensions +#--------------------------------------------------------------------------------- +ifneq ($(BUILD),$(notdir $(CURDIR))) +#--------------------------------------------------------------------------------- + +export OUTPUT := $(CURDIR)/lib/lib$(TARGET).a +export TOPDIR := $(CURDIR) + +export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \ + $(foreach dir,$(DATA),$(CURDIR)/$(dir)) \ + $(foreach sf,$(SOURCEFILES_C),$(CURDIR)/$(dir $(sf))) \ + $(foreach sf,$(SOURCEFILES_CPP),$(CURDIR)/$(dir $(sf))) + +export DEPSDIR := $(CURDIR)/$(BUILD) + +CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c))) \ + $(foreach f,$(SOURCEFILES_C),$(notdir $(f))) +CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp))) \ + $(foreach f,$(SOURCEFILES_CPP),$(notdir $(f))) +SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s))) +BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*))) + +#--------------------------------------------------------------------------------- +# use CXX for linking C++ projects, CC for standard C +#--------------------------------------------------------------------------------- +ifeq ($(strip $(CPPFILES)),) +#--------------------------------------------------------------------------------- + export LD := $(CC) +#--------------------------------------------------------------------------------- +else +#--------------------------------------------------------------------------------- + export LD := $(CXX) +#--------------------------------------------------------------------------------- +endif +#--------------------------------------------------------------------------------- + +export OFILES_BIN := $(addsuffix .o,$(BINFILES)) +export OFILES_SRC := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o) +export OFILES := $(OFILES_BIN) $(OFILES_SRC) +export HFILES_BIN := $(addsuffix .h,$(subst .,_,$(BINFILES))) + +export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \ + $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ + -I$(CURDIR)/$(BUILD) + +export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) + +.PHONY: $(BUILD) clean all + +#--------------------------------------------------------------------------------- +all: $(BUILD) + +lib: + @[ -d $@ ] || mkdir -p $@ + +$(BUILD) : lib + @[ -d $@ ] || mkdir -p $@ + @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile.switch + +#--------------------------------------------------------------------------------- +clean: + @echo clean ... + @rm -rf build lib + +#--------------------------------------------------------------------------------- +else +.PHONY: all + +DEPENDS := $(OFILES:.o=.d) + +#--------------------------------------------------------------------------------- +# main targets +#--------------------------------------------------------------------------------- + +$(OUTPUT) : $(OFILES) + +$(OFILES_SRC) : $(HFILES) +$(OFILES_SRC) : $(HFILES_BIN) + +#--------------------------------------------------------------------------------- +# you need a rule like this for each extension you use as binary data +#--------------------------------------------------------------------------------- +%.bin.o %_bin.h : %.bin +#--------------------------------------------------------------------------------- + @echo $(notdir $<) + @$(bin2o) + +-include $(DEPENDS) + +#--------------------------------------------------------------------------------------- +endif +#--------------------------------------------------------------------------------------- \ No newline at end of file diff --git a/ZAPDTR/ZAPDUtils/Utils/Directory.h b/ZAPDTR/ZAPDUtils/Utils/Directory.h index 1ced139be..f25df2dc9 100644 --- a/ZAPDTR/ZAPDUtils/Utils/Directory.h +++ b/ZAPDTR/ZAPDUtils/Utils/Directory.h @@ -4,6 +4,10 @@ #include #include +#ifdef __SWITCH__ +long int pathconf (const char *__path, int __name){} +#endif + #if __has_include() #include namespace fs = std::filesystem; diff --git a/libultraship/Makefile.switch b/libultraship/Makefile.switch new file mode 100644 index 000000000..ad4967782 --- /dev/null +++ b/libultraship/Makefile.switch @@ -0,0 +1,256 @@ +#--------------------------------------------------------------------------------- +.SUFFIXES: +#--------------------------------------------------------------------------------- + +ifeq ($(strip $(DEVKITPRO)),) +$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=/devkitpro") +endif + +TOPDIR ?= $(CURDIR) +include $(DEVKITPRO)/libnx/switch_rules + +#--------------------------------------------------------------------------------- +# TARGET is the name of the output +# BUILD is the directory where object files & intermediate files will be placed +# SOURCES is a list of directories containing source code +# DATA is a list of directories containing data files +# INCLUDES is a list of directories containing header files +# ROMFS is the directory containing data to be added to RomFS, relative to the Makefile (Optional) +# +# NO_ICON: if set to anything, do not use icon. +# NO_NACP: if set to anything, no .nacp file is generated. +# APP_TITLE is the name of the app stored in the .nacp file (Optional) +# APP_AUTHOR is the author of the app stored in the .nacp file (Optional) +# APP_VERSION is the version of the app stored in the .nacp file (Optional) +# APP_TITLEID is the titleID of the app stored in the .nacp file (Optional) +# ICON is the filename of the icon (.jpg), relative to the project folder. +# If not set, it attempts to use one of the following (in this order): +# - .jpg +# - icon.jpg +# - /default_icon.jpg +# +# CONFIG_JSON is the filename of the NPDM config file (.json), relative to the project folder. +# If not set, it attempts to use one of the following (in this order): +# - .json +# - config.json +# If a JSON file is provided or autodetected, an ExeFS PFS0 (.nsp) is built instead +# of a homebrew executable (.nro). This is intended to be used for sysmodules. +# NACP building is skipped as well. +#--------------------------------------------------------------------------------- +TARGET := ultraship +BUILD := build +SOURCES := +DATA := +INCLUDES := \ + ../ZAPDTR/ZAPDUtils \ + libultraship/Lib/Fast3D/U64 \ + libultraship/Lib/spdlog \ + libultraship/Lib/spdlog/include \ + libultraship + +#------------------------------------------------------------------------------- +# source files +#------------------------------------------------------------------------------- +SOURCEFILES_C := \ + libultraship/mixer.c \ + libultraship/Lib/stb/stb_impl.c \ + +SOURCEFILES_CPP := \ + libultraship/Blob.cpp \ + libultraship/Cvar.cpp \ + libultraship/Environment.cpp \ + libultraship/GameSettings.cpp \ + libultraship/luslog.cpp \ + libultraship/ModManager.cpp \ + libultraship/SDLAudioPlayer.cpp \ + libultraship/Factories/AnimationFactory.cpp \ + libultraship/Factories/ArrayFactory.cpp \ + libultraship/Factories/BlobFactory.cpp \ + libultraship/Factories/CutsceneFactory.cpp \ + libultraship/Factories/MtxFactory.cpp \ + libultraship/Factories/PathFactory.cpp \ + libultraship/Animation.cpp \ + libultraship/Factories/TextFactory.cpp \ + libultraship/Factories/TextureFactory.cpp \ + libultraship/Factories/VtxFactory.cpp \ + libultraship/Array.cpp \ + libultraship/ConfigFile.cpp \ + libultraship/Controller.cpp \ + libultraship/SohHooks.cpp \ + libultraship/Factories/CollisionHeaderFactory.cpp \ + libultraship/Factories/DisplayListFactory.cpp \ + libultraship/Factories/MaterialFactory.cpp \ + libultraship/Factories/PlayerAnimationFactory.cpp \ + libultraship/Factories/ResourceLoader.cpp \ + libultraship/Factories/SceneFactory.cpp \ + libultraship/Factories/SkeletonFactory.cpp \ + libultraship/Factories/SkeletonLimbFactory.cpp \ + libultraship/Lib/Fast3D/gfx_cc.cpp \ + libultraship/Lib/Fast3D/gfx_pc.cpp \ + libultraship/Lib/Fast3D/gfx_sdl2.cpp \ + libultraship/Lib/Fast3D/gfx_opengl.cpp \ + libultraship/Lib/StrHash64.cpp \ + libultraship/Lib/tinyxml2/tinyxml2.cpp \ + libultraship/Archive.cpp \ + libultraship/CollisionHeader.cpp \ + libultraship/ControllerAttachment.cpp \ + libultraship/Cutscene.cpp \ + libultraship/DisplayList.cpp \ + libultraship/GlobalCtx2.cpp \ + libultraship/File.cpp \ + libultraship/Material.cpp \ + libultraship/Matrix.cpp \ + libultraship/MemoryPack.cpp \ + libultraship/Model.cpp \ + libultraship/Path.cpp \ + libultraship/PlayerAnimation.cpp \ + libultraship/Resource.cpp \ + libultraship/ResourceMgr.cpp \ + libultraship/RumblePack.cpp \ + libultraship/Scene.cpp \ + libultraship/Skeleton.cpp \ + libultraship/SkeletonLimb.cpp \ + libultraship/Text.cpp \ + libultraship/Texture.cpp \ + libultraship/TextureMod.cpp \ + libultraship/Utils.cpp \ + libultraship/Vertex.cpp \ + libultraship/Window.cpp \ + libultraship/WindowShim.cpp \ + libultraship/stox.cpp \ + libultraship/ \ + libultraship/GameOverlay.cpp \ + libultraship/SwitchImpl.cpp \ + libultraship/SohConsole.cpp \ + libultraship/KeyboardController.cpp \ + libultraship/SDLController.cpp \ + libultraship/SohImGuiImpl.cpp \ + libultraship/Lib/ImGui/backends/imgui_impl_opengl3.cpp \ + libultraship/Lib/ImGui/backends/imgui_impl_sdl.cpp \ + libultraship/Lib/ImGui/imgui.cpp \ + libultraship/Lib/ImGui/imgui_demo.cpp \ + libultraship/Lib/ImGui/imgui_draw.cpp \ + libultraship/Lib/ImGui/imgui_tables.cpp \ + libultraship/Lib/ImGui/imgui_widgets.cpp + +#--------------------------------------------------------------------------------- +# options for code generation +#--------------------------------------------------------------------------------- +ARCH := -march=armv8-a+crc+crypto -mtune=cortex-a57 -mtp=soft -fPIE + +CFLAGS := -g -Wall -O2 -ffunction-sections \ + $(ARCH) $(DEFINES) \ + -DSPDLOG_NO_THREAD_ID -DSPDLOG_NO_TLS \ + -DSTBI_NO_THREAD_LOCALS + +CFLAGS += $(INCLUDE) -D__SWITCH__ -DENABLE_OPENGL -DSDL_BYTEORDER + +CXXFLAGS := $(CFLAGS) -std=gnu++20 +CFLAGS += -std=gnu11 + +ASFLAGS := -g $(ARCH) +LDFLAGS = -specs=$(DEVKITPRO)/libnx/switch.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map) + +LIBS := -lnx + +#--------------------------------------------------------------------------------- +# list of directories containing libraries, this must be the top level containing +# include and lib +#--------------------------------------------------------------------------------- +LIBDIRS := $(PORTLIBS) $(LIBNX) + + +#--------------------------------------------------------------------------------- +# no real need to edit anything past this point unless you need to add additional +# rules for different file extensions +#--------------------------------------------------------------------------------- +ifneq ($(BUILD),$(notdir $(CURDIR))) +#--------------------------------------------------------------------------------- + +export OUTPUT := $(CURDIR)/lib/lib$(TARGET).a +export TOPDIR := $(CURDIR) + +export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \ + $(foreach dir,$(DATA),$(CURDIR)/$(dir)) \ + $(foreach sf,$(SOURCEFILES_C),$(CURDIR)/$(dir $(sf))) \ + $(foreach sf,$(SOURCEFILES_CPP),$(CURDIR)/$(dir $(sf))) + +export DEPSDIR := $(CURDIR)/$(BUILD) + +CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c))) \ + $(foreach f,$(SOURCEFILES_C),$(notdir $(f))) +CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp))) \ + $(foreach f,$(SOURCEFILES_CPP),$(notdir $(f))) +SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s))) +BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*))) + +#--------------------------------------------------------------------------------- +# use CXX for linking C++ projects, CC for standard C +#--------------------------------------------------------------------------------- +ifeq ($(strip $(CPPFILES)),) +#--------------------------------------------------------------------------------- + export LD := $(CC) +#--------------------------------------------------------------------------------- +else +#--------------------------------------------------------------------------------- + export LD := $(CXX) +#--------------------------------------------------------------------------------- +endif +#--------------------------------------------------------------------------------- + +export OFILES_BIN := $(addsuffix .o,$(BINFILES)) +export OFILES_SRC := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o) +export OFILES := $(OFILES_BIN) $(OFILES_SRC) +export HFILES_BIN := $(addsuffix .h,$(subst .,_,$(BINFILES))) + +export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \ + $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ + -I$(CURDIR)/$(BUILD) + +export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) + +.PHONY: $(BUILD) clean all + +#--------------------------------------------------------------------------------- +all: $(BUILD) + +lib: + @[ -d $@ ] || mkdir -p $@ + +$(BUILD) : lib + @[ -d $@ ] || mkdir -p $@ + @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile.switch + +#--------------------------------------------------------------------------------- +clean: + @echo clean ... + @rm -rf build lib + +#--------------------------------------------------------------------------------- +else +.PHONY: all + +DEPENDS := $(OFILES:.o=.d) + +#--------------------------------------------------------------------------------- +# main targets +#--------------------------------------------------------------------------------- + +$(OUTPUT) : $(OFILES) + +$(OFILES_SRC) : $(HFILES) +$(OFILES_SRC) : $(HFILES_BIN) + +#--------------------------------------------------------------------------------- +# you need a rule like this for each extension you use as binary data +#--------------------------------------------------------------------------------- +%.bin.o %_bin.h : %.bin +#--------------------------------------------------------------------------------- + @echo $(notdir $<) + @$(bin2o) + +-include $(DEPENDS) + +#--------------------------------------------------------------------------------------- +endif +#--------------------------------------------------------------------------------------- \ No newline at end of file diff --git a/libultraship/libultraship/Archive.cpp b/libultraship/libultraship/Archive.cpp index 1e8f8d597..4f766ca01 100644 --- a/libultraship/libultraship/Archive.cpp +++ b/libultraship/libultraship/Archive.cpp @@ -311,15 +311,14 @@ namespace Ship { bool Archive::LoadMainMPQ(bool enableWriting, bool genCRCMap) { HANDLE mpqHandle = NULL; #ifdef _WIN32 - std::wstring wfullPath = std::filesystem::absolute(MainPath).wstring(); -#endif - std::string fullPath = std::filesystem::absolute(MainPath).string(); - -#ifdef _WIN32 - if (!SFileOpenArchive(wfullPath.c_str(), 0, enableWriting ? 0 : MPQ_OPEN_READ_ONLY, &mpqHandle)) { + std::wstring fullPath = std::filesystem::absolute(MainPath).wstring(); +#elif defined(__SWITCH__) + std::string fullPath = MainPath; #else - if (!SFileOpenArchive(fullPath.c_str(), 0, enableWriting ? 0 : MPQ_OPEN_READ_ONLY, &mpqHandle)) { + std::string fullPath = std::filesystem::absolute(MainPath).string(); #endif + + if (!SFileOpenArchive(fullPath.c_str(), 0, enableWriting ? 0 : MPQ_OPEN_READ_ONLY, &mpqHandle)) { SPDLOG_ERROR("({}) Failed to open main mpq file {}.", GetLastError(), fullPath.c_str()); return false; } @@ -346,18 +345,20 @@ namespace Ship { bool Archive::LoadPatchMPQ(const std::string& path) { HANDLE patchHandle = NULL; + +#ifdef _WIN32 + std::wstring fullPath = std::filesystem::absolute(path).wstring(); +#elif defined(__SWITCH__) + std::string fullPath = path; +#else std::string fullPath = std::filesystem::absolute(path).string(); +#endif + if (mpqHandles.contains(fullPath)) { return true; } - std::wstring wPath = std::filesystem::absolute(path).wstring(); - -#ifdef _WIN32 - if (!SFileOpenArchive(wPath.c_str(), 0, MPQ_OPEN_READ_ONLY, &patchHandle)) { -#else if (!SFileOpenArchive(fullPath.c_str(), 0, MPQ_OPEN_READ_ONLY, &patchHandle)) { -#endif SPDLOG_ERROR("({}) Failed to open patch mpq file {} while applying to {}.", GetLastError(), path.c_str(), MainPath.c_str()); return false; } diff --git a/libultraship/libultraship/Environment.cpp b/libultraship/libultraship/Environment.cpp index 7f10c8c44..55586c545 100644 --- a/libultraship/libultraship/Environment.cpp +++ b/libultraship/libultraship/Environment.cpp @@ -9,6 +9,11 @@ namespace SohUtils { void saveEnvironmentVar(const std::string& key, const std::string& value) { environmentVars[key] = value; } + + bool hasEnvironmentVar(const std::string& key) { + return environmentVars.find(key) != environmentVars.end(); + } + std::string getEnvironmentVar(const std::string& key) { return environmentVars[key]; } diff --git a/libultraship/libultraship/Environment.h b/libultraship/libultraship/Environment.h index 4d6ab3346..ba3d89c5e 100644 --- a/libultraship/libultraship/Environment.h +++ b/libultraship/libultraship/Environment.h @@ -4,5 +4,6 @@ namespace SohUtils { void saveEnvironmentVar(const std::string& key, const std::string& value); + bool hasEnvironmentVar(const std::string& key); std::string getEnvironmentVar(const std::string& key); } \ No newline at end of file diff --git a/libultraship/libultraship/GlobalCtx2.cpp b/libultraship/libultraship/GlobalCtx2.cpp index 5ce59f5ab..fb6219cb6 100644 --- a/libultraship/libultraship/GlobalCtx2.cpp +++ b/libultraship/libultraship/GlobalCtx2.cpp @@ -47,7 +47,7 @@ namespace Ship { } PatchesPath = (*Config)["ARCHIVE"]["Patches Directory"]; if (PatchesPath.empty()) { - PatchesPath = "./"; + PatchesPath = "./mods"; } ResMan = std::make_shared(GlobalCtx2::GetInstance(), MainPath, PatchesPath); Win = std::make_shared(GlobalCtx2::GetInstance()); @@ -56,6 +56,8 @@ namespace Ship { { #ifdef _WIN32 MessageBox(NULL, L"Main OTR file not found!", L"Uh oh", MB_OK); +#elif defined(__SWITCH__) + printf("Main OTR file not found!\n"); #else SPDLOG_ERROR("Main OTR file not found!"); #endif diff --git a/libultraship/libultraship/Lib/Fast3D/gfx_opengl.cpp b/libultraship/libultraship/Lib/Fast3D/gfx_opengl.cpp index b2db3186a..3e62a142f 100644 --- a/libultraship/libultraship/Lib/Fast3D/gfx_opengl.cpp +++ b/libultraship/libultraship/Lib/Fast3D/gfx_opengl.cpp @@ -27,11 +27,14 @@ #include "SDL.h" #define GL_GLEXT_PROTOTYPES 1 #include "SDL_opengl.h" +#elif __SWITCH__ +#include +#include "glad/glad.h" #else #include #include #define GL_GLEXT_PROTOTYPES 1 -// #include +#include #endif #include "gfx_cc.h" @@ -562,6 +565,10 @@ static void gfx_opengl_upload_texture(const uint8_t *rgba32_buf, uint32_t width, glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, rgba32_buf); } +#ifdef __SWITCH__ +#define GL_MIRROR_CLAMP_TO_EDGE 0x8743 +#endif + static uint32_t gfx_cm_to_opengl(uint32_t val) { switch (val) { case G_TX_NOMIRROR | G_TX_CLAMP: @@ -629,9 +636,9 @@ static void gfx_opengl_draw_triangles(float buf_vbo[], size_t buf_vbo_len, size_ } static void gfx_opengl_init(void) { -//#if FOR_WINDOWS +#ifndef __SWITCH__ glewInit(); -//#endif +#endif glGenBuffers(1, &opengl_vbo); glBindBuffer(GL_ARRAY_BUFFER, opengl_vbo); diff --git a/libultraship/libultraship/Lib/Fast3D/gfx_pc.h b/libultraship/libultraship/Lib/Fast3D/gfx_pc.h index 62f80ab3c..73b1c5804 100644 --- a/libultraship/libultraship/Lib/Fast3D/gfx_pc.h +++ b/libultraship/libultraship/Lib/Fast3D/gfx_pc.h @@ -5,9 +5,12 @@ #include #include #include - #include "U64/PR/ultra64/types.h" +#ifdef __SWITCH__ +#include +#endif + struct GfxRenderingAPI; struct GfxWindowManagerAPI; diff --git a/libultraship/libultraship/Lib/Fast3D/gfx_sdl2.cpp b/libultraship/libultraship/Lib/Fast3D/gfx_sdl2.cpp index e80097c81..6e6733029 100644 --- a/libultraship/libultraship/Lib/Fast3D/gfx_sdl2.cpp +++ b/libultraship/libultraship/Lib/Fast3D/gfx_sdl2.cpp @@ -13,14 +13,18 @@ #include "SDL.h" #define GL_GLEXT_PROTOTYPES 1 #include "SDL_opengl.h" -#else +#elif !defined(__SWITCH__) #include #define GL_GLEXT_PROTOTYPES 1 #include +#else +#include +#include +#include "glad/glad.h" #endif #include "../../SohImGuiImpl.h" - +#include "../../SwitchImpl.h" #include "gfx_window_manager_api.h" #include "gfx_screen_config.h" #ifdef _WIN32 @@ -37,6 +41,7 @@ static int vsync_enabled = 0; static unsigned int window_width = DESIRED_SCREEN_WIDTH; static unsigned int window_height = DESIRED_SCREEN_HEIGHT; static bool fullscreen_state; +static bool is_running = true; static void (*on_fullscreen_changed_callback)(bool is_now_fullscreen); static bool (*on_key_down_callback)(int scancode); static bool (*on_key_up_callback)(int scancode); @@ -119,7 +124,7 @@ static void set_fullscreen(bool on, bool call_callback) { } static uint64_t previous_time; -#ifndef __linux__ +#if !defined(__linux__) && !defined(__SWITCH__) static HANDLE timer; #endif @@ -135,12 +140,16 @@ static void gfx_sdl_init(const char *game_name, bool start_in_fullscreen) { SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24); SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); -#ifndef __linux +#if !defined(__linux__) && !defined(__SWITCH__) timer = CreateWaitableTimer(nullptr, false, nullptr); #endif - //SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1); - //SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 4); +#ifdef __SWITCH__ + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE); + Ship::Switch::GetDisplaySize(&window_width, &window_height); +#endif char title[512]; int len = sprintf(title, "%s (%s)", game_name, GFX_API_NAME); @@ -148,12 +157,20 @@ static void gfx_sdl_init(const char *game_name, bool start_in_fullscreen) { wnd = SDL_CreateWindow(title, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, window_width, window_height, SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE); +#ifndef __SWITCH__ if (start_in_fullscreen) { set_fullscreen(true, false); } +#endif ctx = SDL_GL_CreateContext(wnd); +#ifdef __SWITCH__ + if(!gladLoadGLLoader(SDL_GL_GetProcAddress)){ + printf("Failed to initialize glad\n"); + } +#endif + SDL_GL_SetSwapInterval(1); SohImGui::WindowImpl window_impl; @@ -194,15 +211,25 @@ static void gfx_sdl_set_keyboard_callbacks(bool (*on_key_down)(int scancode), bo } static void gfx_sdl_main_loop(void (*run_one_game_iter)(void)) { - while (1) - { +#ifdef __SWITCH__ + while(Ship::Switch::IsRunning()) { +#else + while(is_running) { +#endif run_one_game_iter(); } +#ifdef __SWITCH__ + Ship::Switch::Exit(); +#endif } static void gfx_sdl_get_dimensions(uint32_t *width, uint32_t *height) { - *width = window_width; +#ifdef __SWITCH__ + Ship::Switch::GetDisplaySize(width, height); +#else + *width = window_width; *height = window_height; +#endif } static int translate_scancode(int scancode) { @@ -228,6 +255,8 @@ static void gfx_sdl_onkeyup(int scancode) { } static void gfx_sdl_handle_events(void) { + + Ship::Switch::Update(); SDL_Event event; while (SDL_PollEvent(&event)) { SohImGui::EventImpl event_impl; @@ -250,7 +279,7 @@ static void gfx_sdl_handle_events(void) { } break; case SDL_QUIT: - exit(0); + is_running = false; } } } @@ -271,7 +300,7 @@ static inline void sync_framerate_with_timer(void) { const int64_t next = qpc_to_100ns(previous_time) + 10 * FRAME_INTERVAL_US_NUMERATOR / FRAME_INTERVAL_US_DENOMINATOR; const int64_t left = next - qpc_to_100ns(t); if (left > 0) { -#ifdef __linux__ +#if defined(__linux__) || defined(__SWITCH__) const timespec spec = { 0, left * 100 }; nanosleep(&spec, nullptr); #else diff --git a/libultraship/libultraship/Lib/ImGui/backends/imgui_impl_opengl3.cpp b/libultraship/libultraship/Lib/ImGui/backends/imgui_impl_opengl3.cpp index 499798bb0..5a7588629 100644 --- a/libultraship/libultraship/Lib/ImGui/backends/imgui_impl_opengl3.cpp +++ b/libultraship/libultraship/Lib/ImGui/backends/imgui_impl_opengl3.cpp @@ -130,7 +130,10 @@ #else #include // Use GL ES 3 #endif -#elif !defined(IMGUI_IMPL_OPENGL_LOADER_CUSTOM) +#elif defined(__SWITCH__) +#define GL_GLEXT_PROTOTYPES 1 +#include "glad/glad.h" +#else // Modern desktop OpenGL doesn't have a standard portable header file to load OpenGL function pointers. // Helper libraries are often used for this purpose! Here we are using our own minimal custom loader based on gl3w. // In the rest of your app/engine, you can use another loader of your choice (gl3w, glew, glad, glbinding, glext, glLoadGen, etc.). @@ -216,7 +219,7 @@ bool ImGui_ImplOpenGL3_Init(const char* glsl_version) IM_ASSERT(io.BackendRendererUserData == NULL && "Already initialized a renderer backend!"); // Initialize our loader -#if !defined(IMGUI_IMPL_OPENGL_ES2) && !defined(IMGUI_IMPL_OPENGL_ES3) && !defined(IMGUI_IMPL_OPENGL_LOADER_CUSTOM) +#if !defined(__SWITCH__) && !defined(IMGUI_IMPL_OPENGL_ES2) && !defined(IMGUI_IMPL_OPENGL_ES3) && !defined(IMGUI_IMPL_OPENGL_LOADER_CUSTOM) if (imgl3wInit() != 0) { fprintf(stderr, "Failed to initialize OpenGL loader!\n"); @@ -319,7 +322,6 @@ void ImGui_ImplOpenGL3_NewFrame() static void ImGui_ImplOpenGL3_SetupRenderState(ImDrawData* draw_data, int fb_width, int fb_height, GLuint vertex_array_object) { ImGui_ImplOpenGL3_Data* bd = ImGui_ImplOpenGL3_GetBackendData(); - // Setup render state: alpha-blending enabled, no face culling, no depth testing, scissor enabled, polygon fill glEnable(GL_BLEND); glBlendEquation(GL_FUNC_ADD); diff --git a/libultraship/libultraship/Lib/ImGui/backends/imgui_impl_sdl.cpp b/libultraship/libultraship/Lib/ImGui/backends/imgui_impl_sdl.cpp index 61e6d99ac..cb8e8dfa0 100644 --- a/libultraship/libultraship/Lib/ImGui/backends/imgui_impl_sdl.cpp +++ b/libultraship/libultraship/Lib/ImGui/backends/imgui_impl_sdl.cpp @@ -63,11 +63,13 @@ #include "../imgui.h" #include "imgui_impl_sdl.h" - +#include "../../../SwitchImpl.h" // SDL // (the multi-viewports feature requires SDL features supported from SDL 2.0.4+. SDL 2.0.5+ is highly recommended) #include +#ifndef __SWITCH__ #include +#endif #include #if defined(__APPLE__) #include @@ -618,6 +620,7 @@ static void ImGui_ImplSDL2_UpdateMonitors() { ImGuiPlatformIO& platform_io = ImGui::GetPlatformIO(); platform_io.Monitors.resize(0); +#ifndef __SWITCH__ int display_count = SDL_GetNumVideoDisplays(); for (int n = 0; n < display_count; n++) { @@ -639,6 +642,15 @@ static void ImGui_ImplSDL2_UpdateMonitors() #endif platform_io.Monitors.push_back(monitor); } +#else + uint32_t width, height; + Ship::Switch::GetDisplaySize(&width, &height); + ImGuiPlatformMonitor monitor; + monitor.MainPos = monitor.WorkPos = ImVec2(.0f, .0f); + monitor.MainSize = monitor.WorkSize = ImVec2((float) width, (float) height); + monitor.DpiScale = Ship::Switch::GetDPI() / 96.0f; + platform_io.Monitors.push_back(monitor); +#endif } void ImGui_ImplSDL2_NewFrame() diff --git a/libultraship/libultraship/Lib/ImGui/imgui_internal.h b/libultraship/libultraship/Lib/ImGui/imgui_internal.h index b8212198b..b5cfba80c 100644 --- a/libultraship/libultraship/Lib/ImGui/imgui_internal.h +++ b/libultraship/libultraship/Lib/ImGui/imgui_internal.h @@ -1021,6 +1021,7 @@ struct IMGUI_API ImGuiInputTextState bool SelectedAllMouseLock; // after a double-click to select all, we ignore further mouse drags to update selection bool Edited; // edited this frame ImGuiInputTextFlags Flags; // copy of InputText() flags + char* OverwriteData; ImGuiInputTextState() { memset(this, 0, sizeof(*this)); } void ClearText() { CurLenW = CurLenA = 0; TextW[0] = 0; TextA[0] = 0; CursorClamp(); } diff --git a/libultraship/libultraship/Lib/ImGui/imgui_widgets.cpp b/libultraship/libultraship/Lib/ImGui/imgui_widgets.cpp index 8e4210002..ac09cf85d 100644 --- a/libultraship/libultraship/Lib/ImGui/imgui_widgets.cpp +++ b/libultraship/libultraship/Lib/ImGui/imgui_widgets.cpp @@ -4261,6 +4261,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_ const bool is_paste = ((is_shortcut_key && IsKeyPressed(ImGuiKey_V)) || (is_shift_key_only && IsKeyPressed(ImGuiKey_Insert))) && !is_readonly; const bool is_undo = ((is_shortcut_key && IsKeyPressed(ImGuiKey_Z)) && !is_readonly && is_undoable); const bool is_redo = ((is_shortcut_key && IsKeyPressed(ImGuiKey_Y)) || (is_osx_shift_shortcut && IsKeyPressed(ImGuiKey_Z))) && !is_readonly && is_undoable; + const bool is_overwrite = state->OverwriteData != NULL; // We allow validate/cancel with Nav source (gamepad) to makes it easier to undo an accidental NavInput press with no keyboard wired, but otherwise it isn't very useful. const bool is_validate_enter = IsKeyPressed(ImGuiKey_Enter) || IsKeyPressed(ImGuiKey_KeypadEnter); @@ -4341,9 +4342,9 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_ stb_textedit_cut(state, &state->Stb); } } - else if (is_paste) + else if (is_paste || is_overwrite) { - if (const char* clipboard = GetClipboardText()) + if (const char* clipboard = is_overwrite ? state->OverwriteData : GetClipboardText()) { // Filter pasted buffer const int clipboard_len = (int)strlen(clipboard); @@ -4365,6 +4366,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_ stb_textedit_paste(state, &state->Stb, clipboard_filtered, clipboard_filtered_len); state->CursorFollow = true; } + if(is_overwrite) state->OverwriteData = NULL; MemFree(clipboard_filtered); } } diff --git a/libultraship/libultraship/SohImGuiImpl.cpp b/libultraship/libultraship/SohImGuiImpl.cpp index 8e4becaab..e4636e23f 100644 --- a/libultraship/libultraship/SohImGuiImpl.cpp +++ b/libultraship/libultraship/SohImGuiImpl.cpp @@ -25,6 +25,7 @@ #include "Lib/Fast3D/gfx_rendering_api.h" #include "Lib/spdlog/include/spdlog/common.h" #include "Utils/StringHelper.h" +#include "SwitchImpl.h" #ifdef ENABLE_OPENGL #include "Lib/ImGui/backends/imgui_impl_opengl3.h" @@ -335,6 +336,9 @@ namespace SohImGui { overlay->Init(); ImGuiWMInit(); ImGuiBackendInit(); + #ifdef __SWITCH__ + ImGui::GetStyle().ScaleAllSizes(Ship::Switch::GetDPI() / 96.0f); + #endif ModInternal::registerHookListener({ GFX_INIT, [](const HookEvent ev) { @@ -368,6 +372,11 @@ namespace SohImGui { } void Update(EventImpl event) { + #ifdef __SWITCH__ + int xPos, yPos; + Switch::GetTouchPosition(&xPos, &yPos); + io->MousePos = ImVec2(xPos, yPos); + #endif if (needs_save) { Game::SaveSettings(); needs_save = false; @@ -524,7 +533,7 @@ namespace SohImGui { const ImGuiViewport* viewport = ImGui::GetMainViewport(); ImGui::SetNextWindowPos(viewport->WorkPos); - ImGui::SetNextWindowSize(ImVec2(wnd->GetCurrentWidth(), wnd->GetCurrentHeight())); + ImGui::SetNextWindowSize(ImVec2((int) wnd->GetCurrentWidth(), (int) wnd->GetCurrentHeight())); ImGui::SetNextWindowViewport(viewport->ID); ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0.0f, 0.0f)); ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 0.0f); diff --git a/libultraship/libultraship/SwitchImpl.cpp b/libultraship/libultraship/SwitchImpl.cpp new file mode 100644 index 000000000..c8cef3d10 --- /dev/null +++ b/libultraship/libultraship/SwitchImpl.cpp @@ -0,0 +1,147 @@ +#ifdef __SWITCH__ +#include "SwitchImpl.h" +#include +#include +#include "Lib/ImGui/imgui.h" +#include "Lib/ImGui/imgui_internal.h" + +extern "C" s32 CVar_GetS32(const char* name, s32 defaultValue); +extern "C" void CVar_SetS32(const char* name, s32 value); + +#define DOCKED_MODE 1 +#define HANDHELD_MODE 0 + +static int MouseX, MouseY, Prev_TouchCount; +static int WaitFramesToUpdate; +static HidTouchScreenState TouchState = {0}; +static SwkbdConfig kbd; +static PadState pad; + +void InitKeyboard(){ + Result rc = 0; + char tmpoutstr[16] = {0}; + rc = swkbdCreate(&kbd, 0); + if (R_SUCCEEDED(rc)) + swkbdConfigMakePresetDefault(&kbd); +} + +// TODO: Fully Implement Keyboard + +void UpdateKeyboard() { + ImGuiIO* io = &ImGui::GetIO(); + int length = 512; + char* message; + + if(WaitFramesToUpdate > 0) + WaitFramesToUpdate--; + + if(WaitFramesToUpdate){ + ImGui::ClearActiveID(); + free(message); + } + + if(io->WantTextInput && !WaitFramesToUpdate){ + message = (char*)malloc(length); + ImGuiInputTextState* state = ImGui::GetInputTextState(ImGui::GetActiveID()); + if(!state->InitialTextA.empty()){ + swkbdConfigSetInitialText(&kbd, state->InitialTextA.Data); + } + + Result rc = swkbdShow(&kbd, message, length); + + if(R_SUCCEEDED(rc)){ + state->ClearText(); + state->OverwriteData = &message[0]; + } + + WaitFramesToUpdate = 2; + io->WantTextInput = false; + } +} + +void Ship::Switch::Init(){ + appletInitializeGamePlayRecording(); + socketInitializeDefault(); + nxlinkStdio(); + appletSetGamePlayRecordingState(true); + padConfigureInput(1, HidNpadStyleSet_NpadStandard); + padInitializeDefault(&pad); + hidInitializeTouchScreen(); + InitKeyboard(); +} + +void PushSDLEvent(Uint32 type, Uint8 button){ + SDL_Event event; + event.type = type; + event.button.button = button; + SDL_PushEvent(&event); +} + +void Ship::Switch::Update(){ + UpdateKeyboard(); + padUpdate(&pad); + uint64_t kDown = padGetButtonsDown(&pad); + + if (kDown & HidNpadButton_Minus){ + CVar_SetS32("gOpenMenuBar", !CVar_GetS32("gOpenMenuBar", 0)); + } + + if (hidGetTouchScreenStates(&TouchState, 1)) { + if (TouchState.count != Prev_TouchCount) { + Prev_TouchCount = TouchState.count; + PushSDLEvent(SDL_MOUSEBUTTONUP, SDL_BUTTON_LEFT); + PushSDLEvent(SDL_MOUSEBUTTONUP, SDL_BUTTON_RIGHT); + } + + for(s32 i = 0; i < TouchState.count; i++) { + MouseX = TouchState.touches[0].x; + MouseY = TouchState.touches[0].y; + } + + if(TouchState.count == 1) { + PushSDLEvent(SDL_MOUSEBUTTONDOWN, SDL_BUTTON_LEFT); + return; + } + + if(TouchState.count > 1) { + PushSDLEvent(SDL_MOUSEBUTTONDOWN, SDL_BUTTON_RIGHT); + } + } +} + +void Ship::Switch::Exit(){ + socketExit(); + appletSetGamePlayRecordingState(false); +} + +bool Ship::Switch::IsRunning(){ + return appletMainLoop(); +} + +void Ship::Switch::GetDisplaySize(uint32_t *width, uint32_t *height) { + switch (appletGetOperationMode()) { + case DOCKED_MODE: + *width = 1920; + *height = 1080; + break; + case HANDHELD_MODE: + *width = 1280; + *height = 720; + break; + } +} + +void Ship::Switch::GetTouchPosition(int *touchX, int *touchY) { + *touchX = MouseX; + *touchY = MouseY; +} + +float Ship::Switch::GetDPI(){ + switch (appletGetOperationMode()) { + case DOCKED_MODE: + return 56.48480f; + case HANDHELD_MODE: + return 236.8717f; + } +} +#endif \ No newline at end of file diff --git a/libultraship/libultraship/SwitchImpl.h b/libultraship/libultraship/SwitchImpl.h new file mode 100644 index 000000000..3ff2f3749 --- /dev/null +++ b/libultraship/libultraship/SwitchImpl.h @@ -0,0 +1,16 @@ +#pragma once + +#include + +namespace Ship { +class Switch { +public: + static void Init(); + static void Exit(); + static void Update(); + static bool IsRunning(); + static void GetDisplaySize(uint32_t *width, uint32_t *height); + static void GetTouchPosition(int *touchX, int *touchY); + static float GetDPI(); +}; +}; \ No newline at end of file diff --git a/libultraship/libultraship/Window.cpp b/libultraship/libultraship/Window.cpp index 588e3af50..3a22973af 100644 --- a/libultraship/libultraship/Window.cpp +++ b/libultraship/libultraship/Window.cpp @@ -42,6 +42,7 @@ extern "C" { exit(EXIT_FAILURE); } + #ifndef __SWITCH__ const char* controllerDb = "gamecontrollerdb.txt"; int mappingsAdded = SDL_GameControllerAddMappingsFromFile(controllerDb); if (mappingsAdded >= 0) { @@ -49,7 +50,7 @@ extern "C" { } else { SPDLOG_ERROR("Failed add SDL game controller mappings from \"{}\" ({})", controllerDb, SDL_GetError()); } - + #endif // TODO: This for loop is debug. Burn it with fire. for (int i = 0; i < SDL_NumJoysticks(); i++) { if (SDL_IsGameController(i)) { @@ -333,8 +334,6 @@ namespace Ship { GlobalCtx2::GetInstance()->GetWindow()->ToggleFullscreen(); } - - // OTRTODO: Rig with Kirito's console? //if (dwScancode == Ship::stoi(Conf["KEYBOARD SHORTCUTS"]["KEY_CONSOLE"])) { // ToggleConsole(); diff --git a/soh/Makefile.switch b/soh/Makefile.switch new file mode 100644 index 000000000..9344de6d1 --- /dev/null +++ b/soh/Makefile.switch @@ -0,0 +1,964 @@ +#--------------------------------------------------------------------------------- +.SUFFIXES: +#--------------------------------------------------------------------------------- + +ifeq ($(strip $(DEVKITPRO)),) +$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=/devkitpro") +endif + +TOPDIR ?= $(CURDIR) +include $(DEVKITPRO)/libnx/switch_rules + +#--------------------------------------------------------------------------------- +# TARGET is the name of the output +# BUILD is the directory where object files & intermediate files will be placed +# SOURCES is a list of directories containing source code +# DATA is a list of directories containing data files +# INCLUDES is a list of directories containing header files +# ROMFS is the directory containing data to be added to RomFS, relative to the Makefile (Optional) +# +# NO_ICON: if set to anything, do not use icon. +# NO_NACP: if set to anything, no .nacp file is generated. +# APP_TITLE is the name of the app stored in the .nacp file (Optional) +# APP_AUTHOR is the author of the app stored in the .nacp file (Optional) +# APP_VERSION is the version of the app stored in the .nacp file (Optional) +# APP_TITLEID is the titleID of the app stored in the .nacp file (Optional) +# ICON is the filename of the icon (.jpg), relative to the project folder. +# If not set, it attempts to use one of the following (in this order): +# - .jpg +# - icon.jpg +# - /default_icon.jpg +# +# CONFIG_JSON is the filename of the NPDM config file (.json), relative to the project folder. +# If not set, it attempts to use one of the following (in this order): +# - .json +# - config.json +# If a JSON file is provided or autodetected, an ExeFS PFS0 (.nsp) is built instead +# of a homebrew executable (.nro). This is intended to be used for sysmodules. +# NACP building is skipped as well. +#--------------------------------------------------------------------------------- +TARGET := $(notdir $(CURDIR)) +BUILD := build +SOURCES := switch +DATA := +INCLUDES := \ + . \ + assets \ + build \ + include \ + src \ + ../ZAPDTR/ZAPDUtils \ + ../libultraship/libultraship \ + ../libultraship/libultraship/Lib/spdlog/include \ + ../libultraship/libultraship/Lib/Fast3D/U64 \ + ../libultraship/libultraship/Lib/Fast3D/U64/PR + +#------------------------------------------------------------------------------- +# source files +#------------------------------------------------------------------------------- +SOURCEFILES_C := \ + soh/Enhancements/bootcommands.c \ + soh/Enhancements/gameconsole.c \ + soh/gu_pc.c \ + soh/stubs.c \ + src/boot/assert.c \ + src/boot/boot_main.c \ + src/boot/build.c \ + src/boot/idle.c \ + src/boot/is_debug.c \ + src/boot/logutils.c \ + src/boot/missing_gcc_functions.c \ + src/boot/stackcheck.c \ + src/boot/viconfig.c \ + src/boot/yaz0.c \ + src/boot/z_locale.c \ + src/boot/z_std_dma.c \ + src/buffers/gfxbuffers.c \ + src/buffers/heaps.c \ + src/buffers/zbuffer.c \ + src/code/audioMgr.c \ + src/code/audio_data.c \ + src/code/audio_effects.c \ + src/code/audio_heap.c \ + src/code/audio_init_params.c \ + src/code/audio_load.c \ + src/code/audio_playback.c \ + src/code/audio_seqplayer.c \ + src/code/audio_sound_params.c \ + src/code/audio_synthesis.c \ + src/code/code_800430A0.c \ + src/code/code_80043480.c \ + src/code/code_8006C3A0.c \ + src/code/code_8006C510.c \ + src/code/code_80097A00.c \ + src/code/code_800A9F30.c \ + src/code/code_800ACE70.c \ + src/code/code_800AD920.c \ + src/code/code_800BB0A0.c \ + src/code/code_800C3C20.c \ + src/code/code_800D2E30.c \ + src/code/code_800D31A0.c \ + src/code/code_800E4FE0.c \ + src/code/code_800E6840.c \ + src/code/code_800EC960.c \ + src/code/code_800F7260.c \ + src/code/code_800F9280.c \ + src/code/code_800FBCE0.c \ + src/code/code_800FC620.c \ + src/code/code_800FCE80.c \ + src/code/code_800FD970.c \ + src/code/code_801067F0.c \ + src/code/code_801068B0.c \ + src/code/db_camera.c \ + src/code/debug_malloc.c \ + src/code/fault.c \ + src/code/fault_drawer.c \ + src/code/flg_set.c \ + src/code/game.c \ + src/code/gamealloc.c \ + src/code/gfxprint.c \ + src/code/graph.c \ + src/code/irqmgr.c \ + src/code/jpegdecoder.c \ + src/code/jpegutils.c \ + src/code/listalloc.c \ + src/code/loadfragment2.c \ + src/code/logseverity.c \ + src/code/main.c \ + src/code/mempak.c \ + src/code/mtxuty-cvt.c \ + src/code/padmgr.c \ + src/code/padsetup.c \ + src/code/padutils.c \ + src/code/PreRender.c \ + src/code/printutils.c \ + src/code/relocation.c \ + src/code/sched.c \ + src/code/shrink_window.c \ + src/code/sleep.c \ + src/code/speed_meter.c \ + src/code/system_malloc.c \ + src/code/sys_cfb.c \ + src/code/sys_math.c \ + src/code/sys_math3d.c \ + src/code/sys_math_atan.c \ + src/code/sys_matrix.c \ + src/code/sys_ucode.c \ + src/code/title_setup.c \ + src/code/TwoHeadArena.c \ + src/code/ucode_disas.c \ + src/code/z_actor.c \ + src/code/z_actor_dlftbls.c \ + src/code/z_bgcheck.c \ + src/code/z_camera.c \ + src/code/z_cheap_proc.c \ + src/code/z_collision_btltbls.c \ + src/code/z_collision_check.c \ + src/code/z_common_data.c \ + src/code/z_construct.c \ + src/code/z_debug.c \ + src/code/z_debug_display.c \ + src/code/z_demo.c \ + src/code/z_DLF.c \ + src/code/z_draw.c \ + src/code/z_effect.c \ + src/code/z_effect_soft_sprite.c \ + src/code/z_effect_soft_sprite_dlftbls.c \ + src/code/z_effect_soft_sprite_old_init.c \ + src/code/z_eff_blure.c \ + src/code/z_eff_shield_particle.c \ + src/code/z_eff_spark.c \ + src/code/z_eff_ss_dead.c \ + src/code/z_elf_message.c \ + src/code/z_en_a_keep.c \ + src/code/z_en_item00.c \ + src/code/z_face_reaction.c \ + src/code/z_fbdemo.c \ + src/code/z_fbdemo_circle.c \ + src/code/z_fbdemo_fade.c \ + src/code/z_fbdemo_triforce.c \ + src/code/z_fbdemo_wipe1.c \ + src/code/z_fcurve_data_skelanime.c \ + src/code/z_frame_advance.c \ + src/code/z_game_dlftbls.c \ + src/code/z_game_over.c \ + src/code/z_horse.c \ + src/code/z_jpeg.c \ + src/code/z_kaleido_manager.c \ + src/code/z_kaleido_scope_call.c \ + src/code/z_kaleido_setup.c \ + src/code/z_kanfont.c \ + src/code/z_kankyo.c \ + src/code/z_lib.c \ + src/code/z_lifemeter.c \ + src/code/z_lights.c \ + src/code/z_malloc.c \ + src/code/z_map_data.c \ + src/code/z_map_exp.c \ + src/code/z_map_mark.c \ + src/code/z_message_PAL.c \ + src/code/z_moji.c \ + src/code/z_msgevent.c \ + src/code/z_olib.c \ + src/code/z_onepointdemo.c \ + src/code/z_parameter.c \ + src/code/z_path.c \ + src/code/z_play.c \ + src/code/z_player_call.c \ + src/code/z_player_lib.c \ + src/code/z_prenmi.c \ + src/code/z_prenmi_buff.c \ + src/code/z_quake.c \ + src/code/z_rcp.c \ + src/code/z_room.c \ + src/code/z_sample.c \ + src/code/z_scene.c \ + src/code/z_scene_table.c \ + src/code/z_skelanime.c \ + src/code/z_skin.c \ + src/code/z_skin_awb.c \ + src/code/z_skin_matrix.c \ + src/code/z_sound_source.c \ + src/code/z_sram.c \ + src/code/z_ss_sram.c \ + src/code/z_view.c \ + src/code/z_vimode.c \ + src/code/z_vismono.c \ + src/code/z_vr_box.c \ + src/code/z_vr_box_draw.c \ + src/code/__osMalloc.c \ + src/libultra/gu/coss.c \ + src/libultra/gu/guLookAt.c \ + src/libultra/gu/guLookAtHilite.c \ + src/libultra/gu/guPerspectiveF.c \ + src/libultra/gu/guPosition.c \ + src/libultra/gu/guS2DInitBg.c \ + src/libultra/gu/ortho.c \ + src/libultra/gu/rotate.c \ + src/libultra/gu/sins.c \ + src/libultra/gu/sintable.c \ + src/libultra/libc/sprintf.c \ + src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c \ + src/overlays/actors/ovl_Arrow_Fire/z_arrow_fire.c \ + src/overlays/actors/ovl_Arrow_Ice/z_arrow_ice.c \ + src/overlays/actors/ovl_Arrow_Light/z_arrow_light.c \ + src/overlays/actors/ovl_Bg_Bdan_Objects/z_bg_bdan_objects.c \ + src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.c \ + src/overlays/actors/ovl_Bg_Bombwall/z_bg_bombwall.c \ + src/overlays/actors/ovl_Bg_Bom_Guard/z_bg_bom_guard.c \ + src/overlays/actors/ovl_Bg_Bowl_Wall/z_bg_bowl_wall.c \ + src/overlays/actors/ovl_Bg_Breakwall/z_bg_breakwall.c \ + src/overlays/actors/ovl_Bg_Ddan_Jd/z_bg_ddan_jd.c \ + src/overlays/actors/ovl_Bg_Ddan_Kd/z_bg_ddan_kd.c \ + src/overlays/actors/ovl_Bg_Dodoago/z_bg_dodoago.c \ + src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c \ + src/overlays/actors/ovl_Bg_Ganon_Otyuka/z_bg_ganon_otyuka.c \ + src/overlays/actors/ovl_Bg_Gate_Shutter/z_bg_gate_shutter.c \ + src/overlays/actors/ovl_Bg_Gjyo_Bridge/z_bg_gjyo_bridge.c \ + src/overlays/actors/ovl_Bg_Gnd_Darkmeiro/z_bg_gnd_darkmeiro.c \ + src/overlays/actors/ovl_Bg_Gnd_Firemeiro/z_bg_gnd_firemeiro.c \ + src/overlays/actors/ovl_Bg_Gnd_Iceblock/z_bg_gnd_iceblock.c \ + src/overlays/actors/ovl_Bg_Gnd_Nisekabe/z_bg_gnd_nisekabe.c \ + src/overlays/actors/ovl_Bg_Gnd_Soulmeiro/z_bg_gnd_soulmeiro.c \ + src/overlays/actors/ovl_Bg_Haka/z_bg_haka.c \ + src/overlays/actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.c \ + src/overlays/actors/ovl_Bg_Haka_Huta/z_bg_haka_huta.c \ + src/overlays/actors/ovl_Bg_Haka_MeganeBG/z_bg_haka_meganebg.c \ + src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.c \ + src/overlays/actors/ovl_Bg_Haka_Sgami/z_bg_haka_sgami.c \ + src/overlays/actors/ovl_Bg_Haka_Ship/z_bg_haka_ship.c \ + src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.c \ + src/overlays/actors/ovl_Bg_Haka_Tubo/z_bg_haka_tubo.c \ + src/overlays/actors/ovl_Bg_Haka_Water/z_bg_haka_water.c \ + src/overlays/actors/ovl_Bg_Haka_Zou/z_bg_haka_zou.c \ + src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.c \ + src/overlays/actors/ovl_Bg_Hidan_Curtain/z_bg_hidan_curtain.c \ + src/overlays/actors/ovl_Bg_Hidan_Dalm/z_bg_hidan_dalm.c \ + src/overlays/actors/ovl_Bg_Hidan_Firewall/z_bg_hidan_firewall.c \ + src/overlays/actors/ovl_Bg_Hidan_Fslift/z_bg_hidan_fslift.c \ + src/overlays/actors/ovl_Bg_Hidan_Fwbig/z_bg_hidan_fwbig.c \ + src/overlays/actors/ovl_Bg_Hidan_Hamstep/z_bg_hidan_hamstep.c \ + src/overlays/actors/ovl_Bg_Hidan_Hrock/z_bg_hidan_hrock.c \ + src/overlays/actors/ovl_Bg_Hidan_Kousi/z_bg_hidan_kousi.c \ + src/overlays/actors/ovl_Bg_Hidan_Kowarerukabe/z_bg_hidan_kowarerukabe.c \ + src/overlays/actors/ovl_Bg_Hidan_Rock/z_bg_hidan_rock.c \ + src/overlays/actors/ovl_Bg_Hidan_Rsekizou/z_bg_hidan_rsekizou.c \ + src/overlays/actors/ovl_Bg_Hidan_Sekizou/z_bg_hidan_sekizou.c \ + src/overlays/actors/ovl_Bg_Hidan_Sima/z_bg_hidan_sima.c \ + src/overlays/actors/ovl_Bg_Hidan_Syoku/z_bg_hidan_syoku.c \ + src/overlays/actors/ovl_Bg_Ice_Objects/z_bg_ice_objects.c \ + src/overlays/actors/ovl_Bg_Ice_Shelter/z_bg_ice_shelter.c \ + src/overlays/actors/ovl_Bg_Ice_Shutter/z_bg_ice_shutter.c \ + src/overlays/actors/ovl_Bg_Ice_Turara/z_bg_ice_turara.c \ + src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c \ + src/overlays/actors/ovl_Bg_Jya_1flift/z_bg_jya_1flift.c \ + src/overlays/actors/ovl_Bg_Jya_Amishutter/z_bg_jya_amishutter.c \ + src/overlays/actors/ovl_Bg_Jya_Bigmirror/z_bg_jya_bigmirror.c \ + src/overlays/actors/ovl_Bg_Jya_Block/z_bg_jya_block.c \ + src/overlays/actors/ovl_Bg_Jya_Bombchuiwa/z_bg_jya_bombchuiwa.c \ + src/overlays/actors/ovl_Bg_Jya_Bombiwa/z_bg_jya_bombiwa.c \ + src/overlays/actors/ovl_Bg_Jya_Cobra/z_bg_jya_cobra.c \ + src/overlays/actors/ovl_Bg_Jya_Goroiwa/z_bg_jya_goroiwa.c \ + src/overlays/actors/ovl_Bg_Jya_Haheniron/z_bg_jya_haheniron.c \ + src/overlays/actors/ovl_Bg_Jya_Ironobj/z_bg_jya_ironobj.c \ + src/overlays/actors/ovl_Bg_Jya_Kanaami/z_bg_jya_kanaami.c \ + src/overlays/actors/ovl_Bg_Jya_Lift/z_bg_jya_lift.c \ + src/overlays/actors/ovl_Bg_Jya_Megami/z_bg_jya_megami.c \ + src/overlays/actors/ovl_Bg_Jya_Zurerukabe/z_bg_jya_zurerukabe.c \ + src/overlays/actors/ovl_Bg_Menkuri_Eye/z_bg_menkuri_eye.c \ + src/overlays/actors/ovl_Bg_Menkuri_Kaiten/z_bg_menkuri_kaiten.c \ + src/overlays/actors/ovl_Bg_Menkuri_Nisekabe/z_bg_menkuri_nisekabe.c \ + src/overlays/actors/ovl_Bg_Mizu_Bwall/z_bg_mizu_bwall.c \ + src/overlays/actors/ovl_Bg_Mizu_Movebg/z_bg_mizu_movebg.c \ + src/overlays/actors/ovl_Bg_Mizu_Shutter/z_bg_mizu_shutter.c \ + src/overlays/actors/ovl_Bg_Mizu_Uzu/z_bg_mizu_uzu.c \ + src/overlays/actors/ovl_Bg_Mizu_Water/z_bg_mizu_water.c \ + src/overlays/actors/ovl_Bg_Mjin/z_bg_mjin.c \ + src/overlays/actors/ovl_Bg_Mori_Bigst/z_bg_mori_bigst.c \ + src/overlays/actors/ovl_Bg_Mori_Elevator/z_bg_mori_elevator.c \ + src/overlays/actors/ovl_Bg_Mori_Hashigo/z_bg_mori_hashigo.c \ + src/overlays/actors/ovl_Bg_Mori_Hashira4/z_bg_mori_hashira4.c \ + src/overlays/actors/ovl_Bg_Mori_Hineri/z_bg_mori_hineri.c \ + src/overlays/actors/ovl_Bg_Mori_Idomizu/z_bg_mori_idomizu.c \ + src/overlays/actors/ovl_Bg_Mori_Kaitenkabe/z_bg_mori_kaitenkabe.c \ + src/overlays/actors/ovl_Bg_Mori_Rakkatenjo/z_bg_mori_rakkatenjo.c \ + src/overlays/actors/ovl_Bg_Po_Event/z_bg_po_event.c \ + src/overlays/actors/ovl_Bg_Po_Syokudai/z_bg_po_syokudai.c \ + src/overlays/actors/ovl_Bg_Pushbox/z_bg_pushbox.c \ + src/overlays/actors/ovl_Bg_Relay_Objects/z_bg_relay_objects.c \ + src/overlays/actors/ovl_Bg_Spot00_Break/z_bg_spot00_break.c \ + src/overlays/actors/ovl_Bg_Spot00_Hanebasi/z_bg_spot00_hanebasi.c \ + src/overlays/actors/ovl_Bg_Spot01_Fusya/z_bg_spot01_fusya.c \ + src/overlays/actors/ovl_Bg_Spot01_Idohashira/z_bg_spot01_idohashira.c \ + src/overlays/actors/ovl_Bg_Spot01_Idomizu/z_bg_spot01_idomizu.c \ + src/overlays/actors/ovl_Bg_Spot01_Idosoko/z_bg_spot01_idosoko.c \ + src/overlays/actors/ovl_Bg_Spot01_Objects2/z_bg_spot01_objects2.c \ + src/overlays/actors/ovl_Bg_Spot02_Objects/z_bg_spot02_objects.c \ + src/overlays/actors/ovl_Bg_Spot03_Taki/z_bg_spot03_taki.c \ + src/overlays/actors/ovl_Bg_Spot05_Soko/z_bg_spot05_soko.c \ + src/overlays/actors/ovl_Bg_Spot06_Objects/z_bg_spot06_objects.c \ + src/overlays/actors/ovl_Bg_Spot07_Taki/z_bg_spot07_taki.c \ + src/overlays/actors/ovl_Bg_Spot08_Bakudankabe/z_bg_spot08_bakudankabe.c \ + src/overlays/actors/ovl_Bg_Spot08_Iceblock/z_bg_spot08_iceblock.c \ + src/overlays/actors/ovl_Bg_Spot09_Obj/z_bg_spot09_obj.c \ + src/overlays/actors/ovl_Bg_Spot11_Bakudankabe/z_bg_spot11_bakudankabe.c \ + src/overlays/actors/ovl_Bg_Spot11_Oasis/z_bg_spot11_oasis.c \ + src/overlays/actors/ovl_Bg_Spot12_Gate/z_bg_spot12_gate.c \ + src/overlays/actors/ovl_Bg_Spot12_Saku/z_bg_spot12_saku.c \ + src/overlays/actors/ovl_Bg_Spot15_Rrbox/z_bg_spot15_rrbox.c \ + src/overlays/actors/ovl_Bg_Spot15_Saku/z_bg_spot15_saku.c \ + src/overlays/actors/ovl_Bg_Spot16_Bombstone/z_bg_spot16_bombstone.c \ + src/overlays/actors/ovl_Bg_Spot16_Doughnut/z_bg_spot16_doughnut.c \ + src/overlays/actors/ovl_Bg_Spot17_Bakudankabe/z_bg_spot17_bakudankabe.c \ + src/overlays/actors/ovl_Bg_Spot17_Funen/z_bg_spot17_funen.c \ + src/overlays/actors/ovl_Bg_Spot18_Basket/z_bg_spot18_basket.c \ + src/overlays/actors/ovl_Bg_Spot18_Futa/z_bg_spot18_futa.c \ + src/overlays/actors/ovl_Bg_Spot18_Obj/z_bg_spot18_obj.c \ + src/overlays/actors/ovl_Bg_Spot18_Shutter/z_bg_spot18_shutter.c \ + src/overlays/actors/ovl_Bg_Sst_Floor/z_bg_sst_floor.c \ + src/overlays/actors/ovl_Bg_Toki_Hikari/z_bg_toki_hikari.c \ + src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.c \ + src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd_cutscene_data_1.c \ + src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd_cutscene_data_2.c \ + src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd_cutscene_data_3.c \ + src/overlays/actors/ovl_Bg_Treemouth/z_bg_treemouth.c \ + src/overlays/actors/ovl_Bg_Treemouth/z_bg_treemouth_cutscene_data.c \ + src/overlays/actors/ovl_Bg_Umajump/z_bg_umajump.c \ + src/overlays/actors/ovl_Bg_Vb_Sima/z_bg_vb_sima.c \ + src/overlays/actors/ovl_Bg_Ydan_Hasi/z_bg_ydan_hasi.c \ + src/overlays/actors/ovl_Bg_Ydan_Maruta/z_bg_ydan_maruta.c \ + src/overlays/actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.c \ + src/overlays/actors/ovl_Bg_Zg/z_bg_zg.c \ + src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c \ + src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo_data.c \ + src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.c \ + src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2_colchk.c \ + src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c \ + src/overlays/actors/ovl_Boss_Fd/z_boss_fd_colchk.c \ + src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c \ + src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2_data.c \ + src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.c \ + src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c \ + src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c \ + src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c \ + src/overlays/actors/ovl_Boss_Mo/z_boss_mo_colchk.c \ + src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c \ + src/overlays/actors/ovl_Boss_Sst/z_boss_sst_colchk.c \ + src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c \ + src/overlays/actors/ovl_Boss_Va/z_boss_va.c \ + src/overlays/actors/ovl_Demo_6K/z_demo_6k.c \ + src/overlays/actors/ovl_Demo_Du/z_demo_du.c \ + src/overlays/actors/ovl_Demo_Du/z_demo_du_cutscene_data.c \ + src/overlays/actors/ovl_Demo_Ec/z_demo_ec.c \ + src/overlays/actors/ovl_Demo_Effect/z_demo_effect.c \ + src/overlays/actors/ovl_Demo_Ext/z_demo_ext.c \ + src/overlays/actors/ovl_Demo_Geff/z_demo_geff.c \ + src/overlays/actors/ovl_Demo_Gj/z_demo_gj.c \ + src/overlays/actors/ovl_Demo_Go/z_demo_go.c \ + src/overlays/actors/ovl_Demo_Gt/z_demo_gt.c \ + src/overlays/actors/ovl_Demo_Ik/z_demo_ik.c \ + src/overlays/actors/ovl_Demo_Im/z_demo_im.c \ + src/overlays/actors/ovl_Demo_Im/z_demo_im_cutscene_data.c \ + src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c \ + src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo_cutscene_data1.c \ + src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo_cutscene_data2.c \ + src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo_cutscene_data3.c \ + src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo_cutscene_data4.c \ + src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo_cutscene_data5.c \ + src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo_cutscene_data6.c \ + src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo_cutscene_data7.c \ + src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo_cutscene_data8.c \ + src/overlays/actors/ovl_Demo_Kekkai/z_demo_kekkai.c \ + src/overlays/actors/ovl_Demo_Sa/z_demo_sa.c \ + src/overlays/actors/ovl_Demo_Sa/z_demo_sa_cutscene_data.c \ + src/overlays/actors/ovl_Demo_Shd/z_demo_shd.c \ + src/overlays/actors/ovl_Demo_Tre_Lgt/z_demo_tre_lgt.c \ + src/overlays/actors/ovl_Door_Ana/z_door_ana.c \ + src/overlays/actors/ovl_Door_Gerudo/z_door_gerudo.c \ + src/overlays/actors/ovl_Door_Killer/z_door_killer.c \ + src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c \ + src/overlays/actors/ovl_Door_Toki/z_door_toki.c \ + src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c \ + src/overlays/actors/ovl_Efc_Erupc/z_efc_erupc.c \ + src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c \ + src/overlays/actors/ovl_Elf_Msg2/z_elf_msg2.c \ + src/overlays/actors/ovl_Elf_Msg/z_elf_msg.c \ + src/overlays/actors/ovl_End_Title/z_end_title.c \ + src/overlays/actors/ovl_En_Am/z_en_am.c \ + src/overlays/actors/ovl_En_Ani/z_en_ani.c \ + src/overlays/actors/ovl_En_Anubice/z_en_anubice.c \ + src/overlays/actors/ovl_En_Anubice_Fire/z_en_anubice_fire.c \ + src/overlays/actors/ovl_En_Anubice_Tag/z_en_anubice_tag.c \ + src/overlays/actors/ovl_En_Arow_Trap/z_en_arow_trap.c \ + src/overlays/actors/ovl_En_Arrow/z_en_arrow.c \ + src/overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.c \ + src/overlays/actors/ovl_En_Ba/z_en_ba.c \ + src/overlays/actors/ovl_En_Bb/z_en_bb.c \ + src/overlays/actors/ovl_En_Bdfire/z_en_bdfire.c \ + src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c \ + src/overlays/actors/ovl_En_Bili/z_en_bili.c \ + src/overlays/actors/ovl_En_Bird/z_en_bird.c \ + src/overlays/actors/ovl_En_Blkobj/z_en_blkobj.c \ + src/overlays/actors/ovl_En_Bombf/z_en_bombf.c \ + src/overlays/actors/ovl_En_Bom/z_en_bom.c \ + src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c \ + src/overlays/actors/ovl_En_Bom_Bowl_Pit/z_en_bom_bowl_pit.c \ + src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.c \ + src/overlays/actors/ovl_En_Boom/z_en_boom.c \ + src/overlays/actors/ovl_En_Box/z_en_box.c \ + src/overlays/actors/ovl_En_Brob/z_en_brob.c \ + src/overlays/actors/ovl_En_Bubble/z_en_bubble.c \ + src/overlays/actors/ovl_En_Butte/z_en_butte.c \ + src/overlays/actors/ovl_En_Bw/z_en_bw.c \ + src/overlays/actors/ovl_En_Bx/z_en_bx.c \ + src/overlays/actors/ovl_En_Changer/z_en_changer.c \ + src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c \ + src/overlays/actors/ovl_En_Cow/z_en_cow.c \ + src/overlays/actors/ovl_En_Crow/z_en_crow.c \ + src/overlays/actors/ovl_En_Cs/z_en_cs.c \ + src/overlays/actors/ovl_En_Daiku/z_en_daiku.c \ + src/overlays/actors/ovl_En_Daiku_Kakariko/z_en_daiku_kakariko.c \ + src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c \ + src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.c \ + src/overlays/actors/ovl_En_Dha/z_en_dha.c \ + src/overlays/actors/ovl_En_Dh/z_en_dh.c \ + src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.c \ + src/overlays/actors/ovl_En_Dns/z_en_dns.c \ + src/overlays/actors/ovl_En_Dnt_Demo/z_en_dnt_demo.c \ + src/overlays/actors/ovl_En_Dnt_Jiji/z_en_dnt_jiji.c \ + src/overlays/actors/ovl_En_Dnt_Nomal/z_en_dnt_nomal.c \ + src/overlays/actors/ovl_En_Dodojr/z_en_dodojr.c \ + src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c \ + src/overlays/actors/ovl_En_Dog/z_en_dog.c \ + src/overlays/actors/ovl_En_Door/z_en_door.c \ + src/overlays/actors/ovl_En_Ds/z_en_ds.c \ + src/overlays/actors/ovl_En_Du/z_en_du.c \ + src/overlays/actors/ovl_En_Dy_Extra/z_en_dy_extra.c \ + src/overlays/actors/ovl_En_Eg/z_en_eg.c \ + src/overlays/actors/ovl_En_Eiyer/z_en_eiyer.c \ + src/overlays/actors/ovl_En_Elf/z_en_elf.c \ + src/overlays/actors/ovl_En_Encount1/z_en_encount1.c \ + src/overlays/actors/ovl_En_Encount2/z_en_encount2.c \ + src/overlays/actors/ovl_En_Ex_Item/z_en_ex_item.c \ + src/overlays/actors/ovl_En_Ex_Ruppy/z_en_ex_ruppy.c \ + src/overlays/actors/ovl_En_Fd/z_en_fd.c \ + src/overlays/actors/ovl_En_Fd_Fire/z_en_fd_fire.c \ + src/overlays/actors/ovl_En_fHG/z_en_fhg.c \ + src/overlays/actors/ovl_En_Fhg_Fire/z_en_fhg_fire.c \ + src/overlays/actors/ovl_En_Firefly/z_en_firefly.c \ + src/overlays/actors/ovl_En_Fire_Rock/z_en_fire_rock.c \ + src/overlays/actors/ovl_En_Fish/z_en_fish.c \ + src/overlays/actors/ovl_En_Floormas/z_en_floormas.c \ + src/overlays/actors/ovl_En_Fr/z_en_fr.c \ + src/overlays/actors/ovl_En_Fu/z_en_fu.c \ + src/overlays/actors/ovl_En_Fw/z_en_fw.c \ + src/overlays/actors/ovl_En_Fz/z_en_fz.c \ + src/overlays/actors/ovl_En_Ganon_Mant/z_en_ganon_mant.c \ + src/overlays/actors/ovl_En_Ganon_Organ/z_en_ganon_organ.c \ + src/overlays/actors/ovl_En_Gb/z_en_gb.c \ + src/overlays/actors/ovl_En_Ge1/z_en_ge1.c \ + src/overlays/actors/ovl_En_Ge2/z_en_ge2.c \ + src/overlays/actors/ovl_En_Ge3/z_en_ge3.c \ + src/overlays/actors/ovl_En_GeldB/z_en_geldb.c \ + src/overlays/actors/ovl_En_GirlA/z_en_girla.c \ + src/overlays/actors/ovl_En_Gm/z_en_gm.c \ + src/overlays/actors/ovl_En_Go2/z_en_go2.c \ + src/overlays/actors/ovl_En_Goma/z_en_goma.c \ + src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c \ + src/overlays/actors/ovl_En_Go/z_en_go.c \ + src/overlays/actors/ovl_En_Gs/z_en_gs.c \ + src/overlays/actors/ovl_En_Guest/z_en_guest.c \ + src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.c \ + src/overlays/actors/ovl_En_Hata/z_en_hata.c \ + src/overlays/actors/ovl_En_Heishi1/z_en_heishi1.c \ + src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c \ + src/overlays/actors/ovl_En_Heishi3/z_en_heishi3.c \ + src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.c \ + src/overlays/actors/ovl_En_Hintnuts/z_en_hintnuts.c \ + src/overlays/actors/ovl_En_Holl/z_en_holl.c \ + src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c \ + src/overlays/actors/ovl_En_Horse/z_en_horse.c \ + src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c \ + src/overlays/actors/ovl_En_Horse_Ganon/z_en_horse_ganon.c \ + src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.c \ + src/overlays/actors/ovl_En_Horse_Normal/z_en_horse_normal.c \ + src/overlays/actors/ovl_En_Horse_Zelda/z_en_horse_zelda.c \ + src/overlays/actors/ovl_En_Hs2/z_en_hs2.c \ + src/overlays/actors/ovl_En_Hs/z_en_hs.c \ + src/overlays/actors/ovl_En_Hy/z_en_hy.c \ + src/overlays/actors/ovl_En_Ice_Hono/z_en_ice_hono.c \ + src/overlays/actors/ovl_En_Ik/z_en_ik.c \ + src/overlays/actors/ovl_En_Insect/z_en_insect.c \ + src/overlays/actors/ovl_En_In/z_en_in.c \ + src/overlays/actors/ovl_En_Ishi/z_en_ishi.c \ + src/overlays/actors/ovl_En_It/z_en_it.c \ + src/overlays/actors/ovl_En_Jj/z_en_jj.c \ + src/overlays/actors/ovl_En_Jj/z_en_jj_cutscene_data.c \ + src/overlays/actors/ovl_En_Jsjutan/z_en_jsjutan.c \ + src/overlays/actors/ovl_En_Js/z_en_js.c \ + src/overlays/actors/ovl_En_Kakasi2/z_en_kakasi2.c \ + src/overlays/actors/ovl_En_Kakasi3/z_en_kakasi3.c \ + src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c \ + src/overlays/actors/ovl_En_Kanban/z_en_kanban.c \ + src/overlays/actors/ovl_En_Kanban/z_en_kanban_gfx.c \ + src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.c \ + src/overlays/actors/ovl_En_Ko/z_en_ko.c \ + src/overlays/actors/ovl_En_Kusa/z_en_kusa.c \ + src/overlays/actors/ovl_En_Kz/z_en_kz.c \ + src/overlays/actors/ovl_En_Lightbox/z_en_lightbox.c \ + src/overlays/actors/ovl_En_Light/z_en_light.c \ + src/overlays/actors/ovl_En_Ma1/z_en_ma1.c \ + src/overlays/actors/ovl_En_Ma2/z_en_ma2.c \ + src/overlays/actors/ovl_En_Ma3/z_en_ma3.c \ + src/overlays/actors/ovl_En_Mag/z_en_mag.c \ + src/overlays/actors/ovl_En_Mb/z_en_mb.c \ + src/overlays/actors/ovl_En_Md/z_en_md.c \ + src/overlays/actors/ovl_En_Mk/z_en_mk.c \ + src/overlays/actors/ovl_En_Mm2/z_en_mm2.c \ + src/overlays/actors/ovl_En_Mm/z_en_mm.c \ + src/overlays/actors/ovl_En_Ms/z_en_ms.c \ + src/overlays/actors/ovl_En_Mu/z_en_mu.c \ + src/overlays/actors/ovl_En_M_Fire1/z_en_m_fire1.c \ + src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.c \ + src/overlays/actors/ovl_En_Nb/z_en_nb.c \ + src/overlays/actors/ovl_En_Nb/z_en_nb_cutscene_data.c \ + src/overlays/actors/ovl_En_Niw/z_en_niw.c \ + src/overlays/actors/ovl_En_Niw_Girl/z_en_niw_girl.c \ + src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.c \ + src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c \ + src/overlays/actors/ovl_En_Nwc/z_en_nwc.c \ + src/overlays/actors/ovl_En_Ny/z_en_ny.c \ + src/overlays/actors/ovl_En_OE2/z_en_oe2.c \ + src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.c \ + src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.c \ + src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag_cutscene_data.c \ + src/overlays/actors/ovl_En_Okuta/z_en_okuta.c \ + src/overlays/actors/ovl_En_Ossan/z_en_ossan.c \ + src/overlays/actors/ovl_En_Owl/z_en_owl.c \ + src/overlays/actors/ovl_En_Part/z_en_part.c \ + src/overlays/actors/ovl_En_Peehat/z_en_peehat.c \ + src/overlays/actors/ovl_En_Poh/z_en_poh.c \ + src/overlays/actors/ovl_En_Po_Desert/z_en_po_desert.c \ + src/overlays/actors/ovl_En_Po_Field/z_en_po_field.c \ + src/overlays/actors/ovl_En_Po_Relay/z_en_po_relay.c \ + src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c \ + src/overlays/actors/ovl_En_Pu_box/z_en_pu_box.c \ + src/overlays/actors/ovl_En_Rd/z_en_rd.c \ + src/overlays/actors/ovl_En_Reeba/z_en_reeba.c \ + src/overlays/actors/ovl_En_River_Sound/z_en_river_sound.c \ + src/overlays/actors/ovl_En_Rl/z_en_rl.c \ + src/overlays/actors/ovl_En_Rr/z_en_rr.c \ + src/overlays/actors/ovl_En_Ru1/z_en_ru1.c \ + src/overlays/actors/ovl_En_Ru1/z_en_ru1_cutscene_data.c \ + src/overlays/actors/ovl_En_Ru2/z_en_ru2.c \ + src/overlays/actors/ovl_En_Ru2/z_en_ru2_cutscene_data.c \ + src/overlays/actors/ovl_En_Sa/z_en_sa.c \ + src/overlays/actors/ovl_En_Sb/z_en_sb.c \ + src/overlays/actors/ovl_En_Scene_Change/z_en_scene_change.c \ + src/overlays/actors/ovl_En_Sda/z_en_sda.c \ + src/overlays/actors/ovl_En_Shopnuts/z_en_shopnuts.c \ + src/overlays/actors/ovl_En_Siofuki/z_en_siofuki.c \ + src/overlays/actors/ovl_En_Si/z_en_si.c \ + src/overlays/actors/ovl_En_Skb/z_en_skb.c \ + src/overlays/actors/ovl_En_Skjneedle/z_en_skjneedle.c \ + src/overlays/actors/ovl_En_Skj/z_en_skj.c \ + src/overlays/actors/ovl_En_Ssh/z_en_ssh.c \ + src/overlays/actors/ovl_En_Sth/z_en_sth.c \ + src/overlays/actors/ovl_En_Stream/z_en_stream.c \ + src/overlays/actors/ovl_En_St/z_en_st.c \ + src/overlays/actors/ovl_En_Sw/z_en_sw.c \ + src/overlays/actors/ovl_En_Syateki_Itm/z_en_syateki_itm.c \ + src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c \ + src/overlays/actors/ovl_En_Syateki_Niw/z_en_syateki_niw.c \ + src/overlays/actors/ovl_En_Takara_Man/z_en_takara_man.c \ + src/overlays/actors/ovl_En_Tana/z_en_tana.c \ + src/overlays/actors/ovl_En_Ta/z_en_ta.c \ + src/overlays/actors/ovl_En_Test/z_en_test.c \ + src/overlays/actors/ovl_En_Tg/z_en_tg.c \ + src/overlays/actors/ovl_En_Tite/z_en_tite.c \ + src/overlays/actors/ovl_En_Tk/z_en_tk.c \ + src/overlays/actors/ovl_En_Torch2/z_en_torch2.c \ + src/overlays/actors/ovl_En_Torch/z_en_torch.c \ + src/overlays/actors/ovl_En_Toryo/z_en_toryo.c \ + src/overlays/actors/ovl_En_Tp/z_en_tp.c \ + src/overlays/actors/ovl_En_Trap/z_en_trap.c \ + src/overlays/actors/ovl_En_Tr/z_en_tr.c \ + src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c \ + src/overlays/actors/ovl_En_Vali/z_en_vali.c \ + src/overlays/actors/ovl_En_Vase/z_en_vase.c \ + src/overlays/actors/ovl_En_Vb_Ball/z_en_vb_ball.c \ + src/overlays/actors/ovl_En_Viewer/z_en_viewer.c \ + src/overlays/actors/ovl_En_Vm/z_en_vm.c \ + src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c \ + src/overlays/actors/ovl_En_Wall_Tubo/z_en_wall_tubo.c \ + src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c \ + src/overlays/actors/ovl_En_Weiyer/z_en_weiyer.c \ + src/overlays/actors/ovl_En_Wf/z_en_wf.c \ + src/overlays/actors/ovl_En_Wonder_Item/z_en_wonder_item.c \ + src/overlays/actors/ovl_En_Wonder_Talk2/z_en_wonder_talk2.c \ + src/overlays/actors/ovl_En_Wonder_Talk/z_en_wonder_talk.c \ + src/overlays/actors/ovl_En_Wood02/z_en_wood02.c \ + src/overlays/actors/ovl_En_Xc/z_en_xc.c \ + src/overlays/actors/ovl_En_Yabusame_Mark/z_en_yabusame_mark.c \ + src/overlays/actors/ovl_En_Yukabyun/z_en_yukabyun.c \ + src/overlays/actors/ovl_En_Zf/z_en_zf.c \ + src/overlays/actors/ovl_En_Zl1/z_en_zl1.c \ + src/overlays/actors/ovl_En_Zl1/z_en_zl1_camera_data.c \ + src/overlays/actors/ovl_En_Zl1/z_en_zl1_cutscene_data.c \ + src/overlays/actors/ovl_En_Zl2/z_en_zl2.c \ + src/overlays/actors/ovl_En_Zl3/z_en_zl3.c \ + src/overlays/actors/ovl_En_Zl4/z_en_zl4.c \ + src/overlays/actors/ovl_En_Zl4/z_en_zl4_cutscene_data.c \ + src/overlays/actors/ovl_En_Zo/z_en_zo.c \ + src/overlays/actors/ovl_Fishing/z_fishing.c \ + src/overlays/actors/ovl_Item_B_Heart/z_item_b_heart.c \ + src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.c \ + src/overlays/actors/ovl_Item_Inbox/z_item_inbox.c \ + src/overlays/actors/ovl_Item_Ocarina/z_item_ocarina.c \ + src/overlays/actors/ovl_Item_Shield/z_item_shield.c \ + src/overlays/actors/ovl_Magic_Dark/z_magic_dark.c \ + src/overlays/actors/ovl_Magic_Fire/z_magic_fire.c \ + src/overlays/actors/ovl_Magic_Wind/z_magic_wind.c \ + src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c \ + src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c \ + src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c \ + src/overlays/actors/ovl_Obj_Blockstop/z_obj_blockstop.c \ + src/overlays/actors/ovl_Obj_Bombiwa/z_obj_bombiwa.c \ + src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c \ + src/overlays/actors/ovl_Obj_Dekujr/z_obj_dekujr.c \ + src/overlays/actors/ovl_Obj_Elevator/z_obj_elevator.c \ + src/overlays/actors/ovl_Obj_Hamishi/z_obj_hamishi.c \ + src/overlays/actors/ovl_Obj_Hana/z_obj_hana.c \ + src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.c \ + src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c \ + src/overlays/actors/ovl_Obj_Kibako2/z_obj_kibako2.c \ + src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c \ + src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c \ + src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.c \ + src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.c \ + src/overlays/actors/ovl_Obj_Makeoshihiki/z_obj_makeoshihiki.c \ + src/overlays/actors/ovl_Obj_Mure2/z_obj_mure2.c \ + src/overlays/actors/ovl_Obj_Mure3/z_obj_mure3.c \ + src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c \ + src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c \ + src/overlays/actors/ovl_Obj_Roomtimer/z_obj_roomtimer.c \ + src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c \ + src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c \ + src/overlays/actors/ovl_Obj_Timeblock/z_obj_timeblock.c \ + src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c \ + src/overlays/actors/ovl_Obj_Warp2block/z_obj_warp2block.c \ + src/overlays/actors/ovl_Oceff_Spot/z_oceff_spot.c \ + src/overlays/actors/ovl_Oceff_Storm/z_oceff_storm.c \ + src/overlays/actors/ovl_Oceff_Wipe2/z_oceff_wipe2.c \ + src/overlays/actors/ovl_Oceff_Wipe3/z_oceff_wipe3.c \ + src/overlays/actors/ovl_Oceff_Wipe4/z_oceff_wipe4.c \ + src/overlays/actors/ovl_Oceff_Wipe/z_oceff_wipe.c \ + src/overlays/actors/ovl_player_actor/z_player.c \ + src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c \ + src/overlays/effects/ovl_Effect_Ss_Blast/z_eff_ss_blast.c \ + src/overlays/effects/ovl_Effect_Ss_Bomb2/z_eff_ss_bomb2.c \ + src/overlays/effects/ovl_Effect_Ss_Bomb/z_eff_ss_bomb.c \ + src/overlays/effects/ovl_Effect_Ss_Bubble/z_eff_ss_bubble.c \ + src/overlays/effects/ovl_Effect_Ss_Dead_Db/z_eff_ss_dead_db.c \ + src/overlays/effects/ovl_Effect_Ss_Dead_Dd/z_eff_ss_dead_dd.c \ + src/overlays/effects/ovl_Effect_Ss_Dead_Ds/z_eff_ss_dead_ds.c \ + src/overlays/effects/ovl_Effect_Ss_Dead_Sound/z_eff_ss_dead_sound.c \ + src/overlays/effects/ovl_Effect_Ss_Dt_Bubble/z_eff_ss_dt_bubble.c \ + src/overlays/effects/ovl_Effect_Ss_Dust/z_eff_ss_dust.c \ + src/overlays/effects/ovl_Effect_Ss_D_Fire/z_eff_ss_d_fire.c \ + src/overlays/effects/ovl_Effect_Ss_En_Fire/z_eff_ss_en_fire.c \ + src/overlays/effects/ovl_Effect_Ss_En_Ice/z_eff_ss_en_ice.c \ + src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.c \ + src/overlays/effects/ovl_Effect_Ss_Fcircle/z_eff_ss_fcircle.c \ + src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.c \ + src/overlays/effects/ovl_Effect_Ss_Fire_Tail/z_eff_ss_fire_tail.c \ + src/overlays/effects/ovl_Effect_Ss_G_Fire/z_eff_ss_g_fire.c \ + src/overlays/effects/ovl_Effect_Ss_G_Magma2/z_eff_ss_g_magma2.c \ + src/overlays/effects/ovl_Effect_Ss_G_Magma/z_eff_ss_g_magma.c \ + src/overlays/effects/ovl_Effect_Ss_G_Ripple/z_eff_ss_g_ripple.c \ + src/overlays/effects/ovl_Effect_Ss_G_Spk/z_eff_ss_g_spk.c \ + src/overlays/effects/ovl_Effect_Ss_G_Splash/z_eff_ss_g_splash.c \ + src/overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.c \ + src/overlays/effects/ovl_Effect_Ss_HitMark/z_eff_ss_hitmark.c \ + src/overlays/effects/ovl_Effect_Ss_Ice_Piece/z_eff_ss_ice_piece.c \ + src/overlays/effects/ovl_Effect_Ss_Ice_Smoke/z_eff_ss_ice_smoke.c \ + src/overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.c \ + src/overlays/effects/ovl_Effect_Ss_KiraKira/z_eff_ss_kirakira.c \ + src/overlays/effects/ovl_Effect_Ss_K_Fire/z_eff_ss_k_fire.c \ + src/overlays/effects/ovl_Effect_Ss_Lightning/z_eff_ss_lightning.c \ + src/overlays/effects/ovl_Effect_Ss_Sibuki2/z_eff_ss_sibuki2.c \ + src/overlays/effects/ovl_Effect_Ss_Sibuki/z_eff_ss_sibuki.c \ + src/overlays/effects/ovl_Effect_Ss_Solder_Srch_Ball/z_eff_ss_solder_srch_ball.c \ + src/overlays/effects/ovl_Effect_Ss_Stick/z_eff_ss_stick.c \ + src/overlays/effects/ovl_Effect_Ss_Stone1/z_eff_ss_stone1.c \ + src/overlays/gamestates/ovl_file_choose/z_file_choose.c \ + src/overlays/gamestates/ovl_file_choose/z_file_copy_erase.c \ + src/overlays/gamestates/ovl_file_choose/z_file_nameset_data.c \ + src/overlays/gamestates/ovl_file_choose/z_file_nameset_PAL.c \ + src/overlays/gamestates/ovl_opening/z_opening.c \ + src/overlays/gamestates/ovl_select/z_select.c \ + src/overlays/gamestates/ovl_title/z_title.c \ + src/overlays/misc/ovl_kaleido_scope/z_kaleido_collect.c \ + src/overlays/misc/ovl_kaleido_scope/z_kaleido_debug.c \ + src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c \ + src/overlays/misc/ovl_kaleido_scope/z_kaleido_item.c \ + src/overlays/misc/ovl_kaleido_scope/z_kaleido_map_PAL.c \ + src/overlays/misc/ovl_kaleido_scope/z_kaleido_prompt.c \ + src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c \ + src/overlays/misc/ovl_kaleido_scope/z_lmap_mark.c \ + src/overlays/misc/ovl_kaleido_scope/z_lmap_mark_data.c \ + src/overlays/misc/ovl_map_mark_data/z_map_mark_data.c + +SOURCEFILES_CPP := \ + soh/Enhancements/debugconsole.cpp \ + soh/Enhancements/debugger/debugger.cpp \ + soh/Enhancements/debugger/colViewer.cpp \ + soh/Enhancements/debugger/debugSaveEditor.cpp \ + soh/Enhancements/debugger/ImGuiHelpers.cpp \ + soh/GbiWrap.cpp \ + soh/OTRGlobals.cpp \ + soh/z_message_OTR.cpp \ + soh/z_play_otr.cpp \ + soh/z_scene_otr.cpp \ + soh/savestates.cpp \ + soh/frame_interpolation.cpp \ + soh/util.cpp + +#--------------------------------------------------------------------------------- +# app info +#--------------------------------------------------------------------------------- + +APP_TITLE := Ship of Harkinian +APP_AUTHOR := Harbour Masters +APP_VERSION := Roy-Alfa + +#--------------------------------------------------------------------------------- +# options for code generation +#--------------------------------------------------------------------------------- +ARCH := -march=armv8-a+crc+crypto -mtune=cortex-a57 -mtp=soft -fPIE + +CFLAGS := -O2 -ffunction-sections \ + $(ARCH) $(DEFINES) + +CFLAGS += $(INCLUDE) -D__SWITCH__ \ + -DSPDLOG_NO_THREAD_ID -DSPDLOG_NO_TLS \ + -DSTBI_NO_THREAD_LOCALS \ + `sdl2-config --cflags` + +CXXFLAGS := $(CFLAGS) -std=gnu++20 -fpermissive +CFLAGS += -std=gnu11 + +# disable some warnings +CFLAGS += -Wno-incompatible-pointer-types -Wno-int-conversion \ + -Wno-builtin-declaration-mismatch -Wno-implicit-function-declaration \ + -Wno-stringop-overflow -Wno-discarded-qualifiers -Wno-switch-unreachable + +ASFLAGS := -g $(ARCH) +LDFLAGS = -specs=$(DEVKITPRO)/libnx/switch.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map) + +LIBS := -lultraship -lZAPDUtils -lstorm -lz -lbz2 -lnx -lglad -lglapi -ldrm_nouveau -lm `sdl2-config --libs` + +#--------------------------------------------------------------------------------- +# list of directories containing libraries, this must be the top level containing +# include and lib +#--------------------------------------------------------------------------------- +LIBDIRS := $(PORTLIBS) $(LIBNX) $(SOH_TOP_DIR)/libultraship $(SOH_TOP_DIR)/ZAPDTR/ZAPDUtils + +#--------------------------------------------------------------------------------- +# no real need to edit anything past this point unless you need to add additional +# rules for different file extensions +#--------------------------------------------------------------------------------- +ifneq ($(BUILD),$(notdir $(CURDIR))) +#--------------------------------------------------------------------------------- + +export OUTPUT := $(CURDIR)/$(TARGET) +export TOPDIR := $(CURDIR) + +export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \ + $(foreach dir,$(DATA),$(CURDIR)/$(dir)) \ + $(foreach sf,$(SOURCEFILES_C),$(CURDIR)/$(dir $(sf))) \ + $(foreach sf,$(SOURCEFILES_CPP),$(CURDIR)/$(dir $(sf))) + +export DEPSDIR := $(CURDIR)/$(BUILD) + +CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c))) \ + $(foreach f,$(SOURCEFILES_C),$(notdir $(f))) +CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp))) \ + $(foreach f,$(SOURCEFILES_CPP),$(notdir $(f))) +SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s))) +BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*))) + +#--------------------------------------------------------------------------------- +# use CXX for linking C++ projects, CC for standard C +#--------------------------------------------------------------------------------- +ifeq ($(strip $(CPPFILES)),) +#--------------------------------------------------------------------------------- + export LD := $(CC) +#--------------------------------------------------------------------------------- +else +#--------------------------------------------------------------------------------- + export LD := $(CXX) +#--------------------------------------------------------------------------------- +endif +#--------------------------------------------------------------------------------- + +export OFILES_BIN := $(addsuffix .o,$(BINFILES)) +export OFILES_SRC := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o) +export OFILES := $(OFILES_BIN) $(OFILES_SRC) +export HFILES_BIN := $(addsuffix .h,$(subst .,_,$(BINFILES))) + +export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \ + $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ + -I$(CURDIR)/$(BUILD) + +export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) + +ifeq ($(strip $(CONFIG_JSON)),) + jsons := $(wildcard *.json) + ifneq (,$(findstring $(TARGET).json,$(jsons))) + export APP_JSON := $(TOPDIR)/$(TARGET).json + else + ifneq (,$(findstring config.json,$(jsons))) + export APP_JSON := $(TOPDIR)/config.json + endif + endif +else + export APP_JSON := $(TOPDIR)/$(CONFIG_JSON) +endif + +ifeq ($(strip $(ICON)),) + icons := $(wildcard *.jpg) + ifneq (,$(findstring $(TARGET).jpg,$(icons))) + export APP_ICON := $(TOPDIR)/$(TARGET).jpg + else + ifneq (,$(findstring icon.jpg,$(icons))) + export APP_ICON := $(TOPDIR)/icon.jpg + endif + endif +else + export APP_ICON := $(TOPDIR)/$(ICON) +endif + +ifeq ($(strip $(NO_ICON)),) + export NROFLAGS += --icon=$(APP_ICON) +endif + +ifeq ($(strip $(NO_NACP)),) + export NROFLAGS += --nacp=$(CURDIR)/$(TARGET).nacp +endif + +ifneq ($(APP_TITLEID),) + export NACPFLAGS += --titleid=$(APP_TITLEID) +endif + +ifneq ($(ROMFS),) + export NROFLAGS += --romfsdir=$(CURDIR)/$(ROMFS) +endif + +.PHONY: $(BUILD) clean all + +#--------------------------------------------------------------------------------- +all: $(BUILD) + +$(BUILD): + @[ -d $@ ] || mkdir -p $@ + @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile.switch + +#--------------------------------------------------------------------------------- +clean: + @echo clean ... +ifeq ($(strip $(APP_JSON)),) + @rm -fr $(BUILD) $(TARGET).nro $(TARGET).nacp $(TARGET).elf +else + @rm -fr $(BUILD) $(TARGET).nsp $(TARGET).nso $(TARGET).npdm $(TARGET).elf +endif + + +#--------------------------------------------------------------------------------- +else +.PHONY: all + +DEPENDS := $(OFILES:.o=.d) + +#--------------------------------------------------------------------------------- +# main targets +#--------------------------------------------------------------------------------- +ifeq ($(strip $(APP_JSON)),) + +all : $(OUTPUT).nro + +ifeq ($(strip $(NO_NACP)),) +$(OUTPUT).nro : $(OUTPUT).elf $(OUTPUT).nacp +else +$(OUTPUT).nro : $(OUTPUT).elf +endif + +else + +all : $(OUTPUT).nsp + +$(OUTPUT).nsp : $(OUTPUT).nso $(OUTPUT).npdm + +$(OUTPUT).nso : $(OUTPUT).elf + +endif + +$(OUTPUT).elf : $(OFILES) \ + $(SOH_TOP_DIR)/libultraship/lib/libultraship.a \ + $(SOH_TOP_DIR)/ZAPDTR/ZAPDUtils/lib/libZAPDUtils.a + +$(OFILES_SRC) : $(HFILES_BIN) + +#--------------------------------------------------------------------------------- +# you need a rule like this for each extension you use as binary data +#--------------------------------------------------------------------------------- +%.bin.o %_bin.h : %.bin +#--------------------------------------------------------------------------------- + @echo $(notdir $<) + @$(bin2o) + +-include $(DEPENDS) + +#--------------------------------------------------------------------------------------- +endif +#--------------------------------------------------------------------------------------- \ No newline at end of file diff --git a/soh/icon.jpg b/soh/icon.jpg new file mode 100644 index 000000000..54f76c81a Binary files /dev/null and b/soh/icon.jpg differ diff --git a/soh/include/functions.h b/soh/include/functions.h index 92831b138..c0d210497 100644 --- a/soh/include/functions.h +++ b/soh/include/functions.h @@ -60,7 +60,9 @@ void Locale_ResetRegion(void); u32 func_80001F48(void); u32 func_80001F8C(void); u32 Locale_IsRegionNative(void); +#ifndef __SWITCH__ void __assert(const char* exp, const char* file, s32 line); +#endif void isPrintfInit(void); void osSyncPrintfUnused(const char* fmt, ...); //void osSyncPrintf(const char* fmt, ...); diff --git a/soh/soh/OTRGlobals.cpp b/soh/soh/OTRGlobals.cpp index ebc4b3621..41b9d0a2b 100644 --- a/soh/soh/OTRGlobals.cpp +++ b/soh/soh/OTRGlobals.cpp @@ -34,6 +34,7 @@ #include "variables.h" #include "macros.h" #include +#include "SwitchImpl.h" #include @@ -60,6 +61,7 @@ extern "C" int AudioPlayer_GetDesiredBuffered(void); // C->C++ Bridge extern "C" void InitOTR() { + Ship::Switch::Init(); OTRGlobals::Instance = new OTRGlobals(); auto t = OTRGlobals::Instance->context->GetResourceManager()->LoadFile("version"); diff --git a/soh/src/boot/assert.c b/soh/src/boot/assert.c index b7895dddd..5a44a9308 100644 --- a/soh/src/boot/assert.c +++ b/soh/src/boot/assert.c @@ -1,5 +1,6 @@ #include "global.h" +#ifndef __SWITCH__ void __assert(const char* exp, const char* file, s32 line) { char msg[256]; @@ -7,3 +8,4 @@ void __assert(const char* exp, const char* file, s32 line) { sprintf(msg, "ASSERT: %s:%d(%d)", file, line, osGetThreadId(NULL)); Fault_AddHungupAndCrashImpl(msg, exp); } +#endif \ No newline at end of file diff --git a/soh/src/code/audio_load.c b/soh/src/code/audio_load.c index fee03e9ae..74b1a4bff 100644 --- a/soh/src/code/audio_load.c +++ b/soh/src/code/audio_load.c @@ -50,9 +50,9 @@ s32 AudioLoad_Dma(OSIoMesg* mesg, u32 priority, s32 direction, uintptr_t devAddr OSMesgQueue* reqQueue, s32 medium, const char* dmaFuncType); void* AudioLoad_AsyncLoadInner(s32 tableType, s32 id, s32 nChunks, s32 retData, OSMesgQueue* retQueue); AudioAsyncLoad* AudioLoad_StartAsyncLoadUnkMedium(s32 unkMediumParam, uintptr_t devAddr, uintptr_t ramAddr, - ptrdiff_t size, s32 medium, + size_t size, s32 medium, s32 nChunks, OSMesgQueue* retQueue, s32 retMsg); -AudioAsyncLoad* AudioLoad_StartAsyncLoad(u32 devAddr, uintptr_t ramAddr, size_t size, s32 medium, s32 nChunks, +AudioAsyncLoad* AudioLoad_StartAsyncLoad(uintptr_t devAddr, uintptr_t ramAddr, size_t size, s32 medium, s32 nChunks, OSMesgQueue* retQueue, s32 retMsg); void AudioLoad_AsyncDma(AudioAsyncLoad* asyncLoad, size_t size); void AudioLoad_AsyncDmaUnkMedium(uintptr_t devAddr, uintptr_t ramAddr, size_t size, s16 arg3); @@ -1499,8 +1499,8 @@ void AudioLoad_InitAsyncLoads(void) { } } -AudioAsyncLoad* AudioLoad_StartAsyncLoadUnkMedium(s32 unkMediumParam, u32 devAddr, uintptr_t ramAddr, size_t size, - s32 medium, +AudioAsyncLoad* AudioLoad_StartAsyncLoadUnkMedium(s32 unkMediumParam, uintptr_t devAddr, uintptr_t ramAddr, + size_t size, s32 medium, s32 nChunks, OSMesgQueue* retQueue, s32 retMsg) { AudioAsyncLoad* asyncLoad; diff --git a/soh/src/code/fault_drawer.c b/soh/src/code/fault_drawer.c index 9759bfe72..d01887b59 100644 --- a/soh/src/code/fault_drawer.c +++ b/soh/src/code/fault_drawer.c @@ -266,15 +266,17 @@ void* FaultDrawer_FormatStringFunc(void* arg, const char* str, u32 count) { } void FaultDrawer_VPrintf(const char* str, char* args) { // va_list +#ifndef __SWITCH__ _Printf(FaultDrawer_FormatStringFunc, (char*)&sFaultDrawerStruct, str, args); +#endif } void FaultDrawer_Printf(const char* fmt, ...) { va_list args; va_start(args, fmt); - +#ifndef __SWITCH__ FaultDrawer_VPrintf(fmt, args); - +#endif va_end(args); } @@ -283,8 +285,9 @@ void FaultDrawer_DrawText(s32 x, s32 y, const char* fmt, ...) { va_start(args, fmt); FaultDrawer_SetCursor(x, y); +#ifndef __SWITCH__ FaultDrawer_VPrintf(fmt, args); - +#endif va_end(args); }