From e0ae7b1ec18104f301c75b0fda092c340510a204 Mon Sep 17 00:00:00 2001 From: gsds <51339266+Patoke@users.noreply.github.com> Date: Tue, 21 Apr 2026 02:07:59 -0400 Subject: [PATCH] feat: better cmake support (#21) * feat: CMakeSettings.json * chore: remove visual studio stuff chore: move .clang-format to main directory * feat: new file structure, easier to implement as a submodule within existing projects * chore: we actually include some code now... * chore: remove prebuilt libraries (oops) * feat: new shader building script using cmake * chore: add debug postfix specifier * fix: forgot that windows builds use 4J_Render_PC for the render library * fix: didn't add the output directory (where shaders are saved to) to the include directories of 4J_Render --- .../Dev/.clang-format => .clang-format | 0 .gitignore | 9 +- CMakeLists.txt | 20 +- CMakeSettings.json | 27 + README.md | 17 +- Windows_Libs/Dev/Dev.slnx | 10 - Windows_Libs/Dev/Input/CMakeLists.txt | 26 - Windows_Libs/Dev/Input/Input.vcxproj | 184 ----- Windows_Libs/Dev/Input/Input.vcxproj.filters | 59 -- Windows_Libs/Dev/Profile/CMakeLists.txt | 26 - Windows_Libs/Dev/Profile/Profile.vcxproj | 185 ----- .../Dev/Profile/Profile.vcxproj.filters | 62 -- Windows_Libs/Dev/Render/CMakeLists.txt | 53 -- Windows_Libs/Dev/Render/Render.vcxproj | 377 ----------- .../Dev/Render/Render.vcxproj.filters | 211 ------ Windows_Libs/Dev/Storage/Storage.vcxproj | 180 ----- .../Dev/Storage/Storage.vcxproj.filters | 50 -- .../Dev => impls/Windows_Libs}/CMakeLists.txt | 2 - impls/Windows_Libs/Input/CMakeLists.txt | 31 + .../Input/inc}/INP_ForceFeedback.h | 0 .../Windows_Libs/Input/inc}/INP_Keyboard.h | 0 .../Windows_Libs/Input/inc}/INP_Main.h | 0 .../Windows_Libs/Input/inc}/INP_StringCheck.h | 0 .../Windows_Libs/Input/inc}/LinkedList.h | 0 .../Windows_Libs/Input/inc}/stdafx.h | 0 .../Windows_Libs/Input/src}/4J_Input.cpp | 0 .../Input/src}/INP_ForceFeedback.cpp | 0 .../Windows_Libs/Input/src}/INP_Keyboard.cpp | 0 .../Windows_Libs/Input/src}/INP_Main.cpp | 0 .../Input/src}/INP_StringCheck.cpp | 0 .../Windows_Libs/Input/src}/LinkedList.cpp | 0 .../Windows_Libs/Input/src}/stdafx.cpp | 0 impls/Windows_Libs/Profile/CMakeLists.txt | 31 + .../Profile/inc}/PRO_AwardManager.h | 0 .../Windows_Libs/Profile/inc}/PRO_Data.h | 0 .../Windows_Libs/Profile/inc}/PRO_Main.h | 0 .../Profile/inc}/PRO_RichPresence.h | 0 .../Windows_Libs/Profile/inc}/PRO_Sys.h | 0 .../Windows_Libs/Profile/inc}/stdafx.h | 0 .../Windows_Libs/Profile/src}/4J_Profile.cpp | 0 .../Profile/src}/PRO_AwardManager.cpp | 0 .../Windows_Libs/Profile/src}/PRO_Data.cpp | 0 .../Windows_Libs/Profile/src}/PRO_Main.cpp | 0 .../Profile/src}/PRO_RichPresence.cpp | 0 .../Windows_Libs/Profile/src}/PRO_Sys.cpp | 0 .../Windows_Libs/Profile/src}/stdafx.cpp | 0 impls/Windows_Libs/Render/CMakeLists.txt | 64 ++ .../Render/inc}/CompiledShaders.h | 0 .../Windows_Libs/Render/inc}/Profiler.h | 0 .../Windows_Libs/Render/inc}/Renderer.h | 0 .../Windows_Libs/Render/inc}/stdafx.h | 0 .../Windows_Libs}/Render/shaders/build.bat | 1 + impls/Windows_Libs/Render/shaders/build.cmake | 52 ++ .../Windows_Libs}/Render/shaders/main_PS.hlsl | 0 .../Windows_Libs}/Render/shaders/main_VS.hlsl | 0 .../Render/shaders/screen_PS.hlsl | 0 .../Render/shaders/screen_VS.hlsl | 0 .../Windows_Libs/Render/src}/4J_Render.cpp | 0 .../Render/src}/RendererCBuff.cpp | 0 .../Windows_Libs/Render/src}/RendererCore.cpp | 0 .../Render/src}/RendererMatrix.cpp | 0 .../Render/src}/RendererState.cpp | 0 .../Render/src}/RendererTexture.cpp | 0 .../Render/src}/RendererVertex.cpp | 0 .../Windows_Libs/Render/src}/stdafx.cpp | 0 .../Windows_Libs/Render/vendor}/libpng/png.c | 0 .../Windows_Libs/Render/vendor}/libpng/png.h | 0 .../Render/vendor}/libpng/pngconf.h | 0 .../Render/vendor}/libpng/pngdebug.h | 0 .../Render/vendor}/libpng/pngerror.c | 0 .../Render/vendor}/libpng/pngget.c | 0 .../Render/vendor}/libpng/pnginfo.h | 0 .../Render/vendor}/libpng/pnglibconf.h | 0 .../Render/vendor}/libpng/pngmem.c | 0 .../Render/vendor}/libpng/pngpread.c | 0 .../Render/vendor}/libpng/pngpriv.h | 0 .../Render/vendor}/libpng/pngread.c | 0 .../Render/vendor}/libpng/pngrio.c | 0 .../Render/vendor}/libpng/pngrtran.c | 0 .../Render/vendor}/libpng/pngrutil.c | 0 .../Render/vendor}/libpng/pngset.c | 0 .../Render/vendor}/libpng/pngstruct.h | 0 .../Render/vendor}/libpng/pngtest.c | 0 .../Render/vendor}/libpng/pngtrans.c | 0 .../Render/vendor}/libpng/pngwio.c | 0 .../Render/vendor}/libpng/pngwrite.c | 0 .../Render/vendor}/libpng/pngwtran.c | 0 .../Render/vendor}/libpng/pngwutil.c | 0 .../microprofile/microprofile.config.h | 0 .../vendor}/microprofile/microprofile.cpp | 0 .../vendor}/microprofile/microprofile.h | 0 .../vendor}/microprofile/microprofile_html.h | 0 .../vendor}/microprofile/microprofile_icons.h | 0 .../vendor}/microprofile/stb/stb_sprintf.h | 0 .../Windows_Libs/Render/vendor}/zlib/zconf.h | 0 .../Windows_Libs/Render/vendor}/zlib/zlib.h | 0 .../Windows_Libs}/Storage/CMakeLists.txt | 19 +- .../Windows_Libs/Storage/inc}/STO_DLC.h | 0 .../Windows_Libs/Storage/inc}/STO_Main.h | 0 .../Windows_Libs/Storage/inc}/STO_SaveGame.h | 0 .../Windows_Libs/Storage/inc}/stdafx.h | 0 .../Windows_Libs/Storage/src}/4J_Storage.cpp | 0 .../Windows_Libs/Storage/src}/STO_DLC.cpp | 0 .../Windows_Libs/Storage/src}/STO_Main.cpp | 0 .../Storage/src}/STO_SaveGame.cpp | 0 .../Windows_Libs/Storage/src}/stdafx.cpp | 0 inc/4J_Input.h | 137 ++++ inc/4J_Profile.h | 128 ++++ inc/4J_Render.h | 316 +++++++++ inc/4J_Storage.h | 344 ++++++++++ inc/extraX64.h | 639 ++++++++++++++++++ 111 files changed, 1802 insertions(+), 1458 deletions(-) rename Windows_Libs/Dev/.clang-format => .clang-format (100%) create mode 100644 CMakeSettings.json delete mode 100644 Windows_Libs/Dev/Dev.slnx delete mode 100644 Windows_Libs/Dev/Input/CMakeLists.txt delete mode 100644 Windows_Libs/Dev/Input/Input.vcxproj delete mode 100644 Windows_Libs/Dev/Input/Input.vcxproj.filters delete mode 100644 Windows_Libs/Dev/Profile/CMakeLists.txt delete mode 100644 Windows_Libs/Dev/Profile/Profile.vcxproj delete mode 100644 Windows_Libs/Dev/Profile/Profile.vcxproj.filters delete mode 100644 Windows_Libs/Dev/Render/CMakeLists.txt delete mode 100644 Windows_Libs/Dev/Render/Render.vcxproj delete mode 100644 Windows_Libs/Dev/Render/Render.vcxproj.filters delete mode 100644 Windows_Libs/Dev/Storage/Storage.vcxproj delete mode 100644 Windows_Libs/Dev/Storage/Storage.vcxproj.filters rename {Windows_Libs/Dev => impls/Windows_Libs}/CMakeLists.txt (72%) create mode 100644 impls/Windows_Libs/Input/CMakeLists.txt rename {Windows_Libs/Dev/Input => impls/Windows_Libs/Input/inc}/INP_ForceFeedback.h (100%) rename {Windows_Libs/Dev/Input => impls/Windows_Libs/Input/inc}/INP_Keyboard.h (100%) rename {Windows_Libs/Dev/Input => impls/Windows_Libs/Input/inc}/INP_Main.h (100%) rename {Windows_Libs/Dev/Input => impls/Windows_Libs/Input/inc}/INP_StringCheck.h (100%) rename {Windows_Libs/Dev/Input => impls/Windows_Libs/Input/inc}/LinkedList.h (100%) rename {Windows_Libs/Dev/Input => impls/Windows_Libs/Input/inc}/stdafx.h (100%) rename {Windows_Libs/Dev/Input => impls/Windows_Libs/Input/src}/4J_Input.cpp (100%) rename {Windows_Libs/Dev/Input => impls/Windows_Libs/Input/src}/INP_ForceFeedback.cpp (100%) rename {Windows_Libs/Dev/Input => impls/Windows_Libs/Input/src}/INP_Keyboard.cpp (100%) rename {Windows_Libs/Dev/Input => impls/Windows_Libs/Input/src}/INP_Main.cpp (100%) rename {Windows_Libs/Dev/Input => impls/Windows_Libs/Input/src}/INP_StringCheck.cpp (100%) rename {Windows_Libs/Dev/Input => impls/Windows_Libs/Input/src}/LinkedList.cpp (100%) rename {Windows_Libs/Dev/Input => impls/Windows_Libs/Input/src}/stdafx.cpp (100%) create mode 100644 impls/Windows_Libs/Profile/CMakeLists.txt rename {Windows_Libs/Dev/Profile => impls/Windows_Libs/Profile/inc}/PRO_AwardManager.h (100%) rename {Windows_Libs/Dev/Profile => impls/Windows_Libs/Profile/inc}/PRO_Data.h (100%) rename {Windows_Libs/Dev/Profile => impls/Windows_Libs/Profile/inc}/PRO_Main.h (100%) rename {Windows_Libs/Dev/Profile => impls/Windows_Libs/Profile/inc}/PRO_RichPresence.h (100%) rename {Windows_Libs/Dev/Profile => impls/Windows_Libs/Profile/inc}/PRO_Sys.h (100%) rename {Windows_Libs/Dev/Profile => impls/Windows_Libs/Profile/inc}/stdafx.h (100%) rename {Windows_Libs/Dev/Profile => impls/Windows_Libs/Profile/src}/4J_Profile.cpp (100%) rename {Windows_Libs/Dev/Profile => impls/Windows_Libs/Profile/src}/PRO_AwardManager.cpp (100%) rename {Windows_Libs/Dev/Profile => impls/Windows_Libs/Profile/src}/PRO_Data.cpp (100%) rename {Windows_Libs/Dev/Profile => impls/Windows_Libs/Profile/src}/PRO_Main.cpp (100%) rename {Windows_Libs/Dev/Profile => impls/Windows_Libs/Profile/src}/PRO_RichPresence.cpp (100%) rename {Windows_Libs/Dev/Profile => impls/Windows_Libs/Profile/src}/PRO_Sys.cpp (100%) rename {Windows_Libs/Dev/Profile => impls/Windows_Libs/Profile/src}/stdafx.cpp (100%) create mode 100644 impls/Windows_Libs/Render/CMakeLists.txt rename {Windows_Libs/Dev/Render => impls/Windows_Libs/Render/inc}/CompiledShaders.h (100%) rename {Windows_Libs/Dev/Render => impls/Windows_Libs/Render/inc}/Profiler.h (100%) rename {Windows_Libs/Dev/Render => impls/Windows_Libs/Render/inc}/Renderer.h (100%) rename {Windows_Libs/Dev/Render => impls/Windows_Libs/Render/inc}/stdafx.h (100%) rename {Windows_Libs/Dev => impls/Windows_Libs}/Render/shaders/build.bat (96%) create mode 100644 impls/Windows_Libs/Render/shaders/build.cmake rename {Windows_Libs/Dev => impls/Windows_Libs}/Render/shaders/main_PS.hlsl (100%) rename {Windows_Libs/Dev => impls/Windows_Libs}/Render/shaders/main_VS.hlsl (100%) rename {Windows_Libs/Dev => impls/Windows_Libs}/Render/shaders/screen_PS.hlsl (100%) rename {Windows_Libs/Dev => impls/Windows_Libs}/Render/shaders/screen_VS.hlsl (100%) rename {Windows_Libs/Dev/Render => impls/Windows_Libs/Render/src}/4J_Render.cpp (100%) rename {Windows_Libs/Dev/Render => impls/Windows_Libs/Render/src}/RendererCBuff.cpp (100%) rename {Windows_Libs/Dev/Render => impls/Windows_Libs/Render/src}/RendererCore.cpp (100%) rename {Windows_Libs/Dev/Render => impls/Windows_Libs/Render/src}/RendererMatrix.cpp (100%) rename {Windows_Libs/Dev/Render => impls/Windows_Libs/Render/src}/RendererState.cpp (100%) rename {Windows_Libs/Dev/Render => impls/Windows_Libs/Render/src}/RendererTexture.cpp (100%) rename {Windows_Libs/Dev/Render => impls/Windows_Libs/Render/src}/RendererVertex.cpp (100%) rename {Windows_Libs/Dev/Render => impls/Windows_Libs/Render/src}/stdafx.cpp (100%) rename {Windows_Libs/Dev/Render => impls/Windows_Libs/Render/vendor}/libpng/png.c (100%) rename {Windows_Libs/Dev/Render => impls/Windows_Libs/Render/vendor}/libpng/png.h (100%) rename {Windows_Libs/Dev/Render => impls/Windows_Libs/Render/vendor}/libpng/pngconf.h (100%) rename {Windows_Libs/Dev/Render => impls/Windows_Libs/Render/vendor}/libpng/pngdebug.h (100%) rename {Windows_Libs/Dev/Render => impls/Windows_Libs/Render/vendor}/libpng/pngerror.c (100%) rename {Windows_Libs/Dev/Render => impls/Windows_Libs/Render/vendor}/libpng/pngget.c (100%) rename {Windows_Libs/Dev/Render => impls/Windows_Libs/Render/vendor}/libpng/pnginfo.h (100%) rename {Windows_Libs/Dev/Render => impls/Windows_Libs/Render/vendor}/libpng/pnglibconf.h (100%) rename {Windows_Libs/Dev/Render => impls/Windows_Libs/Render/vendor}/libpng/pngmem.c (100%) rename {Windows_Libs/Dev/Render => impls/Windows_Libs/Render/vendor}/libpng/pngpread.c (100%) rename {Windows_Libs/Dev/Render => impls/Windows_Libs/Render/vendor}/libpng/pngpriv.h (100%) rename {Windows_Libs/Dev/Render => impls/Windows_Libs/Render/vendor}/libpng/pngread.c (100%) rename {Windows_Libs/Dev/Render => impls/Windows_Libs/Render/vendor}/libpng/pngrio.c (100%) rename {Windows_Libs/Dev/Render => impls/Windows_Libs/Render/vendor}/libpng/pngrtran.c (100%) rename {Windows_Libs/Dev/Render => impls/Windows_Libs/Render/vendor}/libpng/pngrutil.c (100%) rename {Windows_Libs/Dev/Render => impls/Windows_Libs/Render/vendor}/libpng/pngset.c (100%) rename {Windows_Libs/Dev/Render => impls/Windows_Libs/Render/vendor}/libpng/pngstruct.h (100%) rename {Windows_Libs/Dev/Render => impls/Windows_Libs/Render/vendor}/libpng/pngtest.c (100%) rename {Windows_Libs/Dev/Render => impls/Windows_Libs/Render/vendor}/libpng/pngtrans.c (100%) rename {Windows_Libs/Dev/Render => impls/Windows_Libs/Render/vendor}/libpng/pngwio.c (100%) rename {Windows_Libs/Dev/Render => impls/Windows_Libs/Render/vendor}/libpng/pngwrite.c (100%) rename {Windows_Libs/Dev/Render => impls/Windows_Libs/Render/vendor}/libpng/pngwtran.c (100%) rename {Windows_Libs/Dev/Render => impls/Windows_Libs/Render/vendor}/libpng/pngwutil.c (100%) rename {Windows_Libs/Dev/Render => impls/Windows_Libs/Render/vendor}/microprofile/microprofile.config.h (100%) rename {Windows_Libs/Dev/Render => impls/Windows_Libs/Render/vendor}/microprofile/microprofile.cpp (100%) rename {Windows_Libs/Dev/Render => impls/Windows_Libs/Render/vendor}/microprofile/microprofile.h (100%) rename {Windows_Libs/Dev/Render => impls/Windows_Libs/Render/vendor}/microprofile/microprofile_html.h (100%) rename {Windows_Libs/Dev/Render => impls/Windows_Libs/Render/vendor}/microprofile/microprofile_icons.h (100%) rename {Windows_Libs/Dev/Render => impls/Windows_Libs/Render/vendor}/microprofile/stb/stb_sprintf.h (100%) rename {Windows_Libs/Dev/Render => impls/Windows_Libs/Render/vendor}/zlib/zconf.h (100%) rename {Windows_Libs/Dev/Render => impls/Windows_Libs/Render/vendor}/zlib/zlib.h (100%) rename {Windows_Libs/Dev => impls/Windows_Libs}/Storage/CMakeLists.txt (53%) rename {Windows_Libs/Dev/Storage => impls/Windows_Libs/Storage/inc}/STO_DLC.h (100%) rename {Windows_Libs/Dev/Storage => impls/Windows_Libs/Storage/inc}/STO_Main.h (100%) rename {Windows_Libs/Dev/Storage => impls/Windows_Libs/Storage/inc}/STO_SaveGame.h (100%) rename {Windows_Libs/Dev/Storage => impls/Windows_Libs/Storage/inc}/stdafx.h (100%) rename {Windows_Libs/Dev/Storage => impls/Windows_Libs/Storage/src}/4J_Storage.cpp (100%) rename {Windows_Libs/Dev/Storage => impls/Windows_Libs/Storage/src}/STO_DLC.cpp (100%) rename {Windows_Libs/Dev/Storage => impls/Windows_Libs/Storage/src}/STO_Main.cpp (100%) rename {Windows_Libs/Dev/Storage => impls/Windows_Libs/Storage/src}/STO_SaveGame.cpp (100%) rename {Windows_Libs/Dev/Storage => impls/Windows_Libs/Storage/src}/stdafx.cpp (100%) create mode 100644 inc/4J_Input.h create mode 100644 inc/4J_Profile.h create mode 100644 inc/4J_Render.h create mode 100644 inc/4J_Storage.h create mode 100644 inc/extraX64.h diff --git a/Windows_Libs/Dev/.clang-format b/.clang-format similarity index 100% rename from Windows_Libs/Dev/.clang-format rename to .clang-format diff --git a/.gitignore b/.gitignore index ba66641..11f785c 100644 --- a/.gitignore +++ b/.gitignore @@ -427,16 +427,9 @@ FodyWeavers.xsd *.msm *.msp -# special headers -4J_Input.h -4J_Storage.h -4J_Render.h -4J_Profile.h - -extraX64.h - .vscode/ build/ +libs/ # generated shader headers VS_PF3_TF2_CB4_NB4_XW1.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 0d9f0b3..673fa38 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,5 +2,21 @@ cmake_minimum_required(VERSION 3.25 FATAL_ERROR) project(4JLibs LANGUAGES CXX) -# TODO: target selection? -add_subdirectory(Windows_Libs/Dev) \ No newline at end of file +add_library(4JLibs.Globals INTERFACE) + +target_include_directories(4JLibs.Globals INTERFACE + ${CMAKE_CURRENT_SOURCE_DIR}/inc +) + +set(CMAKE_DEBUG_POSTFIX "_d") + +# msvc specific flags +if(MSVC) + set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") +endif() + +if(WIN32) + add_subdirectory(impls/Windows_Libs) +else() + message(FATAL_ERROR "Unsupported platform.") +endif() diff --git a/CMakeSettings.json b/CMakeSettings.json new file mode 100644 index 0000000..0c5fbf9 --- /dev/null +++ b/CMakeSettings.json @@ -0,0 +1,27 @@ +{ + "configurations": [ + { + "name": "x64-Debug", + "generator": "Ninja", + "configurationType": "Debug", + "inheritEnvironments": [ "msvc_x64_x64" ], + "buildRoot": "${projectDir}\\out\\build\\${name}", + "installRoot": "${projectDir}\\out\\install\\${name}", + "cmakeCommandArgs": "", + "buildCommandArgs": "", + "ctestCommandArgs": "" + }, + { + "name": "x64-Release", + "generator": "Ninja", + "configurationType": "RelWithDebInfo", + "buildRoot": "${projectDir}\\out\\build\\${name}", + "installRoot": "${projectDir}\\out\\install\\${name}", + "cmakeCommandArgs": "", + "buildCommandArgs": "", + "ctestCommandArgs": "", + "inheritEnvironments": [ "msvc_x64_x64" ], + "variables": [] + } + ] +} \ No newline at end of file diff --git a/README.md b/README.md index e3f07ef..cb9632d 100644 --- a/README.md +++ b/README.md @@ -12,24 +12,9 @@ This would allow compiling the Minecraft: Legacy Console Edition source code fro This would also help document the structure of their projects for decompilation projects of newer versions of this version of the game -## Does this use leaked code? - -No, this does not use any code from the Minecraft: Legacy Console Edition source leak, this is all clean decompilation from binaries and debug binaries - ## How can I build this? -You will need to get your hands with files from the source leak that are not included here or rebuild them and push to the repository - -The files needed are the following: -* 4J_Input.h -* 4J_Storage.h -* 4J_Render.h -* 4J_Profile.h -* extraX64.h - -You will need to modify ``extraX64.h`` as it has a couple errors - -You will need to add every file into their respective project and add the ``extraX64.h`` header inside ``Profile`` and ``Storage`` +Just open the main folder and compile with your favourite code editor! ## What is implemented? diff --git a/Windows_Libs/Dev/Dev.slnx b/Windows_Libs/Dev/Dev.slnx deleted file mode 100644 index 346d8fa..0000000 --- a/Windows_Libs/Dev/Dev.slnx +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/Windows_Libs/Dev/Input/CMakeLists.txt b/Windows_Libs/Dev/Input/CMakeLists.txt deleted file mode 100644 index 1bd6aa9..0000000 --- a/Windows_Libs/Dev/Input/CMakeLists.txt +++ /dev/null @@ -1,26 +0,0 @@ -cmake_minimum_required(VERSION 3.25 FATAL_ERROR) - -project(4JLibs.Windows.Input LANGUAGES CXX) - -add_library(${PROJECT_NAME} STATIC - 4J_Input.cpp - INP_ForceFeedback.cpp - INP_Keyboard.cpp - INP_Main.cpp - INP_StringCheck.cpp - LinkedList.cpp - stdafx.cpp -) - -target_include_directories(${PROJECT_NAME} PRIVATE - ${CMAKE_CURRENT_SOURCE_DIR} -) - -target_precompile_headers(${PROJECT_NAME} PRIVATE - stdafx.h -) - -set_target_properties(${PROJECT_NAME} PROPERTIES - PREFIX "" - OUTPUT_NAME "4J_Input" -) \ No newline at end of file diff --git a/Windows_Libs/Dev/Input/Input.vcxproj b/Windows_Libs/Dev/Input/Input.vcxproj deleted file mode 100644 index 3188e2b..0000000 --- a/Windows_Libs/Dev/Input/Input.vcxproj +++ /dev/null @@ -1,184 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - 18.0 - Win32Proj - {258f8cf7-6317-480d-b07d-52a6846adf67} - input - 10.0 - Input - - - - StaticLibrary - true - v145 - Unicode - - - StaticLibrary - false - v145 - true - Unicode - - - StaticLibrary - true - v110 - Unicode - - - StaticLibrary - false - v145 - true - Unicode - - - - - - - - - - - - - - - - - - - - - 4J_$(ProjectName)_d - - - 4J_$(ProjectName) - - - - Level3 - true - _CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - stdcpp20 - Use - pch.h - - - - - true - - - - - Level3 - true - true - true - _CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - stdcpp20 - Use - pch.h - - - - - true - - - - - Level3 - true - _CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - stdcpp20 - Use - stdafx.h - stdafx.h - true - MultiThreadedDebug - Default - true - - - - - true - - - - - - Level3 - true - true - true - _CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - stdcpp20 - Use - stdafx.h - stdafx.h - true - MultiThreaded - - - - - true - - - - - - - - - - - - - - - - - - - - - Create - Create - Create - Create - - - - - - \ No newline at end of file diff --git a/Windows_Libs/Dev/Input/Input.vcxproj.filters b/Windows_Libs/Dev/Input/Input.vcxproj.filters deleted file mode 100644 index 53711b9..0000000 --- a/Windows_Libs/Dev/Input/Input.vcxproj.filters +++ /dev/null @@ -1,59 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - \ No newline at end of file diff --git a/Windows_Libs/Dev/Profile/CMakeLists.txt b/Windows_Libs/Dev/Profile/CMakeLists.txt deleted file mode 100644 index 0c52582..0000000 --- a/Windows_Libs/Dev/Profile/CMakeLists.txt +++ /dev/null @@ -1,26 +0,0 @@ -cmake_minimum_required(VERSION 3.25 FATAL_ERROR) - -project(4JLibs.Windows.Profile LANGUAGES CXX) - -add_library(${PROJECT_NAME} STATIC - 4J_Profile.cpp - PRO_AwardManager.cpp - PRO_Data.cpp - PRO_Main.cpp - PRO_RichPresence.cpp - PRO_Sys.cpp - stdafx.cpp -) - -target_include_directories(${PROJECT_NAME} PRIVATE - ${CMAKE_CURRENT_SOURCE_DIR} -) - -target_precompile_headers(${PROJECT_NAME} PRIVATE - stdafx.h -) - -set_target_properties(${PROJECT_NAME} PROPERTIES - PREFIX "" - OUTPUT_NAME "4J_Profile" -) \ No newline at end of file diff --git a/Windows_Libs/Dev/Profile/Profile.vcxproj b/Windows_Libs/Dev/Profile/Profile.vcxproj deleted file mode 100644 index ec99799..0000000 --- a/Windows_Libs/Dev/Profile/Profile.vcxproj +++ /dev/null @@ -1,185 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - 18.0 - Win32Proj - {d68297b9-ca86-4a8c-b81f-61811d7f96b8} - profile - 10.0 - Profile - - - - StaticLibrary - true - v145 - Unicode - - - StaticLibrary - false - v145 - true - Unicode - - - StaticLibrary - true - v110 - Unicode - - - StaticLibrary - false - v145 - true - Unicode - - - - - - - - - - - - - - - - - - - - - 4J_$(ProjectName) - - - 4J_$(ProjectName)_d - - - - Level3 - true - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - stdcpp20 - Use - pch.h - - - - - true - - - - - Level3 - true - true - true - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - stdcpp20 - Use - pch.h - - - - - true - - - - - Level3 - true - _CRT_SECURE_NO_WARNINGS;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - stdcpp20 - Use - stdafx.h - true - stdafx.h - MultiThreadedDebug - Default - true - - - - - true - - - - - - Level3 - true - true - true - _CRT_SECURE_NO_WARNINGS;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - stdcpp20 - Use - stdafx.h - true - stdafx.h - MultiThreaded - - - - - true - - - - - - - - - - - - - - - - - - - - - - Create - Create - Create - Create - - - - - - \ No newline at end of file diff --git a/Windows_Libs/Dev/Profile/Profile.vcxproj.filters b/Windows_Libs/Dev/Profile/Profile.vcxproj.filters deleted file mode 100644 index ddd612f..0000000 --- a/Windows_Libs/Dev/Profile/Profile.vcxproj.filters +++ /dev/null @@ -1,62 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - \ No newline at end of file diff --git a/Windows_Libs/Dev/Render/CMakeLists.txt b/Windows_Libs/Dev/Render/CMakeLists.txt deleted file mode 100644 index d53e645..0000000 --- a/Windows_Libs/Dev/Render/CMakeLists.txt +++ /dev/null @@ -1,53 +0,0 @@ -cmake_minimum_required(VERSION 3.25 FATAL_ERROR) - -project(4JLibs.Windows.Render LANGUAGES C CXX) - -set(LIBPNG_SOURCES - libpng/png.c - libpng/pngerror.c - libpng/pngget.c - libpng/pngmem.c - libpng/pngpread.c - libpng/pngread.c - libpng/pngrio.c - libpng/pngrtran.c - libpng/pngrutil.c - libpng/pngset.c - libpng/pngtest.c - libpng/pngtrans.c - libpng/pngwio.c - libpng/pngwrite.c - libpng/pngwtran.c - libpng/pngwutil.c -) - -add_library(${PROJECT_NAME} STATIC - ${LIBPNG_SOURCES} - 4J_Render.cpp - RendererCBuff.cpp - RendererCore.cpp - RendererMatrix.cpp - RendererState.cpp - RendererTexture.cpp - RendererVertex.cpp - stdafx.cpp -) - -target_include_directories(${PROJECT_NAME} PRIVATE - ${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_CURRENT_SOURCE_DIR}/zlib -) - -target_precompile_headers(${PROJECT_NAME} PRIVATE - stdafx.h -) - -set_target_properties(${PROJECT_NAME} PROPERTIES - PREFIX "" - OUTPUT_NAME "4J_Render" -) - -set_source_files_properties(${LIBPNG_SOURCES} PROPERTIES - LANGUAGE C - SKIP_PRECOMPILE_HEADERS ON -) \ No newline at end of file diff --git a/Windows_Libs/Dev/Render/Render.vcxproj b/Windows_Libs/Dev/Render/Render.vcxproj deleted file mode 100644 index 641c887..0000000 --- a/Windows_Libs/Dev/Render/Render.vcxproj +++ /dev/null @@ -1,377 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - 18.0 - Win32Proj - {cc99eb47-7231-4067-8717-c6bf4abde338} - render - 10.0 - Render_PC - - - - StaticLibrary - true - v145 - Unicode - - - StaticLibrary - false - v145 - true - Unicode - - - StaticLibrary - true - v110 - Unicode - - - StaticLibrary - false - v145 - true - Unicode - - - - - - - - - - - - - - - - - - - - - 4J_$(ProjectName)_d - - - 4J_$(ProjectName) - - - - Level3 - true - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - stdcpp20 - Use - pch.h - - - - - true - - - - - Level3 - true - true - true - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - stdcpp20 - Use - pch.h - - - - - true - - - - - Level3 - true - _CRT_SECURE_NO_WARNINGS;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - stdcpp20 - Use - stdafx.h - true - stdafx.h - MultiThreadedDebug - libpng\;zlib\;microprofile\;%(AdditionalIncludeDirectories) - Default - true - - - - - true - - - - cd shaders && build.bat - Build Shaders - - - - - Level3 - true - true - true - _CRT_SECURE_NO_WARNINGS;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - stdcpp20 - Use - stdafx.h - true - stdafx.h - MultiThreaded - libpng\;zlib\;microprofile\;%(AdditionalIncludeDirectories) - - - - - true - - - - cd shaders && build.bat - - - Build Shaders - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Default - - - NotUsing - NotUsing - - - - - Default - - - NotUsing - NotUsing - - - - - Default - - - NotUsing - NotUsing - - - - - Default - - - NotUsing - NotUsing - - - - - Default - - - NotUsing - NotUsing - - - - - Default - - - NotUsing - NotUsing - - - - - Default - - - NotUsing - NotUsing - - - - - Default - - - NotUsing - NotUsing - - - - - Default - - - NotUsing - NotUsing - - - - - Default - - - NotUsing - NotUsing - - - - - Default - - - NotUsing - NotUsing - - - - - Default - - - NotUsing - NotUsing - - - - - Default - - - NotUsing - NotUsing - - - - - Default - - - NotUsing - NotUsing - - - - - Default - - - NotUsing - NotUsing - - - - - Default - - - NotUsing - NotUsing - - - - - - - - - - - - Create - Create - Create - Create - - - - - Document - - - Document - - - Document - - - Document - - - - - - \ No newline at end of file diff --git a/Windows_Libs/Dev/Render/Render.vcxproj.filters b/Windows_Libs/Dev/Render/Render.vcxproj.filters deleted file mode 100644 index 57c929b..0000000 --- a/Windows_Libs/Dev/Render/Render.vcxproj.filters +++ /dev/null @@ -1,211 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd - - - {e5716c14-38f4-49f7-bf1a-916fbc7613a8} - - - {0681221a-1efa-43e4-b0f7-0b525172e486} - - - {0629c87a-576d-4163-8c60-dad190ee97d0} - - - {8be558c7-c6e6-4ef7-bfcb-83d29f079240} - - - {6cbd8b95-ff51-42d2-a66f-282d3a11c042} - - - {3b83a35a-3f4e-4ae3-b7fa-17a84f509af5} - - - {a7d5eaa5-01ec-4f81-93cc-0699c5eabc2c} - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files\zlib - - - Header Files\zlib - - - Header Files\libpng - - - Header Files\libpng - - - Header Files\libpng - - - Header Files\libpng - - - Header Files\libpng - - - Header Files\libpng - - - Header Files\libpng - - - Header Files\microprofile - - - Header Files\microprofile - - - Header Files\microprofile - - - Header Files - - - Header Files\generated - - - Header Files\generated - - - Header Files\generated - - - Header Files\generated - - - Header Files\generated - - - Header Files\generated - - - Header Files\generated - - - Header Files\generated - - - Header Files\generated - - - Header Files\generated - - - Header Files\generated - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files\libpng - - - Source Files\libpng - - - Source Files\libpng - - - Source Files\libpng - - - Source Files\libpng - - - Source Files\libpng - - - Source Files\libpng - - - Source Files\libpng - - - Source Files\libpng - - - Source Files\libpng - - - Source Files\libpng - - - Source Files\libpng - - - Source Files\libpng - - - Source Files\libpng - - - Source Files\libpng - - - Source Files\libpng - - - Source Files\microprofile - - - - - Shaders - - - Shaders - - - Shaders - - - Shaders - - - \ No newline at end of file diff --git a/Windows_Libs/Dev/Storage/Storage.vcxproj b/Windows_Libs/Dev/Storage/Storage.vcxproj deleted file mode 100644 index 6f3032a..0000000 --- a/Windows_Libs/Dev/Storage/Storage.vcxproj +++ /dev/null @@ -1,180 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - 18.0 - Win32Proj - {6ded1618-2ada-4d72-a11f-425e83c7042e} - Storage - 10.0 - - - - StaticLibrary - true - v145 - Unicode - - - StaticLibrary - false - v145 - true - Unicode - - - StaticLibrary - true - v110 - Unicode - - - StaticLibrary - false - v145 - true - Unicode - - - - - - - - - - - - - - - - - - - - - 4J_$(ProjectName) - - - 4J_$(ProjectName)_d - - - - Level3 - true - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - stdcpp20 - Use - pch.h - - - - - true - - - - - Level3 - true - true - true - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - stdcpp20 - Use - pch.h - - - - - true - - - - - Level3 - true - _CRT_SECURE_NO_WARNINGS;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - stdcpp20 - Use - stdafx.h - true - stdafx.h - MultiThreadedDebug - Default - true - - - - - true - - - - - - Level3 - true - true - true - _CRT_SECURE_NO_WARNINGS;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - stdcpp20 - Use - stdafx.h - true - stdafx.h - MultiThreaded - - - - - true - - - - - - - - - - - - - - - Create - Create - Create - Create - - - - - - - - - \ No newline at end of file diff --git a/Windows_Libs/Dev/Storage/Storage.vcxproj.filters b/Windows_Libs/Dev/Storage/Storage.vcxproj.filters deleted file mode 100644 index 85c3541..0000000 --- a/Windows_Libs/Dev/Storage/Storage.vcxproj.filters +++ /dev/null @@ -1,50 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - \ No newline at end of file diff --git a/Windows_Libs/Dev/CMakeLists.txt b/impls/Windows_Libs/CMakeLists.txt similarity index 72% rename from Windows_Libs/Dev/CMakeLists.txt rename to impls/Windows_Libs/CMakeLists.txt index 3e9068f..0463046 100644 --- a/Windows_Libs/Dev/CMakeLists.txt +++ b/impls/Windows_Libs/CMakeLists.txt @@ -2,8 +2,6 @@ cmake_minimum_required(VERSION 3.25 FATAL_ERROR) project(4JLibs.Windows LANGUAGES CXX) -set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") - add_subdirectory(Input) add_subdirectory(Profile) add_subdirectory(Render) diff --git a/impls/Windows_Libs/Input/CMakeLists.txt b/impls/Windows_Libs/Input/CMakeLists.txt new file mode 100644 index 0000000..37b0247 --- /dev/null +++ b/impls/Windows_Libs/Input/CMakeLists.txt @@ -0,0 +1,31 @@ +cmake_minimum_required(VERSION 3.25 FATAL_ERROR) + +project(4JLibs.Windows.Input LANGUAGES CXX) + +add_library(${PROJECT_NAME} STATIC + src/4J_Input.cpp + src/INP_ForceFeedback.cpp + src/INP_Keyboard.cpp + src/INP_Main.cpp + src/INP_StringCheck.cpp + src/LinkedList.cpp + src/stdafx.cpp +) + +target_link_libraries(${PROJECT_NAME} PUBLIC + 4JLibs.Globals +) + +target_include_directories(${PROJECT_NAME} PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR}/inc +) + +target_precompile_headers(${PROJECT_NAME} PRIVATE + inc/stdafx.h +) + +set_target_properties(${PROJECT_NAME} PROPERTIES + PREFIX "" + OUTPUT_NAME "4J_Input" + ARCHIVE_OUTPUT_DIRECTORY "${4JLibs_SOURCE_DIR}/libs" +) \ No newline at end of file diff --git a/Windows_Libs/Dev/Input/INP_ForceFeedback.h b/impls/Windows_Libs/Input/inc/INP_ForceFeedback.h similarity index 100% rename from Windows_Libs/Dev/Input/INP_ForceFeedback.h rename to impls/Windows_Libs/Input/inc/INP_ForceFeedback.h diff --git a/Windows_Libs/Dev/Input/INP_Keyboard.h b/impls/Windows_Libs/Input/inc/INP_Keyboard.h similarity index 100% rename from Windows_Libs/Dev/Input/INP_Keyboard.h rename to impls/Windows_Libs/Input/inc/INP_Keyboard.h diff --git a/Windows_Libs/Dev/Input/INP_Main.h b/impls/Windows_Libs/Input/inc/INP_Main.h similarity index 100% rename from Windows_Libs/Dev/Input/INP_Main.h rename to impls/Windows_Libs/Input/inc/INP_Main.h diff --git a/Windows_Libs/Dev/Input/INP_StringCheck.h b/impls/Windows_Libs/Input/inc/INP_StringCheck.h similarity index 100% rename from Windows_Libs/Dev/Input/INP_StringCheck.h rename to impls/Windows_Libs/Input/inc/INP_StringCheck.h diff --git a/Windows_Libs/Dev/Input/LinkedList.h b/impls/Windows_Libs/Input/inc/LinkedList.h similarity index 100% rename from Windows_Libs/Dev/Input/LinkedList.h rename to impls/Windows_Libs/Input/inc/LinkedList.h diff --git a/Windows_Libs/Dev/Input/stdafx.h b/impls/Windows_Libs/Input/inc/stdafx.h similarity index 100% rename from Windows_Libs/Dev/Input/stdafx.h rename to impls/Windows_Libs/Input/inc/stdafx.h diff --git a/Windows_Libs/Dev/Input/4J_Input.cpp b/impls/Windows_Libs/Input/src/4J_Input.cpp similarity index 100% rename from Windows_Libs/Dev/Input/4J_Input.cpp rename to impls/Windows_Libs/Input/src/4J_Input.cpp diff --git a/Windows_Libs/Dev/Input/INP_ForceFeedback.cpp b/impls/Windows_Libs/Input/src/INP_ForceFeedback.cpp similarity index 100% rename from Windows_Libs/Dev/Input/INP_ForceFeedback.cpp rename to impls/Windows_Libs/Input/src/INP_ForceFeedback.cpp diff --git a/Windows_Libs/Dev/Input/INP_Keyboard.cpp b/impls/Windows_Libs/Input/src/INP_Keyboard.cpp similarity index 100% rename from Windows_Libs/Dev/Input/INP_Keyboard.cpp rename to impls/Windows_Libs/Input/src/INP_Keyboard.cpp diff --git a/Windows_Libs/Dev/Input/INP_Main.cpp b/impls/Windows_Libs/Input/src/INP_Main.cpp similarity index 100% rename from Windows_Libs/Dev/Input/INP_Main.cpp rename to impls/Windows_Libs/Input/src/INP_Main.cpp diff --git a/Windows_Libs/Dev/Input/INP_StringCheck.cpp b/impls/Windows_Libs/Input/src/INP_StringCheck.cpp similarity index 100% rename from Windows_Libs/Dev/Input/INP_StringCheck.cpp rename to impls/Windows_Libs/Input/src/INP_StringCheck.cpp diff --git a/Windows_Libs/Dev/Input/LinkedList.cpp b/impls/Windows_Libs/Input/src/LinkedList.cpp similarity index 100% rename from Windows_Libs/Dev/Input/LinkedList.cpp rename to impls/Windows_Libs/Input/src/LinkedList.cpp diff --git a/Windows_Libs/Dev/Input/stdafx.cpp b/impls/Windows_Libs/Input/src/stdafx.cpp similarity index 100% rename from Windows_Libs/Dev/Input/stdafx.cpp rename to impls/Windows_Libs/Input/src/stdafx.cpp diff --git a/impls/Windows_Libs/Profile/CMakeLists.txt b/impls/Windows_Libs/Profile/CMakeLists.txt new file mode 100644 index 0000000..40de137 --- /dev/null +++ b/impls/Windows_Libs/Profile/CMakeLists.txt @@ -0,0 +1,31 @@ +cmake_minimum_required(VERSION 3.25 FATAL_ERROR) + +project(4JLibs.Windows.Profile LANGUAGES CXX) + +add_library(${PROJECT_NAME} STATIC + src/4J_Profile.cpp + src/PRO_AwardManager.cpp + src/PRO_Data.cpp + src/PRO_Main.cpp + src/PRO_RichPresence.cpp + src/PRO_Sys.cpp + src/stdafx.cpp +) + +target_link_libraries(${PROJECT_NAME} PUBLIC + 4JLibs.Globals +) + +target_include_directories(${PROJECT_NAME} PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR}/inc +) + +target_precompile_headers(${PROJECT_NAME} PRIVATE + inc/stdafx.h +) + +set_target_properties(${PROJECT_NAME} PROPERTIES + PREFIX "" + OUTPUT_NAME "4J_Profile" + ARCHIVE_OUTPUT_DIRECTORY "${4JLibs_SOURCE_DIR}/libs" +) \ No newline at end of file diff --git a/Windows_Libs/Dev/Profile/PRO_AwardManager.h b/impls/Windows_Libs/Profile/inc/PRO_AwardManager.h similarity index 100% rename from Windows_Libs/Dev/Profile/PRO_AwardManager.h rename to impls/Windows_Libs/Profile/inc/PRO_AwardManager.h diff --git a/Windows_Libs/Dev/Profile/PRO_Data.h b/impls/Windows_Libs/Profile/inc/PRO_Data.h similarity index 100% rename from Windows_Libs/Dev/Profile/PRO_Data.h rename to impls/Windows_Libs/Profile/inc/PRO_Data.h diff --git a/Windows_Libs/Dev/Profile/PRO_Main.h b/impls/Windows_Libs/Profile/inc/PRO_Main.h similarity index 100% rename from Windows_Libs/Dev/Profile/PRO_Main.h rename to impls/Windows_Libs/Profile/inc/PRO_Main.h diff --git a/Windows_Libs/Dev/Profile/PRO_RichPresence.h b/impls/Windows_Libs/Profile/inc/PRO_RichPresence.h similarity index 100% rename from Windows_Libs/Dev/Profile/PRO_RichPresence.h rename to impls/Windows_Libs/Profile/inc/PRO_RichPresence.h diff --git a/Windows_Libs/Dev/Profile/PRO_Sys.h b/impls/Windows_Libs/Profile/inc/PRO_Sys.h similarity index 100% rename from Windows_Libs/Dev/Profile/PRO_Sys.h rename to impls/Windows_Libs/Profile/inc/PRO_Sys.h diff --git a/Windows_Libs/Dev/Profile/stdafx.h b/impls/Windows_Libs/Profile/inc/stdafx.h similarity index 100% rename from Windows_Libs/Dev/Profile/stdafx.h rename to impls/Windows_Libs/Profile/inc/stdafx.h diff --git a/Windows_Libs/Dev/Profile/4J_Profile.cpp b/impls/Windows_Libs/Profile/src/4J_Profile.cpp similarity index 100% rename from Windows_Libs/Dev/Profile/4J_Profile.cpp rename to impls/Windows_Libs/Profile/src/4J_Profile.cpp diff --git a/Windows_Libs/Dev/Profile/PRO_AwardManager.cpp b/impls/Windows_Libs/Profile/src/PRO_AwardManager.cpp similarity index 100% rename from Windows_Libs/Dev/Profile/PRO_AwardManager.cpp rename to impls/Windows_Libs/Profile/src/PRO_AwardManager.cpp diff --git a/Windows_Libs/Dev/Profile/PRO_Data.cpp b/impls/Windows_Libs/Profile/src/PRO_Data.cpp similarity index 100% rename from Windows_Libs/Dev/Profile/PRO_Data.cpp rename to impls/Windows_Libs/Profile/src/PRO_Data.cpp diff --git a/Windows_Libs/Dev/Profile/PRO_Main.cpp b/impls/Windows_Libs/Profile/src/PRO_Main.cpp similarity index 100% rename from Windows_Libs/Dev/Profile/PRO_Main.cpp rename to impls/Windows_Libs/Profile/src/PRO_Main.cpp diff --git a/Windows_Libs/Dev/Profile/PRO_RichPresence.cpp b/impls/Windows_Libs/Profile/src/PRO_RichPresence.cpp similarity index 100% rename from Windows_Libs/Dev/Profile/PRO_RichPresence.cpp rename to impls/Windows_Libs/Profile/src/PRO_RichPresence.cpp diff --git a/Windows_Libs/Dev/Profile/PRO_Sys.cpp b/impls/Windows_Libs/Profile/src/PRO_Sys.cpp similarity index 100% rename from Windows_Libs/Dev/Profile/PRO_Sys.cpp rename to impls/Windows_Libs/Profile/src/PRO_Sys.cpp diff --git a/Windows_Libs/Dev/Profile/stdafx.cpp b/impls/Windows_Libs/Profile/src/stdafx.cpp similarity index 100% rename from Windows_Libs/Dev/Profile/stdafx.cpp rename to impls/Windows_Libs/Profile/src/stdafx.cpp diff --git a/impls/Windows_Libs/Render/CMakeLists.txt b/impls/Windows_Libs/Render/CMakeLists.txt new file mode 100644 index 0000000..6c17ced --- /dev/null +++ b/impls/Windows_Libs/Render/CMakeLists.txt @@ -0,0 +1,64 @@ +cmake_minimum_required(VERSION 3.25 FATAL_ERROR) + +project(4JLibs.Windows.Render LANGUAGES C CXX) + +include(shaders/build.cmake) + +set(LIBPNG_SOURCES + vendor/libpng/png.c + vendor/libpng/pngerror.c + vendor/libpng/pngget.c + vendor/libpng/pngmem.c + vendor/libpng/pngpread.c + vendor/libpng/pngread.c + vendor/libpng/pngrio.c + vendor/libpng/pngrtran.c + vendor/libpng/pngrutil.c + vendor/libpng/pngset.c + vendor/libpng/pngtest.c + vendor/libpng/pngtrans.c + vendor/libpng/pngwio.c + vendor/libpng/pngwrite.c + vendor/libpng/pngwtran.c + vendor/libpng/pngwutil.c +) + +add_library(${PROJECT_NAME} STATIC + ${LIBPNG_SOURCES} + src/4J_Render.cpp + src/RendererCBuff.cpp + src/RendererCore.cpp + src/RendererMatrix.cpp + src/RendererState.cpp + src/RendererTexture.cpp + src/RendererVertex.cpp + src/stdafx.cpp + ${GENERATED_SHADER_HEADERS} +) + +target_link_libraries(${PROJECT_NAME} PUBLIC + 4JLibs.Globals +) + +target_include_directories(${PROJECT_NAME} PRIVATE + ${CMAKE_CURRENT_BINARY_DIR}/inc # binary output directory + ${CMAKE_CURRENT_SOURCE_DIR}/inc + ${CMAKE_CURRENT_SOURCE_DIR}/vendor + ${CMAKE_CURRENT_SOURCE_DIR}/vendor/zlib +) + +target_precompile_headers(${PROJECT_NAME} PRIVATE + inc/stdafx.h +) + +set_target_properties(${PROJECT_NAME} PROPERTIES + PREFIX "" + # this suffix here should only exist for windows builds, as for other platforms it's just "4J_Render" + OUTPUT_NAME "4J_Render_PC" + ARCHIVE_OUTPUT_DIRECTORY "${4JLibs_SOURCE_DIR}/libs" +) + +set_source_files_properties(${LIBPNG_SOURCES} PROPERTIES + LANGUAGE C + SKIP_PRECOMPILE_HEADERS ON +) \ No newline at end of file diff --git a/Windows_Libs/Dev/Render/CompiledShaders.h b/impls/Windows_Libs/Render/inc/CompiledShaders.h similarity index 100% rename from Windows_Libs/Dev/Render/CompiledShaders.h rename to impls/Windows_Libs/Render/inc/CompiledShaders.h diff --git a/Windows_Libs/Dev/Render/Profiler.h b/impls/Windows_Libs/Render/inc/Profiler.h similarity index 100% rename from Windows_Libs/Dev/Render/Profiler.h rename to impls/Windows_Libs/Render/inc/Profiler.h diff --git a/Windows_Libs/Dev/Render/Renderer.h b/impls/Windows_Libs/Render/inc/Renderer.h similarity index 100% rename from Windows_Libs/Dev/Render/Renderer.h rename to impls/Windows_Libs/Render/inc/Renderer.h diff --git a/Windows_Libs/Dev/Render/stdafx.h b/impls/Windows_Libs/Render/inc/stdafx.h similarity index 100% rename from Windows_Libs/Dev/Render/stdafx.h rename to impls/Windows_Libs/Render/inc/stdafx.h diff --git a/Windows_Libs/Dev/Render/shaders/build.bat b/impls/Windows_Libs/Render/shaders/build.bat similarity index 96% rename from Windows_Libs/Dev/Render/shaders/build.bat rename to impls/Windows_Libs/Render/shaders/build.bat index 678a868..86b97e8 100644 --- a/Windows_Libs/Dev/Render/shaders/build.bat +++ b/impls/Windows_Libs/Render/shaders/build.bat @@ -1,3 +1,4 @@ +:: legacy shader building code @echo off set OUT=../ diff --git a/impls/Windows_Libs/Render/shaders/build.cmake b/impls/Windows_Libs/Render/shaders/build.cmake new file mode 100644 index 0000000..83321ec --- /dev/null +++ b/impls/Windows_Libs/Render/shaders/build.cmake @@ -0,0 +1,52 @@ +# new shader build system + +find_program(FXC_COMPILER NAMES fxc + HINTS + "C:/Program Files (x86)/Windows Kits/10/bin/*/x64" + "C:/Program Files (x86)/Windows Kits/8.1/bin/x64" +) + +if(NOT FXC_COMPILER) + message(FATAL_ERROR "Could not find 'fxc.exe', please make sure you have the Windows SDK installed or this file is available in this directory.") +endif() + +set(SHADER_OUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/inc") + +function(compile_hlsl) + set(options) + set(argDescriptor SOURCE PROFILE ENTRY OUT_HEADER VAR_NAME) + set(defDescriptor DEFINES) + cmake_parse_arguments(ARG "${options}" "${argDescriptor}" "${defDescriptor}" ${ARGN}) + + set(OUT_FILE "${SHADER_OUT_DIR}/${ARG_OUT_HEADER}") + + set(FXC_DEFINES "") + foreach(DEF ${ARG_DEFINES}) + list(APPEND FXC_DEFINES "/D" "${DEF}") + endforeach() + + add_custom_command( + OUTPUT "${OUT_FILE}" + # should probably disable optimizations and enable debug flags when building in debug mode, but i don't care enough to do that right now BUAHAHAHA + COMMAND ${FXC_COMPILER} /O3 /nologo /T ${ARG_PROFILE} /E ${ARG_ENTRY} ${FXC_DEFINES} /Fh "${OUT_FILE}" /Vn ${ARG_VAR_NAME} "${CMAKE_CURRENT_LIST_DIR}/${ARG_SOURCE}" + DEPENDS "${CMAKE_CURRENT_LIST_DIR}/${ARG_SOURCE}" + COMMENT "Compiling shader: '${ARG_SOURCE}' into '${ARG_OUT_HEADER}'" + VERBATIM + ) + + # send the generated paths to the parent scope + set(GENERATED_SHADER_HEADERS ${GENERATED_SHADER_HEADERS} "${OUT_FILE}" PARENT_SCOPE) +endfunction() + +compile_hlsl(SOURCE main_VS.hlsl PROFILE vs_4_0 ENTRY main OUT_HEADER VS_Compressed.h VAR_NAME g_main_VS_Compressed DEFINES COMPRESSED) +compile_hlsl(SOURCE main_VS.hlsl PROFILE vs_4_0 ENTRY main OUT_HEADER VS_PF3_TF2_CB4_NB4_XW1.h VAR_NAME g_main_VS_PF3_TF2_CB4_NB4_XW1) +compile_hlsl(SOURCE main_VS.hlsl PROFILE vs_4_0 ENTRY main OUT_HEADER VS_PF3_TF2_CB4_NB4_XW1_LIGHTING.h VAR_NAME g_main_VS_PF3_TF2_CB4_NB4_XW1_LIGHTING DEFINES LIGHTING) +compile_hlsl(SOURCE main_VS.hlsl PROFILE vs_4_0 ENTRY main OUT_HEADER VS_PF3_TF2_CB4_NB4_XW1_TEXGEN.h VAR_NAME g_main_VS_PF3_TF2_CB4_NB4_XW1_TEXGEN DEFINES TEXGEN) +compile_hlsl(SOURCE screen_VS.hlsl PROFILE vs_4_0 ENTRY VS_ScreenSpace OUT_HEADER VS_ScreenSpace.h VAR_NAME g_main_VS_ScreenSpace) +compile_hlsl(SOURCE screen_VS.hlsl PROFILE vs_4_0 ENTRY VS_ScreenClear OUT_HEADER VS_ScreenClear.h VAR_NAME g_main_VS_ScreenClear) + +compile_hlsl(SOURCE main_PS.hlsl PROFILE ps_4_0 ENTRY main OUT_HEADER PS_Standard.h VAR_NAME g_main_PS_Standard) +compile_hlsl(SOURCE main_PS.hlsl PROFILE ps_4_0 ENTRY main OUT_HEADER PS_TextureProjection.h VAR_NAME g_main_PS_TextureProjection DEFINES TEXTURE_PROJECTION) +compile_hlsl(SOURCE main_PS.hlsl PROFILE ps_4_0 ENTRY main OUT_HEADER PS_ForceLOD.h VAR_NAME g_main_PS_ForceLOD DEFINES FORCE_LOD) +compile_hlsl(SOURCE screen_PS.hlsl PROFILE ps_4_0 ENTRY PS_ScreenSpace OUT_HEADER PS_ScreenSpace.h VAR_NAME g_main_PS_ScreenSpace) +compile_hlsl(SOURCE screen_PS.hlsl PROFILE ps_4_0 ENTRY PS_ScreenClear OUT_HEADER PS_ScreenClear.h VAR_NAME g_main_PS_ScreenClear) \ No newline at end of file diff --git a/Windows_Libs/Dev/Render/shaders/main_PS.hlsl b/impls/Windows_Libs/Render/shaders/main_PS.hlsl similarity index 100% rename from Windows_Libs/Dev/Render/shaders/main_PS.hlsl rename to impls/Windows_Libs/Render/shaders/main_PS.hlsl diff --git a/Windows_Libs/Dev/Render/shaders/main_VS.hlsl b/impls/Windows_Libs/Render/shaders/main_VS.hlsl similarity index 100% rename from Windows_Libs/Dev/Render/shaders/main_VS.hlsl rename to impls/Windows_Libs/Render/shaders/main_VS.hlsl diff --git a/Windows_Libs/Dev/Render/shaders/screen_PS.hlsl b/impls/Windows_Libs/Render/shaders/screen_PS.hlsl similarity index 100% rename from Windows_Libs/Dev/Render/shaders/screen_PS.hlsl rename to impls/Windows_Libs/Render/shaders/screen_PS.hlsl diff --git a/Windows_Libs/Dev/Render/shaders/screen_VS.hlsl b/impls/Windows_Libs/Render/shaders/screen_VS.hlsl similarity index 100% rename from Windows_Libs/Dev/Render/shaders/screen_VS.hlsl rename to impls/Windows_Libs/Render/shaders/screen_VS.hlsl diff --git a/Windows_Libs/Dev/Render/4J_Render.cpp b/impls/Windows_Libs/Render/src/4J_Render.cpp similarity index 100% rename from Windows_Libs/Dev/Render/4J_Render.cpp rename to impls/Windows_Libs/Render/src/4J_Render.cpp diff --git a/Windows_Libs/Dev/Render/RendererCBuff.cpp b/impls/Windows_Libs/Render/src/RendererCBuff.cpp similarity index 100% rename from Windows_Libs/Dev/Render/RendererCBuff.cpp rename to impls/Windows_Libs/Render/src/RendererCBuff.cpp diff --git a/Windows_Libs/Dev/Render/RendererCore.cpp b/impls/Windows_Libs/Render/src/RendererCore.cpp similarity index 100% rename from Windows_Libs/Dev/Render/RendererCore.cpp rename to impls/Windows_Libs/Render/src/RendererCore.cpp diff --git a/Windows_Libs/Dev/Render/RendererMatrix.cpp b/impls/Windows_Libs/Render/src/RendererMatrix.cpp similarity index 100% rename from Windows_Libs/Dev/Render/RendererMatrix.cpp rename to impls/Windows_Libs/Render/src/RendererMatrix.cpp diff --git a/Windows_Libs/Dev/Render/RendererState.cpp b/impls/Windows_Libs/Render/src/RendererState.cpp similarity index 100% rename from Windows_Libs/Dev/Render/RendererState.cpp rename to impls/Windows_Libs/Render/src/RendererState.cpp diff --git a/Windows_Libs/Dev/Render/RendererTexture.cpp b/impls/Windows_Libs/Render/src/RendererTexture.cpp similarity index 100% rename from Windows_Libs/Dev/Render/RendererTexture.cpp rename to impls/Windows_Libs/Render/src/RendererTexture.cpp diff --git a/Windows_Libs/Dev/Render/RendererVertex.cpp b/impls/Windows_Libs/Render/src/RendererVertex.cpp similarity index 100% rename from Windows_Libs/Dev/Render/RendererVertex.cpp rename to impls/Windows_Libs/Render/src/RendererVertex.cpp diff --git a/Windows_Libs/Dev/Render/stdafx.cpp b/impls/Windows_Libs/Render/src/stdafx.cpp similarity index 100% rename from Windows_Libs/Dev/Render/stdafx.cpp rename to impls/Windows_Libs/Render/src/stdafx.cpp diff --git a/Windows_Libs/Dev/Render/libpng/png.c b/impls/Windows_Libs/Render/vendor/libpng/png.c similarity index 100% rename from Windows_Libs/Dev/Render/libpng/png.c rename to impls/Windows_Libs/Render/vendor/libpng/png.c diff --git a/Windows_Libs/Dev/Render/libpng/png.h b/impls/Windows_Libs/Render/vendor/libpng/png.h similarity index 100% rename from Windows_Libs/Dev/Render/libpng/png.h rename to impls/Windows_Libs/Render/vendor/libpng/png.h diff --git a/Windows_Libs/Dev/Render/libpng/pngconf.h b/impls/Windows_Libs/Render/vendor/libpng/pngconf.h similarity index 100% rename from Windows_Libs/Dev/Render/libpng/pngconf.h rename to impls/Windows_Libs/Render/vendor/libpng/pngconf.h diff --git a/Windows_Libs/Dev/Render/libpng/pngdebug.h b/impls/Windows_Libs/Render/vendor/libpng/pngdebug.h similarity index 100% rename from Windows_Libs/Dev/Render/libpng/pngdebug.h rename to impls/Windows_Libs/Render/vendor/libpng/pngdebug.h diff --git a/Windows_Libs/Dev/Render/libpng/pngerror.c b/impls/Windows_Libs/Render/vendor/libpng/pngerror.c similarity index 100% rename from Windows_Libs/Dev/Render/libpng/pngerror.c rename to impls/Windows_Libs/Render/vendor/libpng/pngerror.c diff --git a/Windows_Libs/Dev/Render/libpng/pngget.c b/impls/Windows_Libs/Render/vendor/libpng/pngget.c similarity index 100% rename from Windows_Libs/Dev/Render/libpng/pngget.c rename to impls/Windows_Libs/Render/vendor/libpng/pngget.c diff --git a/Windows_Libs/Dev/Render/libpng/pnginfo.h b/impls/Windows_Libs/Render/vendor/libpng/pnginfo.h similarity index 100% rename from Windows_Libs/Dev/Render/libpng/pnginfo.h rename to impls/Windows_Libs/Render/vendor/libpng/pnginfo.h diff --git a/Windows_Libs/Dev/Render/libpng/pnglibconf.h b/impls/Windows_Libs/Render/vendor/libpng/pnglibconf.h similarity index 100% rename from Windows_Libs/Dev/Render/libpng/pnglibconf.h rename to impls/Windows_Libs/Render/vendor/libpng/pnglibconf.h diff --git a/Windows_Libs/Dev/Render/libpng/pngmem.c b/impls/Windows_Libs/Render/vendor/libpng/pngmem.c similarity index 100% rename from Windows_Libs/Dev/Render/libpng/pngmem.c rename to impls/Windows_Libs/Render/vendor/libpng/pngmem.c diff --git a/Windows_Libs/Dev/Render/libpng/pngpread.c b/impls/Windows_Libs/Render/vendor/libpng/pngpread.c similarity index 100% rename from Windows_Libs/Dev/Render/libpng/pngpread.c rename to impls/Windows_Libs/Render/vendor/libpng/pngpread.c diff --git a/Windows_Libs/Dev/Render/libpng/pngpriv.h b/impls/Windows_Libs/Render/vendor/libpng/pngpriv.h similarity index 100% rename from Windows_Libs/Dev/Render/libpng/pngpriv.h rename to impls/Windows_Libs/Render/vendor/libpng/pngpriv.h diff --git a/Windows_Libs/Dev/Render/libpng/pngread.c b/impls/Windows_Libs/Render/vendor/libpng/pngread.c similarity index 100% rename from Windows_Libs/Dev/Render/libpng/pngread.c rename to impls/Windows_Libs/Render/vendor/libpng/pngread.c diff --git a/Windows_Libs/Dev/Render/libpng/pngrio.c b/impls/Windows_Libs/Render/vendor/libpng/pngrio.c similarity index 100% rename from Windows_Libs/Dev/Render/libpng/pngrio.c rename to impls/Windows_Libs/Render/vendor/libpng/pngrio.c diff --git a/Windows_Libs/Dev/Render/libpng/pngrtran.c b/impls/Windows_Libs/Render/vendor/libpng/pngrtran.c similarity index 100% rename from Windows_Libs/Dev/Render/libpng/pngrtran.c rename to impls/Windows_Libs/Render/vendor/libpng/pngrtran.c diff --git a/Windows_Libs/Dev/Render/libpng/pngrutil.c b/impls/Windows_Libs/Render/vendor/libpng/pngrutil.c similarity index 100% rename from Windows_Libs/Dev/Render/libpng/pngrutil.c rename to impls/Windows_Libs/Render/vendor/libpng/pngrutil.c diff --git a/Windows_Libs/Dev/Render/libpng/pngset.c b/impls/Windows_Libs/Render/vendor/libpng/pngset.c similarity index 100% rename from Windows_Libs/Dev/Render/libpng/pngset.c rename to impls/Windows_Libs/Render/vendor/libpng/pngset.c diff --git a/Windows_Libs/Dev/Render/libpng/pngstruct.h b/impls/Windows_Libs/Render/vendor/libpng/pngstruct.h similarity index 100% rename from Windows_Libs/Dev/Render/libpng/pngstruct.h rename to impls/Windows_Libs/Render/vendor/libpng/pngstruct.h diff --git a/Windows_Libs/Dev/Render/libpng/pngtest.c b/impls/Windows_Libs/Render/vendor/libpng/pngtest.c similarity index 100% rename from Windows_Libs/Dev/Render/libpng/pngtest.c rename to impls/Windows_Libs/Render/vendor/libpng/pngtest.c diff --git a/Windows_Libs/Dev/Render/libpng/pngtrans.c b/impls/Windows_Libs/Render/vendor/libpng/pngtrans.c similarity index 100% rename from Windows_Libs/Dev/Render/libpng/pngtrans.c rename to impls/Windows_Libs/Render/vendor/libpng/pngtrans.c diff --git a/Windows_Libs/Dev/Render/libpng/pngwio.c b/impls/Windows_Libs/Render/vendor/libpng/pngwio.c similarity index 100% rename from Windows_Libs/Dev/Render/libpng/pngwio.c rename to impls/Windows_Libs/Render/vendor/libpng/pngwio.c diff --git a/Windows_Libs/Dev/Render/libpng/pngwrite.c b/impls/Windows_Libs/Render/vendor/libpng/pngwrite.c similarity index 100% rename from Windows_Libs/Dev/Render/libpng/pngwrite.c rename to impls/Windows_Libs/Render/vendor/libpng/pngwrite.c diff --git a/Windows_Libs/Dev/Render/libpng/pngwtran.c b/impls/Windows_Libs/Render/vendor/libpng/pngwtran.c similarity index 100% rename from Windows_Libs/Dev/Render/libpng/pngwtran.c rename to impls/Windows_Libs/Render/vendor/libpng/pngwtran.c diff --git a/Windows_Libs/Dev/Render/libpng/pngwutil.c b/impls/Windows_Libs/Render/vendor/libpng/pngwutil.c similarity index 100% rename from Windows_Libs/Dev/Render/libpng/pngwutil.c rename to impls/Windows_Libs/Render/vendor/libpng/pngwutil.c diff --git a/Windows_Libs/Dev/Render/microprofile/microprofile.config.h b/impls/Windows_Libs/Render/vendor/microprofile/microprofile.config.h similarity index 100% rename from Windows_Libs/Dev/Render/microprofile/microprofile.config.h rename to impls/Windows_Libs/Render/vendor/microprofile/microprofile.config.h diff --git a/Windows_Libs/Dev/Render/microprofile/microprofile.cpp b/impls/Windows_Libs/Render/vendor/microprofile/microprofile.cpp similarity index 100% rename from Windows_Libs/Dev/Render/microprofile/microprofile.cpp rename to impls/Windows_Libs/Render/vendor/microprofile/microprofile.cpp diff --git a/Windows_Libs/Dev/Render/microprofile/microprofile.h b/impls/Windows_Libs/Render/vendor/microprofile/microprofile.h similarity index 100% rename from Windows_Libs/Dev/Render/microprofile/microprofile.h rename to impls/Windows_Libs/Render/vendor/microprofile/microprofile.h diff --git a/Windows_Libs/Dev/Render/microprofile/microprofile_html.h b/impls/Windows_Libs/Render/vendor/microprofile/microprofile_html.h similarity index 100% rename from Windows_Libs/Dev/Render/microprofile/microprofile_html.h rename to impls/Windows_Libs/Render/vendor/microprofile/microprofile_html.h diff --git a/Windows_Libs/Dev/Render/microprofile/microprofile_icons.h b/impls/Windows_Libs/Render/vendor/microprofile/microprofile_icons.h similarity index 100% rename from Windows_Libs/Dev/Render/microprofile/microprofile_icons.h rename to impls/Windows_Libs/Render/vendor/microprofile/microprofile_icons.h diff --git a/Windows_Libs/Dev/Render/microprofile/stb/stb_sprintf.h b/impls/Windows_Libs/Render/vendor/microprofile/stb/stb_sprintf.h similarity index 100% rename from Windows_Libs/Dev/Render/microprofile/stb/stb_sprintf.h rename to impls/Windows_Libs/Render/vendor/microprofile/stb/stb_sprintf.h diff --git a/Windows_Libs/Dev/Render/zlib/zconf.h b/impls/Windows_Libs/Render/vendor/zlib/zconf.h similarity index 100% rename from Windows_Libs/Dev/Render/zlib/zconf.h rename to impls/Windows_Libs/Render/vendor/zlib/zconf.h diff --git a/Windows_Libs/Dev/Render/zlib/zlib.h b/impls/Windows_Libs/Render/vendor/zlib/zlib.h similarity index 100% rename from Windows_Libs/Dev/Render/zlib/zlib.h rename to impls/Windows_Libs/Render/vendor/zlib/zlib.h diff --git a/Windows_Libs/Dev/Storage/CMakeLists.txt b/impls/Windows_Libs/Storage/CMakeLists.txt similarity index 53% rename from Windows_Libs/Dev/Storage/CMakeLists.txt rename to impls/Windows_Libs/Storage/CMakeLists.txt index b27c0ba..f4f37f4 100644 --- a/Windows_Libs/Dev/Storage/CMakeLists.txt +++ b/impls/Windows_Libs/Storage/CMakeLists.txt @@ -3,22 +3,27 @@ cmake_minimum_required(VERSION 3.25 FATAL_ERROR) project(4JLibs.Windows.Storage LANGUAGES C CXX) add_library(${PROJECT_NAME} STATIC - 4J_Storage.cpp - stdafx.cpp - STO_DLC.cpp - STO_Main.cpp - STO_SaveGame.cpp + src/4J_Storage.cpp + src/stdafx.cpp + src/STO_DLC.cpp + src/STO_Main.cpp + src/STO_SaveGame.cpp +) + +target_link_libraries(${PROJECT_NAME} PUBLIC + 4JLibs.Globals ) target_include_directories(${PROJECT_NAME} PRIVATE - ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/inc ) target_precompile_headers(${PROJECT_NAME} PRIVATE - stdafx.h + inc/stdafx.h ) set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "" OUTPUT_NAME "4J_Storage" + ARCHIVE_OUTPUT_DIRECTORY "${4JLibs_SOURCE_DIR}/libs" ) \ No newline at end of file diff --git a/Windows_Libs/Dev/Storage/STO_DLC.h b/impls/Windows_Libs/Storage/inc/STO_DLC.h similarity index 100% rename from Windows_Libs/Dev/Storage/STO_DLC.h rename to impls/Windows_Libs/Storage/inc/STO_DLC.h diff --git a/Windows_Libs/Dev/Storage/STO_Main.h b/impls/Windows_Libs/Storage/inc/STO_Main.h similarity index 100% rename from Windows_Libs/Dev/Storage/STO_Main.h rename to impls/Windows_Libs/Storage/inc/STO_Main.h diff --git a/Windows_Libs/Dev/Storage/STO_SaveGame.h b/impls/Windows_Libs/Storage/inc/STO_SaveGame.h similarity index 100% rename from Windows_Libs/Dev/Storage/STO_SaveGame.h rename to impls/Windows_Libs/Storage/inc/STO_SaveGame.h diff --git a/Windows_Libs/Dev/Storage/stdafx.h b/impls/Windows_Libs/Storage/inc/stdafx.h similarity index 100% rename from Windows_Libs/Dev/Storage/stdafx.h rename to impls/Windows_Libs/Storage/inc/stdafx.h diff --git a/Windows_Libs/Dev/Storage/4J_Storage.cpp b/impls/Windows_Libs/Storage/src/4J_Storage.cpp similarity index 100% rename from Windows_Libs/Dev/Storage/4J_Storage.cpp rename to impls/Windows_Libs/Storage/src/4J_Storage.cpp diff --git a/Windows_Libs/Dev/Storage/STO_DLC.cpp b/impls/Windows_Libs/Storage/src/STO_DLC.cpp similarity index 100% rename from Windows_Libs/Dev/Storage/STO_DLC.cpp rename to impls/Windows_Libs/Storage/src/STO_DLC.cpp diff --git a/Windows_Libs/Dev/Storage/STO_Main.cpp b/impls/Windows_Libs/Storage/src/STO_Main.cpp similarity index 100% rename from Windows_Libs/Dev/Storage/STO_Main.cpp rename to impls/Windows_Libs/Storage/src/STO_Main.cpp diff --git a/Windows_Libs/Dev/Storage/STO_SaveGame.cpp b/impls/Windows_Libs/Storage/src/STO_SaveGame.cpp similarity index 100% rename from Windows_Libs/Dev/Storage/STO_SaveGame.cpp rename to impls/Windows_Libs/Storage/src/STO_SaveGame.cpp diff --git a/Windows_Libs/Dev/Storage/stdafx.cpp b/impls/Windows_Libs/Storage/src/stdafx.cpp similarity index 100% rename from Windows_Libs/Dev/Storage/stdafx.cpp rename to impls/Windows_Libs/Storage/src/stdafx.cpp diff --git a/inc/4J_Input.h b/inc/4J_Input.h new file mode 100644 index 0000000..3083e99 --- /dev/null +++ b/inc/4J_Input.h @@ -0,0 +1,137 @@ +#pragma once + +#define MAP_STYLE_0 0 +#define MAP_STYLE_1 1 +#define MAP_STYLE_2 2 + +#define _360_JOY_BUTTON_A 0x00000001 +#define _360_JOY_BUTTON_B 0x00000002 +#define _360_JOY_BUTTON_X 0x00000004 +#define _360_JOY_BUTTON_Y 0x00000008 + +#define _360_JOY_BUTTON_START 0x00000010 +#define _360_JOY_BUTTON_BACK 0x00000020 +#define _360_JOY_BUTTON_RB 0x00000040 +#define _360_JOY_BUTTON_LB 0x00000080 + +#define _360_JOY_BUTTON_RTHUMB 0x00000100 +#define _360_JOY_BUTTON_LTHUMB 0x00000200 +#define _360_JOY_BUTTON_DPAD_UP 0x00000400 +#define _360_JOY_BUTTON_DPAD_DOWN 0x00000800 + +#define _360_JOY_BUTTON_DPAD_LEFT 0x00001000 +#define _360_JOY_BUTTON_DPAD_RIGHT 0x00002000 +// fake digital versions of analog values +#define _360_JOY_BUTTON_LSTICK_RIGHT 0x00004000 +#define _360_JOY_BUTTON_LSTICK_LEFT 0x00008000 + +#define _360_JOY_BUTTON_RSTICK_DOWN 0x00010000 +#define _360_JOY_BUTTON_RSTICK_UP 0x00020000 +#define _360_JOY_BUTTON_RSTICK_RIGHT 0x00040000 +#define _360_JOY_BUTTON_RSTICK_LEFT 0x00080000 + +#define _360_JOY_BUTTON_LSTICK_DOWN 0x00100000 +#define _360_JOY_BUTTON_LSTICK_UP 0x00200000 +#define _360_JOY_BUTTON_RT 0x00400000 +#define _360_JOY_BUTTON_LT 0x00800000 + +// Stick axis maps - to allow changes for SouthPaw in-game axis mapping +#define AXIS_MAP_LX 0 +#define AXIS_MAP_LY 1 +#define AXIS_MAP_RX 2 +#define AXIS_MAP_RY 3 + +// Trigger map - to allow for swap triggers in-game +#define TRIGGER_MAP_0 0 +#define TRIGGER_MAP_1 1 + +enum EKeyboardResult +{ + EKeyboard_Pending, + EKeyboard_Cancelled, + EKeyboard_ResultAccept, + EKeyboard_ResultDecline, +}; + +typedef struct _STRING_VERIFY_RESPONSE +{ + WORD wNumStrings; + HRESULT* pStringResult; +} +STRING_VERIFY_RESPONSE; + +class C_4JInput +{ +public: + + + enum EKeyboardMode + { + EKeyboardMode_Default, + EKeyboardMode_Numeric, + EKeyboardMode_Password, + EKeyboardMode_Alphabet, + EKeyboardMode_Full, + EKeyboardMode_Alphabet_Extended, + EKeyboardMode_IP_Address, + EKeyboardMode_Phone + }; + + void Initialise(int iInputStateC, unsigned char ucMapC, unsigned char ucActionC, unsigned char ucMenuActionC); + void Tick(void); + void SetDeadzoneAndMovementRange(unsigned int uiDeadzone, unsigned int uiMovementRangeMax); + void SetGameJoypadMaps(unsigned char ucMap, unsigned char ucAction, unsigned int uiActionVal); + unsigned int GetGameJoypadMaps(unsigned char ucMap, unsigned char ucAction); + void SetJoypadMapVal(int iPad, unsigned char ucMap); + unsigned char GetJoypadMapVal(int iPad); + void SetJoypadSensitivity(int iPad, float fSensitivity); + unsigned int GetValue(int iPad, unsigned char ucAction, bool bRepeat = false); + bool ButtonPressed(int iPad, unsigned char ucAction = 255); // toggled + bool ButtonReleased(int iPad, unsigned char ucAction); //toggled + bool ButtonDown(int iPad, unsigned char ucAction = 255); // button held down + // Functions to remap the axis and triggers for in-game (not menus) - SouthPaw, etc + void SetJoypadStickAxisMap(int iPad, unsigned int uiFrom, unsigned int uiTo); + void SetJoypadStickTriggerMap(int iPad, unsigned int uiFrom, unsigned int uiTo); + void SetKeyRepeatRate(float fRepeatDelaySecs, float fRepeatRateSecs); + void SetDebugSequence(const char* chSequenceA, int(*Func)(LPVOID), LPVOID lpParam); + FLOAT GetIdleSeconds(int iPad); + bool IsPadConnected(int iPad); + + // In-Game values which may have been remapped due to Southpaw, swap triggers, etc + float GetJoypadStick_LX(int iPad, bool bCheckMenuDisplay = true); + float GetJoypadStick_LY(int iPad, bool bCheckMenuDisplay = true); + float GetJoypadStick_RX(int iPad, bool bCheckMenuDisplay = true); + float GetJoypadStick_RY(int iPad, bool bCheckMenuDisplay = true); + unsigned char GetJoypadLTrigger(int iPad, bool bCheckMenuDisplay = true); + unsigned char GetJoypadRTrigger(int iPad, bool bCheckMenuDisplay = true); + + void SetMenuDisplayed(int iPad, bool bVal); + + // EKeyboardResult RequestKeyboard(UINT uiTitle, UINT uiText, UINT uiDesc, DWORD dwPad, WCHAR *pwchResult, UINT uiResultSize,int( *Func)(LPVOID,const bool),LPVOID lpParam,EKeyboardMode eMode,C4JStringTable *pStringTable=NULL); + // EKeyboardResult RequestKeyboard(UINT uiTitle, LPCWSTR pwchDefault, UINT uiDesc, DWORD dwPad, WCHAR *pwchResult, UINT uiResultSize,int( *Func)(LPVOID,const bool),LPVOID lpParam, EKeyboardMode eMode,C4JStringTable *pStringTable=NULL); + EKeyboardResult RequestKeyboard(LPCWSTR Title, LPCWSTR Text, DWORD dwPad, UINT uiMaxChars, int(*Func)(LPVOID, const bool), LPVOID lpParam, C_4JInput::EKeyboardMode eMode); + void GetText(uint16_t* UTF16String); + + // Online check strings against offensive list - TCR 92 + // TCR # 092 CMTV Player Text String Verification + // Requirement Any player-entered text visible to another player on Xbox LIVE must be verified using the Xbox LIVE service before being transmitted. Text that is rejected by the Xbox LIVE service must not be displayed. + // + // Remarks + // This requirement applies to any player-entered string that can be exposed to other players on Xbox LIVE. It includes session names, content descriptions, text messages, tags, team names, mottos, comments, and so on. + // + // Games may decide to not send the text, blank it out, or use generic text if the text was rejected by the Xbox LIVE service. + // + // Games verify the text by calling the XStringVerify function. + // + // Exemption It is not required to use the Xbox LIVE service to verify real-time text communication. An example of real-time text communication is in-game text chat. + // + // Intent Protect players from inappropriate language. + bool VerifyStrings(WCHAR** pwStringA, int iStringC, int(*Func)(LPVOID, STRING_VERIFY_RESPONSE*), LPVOID lpParam); + void CancelQueuedVerifyStrings(int(*Func)(LPVOID, STRING_VERIFY_RESPONSE*), LPVOID lpParam); + void CancelAllVerifyInProgress(void); + + //bool InputDetected(DWORD dwUserIndex,WCHAR *pwchInput); +}; + +// Singleton +extern C_4JInput InputManager; diff --git a/inc/4J_Profile.h b/inc/4J_Profile.h new file mode 100644 index 0000000..f1bd85b --- /dev/null +++ b/inc/4J_Profile.h @@ -0,0 +1,128 @@ +#pragma once + +enum eAwardType +{ + eAwardType_Achievement = 0, + eAwardType_GamerPic, + eAwardType_Theme, + eAwardType_AvatarItem, +}; + +enum eUpsellType +{ + eUpsellType_Custom = 0, // This is the default, and means that the upsell dialog was initiated in the app code + eUpsellType_Achievement, + eUpsellType_GamerPic, + eUpsellType_Theme, + eUpsellType_AvatarItem, +}; + +enum eUpsellResponse +{ + eUpsellResponse_Declined, + eUpsellResponse_Accepted_NoPurchase, + eUpsellResponse_Accepted_Purchase, +}; + + + +class C_4JProfile +{ +public: + struct PROFILESETTINGS + { + int iYAxisInversion; + int iControllerSensitivity; + int iVibration; + bool bSwapSticks; + }; + + + // 4 players have game defined data, puiGameDefinedDataChangedBitmask needs to be checked by the game side to see if there's an update needed - it'll have the bits set for players to be updated + void Initialise( DWORD dwTitleID, + DWORD dwOfferID, + unsigned short usProfileVersion, + UINT uiProfileValuesC, + UINT uiProfileSettingsC, + DWORD *pdwProfileSettingsA, + int iGameDefinedDataSizeX4, + unsigned int *puiGameDefinedDataChangedBitmask); + void SetTrialTextStringTable(CXuiStringTable *pStringTable,int iAccept,int iReject); + void SetTrialAwardText(eAwardType AwardType,int iTitle,int iText); // achievement popup in the trial game + int GetLockedProfile(); + void SetLockedProfile(int iProf); + bool IsSignedIn(int iQuadrant); + bool IsSignedInLive(int iProf); + bool IsGuest(int iQuadrant); + UINT RequestSignInUI(bool bFromInvite,bool bLocalGame,bool bNoGuestsAllowed,bool bMultiplayerSignIn,bool bAddUser, int( *Func)(LPVOID,const bool, const int iPad),LPVOID lpParam,int iQuadrant=XUSER_INDEX_ANY); + UINT DisplayOfflineProfile(int( *Func)(LPVOID,const bool, const int iPad),LPVOID lpParam,int iQuadrant=XUSER_INDEX_ANY); + UINT RequestConvertOfflineToGuestUI(int( *Func)(LPVOID,const bool, const int iPad),LPVOID lpParam,int iQuadrant=XUSER_INDEX_ANY); + void SetPrimaryPlayerChanged(bool bVal); + bool QuerySigninStatus(void); + void GetXUID(int iPad, PlayerUID *pXuid,bool bOnlineXuid); + BOOL AreXUIDSEqual(PlayerUID xuid1,PlayerUID xuid2); + BOOL XUIDIsGuest(PlayerUID xuid); + bool AllowedToPlayMultiplayer(int iProf); + bool GetChatAndContentRestrictions(int iPad,bool *pbChatRestricted,bool *pbContentRestricted,int *piAge); + void StartTrialGame(); // disables saves and leaderboard, and change state to readyforgame from pregame + void AllowedPlayerCreatedContent(int iPad, bool thisQuadrantOnly, BOOL *allAllowed, BOOL *friendsAllowed); + BOOL CanViewPlayerCreatedContent(int iPad, bool thisQuadrantOnly, PPlayerUID pXuids, DWORD dwXuidCount ); + void ShowProfileCard(int iPad, PlayerUID targetUid); + bool GetProfileAvatar(int iPad,int( *Func)(LPVOID lpParam,PBYTE pbThumbnail,DWORD dwThumbnailBytes), LPVOID lpParam); + void CancelProfileAvatarRequest(); + + + // SYS + int GetPrimaryPad(); + void SetPrimaryPad(int iPad); + char* GetGamertag(int iPad); + wstring GetDisplayName(int iPad); + bool IsFullVersion(); + void SetSignInChangeCallback(void ( *Func)(LPVOID, bool, unsigned int),LPVOID lpParam); + void SetNotificationsCallback(void ( *Func)(LPVOID, DWORD, unsigned int),LPVOID lpParam); + bool RegionIsNorthAmerica(void); + bool LocaleIsUSorCanada(void); + HRESULT GetLiveConnectionStatus(); + bool IsSystemUIDisplayed(); + void SetProfileReadErrorCallback(void ( *Func)(LPVOID), LPVOID lpParam); + + + // PROFILE DATA + int SetDefaultOptionsCallback(int( *Func)(LPVOID,PROFILESETTINGS *, const int iPad),LPVOID lpParam); + int SetOldProfileVersionCallback(int( *Func)(LPVOID,unsigned char *, const unsigned short,const int),LPVOID lpParam); + PROFILESETTINGS * GetDashboardProfileSettings(int iPad); + void WriteToProfile(int iQuadrant, bool bGameDefinedDataChanged=false, bool bOverride5MinuteLimitOnProfileWrites=false); + void ForceQueuedProfileWrites(int iPad=XUSER_INDEX_ANY); + void *GetGameDefinedProfileData(int iQuadrant); + void ResetProfileProcessState(); // after a sign out from the primary player, call this + void Tick( void ); + + // ACHIEVEMENTS & AWARDS + + void RegisterAward(int iAwardNumber,int iGamerconfigID, eAwardType eType, bool bLeaderboardAffected=false, + CXuiStringTable*pStringTable=NULL, int iTitleStr=-1, int iTextStr=-1, int iAcceptStr=-1, char *pszThemeName=NULL, unsigned int uiThemeSize=0L); + int GetAwardId(int iAwardNumber); + eAwardType GetAwardType(int iAwardNumber); + bool CanBeAwarded(int iQuadrant, int iAwardNumber); + void Award(int iQuadrant, int iAwardNumber, bool bForce=false); + bool IsAwardsFlagSet(int iQuadrant, int iAward); + + // RICH PRESENCE + + void RichPresenceInit(int iPresenceCount, int iContextCount); + void RegisterRichPresenceContext(int iGameConfigContextID); + void SetRichPresenceContextValue(int iPad,int iContextID, int iVal); + void SetCurrentGameActivity(int iPad,int iNewPresence, bool bSetOthersToIdle=false); + + // PURCHASE + void DisplayFullVersionPurchase(bool bRequired, int iQuadrant, int iUpsellParam = -1); + void SetUpsellCallback(void ( *Func)(LPVOID lpParam, eUpsellType type, eUpsellResponse response, int iUserData),LPVOID lpParam); + + // Debug + void SetDebugFullOverride(bool bVal); // To override the license version (trail/full). Only in debug/release, not ContentPackage + +}; + +// Singleton +extern C_4JProfile ProfileManager; + diff --git a/inc/4J_Render.h b/inc/4J_Render.h new file mode 100644 index 0000000..d794b10 --- /dev/null +++ b/inc/4J_Render.h @@ -0,0 +1,316 @@ +#pragma once + +class ImageFileBuffer +{ +public: + enum EImageType + { + e_typePNG, + e_typeJPG + }; + + EImageType m_type; + void *m_pBuffer; + int m_bufferSize; + + int GetType() + { + return m_type; + } + void *GetBufferPointer() + { + return m_pBuffer; + } + int GetBufferSize() + { + return m_bufferSize; + } + void Release() + { + free(m_pBuffer); + m_pBuffer = NULL; + } + bool Allocated() + { + return m_pBuffer != NULL; + } +}; + +typedef struct +{ + int Width; + int Height; +} D3DXIMAGE_INFO; + +typedef struct _XSOCIAL_PREVIEWIMAGE +{ + BYTE *pBytes; + DWORD Pitch; + DWORD Width; + DWORD Height; + // D3DFORMAT Format; +} XSOCIAL_PREVIEWIMAGE, *PXSOCIAL_PREVIEWIMAGE; + +class C4JRender +{ +public: + void Tick(); + void UpdateGamma(unsigned short usGamma); + + // Matrix stack + void MatrixMode(int type); + void MatrixSetIdentity(); + void MatrixTranslate(float x, float y, float z); + void MatrixRotate(float angle, float x, float y, float z); + void MatrixScale(float x, float y, float z); + void MatrixPerspective(float fovy, float aspect, float zNear, float zFar); + void MatrixOrthogonal(float left, float right, float bottom, float top, float zNear, float zFar); + void MatrixPop(); + void MatrixPush(); + void MatrixMult(float *mat); + const float *MatrixGet(int type); + void Set_matrixDirty(); + + // Core + void Initialise(ID3D11Device *pDevice, IDXGISwapChain *pSwapChain); + void InitialiseContext(); + void StartFrame(); + void DoScreenGrabOnNextPresent(); + void Present(); + void Clear(int flags, D3D11_RECT *pRect = NULL); + void SetClearColour(const float colourRGBA[4]); + bool IsWidescreen(); + bool IsHiDef(); + void CaptureThumbnail(ImageFileBuffer *pngOut); + void CaptureScreen(ImageFileBuffer *jpgOut, XSOCIAL_PREVIEWIMAGE *previewOut); + void BeginConditionalSurvey(int identifier); + void EndConditionalSurvey(); + void BeginConditionalRendering(int identifier); + void EndConditionalRendering(); + + // Vertex data handling + typedef enum + { + VERTEX_TYPE_PF3_TF2_CB4_NB4_XW1, // Position 3 x float, texture 2 x float, colour 4 x byte, normal 4 x byte, padding 1 DWORD + VERTEX_TYPE_COMPRESSED, // Compressed format - see comment at top of VS_PS3_TS2_CS1.hlsl for description of layout + VERTEX_TYPE_PF3_TF2_CB4_NB4_XW1_LIT, // as VERTEX_TYPE_PF3_TF2_CB4_NB4_XW1 with lighting applied, + VERTEX_TYPE_PF3_TF2_CB4_NB4_XW1_TEXGEN, // as VERTEX_TYPE_PF3_TF2_CB4_NB4_XW1 with tex gen + VERTEX_TYPE_COUNT + } eVertexType; + + // Pixel shader + typedef enum + { + PIXEL_SHADER_TYPE_STANDARD, + PIXEL_SHADER_TYPE_PROJECTION, + PIXEL_SHADER_TYPE_FORCELOD, + PIXEL_SHADER_COUNT + } ePixelShaderType; + + typedef enum + { + VIEWPORT_TYPE_FULLSCREEN, + VIEWPORT_TYPE_SPLIT_TOP, + VIEWPORT_TYPE_SPLIT_BOTTOM, + VIEWPORT_TYPE_SPLIT_LEFT, + VIEWPORT_TYPE_SPLIT_RIGHT, + VIEWPORT_TYPE_QUADRANT_TOP_LEFT, + VIEWPORT_TYPE_QUADRANT_TOP_RIGHT, + VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT, + VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT, + } eViewportType; + + typedef enum + { + PRIMITIVE_TYPE_TRIANGLE_LIST, + PRIMITIVE_TYPE_TRIANGLE_STRIP, + PRIMITIVE_TYPE_TRIANGLE_FAN, + PRIMITIVE_TYPE_QUAD_LIST, + PRIMITIVE_TYPE_LINE_LIST, + PRIMITIVE_TYPE_LINE_STRIP, + PRIMITIVE_TYPE_COUNT + } ePrimitiveType; + + void DrawVertices(ePrimitiveType PrimitiveType, int count, void *dataIn, eVertexType vType, C4JRender::ePixelShaderType psType); + void DrawVertexBuffer(ePrimitiveType PrimitiveType, int count, ID3D11Buffer *buffer, C4JRender::eVertexType vType, + C4JRender::ePixelShaderType psType); + + // Command buffers + void CBuffLockStaticCreations(); + int CBuffCreate(int count); + void CBuffDelete(int first, int count); + void CBuffStart(int index, bool full = false); + void CBuffClear(int index); + int CBuffSize(int index); + void CBuffEnd(); + bool CBuffCall(int index, bool full = true); + void CBuffTick(); + void CBuffDeferredModeStart(); + void CBuffDeferredModeEnd(); + + typedef enum + { + TEXTURE_FORMAT_RxGyBzAw, // Normal 32-bit RGBA texture, 8 bits per component + /* Don't think these are all directly available on D3D 11 - leaving for now + TEXTURE_FORMAT_R0G0B0Ax, // One 8-bit component mapped to alpha channel, R=G=B=0 + TEXTURE_FORMAT_R1G1B1Ax, // One 8-bit component mapped to alpha channel, R=G=B=1 + TEXTURE_FORMAT_RxGxBxAx, // One 8-bit component mapped to all channels + */ + MAX_TEXTURE_FORMATS + } eTextureFormat; + + // Textures + int TextureCreate(); + void TextureFree(int idx); + void TextureBind(int idx); + void TextureBindVertex(int idx); + void TextureSetTextureLevels(int levels); + int TextureGetTextureLevels(); + void TextureData(int width, int height, void *data, int level, eTextureFormat format = TEXTURE_FORMAT_RxGyBzAw); + void TextureDataUpdate(int xoffset, int yoffset, int width, int height, void *data, int level); + void TextureSetParam(int param, int value); + void TextureDynamicUpdateStart(); + void TextureDynamicUpdateEnd(); + HRESULT LoadTextureData(const char *szFilename, D3DXIMAGE_INFO *pSrcInfo, int **ppDataOut); + HRESULT LoadTextureData(BYTE *pbData, DWORD dwBytes, D3DXIMAGE_INFO *pSrcInfo, int **ppDataOut); + HRESULT SaveTextureData(const char *szFilename, D3DXIMAGE_INFO *pSrcInfo, int *ppDataOut); + HRESULT SaveTextureDataToMemory(void *pOutput, int outputCapacity, int *outputLength, int width, int height, int *ppDataIn); + void TextureGetStats(); + ID3D11ShaderResourceView *TextureGetTexture(int idx); + + // State control + void StateSetColour(float r, float g, float b, float a); + void StateSetDepthMask(bool enable); + void StateSetBlendEnable(bool enable); + void StateSetBlendFunc(int src, int dst); + void StateSetBlendFactor(unsigned int colour); + void StateSetAlphaFunc(int func, float param); + void StateSetDepthFunc(int func); + void StateSetFaceCull(bool enable); + void StateSetFaceCullCW(bool enable); + void StateSetLineWidth(float width); + void StateSetWriteEnable(bool red, bool green, bool blue, bool alpha); + void StateSetDepthTestEnable(bool enable); + void StateSetAlphaTestEnable(bool enable); + void StateSetDepthSlopeAndBias(float slope, float bias); + void StateSetFogEnable(bool enable); + void StateSetFogMode(int mode); + void StateSetFogNearDistance(float dist); + void StateSetFogFarDistance(float dist); + void StateSetFogDensity(float density); + void StateSetFogColour(float red, float green, float blue); + void StateSetLightingEnable(bool enable); + void StateSetVertexTextureUV(float u, float v); + void StateSetLightColour(int light, float red, float green, float blue); + void StateSetLightAmbientColour(float red, float green, float blue); + void StateSetLightDirection(int light, float x, float y, float z); + void StateSetLightEnable(int light, bool enable); + void StateSetViewport(eViewportType viewportType); + void StateSetEnableViewportClipPlanes(bool enable); + void StateSetTexGenCol(int col, float x, float y, float z, float w, bool eyeSpace); + void StateSetStencil(int Function, uint8_t stencil_ref, uint8_t stencil_func_mask, uint8_t stencil_write_mask); + void StateSetForceLOD(int LOD); + + // Event tracking + void BeginEvent(LPCWSTR eventName); + void EndEvent(); + + // PLM event handling + void Suspend(); + bool Suspended(); + void Resume(); +}; + +const int GL_MODELVIEW_MATRIX = 0; +const int GL_PROJECTION_MATRIX = 1; +const int GL_MODELVIEW = 0; +const int GL_PROJECTION = 1; +const int GL_TEXTURE = 2; + +// These things required for tex gen + +const int GL_S = 0; +const int GL_T = 1; +const int GL_R = 2; +const int GL_Q = 3; + +const int GL_TEXTURE_GEN_S = 0; +const int GL_TEXTURE_GEN_T = 1; +const int GL_TEXTURE_GEN_Q = 2; +const int GL_TEXTURE_GEN_R = 3; + +const int GL_TEXTURE_GEN_MODE = 0; +const int GL_OBJECT_LINEAR = 0; +const int GL_EYE_LINEAR = 1; +const int GL_OBJECT_PLANE = 0; +const int GL_EYE_PLANE = 1; + +// These things are used by glEnable/glDisable so must be different and non-zero (zero is used by things we haven't assigned yet) +const int GL_TEXTURE_2D = 1; +const int GL_BLEND = 2; +const int GL_CULL_FACE = 3; +const int GL_ALPHA_TEST = 4; +const int GL_DEPTH_TEST = 5; +const int GL_FOG = 6; +const int GL_LIGHTING = 7; +const int GL_LIGHT0 = 8; +const int GL_LIGHT1 = 9; + +const int CLEAR_DEPTH_FLAG = 1; +const int CLEAR_COLOUR_FLAG = 2; + +const int GL_DEPTH_BUFFER_BIT = CLEAR_DEPTH_FLAG; +const int GL_COLOR_BUFFER_BIT = CLEAR_COLOUR_FLAG; + +const int GL_SRC_ALPHA = D3D11_BLEND_SRC_ALPHA; +const int GL_ONE_MINUS_SRC_ALPHA = D3D11_BLEND_INV_SRC_ALPHA; +const int GL_ONE = D3D11_BLEND_ONE; +const int GL_ZERO = D3D11_BLEND_ZERO; +const int GL_DST_ALPHA = D3D11_BLEND_DEST_ALPHA; +const int GL_SRC_COLOR = D3D11_BLEND_SRC_COLOR; +const int GL_DST_COLOR = D3D11_BLEND_DEST_COLOR; +const int GL_ONE_MINUS_DST_COLOR = D3D11_BLEND_INV_DEST_COLOR; +const int GL_ONE_MINUS_SRC_COLOR = D3D11_BLEND_INV_SRC_COLOR; +const int GL_CONSTANT_ALPHA = D3D11_BLEND_BLEND_FACTOR; +const int GL_ONE_MINUS_CONSTANT_ALPHA = D3D11_BLEND_INV_BLEND_FACTOR; + +const int GL_GREATER = D3D11_COMPARISON_GREATER; +const int GL_EQUAL = D3D11_COMPARISON_EQUAL; +const int GL_LEQUAL = D3D11_COMPARISON_LESS_EQUAL; +const int GL_GEQUAL = D3D11_COMPARISON_GREATER_EQUAL; +const int GL_ALWAYS = D3D11_COMPARISON_ALWAYS; + +const int GL_TEXTURE_MIN_FILTER = 1; +const int GL_TEXTURE_MAG_FILTER = 2; +const int GL_TEXTURE_WRAP_S = 3; +const int GL_TEXTURE_WRAP_T = 4; + +const int GL_NEAREST = 0; +const int GL_LINEAR = 1; +const int GL_EXP = 2; +const int GL_NEAREST_MIPMAP_LINEAR = 0; // TODO - mipmapping bit of this + +const int GL_CLAMP = 0; +const int GL_REPEAT = 1; + +const int GL_FOG_START = 1; +const int GL_FOG_END = 2; +const int GL_FOG_MODE = 3; +const int GL_FOG_DENSITY = 4; +const int GL_FOG_COLOR = 5; + +const int GL_POSITION = 1; +const int GL_AMBIENT = 2; +const int GL_DIFFUSE = 3; +const int GL_SPECULAR = 4; + +const int GL_LIGHT_MODEL_AMBIENT = 1; + +const int GL_LINES = C4JRender::PRIMITIVE_TYPE_LINE_LIST; +const int GL_LINE_STRIP = C4JRender::PRIMITIVE_TYPE_LINE_STRIP; +const int GL_QUADS = C4JRender::PRIMITIVE_TYPE_QUAD_LIST; +const int GL_TRIANGLE_FAN = C4JRender::PRIMITIVE_TYPE_TRIANGLE_FAN; +const int GL_TRIANGLE_STRIP = C4JRender::PRIMITIVE_TYPE_TRIANGLE_STRIP; + +// Singleton +extern C4JRender RenderManager; diff --git a/inc/4J_Storage.h b/inc/4J_Storage.h new file mode 100644 index 0000000..644e806 --- /dev/null +++ b/inc/4J_Storage.h @@ -0,0 +1,344 @@ +#pragma once +#include +//#include +class C4JStringTable; + +#define MAX_DISPLAYNAME_LENGTH 128 // CELL_SAVEDATA_SYSP_SUBTITLE_SIZE on PS3 +#define MAX_DETAILS_LENGTH 128 // CELL_SAVEDATA_SYSP_SUBTITLE_SIZE on PS3 +#define MAX_SAVEFILENAME_LENGTH 32 // CELL_SAVEDATA_DIRNAME_SIZE + +typedef struct +{ + time_t modifiedTime; + unsigned int dataSize; + unsigned int thumbnailSize; +} +CONTAINER_METADATA; + +typedef struct +{ + char UTF8SaveFilename[MAX_SAVEFILENAME_LENGTH]; + char UTF8SaveTitle[MAX_DISPLAYNAME_LENGTH]; + CONTAINER_METADATA metaData; + PBYTE thumbnailData; +} +SAVE_INFO, * PSAVE_INFO; + +typedef struct +{ + int iSaveC; + PSAVE_INFO SaveInfoA; +} +SAVE_DETAILS, * PSAVE_DETAILS; + +typedef std::vector OfferDataArray; +typedef std::vector XContentDataArray; +//typedef std::vector SaveDetailsArray; + +// Current version of the dlc data creator +#define CURRENT_DLC_VERSION_NUM 3 + +class C4JStorage +{ + +public: + // Structs defined in the DLC_Creator, but added here to be used in the app + typedef struct + { + unsigned int uiFileSize; + DWORD dwType; + DWORD dwWchCount; // count of WCHAR in next array + WCHAR wchFile[1]; + } + DLC_FILE_DETAILS, * PDLC_FILE_DETAILS; + + typedef struct + { + DWORD dwType; + DWORD dwWchCount; // count of WCHAR in next array; + WCHAR wchData[1]; // will be an array of size dwBytes + } + DLC_FILE_PARAM, * PDLC_FILE_PARAM; + // End of DLC_Creator structs + + typedef struct + { + WCHAR wchDisplayName[XCONTENT_MAX_DISPLAYNAME_LENGTH]; + CHAR szFileName[XCONTENT_MAX_FILENAME_LENGTH]; + DWORD dwImageOffset; + DWORD dwImageBytes; + } + CACHEINFOSTRUCT; + + // structure to hold DLC info in TMS + typedef struct + { + DWORD dwVersion; + DWORD dwNewOffers; + DWORD dwTotalOffers; + DWORD dwInstalledTotalOffers; + BYTE bPadding[1024 - sizeof(DWORD) * 4]; // future expansion + } + DLC_TMS_DETAILS; + + enum eGTS_FileTypes + { + eGTS_Type_Skin = 0, + eGTS_Type_Cape, + eGTS_Type_MAX + }; + + enum eGlobalStorage + { + //eGlobalStorage_GameClip=0, + eGlobalStorage_Title = 0, + eGlobalStorage_TitleUser, + eGlobalStorage_Max + }; + + enum EMessageResult + { + EMessage_Undefined = 0, + EMessage_Busy, + EMessage_Pending, + EMessage_Cancelled, + EMessage_ResultAccept, + EMessage_ResultDecline, + EMessage_ResultThirdOption, + EMessage_ResultFourthOption + }; + + enum ESaveGameControlState + { + ESaveGameControl_Idle = 0, + ESaveGameControl_Save, + ESaveGameControl_InternalRequestingDevice, + ESaveGameControl_InternalGetSaveName, + ESaveGameControl_InternalSaving, + ESaveGameControl_CopySave, + ESaveGameControl_CopyingSave, + }; + + enum ESaveGameState + { + ESaveGame_Idle = 0, + ESaveGame_Save, + ESaveGame_InternalRequestingDevice, + ESaveGame_InternalGetSaveName, + ESaveGame_InternalSaving, + ESaveGame_CopySave, + ESaveGame_CopyingSave, + ESaveGame_Load, + ESaveGame_GetSavesInfo, + ESaveGame_Rename, + ESaveGame_Delete, + + ESaveGame_GetSaveThumbnail // Not used as an actual state in the PS4, but the game expects this to be returned to indicate success when getting a thumbnail + + }; + enum ELoadGameStatus + { + ELoadGame_Idle = 0, + ELoadGame_InProgress, + ELoadGame_NoSaves, + ELoadGame_ChangedDevice, + ELoadGame_DeviceRemoved + }; + + enum EDeleteGameStatus + { + EDeleteGame_Idle = 0, + EDeleteGame_InProgress, + }; + + + enum ESGIStatus + { + ESGIStatus_Error = 0, + ESGIStatus_Idle, + ESGIStatus_ReadInProgress, + ESGIStatus_NoSaves, + }; + + enum EDLCStatus + { + EDLC_Error = 0, + EDLC_Idle, + EDLC_NoOffers, + EDLC_AlreadyEnumeratedAllOffers, + EDLC_NoInstalledDLC, + EDLC_Pending, + EDLC_LoadInProgress, + EDLC_Loaded, + EDLC_ChangedDevice + }; + + enum ESavingMessage + { + ESavingMessage_None = 0, + ESavingMessage_Short, + ESavingMessage_Long + }; + + enum ETMSStatus + { + ETMSStatus_Idle = 0, + ETMSStatus_Fail, + ETMSStatus_Fail_ReadInProgress, + ETMSStatus_Fail_WriteInProgress, + ETMSStatus_Pending, + }; + + enum eTMS_FileType + { + eTMS_FileType_Normal = 0, + eTMS_FileType_Graphic, + }; + + enum eTMS_FILETYPEVAL + { + TMS_FILETYPE_BINARY, + TMS_FILETYPE_CONFIG, + TMS_FILETYPE_JSON, + TMS_FILETYPE_MAX + }; + enum eTMS_UGCTYPE + { + TMS_UGCTYPE_NONE, + TMS_UGCTYPE_IMAGE, + TMS_UGCTYPE_MAX + }; + + + typedef struct + { + CHAR szFilename[256]; + int iFileSize; + eTMS_FILETYPEVAL eFileTypeVal; + } + TMSPP_FILE_DETAILS, * PTMSPP_FILE_DETAILS; + + typedef struct + { + int iCount; + PTMSPP_FILE_DETAILS FileDetailsA; + } + TMSPP_FILE_LIST, * PTMSPP_FILE_LIST; + + typedef struct + { + DWORD dwSize; + PBYTE pbData; + } + TMSPP_FILEDATA, * PTMSPP_FILEDATA; + + + C4JStorage(); + + void Tick(void); + + // Messages + C4JStorage::EMessageResult RequestMessageBox(UINT uiTitle, UINT uiText, UINT* uiOptionA, UINT uiOptionC, DWORD dwPad = XUSER_INDEX_ANY, + int(*Func)(LPVOID, int, const C4JStorage::EMessageResult) = NULL, LPVOID lpParam = NULL, C4JStringTable* pStringTable = NULL, WCHAR* pwchFormatString = NULL, DWORD dwFocusButton = 0); + + + C4JStorage::EMessageResult GetMessageBoxResult(); + + // save device + bool SetSaveDevice(int(*Func)(LPVOID, const bool), LPVOID lpParam, bool bForceResetOfSaveDevice = false); + + // savegame + void Init(unsigned int uiSaveVersion, LPCWSTR pwchDefaultSaveName, char* pszSavePackName, int iMinimumSaveSize, int(*Func)(LPVOID, const ESavingMessage, int), LPVOID lpParam, LPCSTR szGroupID); + void ResetSaveData(); // Call before a new save to clear out stored save file name + void SetDefaultSaveNameForKeyboardDisplay(LPCWSTR pwchDefaultSaveName); + void SetSaveTitle(LPCWSTR pwchDefaultSaveName); + bool GetSaveUniqueNumber(INT* piVal); + bool GetSaveUniqueFilename(char* pszName); + void SetSaveUniqueFilename(char* szFilename); + void SetState(ESaveGameControlState eControlState, int(*Func)(LPVOID, const bool), LPVOID lpParam); + void SetSaveDisabled(bool bDisable); + bool GetSaveDisabled(void); + unsigned int GetSaveSize(); + void GetSaveData(void* pvData, unsigned int* puiBytes); + PVOID AllocateSaveData(unsigned int uiBytes); + void SetSaveImages(PBYTE pbThumbnail, DWORD dwThumbnailBytes, PBYTE pbImage, DWORD dwImageBytes, PBYTE pbTextData, DWORD dwTextDataBytes); // Sets the thumbnail & image for the save, optionally setting the metadata in the png + C4JStorage::ESaveGameState SaveSaveData(int(*Func)(LPVOID, const bool), LPVOID lpParam); + void CopySaveDataToNewSave(PBYTE pbThumbnail, DWORD cbThumbnail, WCHAR* wchNewName, int (*Func)(LPVOID lpParam, bool), LPVOID lpParam); + void SetSaveDeviceSelected(unsigned int uiPad, bool bSelected); + bool GetSaveDeviceSelected(unsigned int iPad); + C4JStorage::ESaveGameState DoesSaveExist(bool* pbExists); + bool EnoughSpaceForAMinSaveGame(); + + void SetSaveMessageVPosition(float fY); // The 'Saving' message will display at a default position unless changed + // Get the info for the saves + C4JStorage::ESaveGameState GetSavesInfo(int iPad, int (*Func)(LPVOID lpParam, SAVE_DETAILS* pSaveDetails, const bool), LPVOID lpParam, char* pszSavePackName); + PSAVE_DETAILS ReturnSavesInfo(); + void ClearSavesInfo(); // Clears results + C4JStorage::ESaveGameState LoadSaveDataThumbnail(PSAVE_INFO pSaveInfo, int(*Func)(LPVOID lpParam, PBYTE pbThumbnail, DWORD dwThumbnailBytes), LPVOID lpParam); // Get the thumbnail for an individual save referenced by pSaveInfo + + void GetSaveCacheFileInfo(DWORD dwFile, XCONTENT_DATA& xContentData); + void GetSaveCacheFileInfo(DWORD dwFile, PBYTE* ppbImageData, DWORD* pdwImageBytes); + + // Load the save. Need to call GetSaveData once the callback is called + C4JStorage::ESaveGameState LoadSaveData(PSAVE_INFO pSaveInfo, int(*Func)(LPVOID lpParam, const bool, const bool), LPVOID lpParam); + C4JStorage::ESaveGameState DeleteSaveData(PSAVE_INFO pSaveInfo, int(*Func)(LPVOID lpParam, const bool), LPVOID lpParam); + + // DLC + void RegisterMarketplaceCountsCallback(int (*Func)(LPVOID lpParam, C4JStorage::DLC_TMS_DETAILS*, int), LPVOID lpParam); + void SetDLCPackageRoot(char* pszDLCRoot); + C4JStorage::EDLCStatus GetDLCOffers(int iPad, int(*Func)(LPVOID, int, DWORD, int), LPVOID lpParam, DWORD dwOfferTypesBitmask = XMARKETPLACE_OFFERING_TYPE_CONTENT); + DWORD CancelGetDLCOffers(); + void ClearDLCOffers(); + XMARKETPLACE_CONTENTOFFER_INFO& GetOffer(DWORD dw); + int GetOfferCount(); + DWORD InstallOffer(int iOfferIDC, __uint64* ullOfferIDA, int(*Func)(LPVOID, int, int), LPVOID lpParam, bool bTrial = false); + DWORD GetAvailableDLCCount(int iPad); + + C4JStorage::EDLCStatus GetInstalledDLC(int iPad, int(*Func)(LPVOID, int, int), LPVOID lpParam); + XCONTENT_DATA& GetDLC(DWORD dw); + DWORD MountInstalledDLC(int iPad, DWORD dwDLC, int(*Func)(LPVOID, int, DWORD, DWORD), LPVOID lpParam, LPCSTR szMountDrive = NULL); + DWORD UnmountInstalledDLC(LPCSTR szMountDrive = NULL); + void GetMountedDLCFileList(const char* szMountDrive, std::vector& fileList); + std::string GetMountedPath(std::string szMount); + + // Global title storage + C4JStorage::ETMSStatus ReadTMSFile(int iQuadrant, eGlobalStorage eStorageFacility, C4JStorage::eTMS_FileType eFileType, + WCHAR* pwchFilename, BYTE** ppBuffer, DWORD* pdwBufferSize, int(*Func)(LPVOID, WCHAR*, int, bool, int) = NULL, LPVOID lpParam = NULL, int iAction = 0); + bool WriteTMSFile(int iQuadrant, eGlobalStorage eStorageFacility, WCHAR* pwchFilename, BYTE* pBuffer, DWORD dwBufferSize); + bool DeleteTMSFile(int iQuadrant, eGlobalStorage eStorageFacility, WCHAR* pwchFilename); + void StoreTMSPathName(WCHAR* pwchName = NULL); + + // TMS++ +#ifdef _XBOX + C4JStorage::ETMSStatus WriteTMSFile(int iPad, C4JStorage::eGlobalStorage eStorageFacility, C4JStorage::eTMS_FileType eFileType, CHAR* pchFilePath, CHAR* pchBuffer, DWORD dwBufferSize, TMSCLIENT_CALLBACK Func, LPVOID lpParam); + HRESULT GetUserQuotaInfo(int iPad, TMSCLIENT_CALLBACK Func, LPVOID lpParam); +#endif + + // C4JStorage::ETMSStatus TMSPP_WriteFile(int iPad,C4JStorage::eGlobalStorage eStorageFacility,C4JStorage::eTMS_FILETYPEVAL eFileTypeVal,C4JStorage::eTMS_UGCTYPE eUGCType,CHAR *pchFilePath,CHAR *pchBuffer,DWORD dwBufferSize,int( *Func)(LPVOID,int,int)=NULL,LPVOID lpParam=NULL, int iUserData=0); + // C4JStorage::ETMSStatus TMSPP_GetUserQuotaInfo(int iPad,TMSCLIENT_CALLBACK Func,LPVOID lpParam, int iUserData=0); + C4JStorage::ETMSStatus TMSPP_ReadFile(int iPad, C4JStorage::eGlobalStorage eStorageFacility, C4JStorage::eTMS_FILETYPEVAL eFileTypeVal, LPCSTR szFilename, int(*Func)(LPVOID, int, int, PTMSPP_FILEDATA, LPCSTR) = NULL, LPVOID lpParam = NULL, int iUserData = 0); + // C4JStorage::ETMSStatus TMSPP_ReadFileList(int iPad,C4JStorage::eGlobalStorage eStorageFacility,CHAR *pchFilePath,int( *Func)(LPVOID,int,int,PTMSPP_FILE_LIST)=NULL,LPVOID lpParam=NULL, int iUserData=0); + // C4JStorage::ETMSStatus TMSPP_DeleteFile(int iPad,LPCSTR szFilePath,C4JStorage::eTMS_FILETYPEVAL eFileTypeVal,int( *Func)(LPVOID,int,int),LPVOID lpParam=NULL, int iUserData=0); + // bool TMSPP_InFileList(eGlobalStorage eStorageFacility, int iPad,const wstring &Filename); + // unsigned int CRC(unsigned char *buf, int len); + +// enum eXBLWS +// { +// eXBLWS_GET, +// eXBLWS_POST, +// eXBLWS_PUT, +// eXBLWS_DELETE, +// }; + //bool XBLWS_Command(eXBLWS eCommand); + + + unsigned int CRC(unsigned char* buf, int len); + + // #ifdef _DEBUG + // void SetSaveName(int i); + // #endif + // string table for all the Storage problems. Loaded by the application + C4JStringTable* m_pStringTable; +}; + +extern C4JStorage StorageManager; diff --git a/inc/extraX64.h b/inc/extraX64.h new file mode 100644 index 0000000..c5a63aa --- /dev/null +++ b/inc/extraX64.h @@ -0,0 +1,639 @@ +#pragma once +#include +#include +#include +#include + +#include + +#define MULTITHREAD_ENABLE + +//const int XUSER_INDEX_ANY = 255; +const int XUSER_INDEX_FOCUS = 254; + +#ifdef __PSVITA__ +const int XUSER_MAX_COUNT = 1; +const int MINECRAFT_NET_MAX_PLAYERS = 4; +#else +//const int XUSER_MAX_COUNT = 4; +const int MINECRAFT_NET_MAX_PLAYERS = 8; +#endif + +// @Patoke: i'm sorry i had to do this for compat +namespace sigma +{ + enum class byte : unsigned char {}; +} + +#ifdef __ORBIS__ +#include +#include +#include +#include "..\..\Minecraft.Client\Orbis\Orbis_PlayerUID.h" +#include "..\..\Minecraft.Client\Orbis\Network\SQRNetworkManager_Orbis.h" +typedef SQRNetworkManager_Orbis::SessionID SessionID; +typedef SQRNetworkManager_Orbis::PresenceSyncInfo INVITE_INFO; + +#elif defined __PS3__ // defined in the profile lib +#include +#include +#include +#include +#include +#include "..\..\Minecraft.Client\PS3\PS3_PlayerUID.h" +#include "..\..\Minecraft.Client\PS3\Network\SQRNetworkManager_PS3.h" +typedef SQRNetworkManager::SessionID SessionID; +typedef SQRNetworkManager::PresenceSyncInfo INVITE_INFO; + +#elif defined __PSVITA__ +#include +#include +#include +#include "..\..\Minecraft.Client\PSVita\PSVita_PlayerUID.h" +#include "..\..\Minecraft.Client\PSVita\Network\SQRNetworkManager_Vita.h" +#include "..\..\Minecraft.Client\PSVita\Network\SQRNetworkManager_AdHoc_Vita.h" +typedef SQRNetworkManager_Vita::SessionID SessionID; +typedef SQRNetworkManager_Vita::PresenceSyncInfo INVITE_INFO; + +#elif defined _DURANGO +#include "..\..\Minecraft.Client\Durango\4JLibs\inc\4J_Profile.h" +#include "..\..\Minecraft.Client\Durango\Network\DQRNetworkManager.h" +typedef ULONGLONG SessionID; +typedef ULONGLONG GameSessionUID; +typedef DQRNetworkManager::SessionInfo INVITE_INFO; +#else +typedef ULONGLONG PlayerUID; +typedef ULONGLONG SessionID; +typedef PlayerUID GameSessionUID; +class INVITE_INFO; + +#endif // __PS3__ + +#ifndef _DURANGO +typedef PlayerUID *PPlayerUID; +#endif +typedef struct _XUIOBJ* HXUIOBJ; +typedef struct _XUICLASS* HXUICLASS; +typedef struct _XUIBRUSH* HXUIBRUSH; +typedef struct _XUIDC* HXUIDC; + + + +// #ifdef _DURANGO +// void GetLocalTime(SYSTEMTIME *time); +// #endif + +bool IsEqualXUID(PlayerUID a, PlayerUID b); + +using namespace std; + +// Temporary implementation of lock free stack with quite a bit more locking than you might expect +template class XLockFreeStack +{ + std::vector intStack; +public: + XLockFreeStack() { +#ifdef __ORBIS__ + OrbisInit(); // For PS4, we need to make sure Ult is set up for the critical sections to be able to initialise +#endif + InitializeCriticalSectionAndSpinCount(&m_cs,5120); + } + ~XLockFreeStack() { DeleteCriticalSection( &m_cs ); } + void Initialize() {} + void Push(T *data) + { + EnterCriticalSection(&m_cs); + intStack.push_back(data); + LeaveCriticalSection(&m_cs); + } + T *Pop() + { + EnterCriticalSection(&m_cs); + if( intStack.size() ) + { + T* ret = intStack.back(); + intStack.pop_back(); + LeaveCriticalSection(&m_cs); + return ret; + } + else + { + LeaveCriticalSection(&m_cs); + return NULL; + } + } +private: + CRITICAL_SECTION m_cs; +}; + +void XMemCpy(void *a, const void *b, size_t s); +void XMemSet(void *a, int t, size_t s); +void XMemSet128(void *a, int t, size_t s); +void *XPhysicalAlloc(SIZE_T a, ULONG_PTR b, ULONG_PTR c, DWORD d); +void XPhysicalFree(void *a); + +class DLCManager; + +//class LevelGenerationOptions; +class LevelRuleset; +class ModelPart; +class LevelChunk; +class IXACT3Engine; +class XACT_NOTIFICATION; +class ConsoleSchematicFile; + +const int XZP_ICON_SHANK_01 = 1; +const int XZP_ICON_SHANK_02 = 2; +const int XZP_ICON_SHANK_03 = 3; + +const int XN_SYS_SIGNINCHANGED = 0; +const int XN_SYS_INPUTDEVICESCHANGED = 1; +const int XN_LIVE_CONTENT_INSTALLED = 2; +const int XN_SYS_STORAGEDEVICESCHANGED = 3; + +// +// Codes returned for the gamepad input +// + +#define VK_PAD_A 0x5800 +#define VK_PAD_B 0x5801 +#define VK_PAD_X 0x5802 +#define VK_PAD_Y 0x5803 +#define VK_PAD_RSHOULDER 0x5804 +#define VK_PAD_LSHOULDER 0x5805 +#define VK_PAD_LTRIGGER 0x5806 +#define VK_PAD_RTRIGGER 0x5807 + +#define VK_PAD_DPAD_UP 0x5810 +#define VK_PAD_DPAD_DOWN 0x5811 +#define VK_PAD_DPAD_LEFT 0x5812 +#define VK_PAD_DPAD_RIGHT 0x5813 +#define VK_PAD_START 0x5814 +#define VK_PAD_BACK 0x5815 +#define VK_PAD_LTHUMB_PRESS 0x5816 +#define VK_PAD_RTHUMB_PRESS 0x5817 + +#define VK_PAD_LTHUMB_UP 0x5820 +#define VK_PAD_LTHUMB_DOWN 0x5821 +#define VK_PAD_LTHUMB_RIGHT 0x5822 +#define VK_PAD_LTHUMB_LEFT 0x5823 +#define VK_PAD_LTHUMB_UPLEFT 0x5824 +#define VK_PAD_LTHUMB_UPRIGHT 0x5825 +#define VK_PAD_LTHUMB_DOWNRIGHT 0x5826 +#define VK_PAD_LTHUMB_DOWNLEFT 0x5827 + +#define VK_PAD_RTHUMB_UP 0x5830 +#define VK_PAD_RTHUMB_DOWN 0x5831 +#define VK_PAD_RTHUMB_RIGHT 0x5832 +#define VK_PAD_RTHUMB_LEFT 0x5833 +#define VK_PAD_RTHUMB_UPLEFT 0x5834 +#define VK_PAD_RTHUMB_UPRIGHT 0x5835 +#define VK_PAD_RTHUMB_DOWNRIGHT 0x5836 +#define VK_PAD_RTHUMB_DOWNLEFT 0x5837 + +const int XUSER_NAME_SIZE = 32; + +class IQNetPlayer +{ +public: + BYTE GetSmallId(); + void SendData(IQNetPlayer *player, const void *pvData, DWORD dwDataSize, DWORD dwFlags); + bool IsSameSystem(IQNetPlayer *player); + DWORD GetSendQueueSize( IQNetPlayer *player, DWORD dwFlags ); + DWORD GetCurrentRtt(); + bool IsHost(); + bool IsGuest(); + bool IsLocal(); + PlayerUID GetXuid(); + LPCWSTR GetGamertag(); + int GetSessionIndex(); + bool IsTalking(); + bool IsMutedByLocalUser(DWORD dwUserIndex); + bool HasVoice(); + bool HasCamera(); + int GetUserIndex(); + void SetCustomDataValue(ULONG_PTR ulpCustomDataValue); + ULONG_PTR GetCustomDataValue(); +private: + ULONG_PTR m_customData; +}; + +const int QNET_GETSENDQUEUESIZE_SECONDARY_TYPE = 0; +const int QNET_GETSENDQUEUESIZE_MESSAGES = 0; +const int QNET_GETSENDQUEUESIZE_BYTES = 0; + + +typedef struct { + BYTE bFlags; + BYTE bReserved; + WORD cProbesXmit; + WORD cProbesRecv; + WORD cbData; + BYTE *pbData; + WORD wRttMinInMsecs; + WORD wRttMedInMsecs; + DWORD dwUpBitsPerSec; + DWORD dwDnBitsPerSec; +} XNQOSINFO; + +typedef struct { + UINT cxnqos; + UINT cxnqosPending; + XNQOSINFO axnqosinfo[1]; +} XNQOS; + +typedef struct _XOVERLAPPED { +} XOVERLAPPED, *PXOVERLAPPED; + +typedef struct _XSESSION_SEARCHRESULT { +} XSESSION_SEARCHRESULT, *PXSESSION_SEARCHRESULT; + +typedef struct { + DWORD dwContextId; + DWORD dwValue; +} XUSER_CONTEXT, *PXUSER_CONTEXT; + +typedef struct _XSESSION_SEARCHRESULT_HEADER { + DWORD dwSearchResults; + XSESSION_SEARCHRESULT *pResults; +} XSESSION_SEARCHRESULT_HEADER, *PXSESSION_SEARCHRESULT_HEADER; + +typedef struct _XONLINE_FRIEND { + PlayerUID xuid; + CHAR szGamertag[XUSER_NAME_SIZE]; + DWORD dwFriendState; + SessionID sessionID; + DWORD dwTitleID; + FILETIME ftUserTime; + SessionID xnkidInvite; + FILETIME gameinviteTime; + DWORD cchRichPresence; +// WCHAR wszRichPresence[MAX_RICHPRESENCE_SIZE]; +} XONLINE_FRIEND, *PXONLINE_FRIEND; + +class IQNetCallbacks +{ +}; + +class IQNetGameSearch +{ +}; + + +typedef enum _QNET_STATE +{ + QNET_STATE_IDLE, + QNET_STATE_SESSION_HOSTING, + QNET_STATE_SESSION_JOINING, + QNET_STATE_GAME_LOBBY, + QNET_STATE_SESSION_REGISTERING, + QNET_STATE_SESSION_STARTING, + QNET_STATE_GAME_PLAY, + QNET_STATE_SESSION_ENDING, + QNET_STATE_SESSION_LEAVING, + QNET_STATE_SESSION_DELETING +} QNET_STATE, * PQNET_STATE; + +class IQNet +{ +public: + HRESULT AddLocalPlayerByUserIndex(DWORD dwUserIndex); + IQNetPlayer *GetHostPlayer(); + IQNetPlayer *GetLocalPlayerByUserIndex(DWORD dwUserIndex); + IQNetPlayer *GetPlayerByIndex(DWORD dwPlayerIndex); + IQNetPlayer *GetPlayerBySmallId(BYTE SmallId); + IQNetPlayer *GetPlayerByXuid(PlayerUID xuid); + DWORD GetPlayerCount(); + QNET_STATE GetState(); + bool IsHost(); + HRESULT JoinGameFromInviteInfo(DWORD dwUserIndex, DWORD dwUserMask, const INVITE_INFO *pInviteInfo); + void HostGame(); + void EndGame(); + + static IQNetPlayer m_player[4]; +}; + +#ifdef _DURANGO +// 4J Stu - We don't want to be doing string conversions at runtime for timing instrumentation, so do this instead +#define PIXBeginNamedEvent(a, b, ...) PIXBeginEvent(a,L ## b, __VA_ARGS__) +#define PIXEndNamedEvent() PIXEndEvent() +#define PIXSetMarkerDeprecated(a, b, ...) PIXSetMarker(a, L ## b, __VA_ARGS__) +#define PIXAddNamedCounter(a, b) PIXReportCounter( L ## b, a) +#else +void PIXAddNamedCounter(int a, char *b, ...); +void PIXBeginNamedEvent(int a, char *b, ...); +void PIXEndNamedEvent(); +void PIXSetMarkerDeprecated(int a, char *b, ...); +#endif + +void XSetThreadProcessor(HANDLE a, int b); +//BOOL XCloseHandle(HANDLE a); + +const int QNET_SENDDATA_LOW_PRIORITY = 0; +const int QNET_SENDDATA_SECONDARY = 0; +#if defined(__PS3__) || defined(__ORBIS__) || defined(_DURANGO) || defined(__PSVITA__) +#define INVALID_XUID PlayerUID() +#else +const int INVALID_XUID = 0; +#endif +// const int MOJANG_DATA = 0; + +// typedef struct _STRING_VERIFY_RESPONSE +// { +// WORD wNumStrings; +// HRESULT *pStringResult; +// } STRING_VERIFY_RESPONSE; + +const int XCONTENT_MAX_DISPLAYNAME_LENGTH = 256; +const int XCONTENT_MAX_FILENAME_LENGTH = 256; +typedef int XCONTENTDEVICEID; + +#if !defined( __PS3__) && !defined(__ORBIS__) && !defined(_DURANGO) && !defined(__PSVITA__) +typedef struct _XCONTENT_DATA +{ + XCONTENTDEVICEID DeviceID; + DWORD dwContentType; + WCHAR szDisplayName[XCONTENT_MAX_DISPLAYNAME_LENGTH]; + CHAR szFileName[XCONTENT_MAX_FILENAME_LENGTH]; +} XCONTENT_DATA, *PXCONTENT_DATA; +#endif //__PS3__ + +static const int XMARKETPLACE_CONTENT_ID_LEN = 4; + +#ifndef _DURANGO +typedef struct _XMARKETPLACE_CONTENTOFFER_INFO +{ + ULONGLONG qwOfferID; + ULONGLONG qwPreviewOfferID; + DWORD dwOfferNameLength; + WCHAR *wszOfferName; + DWORD dwOfferType; + BYTE contentId[XMARKETPLACE_CONTENT_ID_LEN]; + BOOL fIsUnrestrictedLicense; + DWORD dwLicenseMask; + DWORD dwTitleID; + DWORD dwContentCategory; + DWORD dwTitleNameLength; + WCHAR *wszTitleName; + BOOL fUserHasPurchased; + DWORD dwPackageSize; + DWORD dwInstallSize; + DWORD dwSellTextLength; + WCHAR *wszSellText; + DWORD dwAssetID; + DWORD dwPurchaseQuantity; + DWORD dwPointsPrice; +} XMARKETPLACE_CONTENTOFFER_INFO, *PXMARKETPLACE_CONTENTOFFER_INFO; + +typedef enum +{ + XMARKETPLACE_OFFERING_TYPE_CONTENT = 0x00000002, + XMARKETPLACE_OFFERING_TYPE_GAME_DEMO = 0x00000020, + XMARKETPLACE_OFFERING_TYPE_GAME_TRAILER = 0x00000040, + XMARKETPLACE_OFFERING_TYPE_THEME = 0x00000080, + XMARKETPLACE_OFFERING_TYPE_TILE = 0x00000800, + XMARKETPLACE_OFFERING_TYPE_ARCADE = 0x00002000, + XMARKETPLACE_OFFERING_TYPE_VIDEO = 0x00004000, + XMARKETPLACE_OFFERING_TYPE_CONSUMABLE = 0x00010000, + XMARKETPLACE_OFFERING_TYPE_AVATARITEM = 0x00100000 +} XMARKETPLACE_OFFERING_TYPE; +#endif // _DURANGO + +const int QNET_SENDDATA_RELIABLE = 0; +const int QNET_SENDDATA_SEQUENTIAL = 0; + +struct XRNM_SEND_BUFFER +{ + DWORD dwDataSize; + sigma::byte *pbyData; +}; + +const int D3DBLEND_CONSTANTALPHA = 0; +const int D3DBLEND_INVCONSTANTALPHA = 0; +const int D3DPT_QUADLIST = 0; + + +typedef struct _XUSER_SIGNIN_INFO { + PlayerUID xuid; + DWORD dwGuestNumber; +} XUSER_SIGNIN_INFO, *PXUSER_SIGNIN_INFO; + +#define XUSER_GET_SIGNIN_INFO_ONLINE_XUID_ONLY 0x00000001 +#define XUSER_GET_SIGNIN_INFO_OFFLINE_XUID_ONLY 0x00000002 + +DWORD XUserGetSigninInfo( + DWORD dwUserIndex, + DWORD dwFlags, + PXUSER_SIGNIN_INFO pSigninInfo +); + +class CXuiStringTable +{ +public: + LPCWSTR Lookup(LPCWSTR szId); + LPCWSTR Lookup(UINT nIndex); + void Clear(); + HRESULT Load(LPCWSTR szId); +}; + +#if !defined(__ORBIS__) && !defined(_XBOX_ONE) +typedef VOID * XMEMDECOMPRESSION_CONTEXT; +typedef VOID * XMEMCOMPRESSION_CONTEXT; + +typedef enum _XMEMCODEC_TYPE +{ + XMEMCODEC_DEFAULT = 0, + XMEMCODEC_LZX = 1 +} XMEMCODEC_TYPE; + +HRESULT XMemDecompress( + XMEMDECOMPRESSION_CONTEXT Context, + VOID *pDestination, + SIZE_T *pDestSize, + CONST VOID *pSource, + SIZE_T SrcSize +); + + +HRESULT XMemCompress( + XMEMCOMPRESSION_CONTEXT Context, + VOID *pDestination, + SIZE_T *pDestSize, + CONST VOID *pSource, + SIZE_T SrcSize +); + +HRESULT XMemCreateCompressionContext( + XMEMCODEC_TYPE CodecType, + CONST VOID *pCodecParams, + DWORD Flags, + XMEMCOMPRESSION_CONTEXT *pContext +); + +HRESULT XMemCreateDecompressionContext( + XMEMCODEC_TYPE CodecType, + CONST VOID *pCodecParams, + DWORD Flags, + XMEMDECOMPRESSION_CONTEXT *pContext +); + +typedef struct _XMEMCODEC_PARAMETERS_LZX { + DWORD Flags; + DWORD WindowSize; + DWORD CompressionPartitionSize; +} XMEMCODEC_PARAMETERS_LZX; + +void XMemDestroyCompressionContext(XMEMCOMPRESSION_CONTEXT Context); +void XMemDestroyDecompressionContext(XMEMDECOMPRESSION_CONTEXT Context); +#endif + +typedef struct { + BYTE type; + union { + LONG nData; + LONGLONG i64Data; + double dblData; + struct { + DWORD cbData; + LPWSTR pwszData; + }string; + float fData; + struct { + DWORD cbData; + PBYTE pbData; + }binary; + FILETIME ftData; + }; +} XUSER_DATA, *PXUSER_DATA; + +typedef struct { + DWORD dwPropertyId; + XUSER_DATA value; +} XUSER_PROPERTY, *PXUSER_PROPERTY; + +// these need to match apwstrLocaleCode +// const int XC_LANGUAGE_ENGLISH =1; +// const int XC_LANGUAGE_JAPANESE =2; +// const int XC_LANGUAGE_GERMAN =3; +// const int XC_LANGUAGE_FRENCH =4; +// const int XC_LANGUAGE_SPANISH =5; +// const int XC_LANGUAGE_ITALIAN =6; +// const int XC_LANGUAGE_KOREAN =7; +// const int XC_LANGUAGE_TCHINESE =8; +// const int XC_LANGUAGE_PORTUGUESE =9; +// const int XC_LANGUAGE_BRAZILIAN =10; +// #if defined __PS3__ || defined __PSVITA__ || defined __ORBIS__ +// const int XC_LANGUAGE_RUSSIAN =11; +// // more PS3 +// const int XC_LANGUAGE_DUTCH =12; +// const int XC_LANGUAGE_FINISH =13; +// const int XC_LANGUAGE_SWEDISH =14; +// const int XC_LANGUAGE_DANISH =15; +// const int XC_LANGUAGE_NORWEGIAN =16; +// const int XC_LANGUAGE_POLISH =17; +// const int XC_LANGUAGE_TURKISH =18; +// const int XC_LANGUAGE_LATINAMERICANSPANISH =19; +// +// const int XC_LANGUAGE_GREEK =20; +// #else +// const int XC_LANGUAGE_UKENGLISH =11; +// const int XC_LANGUAGE_MEXICANSPANISH=12; +// #endif + +// matching Xbox 360 +const int XC_LANGUAGE_ENGLISH =0x01; +const int XC_LANGUAGE_JAPANESE =0x02; +const int XC_LANGUAGE_GERMAN =0x03; +const int XC_LANGUAGE_FRENCH =0x04; +const int XC_LANGUAGE_SPANISH =0x05; +const int XC_LANGUAGE_ITALIAN =0x06; +const int XC_LANGUAGE_KOREAN =0x07; +const int XC_LANGUAGE_TCHINESE =0x08; +const int XC_LANGUAGE_PORTUGUESE =0x09; +const int XC_LANGUAGE_POLISH =0x0B; +const int XC_LANGUAGE_RUSSIAN =0x0C; +const int XC_LANGUAGE_SWEDISH =0x0D; +const int XC_LANGUAGE_TURKISH =0x0E; +const int XC_LANGUAGE_BNORWEGIAN =0x0F; +const int XC_LANGUAGE_DUTCH =0x10; +const int XC_LANGUAGE_SCHINESE =0x11; + +// for Sony +const int XC_LANGUAGE_LATINAMERICANSPANISH =0xF0; +const int XC_LANGUAGE_FINISH =0xF1; +const int XC_LANGUAGE_GREEK =0xF2; +const int XC_LANGUAGE_DANISH =0xF3; + +// for Xbox One +const int XC_LANGUAGE_CZECH =0xF4; +const int XC_LANGUAGE_SLOVAK =0xF5; + +const int XC_LOCALE_AUSTRALIA =1; +const int XC_LOCALE_AUSTRIA =2; +const int XC_LOCALE_BELGIUM =3; +const int XC_LOCALE_BRAZIL =4; +const int XC_LOCALE_CANADA =5; +const int XC_LOCALE_CHILE =6; +const int XC_LOCALE_CHINA =7; +const int XC_LOCALE_COLOMBIA =8; +const int XC_LOCALE_CZECH_REPUBLIC =9; +const int XC_LOCALE_DENMARK =10; +const int XC_LOCALE_FINLAND =11; +const int XC_LOCALE_FRANCE =12; +const int XC_LOCALE_GERMANY =13; +const int XC_LOCALE_GREECE =14; +const int XC_LOCALE_HONG_KONG =15; +const int XC_LOCALE_HUNGARY =16; +const int XC_LOCALE_INDIA =17; +const int XC_LOCALE_IRELAND =18; +const int XC_LOCALE_ITALY =19; +const int XC_LOCALE_JAPAN =20; +const int XC_LOCALE_KOREA =21; +const int XC_LOCALE_MEXICO =22; +const int XC_LOCALE_NETHERLANDS =23; +const int XC_LOCALE_NEW_ZEALAND =24; +const int XC_LOCALE_NORWAY =25; +const int XC_LOCALE_POLAND =26; +const int XC_LOCALE_PORTUGAL =27; +const int XC_LOCALE_SINGAPORE =28; +const int XC_LOCALE_SLOVAK_REPUBLIC =29; +const int XC_LOCALE_SOUTH_AFRICA =30; +const int XC_LOCALE_SPAIN =31; +const int XC_LOCALE_SWEDEN =32; +const int XC_LOCALE_SWITZERLAND =33; +const int XC_LOCALE_TAIWAN =34; +const int XC_LOCALE_GREAT_BRITAIN =35; +const int XC_LOCALE_UNITED_STATES =36; +const int XC_LOCALE_RUSSIAN_FEDERATION =37; +const int XC_LOCALE_WORLD_WIDE =38; +const int XC_LOCALE_TURKEY =39; +const int XC_LOCALE_ARGENTINA =40; +const int XC_LOCALE_SAUDI_ARABIA =41; +const int XC_LOCALE_ISRAEL =42; +const int XC_LOCALE_UNITED_ARAB_EMIRATES =43; + +// for Sony +const int XC_LOCALE_LATIN_AMERICA =240; + + + +#if !(defined _DURANGO || defined __PS3__ || defined __ORBIS__ || defined __PSVITA__) +DWORD XGetLanguage(); +DWORD XGetLocale(); +DWORD XEnableGuestSignin(BOOL fEnable); +#endif + +class D3DXVECTOR3 +{ +public: + D3DXVECTOR3(); + D3DXVECTOR3(float,float,float); + float x,y,z,pad; + D3DXVECTOR3& operator += ( CONST D3DXVECTOR3& add ); +}; + +#define QNET_E_SESSION_FULL 0 +#define QNET_USER_MASK_USER0 1 +#define QNET_USER_MASK_USER1 2 +#define QNET_USER_MASK_USER2 4 +#define QNET_USER_MASK_USER3 8