From d7fc121faff64159bee060015c97938a0f94cbf0 Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Fri, 26 Apr 2019 13:56:06 +0200 Subject: [PATCH] Start porting the engine to the Nintendo Switch. --- .gitmodules | 3 ++ build/msbuild/lol.config.props | 6 ++++ build/msbuild/lol.rules.props | 53 ++++++++++++++++++-------------- doc/tutorial/05_easymesh.vcxproj | 3 +- doc/tutorial/14_lua.vcxproj | 3 +- src/3rdparty/lol-bullet.vcxproj | 4 +-- src/3rdparty/lol-lua.vcxproj | 5 +-- src/lol-core.vcxproj | 3 ++ src/lol/engine.h | 5 +++ src/private/nx | 1 + src/ui/sdl-input.h | 2 ++ 11 files changed, 57 insertions(+), 31 deletions(-) create mode 160000 src/private/nx diff --git a/.gitmodules b/.gitmodules index 5110fa82..e9ca09b5 100644 --- a/.gitmodules +++ b/.gitmodules @@ -22,3 +22,6 @@ path = src/3rdparty/mingw-std-threads url = ../../lolengine/ext-mingw-std-threads.git branch = master +[submodule "src/private/nx"] + path = src/private/nx + url = ../../samhocevar/lol-nx.git diff --git a/build/msbuild/lol.config.props b/build/msbuild/lol.config.props index 639c9b6e..3730ba7b 100644 --- a/build/msbuild/lol.config.props +++ b/build/msbuild/lol.config.props @@ -47,6 +47,12 @@ v141 + + + diff --git a/build/msbuild/lol.rules.props b/build/msbuild/lol.rules.props index cbdce120..6c4297d1 100644 --- a/build/msbuild/lol.rules.props +++ b/build/msbuild/lol.rules.props @@ -4,6 +4,13 @@ true false + + + + Level3 @@ -37,20 +44,18 @@ %(AdditionalIncludeDirectories) - + NOMINMAX; _CRT_SECURE_NO_WARNINGS; B3_USE_CLEW; LUA_ANSI; - %(PreprocessorDefinitions) - + - - LOL_CONFIG_PROJECTDIR="$(ProjectDir.Replace('\','\\'))";%(PreprocessorDefinitions) - LOL_CONFIG_SOLUTIONDIR="$(SolutionDir.Replace('\','\\'))";%(PreprocessorDefinitions) - LOL_CONFIG_PROJECTDIR="$(ProjectDir.Replace('\','/'))";%(PreprocessorDefinitions) - LOL_CONFIG_SOLUTIONDIR="$(SolutionDir.Replace('\','/'))";%(PreprocessorDefinitions) + $(AdditionalPreprocessorDefinitions.Replace('\n',''));%(PreprocessorDefinitions) + + + LOL_CONFIG_PROJECTDIR="$(ProjectDir.Trim('\').Replace('\','/'))";%(PreprocessorDefinitions) + LOL_CONFIG_SOLUTIONDIR="$(SolutionDir.Trim('\').Replace('\','/'))";%(PreprocessorDefinitions) WIN32;$(Win32Defines);%(PreprocessorDefinitions) WIN32;$(Win32Defines);%(PreprocessorDefinitions) @@ -76,24 +81,22 @@ NDEBUG;LOL_RELEASE;%(PreprocessorDefinitions) - - - kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;$(SdlDeps);$(FfmpegDeps);$(AssimpDeps);$(LibGccDeps);$(GdiDeps);$(XinputDeps);$(GlDeps);%(AdditionalDependencies) - %(AdditionalDependencies) - $(LibGccLibs);%(AdditionalLibraryDirectories) - $(SdlLibs);%(AdditionalLibraryDirectories) - $(FfmpegLibs);%(AdditionalLibraryDirectories) - $(AssimpLibs);%(AdditionalLibraryDirectories) - $(GlLibs);%(AdditionalLibraryDirectories) - $(XinputLibs);%(AdditionalLibraryDirectories) - %(AdditionalLibraryDirectories) - $(OrbisLibs);%(AdditionalLibraryDirectories) - $(OrbisDeps);%(AdditionalDependencies) - + + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;$(SdlDeps);$(FfmpegDeps);$(AssimpDeps);$(LibGccDeps);$(GdiDeps);$(XinputDeps);$(GlDeps);%(AdditionalDependencies) + $(LibGccLibs);%(AdditionalLibraryDirectories) + $(SdlLibs);%(AdditionalLibraryDirectories) + $(FfmpegLibs);%(AdditionalLibraryDirectories) + $(AssimpLibs);%(AdditionalLibraryDirectories) + $(GlLibs);%(AdditionalLibraryDirectories) + $(XinputLibs);%(AdditionalLibraryDirectories) Windows Console + + $(OrbisLibs);%(AdditionalLibraryDirectories) + $(OrbisDeps);%(AdditionalDependencies) + true @@ -102,6 +105,10 @@ true true + + %(AdditionalDependencies) + %(AdditionalLibraryDirectories) + diff --git a/doc/tutorial/05_easymesh.vcxproj b/doc/tutorial/05_easymesh.vcxproj index da5006b4..4f505161 100644 --- a/doc/tutorial/05_easymesh.vcxproj +++ b/doc/tutorial/05_easymesh.vcxproj @@ -54,8 +54,7 @@ - true - true + true diff --git a/doc/tutorial/14_lua.vcxproj b/doc/tutorial/14_lua.vcxproj index a7d72e69..5882f3af 100644 --- a/doc/tutorial/14_lua.vcxproj +++ b/doc/tutorial/14_lua.vcxproj @@ -54,8 +54,7 @@ - true - true + true diff --git a/src/3rdparty/lol-bullet.vcxproj b/src/3rdparty/lol-bullet.vcxproj index 01fc99ec..a2ffaea9 100644 --- a/src/3rdparty/lol-bullet.vcxproj +++ b/src/3rdparty/lol-bullet.vcxproj @@ -163,7 +163,7 @@ - + @@ -721,7 +721,7 @@ - + diff --git a/src/3rdparty/lol-lua.vcxproj b/src/3rdparty/lol-lua.vcxproj index 6c4a1a86..3a38943e 100644 --- a/src/3rdparty/lol-lua.vcxproj +++ b/src/3rdparty/lol-lua.vcxproj @@ -63,6 +63,8 @@ LUA_ANSI;%(PreprocessorDefinitions) + + @@ -130,8 +132,7 @@ - true - true + true diff --git a/src/lol-core.vcxproj b/src/lol-core.vcxproj index d8eb4bdb..dd97cb36 100644 --- a/src/lol-core.vcxproj +++ b/src/lol-core.vcxproj @@ -183,6 +183,9 @@ + + true + diff --git a/src/lol/engine.h b/src/lol/engine.h index da5a071e..14b6f14c 100644 --- a/src/lol/engine.h +++ b/src/lol/engine.h @@ -22,6 +22,11 @@ # define main lol_android_main #endif +// If using NX, do that, too +#if NN_NINTENDO_SDK +# define main lol_nx_main +#endif + /* If using SDL on Windows or OS X, let it override main() */ #if LOL_USE_SDL && (_WIN32 || __APPLE__) # include diff --git a/src/private/nx b/src/private/nx new file mode 160000 index 00000000..65949704 --- /dev/null +++ b/src/private/nx @@ -0,0 +1 @@ +Subproject commit 659497041784fef0adff7b0ce7ab22b9379e5f66 diff --git a/src/ui/sdl-input.h b/src/ui/sdl-input.h index fe446162..0d366765 100644 --- a/src/ui/sdl-input.h +++ b/src/ui/sdl-input.h @@ -48,7 +48,9 @@ protected: private: void tick(float seconds); +#if LOL_USE_SDL array> m_joysticks; +#endif vec2 m_app; vec2 m_screen;