diff --git a/.gitignore b/.gitignore index 8a574ae36..118fbad3d 100644 --- a/.gitignore +++ b/.gitignore @@ -449,3 +449,10 @@ Brewfile.lock.json # GPerf heap profile dumps *.heap *.mo + +# UWP copied assets +uwp-project/Assets/data +uwp-project/Assets/fonts +uwp-project/Assets/gendata +uwp-project/Assets/ui_art + diff --git a/3rdParty/SDL2/CMake/FindSDL2.cmake b/3rdParty/SDL2/CMake/FindSDL2.cmake index 50f5cecfd..57118cad9 100644 --- a/3rdParty/SDL2/CMake/FindSDL2.cmake +++ b/3rdParty/SDL2/CMake/FindSDL2.cmake @@ -1 +1,17 @@ -# An empty find module to allow calls to `find_package(SDL2)` to succeed. +if(UWP_LIB AND NOT TARGET SDL2::SDL2-static) + set(SDL_BUILD_TYPE "Release") + + if(CMAKE_BUILD_TYPE MATCHES "Debug") + set(SDL_BUILD_TYPE "Debug") + endif() + + set(SDL2_LIBRARY "${UWP_SDL2_DIR}/VisualC-WinRT/x64/${SDL_BUILD_TYPE}/SDL-UWP") + set(SDL2_INCLUDE_DIR "${UWP_SDL2_DIR}/include") + add_library(SDL2_lib STATIC IMPORTED) + set_property(TARGET SDL2_lib PROPERTY IMPORTED_LOCATION "${SDL2_LIBRARY}/SDL2.lib") + set_property(TARGET SDL2_lib PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${SDL2_INCLUDE_DIR}) + add_library(SDL2::SDL2-static ALIAS SDL2_lib) + mark_as_advanced(SDL2_INCLUDE_DIR SDL2_LIBRARY) + set(SDL2_LIBRARIES ${SDL2_LIBRARY}) + set(SDL2_INCLUDE_DIRS ${SDL2_INCLUDE_DIR}) +endif() diff --git a/3rdParty/SDL2/CMakeLists.txt b/3rdParty/SDL2/CMakeLists.txt index d3ea5f821..3943888b3 100644 --- a/3rdParty/SDL2/CMakeLists.txt +++ b/3rdParty/SDL2/CMakeLists.txt @@ -18,7 +18,3 @@ FetchContent_Declare(SDL2 URL_HASH MD5=3fb6d72c33434082c32d2649c35c6502 ) FetchContent_MakeAvailableExcludeFromAll(SDL2) - -if(TARGET SDL2::SDL2-static) - add_library(SDL2::SDL2 ALIAS SDL2-static) -endif() diff --git a/3rdParty/SDL_image/CMakeLists.txt b/3rdParty/SDL_image/CMakeLists.txt index 0b707dd0a..2094b6cfc 100644 --- a/3rdParty/SDL_image/CMakeLists.txt +++ b/3rdParty/SDL_image/CMakeLists.txt @@ -43,7 +43,10 @@ target_link_libraries(SDL_image PNG::PNG) if(USE_SDL1) target_link_libraries(SDL_image ${SDL_LIBRARY}) -else() +elseif(TARGET SDL2::SDL2) target_link_libraries(SDL_image SDL2::SDL2) add_library(SDL2::SDL2_image ALIAS SDL_image) +elseif(TARGET SDL2::SDL2-static) + target_link_libraries(SDL_image SDL2::SDL2-static) + add_library(SDL2::SDL2_image ALIAS SDL_image) endif() diff --git a/3rdParty/libsmackerdec/CMakeLists.txt b/3rdParty/libsmackerdec/CMakeLists.txt index e91e19dbc..78417e4ab 100644 --- a/3rdParty/libsmackerdec/CMakeLists.txt +++ b/3rdParty/libsmackerdec/CMakeLists.txt @@ -17,6 +17,8 @@ target_include_directories(libsmackerdec PUBLIC ${libsmackerdec_SOURCE_DIR}/incl if(USE_SDL1) target_link_libraries(libsmackerdec PUBLIC ${SDL_LIBRARY}) -else() +elseif(TARGET SDL2::SDL2) target_link_libraries(libsmackerdec PUBLIC SDL2::SDL2) +elseif(TARGET SDL2::SDL2-static) + target_link_libraries(libsmackerdec PUBLIC SDL2::SDL2-static) endif() diff --git a/3rdParty/zlib/CMakeLists.txt b/3rdParty/zlib/CMakeLists.txt new file mode 100644 index 000000000..767103e49 --- /dev/null +++ b/3rdParty/zlib/CMakeLists.txt @@ -0,0 +1,49 @@ +include(functions/FetchContent_MakeAvailableExcludeFromAll) + +include(FetchContent) +FetchContent_Declare(zlib + URL https://www.zlib.net/zlib-1.2.11.tar.gz + URL_HASH MD5=1c9f62f0778697a09d36121ead88e08e +) +FetchContent_MakeAvailableExcludeFromAll(zlib) + +if(DEVILUTIONX_STATIC_ZLIB) + set(_lib_type STATIC) +else() + set(_lib_type SHARED) +endif() +add_library(ZLIB ${_lib_type} + ${zlib_SOURCE_DIR}/crc32.h + ${zlib_SOURCE_DIR}/gzguts.h + ${zlib_SOURCE_DIR}/inffixed.h + ${zlib_SOURCE_DIR}/inftrees.h + ${zlib_BINARY_DIR}/zconf.h + ${zlib_SOURCE_DIR}/zutil.h + ${zlib_SOURCE_DIR}/deflate.h + ${zlib_SOURCE_DIR}/inffast.h + ${zlib_SOURCE_DIR}/inflate.h + ${zlib_SOURCE_DIR}/trees.h + ${zlib_SOURCE_DIR}/zlib.h + ${zlib_SOURCE_DIR}/adler32.c + ${zlib_SOURCE_DIR}/deflate.c + ${zlib_SOURCE_DIR}/gzread.c + ${zlib_SOURCE_DIR}/inffast.c + ${zlib_SOURCE_DIR}/trees.c + ${zlib_SOURCE_DIR}/compress.c + ${zlib_SOURCE_DIR}/gzclose.c + ${zlib_SOURCE_DIR}/gzwrite.c + ${zlib_SOURCE_DIR}/inflate.c + ${zlib_SOURCE_DIR}/uncompr.c + ${zlib_SOURCE_DIR}/crc32.c + ${zlib_SOURCE_DIR}/gzlib.c + ${zlib_SOURCE_DIR}/infback.c + ${zlib_SOURCE_DIR}/inftrees.c + ${zlib_SOURCE_DIR}/zutil.c +) +target_include_directories(ZLIB PUBLIC ${zlib_SOURCE_DIR}) +target_include_directories(ZLIB PUBLIC ${zlib_BINARY_DIR}) + +add_library(ZLIB::ZLIB ALIAS ZLIB) + +set(ZLIB_LIBRARY "${CMAKE_CURRENT_BINARY_DIR}/3dsParty/zlib" PARENT_SCOPE) +set(ZLIB_INCLUDE_DIR HINTS ${zlib_SOURCE_DIR} ${zlib_BINARY_DIR} PARENT_SCOPE) diff --git a/CMake/Dependencies.cmake b/CMake/Dependencies.cmake index 47160fe50..0c58a3013 100644 --- a/CMake/Dependencies.cmake +++ b/CMake/Dependencies.cmake @@ -3,6 +3,19 @@ include(functions/dependency_options) include(functions/emscripten_system_library) +if(EMSCRIPTEN) + emscripten_system_library("zlib" ZLIB::ZLIB USE_ZLIB=1) +elseif(UWP_LIB) + add_subdirectory(3rdParty/zlib) +endif() + +dependency_options("bzip2" DEVILUTIONX_SYSTEM_BZIP2 ON DEVILUTIONX_STATIC_BZIP2) +if(DEVILUTIONX_SYSTEM_BZIP2) + find_package(BZip2 REQUIRED) +else() + add_subdirectory(3rdParty/bzip2) +endif() + if(EMSCRIPTEN) # We use `USE_PTHREADS=1` here to get a version of SDL2 that supports threads. emscripten_system_library("SDL2" SDL2::SDL2 USE_SDL=2 USE_PTHREADS=1) @@ -23,7 +36,6 @@ else() # Aliasing local targets is not supported on CMake < 3.18, so make it global. set_target_properties(SDL2::SDL2-static PROPERTIES IMPORTED_GLOBAL TRUE) endif() - add_library(SDL2::SDL2 ALIAS SDL2::SDL2-static) set(SDL2_MAIN SDL2::SDL2main) else() # Assume an older Debian derivate that comes with an sdl2-config.cmake @@ -34,6 +46,9 @@ else() # Can't define an INTERFACE target with ::, so alias instead add_library(SDL2::SDL2 ALIAS SDL2_lib) endif() + elseif(UWP_LIB) + list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/3rdParty/SDL2/CMake") + find_package(SDL2 REQUIRED) else() add_subdirectory(3rdParty/SDL2) set(SDL2_MAIN SDL2::SDL2main) @@ -46,7 +61,14 @@ if(USE_SDL1) target_link_libraries(DevilutionX::SDL INTERFACE ${SDL_LIBRARY}) target_compile_definitions(DevilutionX::SDL INTERFACE USE_SDL1) else() - target_link_libraries(DevilutionX::SDL INTERFACE ${SDL2_MAIN} SDL2::SDL2) + if(TARGET SDL2::SDL2) + target_link_libraries(DevilutionX::SDL INTERFACE SDL2::SDL2) + elseif(TARGET SDL2::SDL2-static) + target_link_libraries(DevilutionX::SDL INTERFACE SDL2::SDL2-static) + endif() + if(NOT UWP_LIB) + target_link_libraries(DevilutionX::SDL INTERFACE ${SDL2_MAIN}) + endif() endif() macro(_find_SDL_image QUIET_OR_REQUIRED) @@ -127,20 +149,9 @@ else() add_subdirectory(3rdParty/libfmt) endif() -dependency_options("bzip2" DEVILUTIONX_SYSTEM_BZIP2 ON DEVILUTIONX_STATIC_BZIP2) -if(DEVILUTIONX_SYSTEM_BZIP2) - find_package(BZip2 REQUIRED) -else() - add_subdirectory(3rdParty/bzip2) -endif() - -if(EMSCRIPTEN) - emscripten_system_library("zlib" ZLIB::ZLIB USE_ZLIB=1) -endif() - add_subdirectory(3rdParty/libsmackerdec) -if(WIN32) +if(WIN32 AND NOT UWP_LIB) add_subdirectory(3rdParty/find_steam_game) endif() diff --git a/CMake/Platforms.cmake b/CMake/Platforms.cmake index 370a1c4ee..16422ae2f 100644 --- a/CMake/Platforms.cmake +++ b/CMake/Platforms.cmake @@ -59,3 +59,7 @@ endif() if(EMSCRIPTEN) include(platforms/emscripten) endif() + +if(UWP_LIB) + include(platforms/uwp_lib) +endif() diff --git a/CMake/platforms/uwp_lib.cmake b/CMake/platforms/uwp_lib.cmake new file mode 100644 index 000000000..a89fe27de --- /dev/null +++ b/CMake/platforms/uwp_lib.cmake @@ -0,0 +1,26 @@ +set(ASAN OFF) +set(UBSAN OFF) +set(BUILD_TESTING OFF) +set(DISCORD_INTEGRATION OFF) + +# setting all libs to be built statically and from source +set(DEVILUTIONX_SYSTEM_SDL2 OFF) +set(DEVILUTIONX_SYSTEM_SDL_IMAGE OFF) +set(DEVILUTIONX_SYSTEM_SDL_AUDIOLIB OFF) +set(DEVILUTIONX_SYSTEM_LIBSODIUM OFF) +set(DEVILUTIONX_SYSTEM_LIBPNG OFF) +set(DEVILUTIONX_SYSTEM_LIBFMT OFF) +set(DEVILUTIONX_SYSTEM_BZIP2 OFF) +set(DEVILUTIONX_SYSTEM_ZLIB OFF) + +set(DEVILUTIONX_STATIC_SDL2 ON) +set(DEVILUTIONX_STATIC_SDL_IMAGE ON) +set(DEVILUTIONX_STATIC_SDL_AUDIOLIB ON) +set(DEVILUTIONX_STATIC_LIBSODIUM ON) +set(DEVILUTIONX_STATIC_LIBPNG ON) +set(DEVILUTIONX_STATIC_LIBFMT ON) +set(DEVILUTIONX_STATIC_BZIP2 ON) +set(DEVILUTIONX_STATIC_ZLIB ON) + +# not really necessary but a good measure for SDL related stuff +set(WINDOWS_STORE ON) diff --git a/CMakeLists.txt b/CMakeLists.txt index fc37ec725..55bf60c7d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -209,6 +209,8 @@ endif() if(ANDROID) add_library(${BIN_TARGET} SHARED Source/main.cpp) +elseif(UWP_LIB) + add_custom_target(${BIN_TARGET}) # we only need libdevilutionx else() add_executable(${BIN_TARGET} WIN32 @@ -219,7 +221,10 @@ else() Packaging/apple/AppIcon.icns Packaging/apple/LaunchScreen.storyboard) endif() -target_link_libraries(${BIN_TARGET} PRIVATE libdevilutionx) + +if(NOT UWP_LIB) + target_link_libraries(${BIN_TARGET} PRIVATE libdevilutionx) +endif() # Must be included after `BIN_TARGET` and `libdevilutionx` are defined. include(Assets) @@ -228,7 +233,7 @@ if(EMSCRIPTEN) target_link_options(${BIN_TARGET} PRIVATE --preload-file assets) endif() -if(NOT USE_SDL1) +if(NOT USE_SDL1 AND NOT UWP_LIB) target_link_libraries(${BIN_TARGET} PUBLIC ${SDL2_MAIN}) endif() @@ -371,6 +376,10 @@ if(NINTENDO_3DS) add_dependencies(${APP_TARGET_PREFIX}_cia romfs_files) endif() +if(UWP_LIB) + target_compile_definitions(libdevilutionx PRIVATE __UWP__=1) +endif() + if(CPACK AND (APPLE OR BUILD_ASSETS_MPQ OR SRC_DIST)) if(WIN32) if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC") diff --git a/Packaging/xbox-one/build.bat b/Packaging/xbox-one/build.bat new file mode 100644 index 000000000..41ef72729 --- /dev/null +++ b/Packaging/xbox-one/build.bat @@ -0,0 +1,20 @@ +call VsDevCmd.bat + +mkdir ..\..\build +cd ..\..\build + +git clone https://github.com/libsdl-org/SDL.git +git -C SDL checkout b424665e0899769b200231ba943353a5fee1b6b6 +msbuild /p:PlatformToolset=v143;TargetPlatformVersion=10.0.22000.0;TargetPlatformMinVersion=10.0.14393.0;ConfigurationType=StaticLibrary;Configuration=Release;Platform=x64 SDL\VisualC-WinRT\SDL-UWP.vcxproj + +cmake -DUWP_LIB=1 -DUWP_SDL2_DIR="%CD%/SDL" -DCMAKE_BUILD_TYPE=x64-Release .. + +msbuild /p:Configuration=Release;Platform=x64 DevilutionX.sln + +powershell "Get-Content ..\uwp-project\Package.appxmanifest.template | %% {$_ -replace '__PROJECT_VERSION__',$(& {git describe --tags --abbrev=0})} | Out-File -FilePath ..\uwp-project\Package.appxmanifest -encoding ASCII" + +msbuild /p:Configuration=Release;Platform=x64;AppxBundle=Always;AppxBundlePlatforms=x64 ..\uwp-project\devilutionx.sln + +powershell "Get-Childitem -Path uwp-project\AppxPackages, uwp-project\Release -Include Microsoft.VCLibs.x64.*.appx, devilutionX_*_x64.appx -File -Recurse | Copy-Item -Destination ..\Packaging\xbox-one" + +cd ..\Packaging\xbox-one diff --git a/Source/diablo.cpp b/Source/diablo.cpp index cb353813e..16f5047db 100644 --- a/Source/diablo.cpp +++ b/Source/diablo.cpp @@ -1695,6 +1695,15 @@ void diablo_quit(int exitStatus) exit(exitStatus); } +#ifdef __UWP__ +void (*onInitialized)() = NULL; + +void setOnInitialized(void (*callback)()) +{ + onInitialized = callback; +} +#endif + int DiabloMain(int argc, char **argv) { #ifdef _DEBUG @@ -1718,6 +1727,10 @@ int DiabloMain(int argc, char **argv) DiabloInit(); +#ifdef __UWP__ + onInitialized(); +#endif + DiabloSplash(); mainmenu_loop(); DiabloDeinit(); diff --git a/Source/diablo.h b/Source/diablo.h index 0aeb9da00..6a2b39904 100644 --- a/Source/diablo.h +++ b/Source/diablo.h @@ -120,4 +120,8 @@ extern bool gbFriendlyMode; */ extern GameLogicStep gGameLogicStep; +#ifdef __UWP__ +void setOnInitialized(void (*)()); +#endif + } // namespace devilution diff --git a/Source/init.cpp b/Source/init.cpp index 48bd090a6..475fb7007 100644 --- a/Source/init.cpp +++ b/Source/init.cpp @@ -8,7 +8,7 @@ #include #include -#if defined(_WIN64) || defined(_WIN32) +#if (defined(_WIN64) || defined(_WIN32)) && !defined(__UWP__) #include #endif @@ -96,7 +96,7 @@ std::vector GetMPQSearchPaths() paths.emplace_back("/usr/local/share/diasurgical/devilutionx/"); #elif defined(__3DS__) paths.emplace_back("romfs:/"); -#elif defined(_WIN64) || defined(_WIN32) +#elif (defined(_WIN64) || defined(_WIN32)) && !defined(__UWP__) char gogpath[_FSG_PATH_MAX]; fsg_get_gog_game_path(gogpath, "1412601690"); if (strlen(gogpath) > 0) { diff --git a/Source/utils/display.cpp b/Source/utils/display.cpp index 5c266c7e3..a1b875da2 100644 --- a/Source/utils/display.cpp +++ b/Source/utils/display.cpp @@ -192,7 +192,7 @@ bool SpawnWindow(const char *lpWindowName) SDL_SetHint(SDL_HINT_ACCELEROMETER_AS_JOYSTICK, "0"); #endif -#if defined(_WIN32) && !defined(USE_SDL1) +#if defined(_WIN32) && !defined(USE_SDL1) && !defined(__UWP__) // The default WASAPI backend causes distortions // https://github.com/diasurgical/devilutionX/issues/1434 SDL_setenv("SDL_AUDIODRIVER", "winmm", /*overwrite=*/false); diff --git a/Source/utils/stdcompat/optional.hpp b/Source/utils/stdcompat/optional.hpp index 2c51da0db..ad6c5404a 100644 --- a/Source/utils/stdcompat/optional.hpp +++ b/Source/utils/stdcompat/optional.hpp @@ -1,7 +1,7 @@ #pragma once #ifdef __has_include -#if defined(__cplusplus) && __cplusplus >= 201606L && __has_include() +#if defined(__cplusplus) && (__cplusplus >= 201606L || _MSC_VER >= 1930) && __has_include() #include // IWYU pragma: export #elif __has_include() #include // IWYU pragma: export diff --git a/Source/utils/stdcompat/string_view.hpp b/Source/utils/stdcompat/string_view.hpp index 443c4d806..90fc183a2 100644 --- a/Source/utils/stdcompat/string_view.hpp +++ b/Source/utils/stdcompat/string_view.hpp @@ -1,7 +1,7 @@ #pragma once #ifdef __has_include -#if defined(__cplusplus) && __cplusplus >= 201703L && __has_include() // should be 201606L, but STL headers disagree +#if defined(__cplusplus) && (__cplusplus >= 201703L || _MSC_VER >= 1930) && __has_include() // should be 201606L, but STL headers disagree #include // IWYU pragma: export namespace devilution { diff --git a/appveyor-uwp.yml b/appveyor-uwp.yml new file mode 100644 index 000000000..eb9fcdd0f --- /dev/null +++ b/appveyor-uwp.yml @@ -0,0 +1,16 @@ +version: 1.0.{build} + +pull_requests: + do_not_increment_build_number: true +image: Visual Studio 2022 + +before_build: + - cd %APPVEYOR_BUILD_FOLDER%\Packaging\xbox-one + +build_script: + - build.bat +artifacts: + - path: . + name: devilutionX_*_x64.appx + - path: . + name: Microsoft.VCLibs.x64.*.appx diff --git a/docs/building.md b/docs/building.md index 001b96d5f..b3161dc69 100644 --- a/docs/building.md +++ b/docs/building.md @@ -360,8 +360,8 @@ Emscripten port is a work in progress. It builds but does not do more than that To build, install the [Emscripten SDK](https://emscripten.org/docs/getting_started/downloads.html), then run: ~~~ bash -emcmake cmake -S. -Bbuild-em -DCMAKE_BUILD_TYPE=Release -cmake --build build-em -j $(getconf _NPROCESSORS_ONLN) +emcmake cmake -S. -Bbuild-em -DCMAKE\_BUILD\_TYPE=Release +cmake --build build-em -j $(getconf \_NPROCESSORS\_ONLN) ~~~ To then run it: @@ -372,6 +372,36 @@ emrun index.html ~~~ +
Xbox One/Series + +### Dependencies + +* Windows 10 +* CMake +* Git +* Visual Studio 2022 with the foloowing packages installed: + * C++ (v143) Universal Windows Platform tools + * Windows 11 SDK (10.0.22000.0) + * Windows 10 SDK (10.0.18362.0) + * MSVC v143 - VS 2022 C++ x64/x86 build tools + +_Note: Visual Studio Community Edition can be used._ + +### Building + +Add the following to the PATH: +* CMake +* GIT +* VsDevCmd.bat + +Run: +``` +Packaging/xbox-one/build.bat +``` + +[Xbox One/Series manual](manual/platforms/xbox-one.md) +
+
CMake build options ### General diff --git a/docs/manual/platforms/xbox-one.md b/docs/manual/platforms/xbox-one.md new file mode 100644 index 000000000..88ee53aa5 --- /dev/null +++ b/docs/manual/platforms/xbox-one.md @@ -0,0 +1,40 @@ +# DevilutionX (Diablo 1) for Microsoft Xbox One/Series + +## Installation + +1. Download and unzip [devilutionx-xbox-one.zip](https://github.com/diasurgical/devilutionX/releases/latest/download/devilutionx-xbox-one.zip). +2. In Xbox Device Portal click on `Add` button located at `Home/My games & apps` +3. In the first popup - called `Deploy or Install Application` choose `devilutionX..appx` and then click `Next` +4. In the second popup - called `Choose any necessary dependencies` choose `Microsoft.VCLibs..appx` and then click `Start` +5. In your PC go to the shared folder `WindowsApps` and find the devilutionX folder which should be something like `\_\_random string<>` +6. Copy `diabdat.mpq` from your CD (or GoG install folder) to it. +7. In the Xbox press `View` on DevilutionX and select `Details` and there change the type from `App` to `Game`. + +## Usage + +Launch `DevilutionX` from the Dev Mode home. + +## Controls + +- Left analog or D-Pad: move hero +- A: attack nearby enemies, talk to townspeople and merchants, pickup/place items in the inventory, OK while in main menu +- B: select spell, back while in menus +- X: pickup items, open nearby chests and doors, use item in the inventory +- Y: cast spell, delete character while in main menu +- LB: use health item from belt +- RB: use mana potion from belt +- LT: character sheet (alt: Menu + LB or ←) +- RT: inventory (alt: Menu + RB or →) +- Left analog click: toggle automap (alt: Menu + ↓) +- Menu + View: game menu (alt: Menu + ↑) +- View + A/B/X/Y: Spell hotkeys +- Right analog: move automap or simulate mouse +- Right analog click: left mouse click (alt: View + LB) +- View + Right analog click: right mouse click (alt: View + RB) +- View + LT: quest log (alt: Menu + Y) +- View + RT: spell book (alt: Menu + B) + +## Resources + +* Discord: https://discord.gg/YQKCAYQ +* GitHub: https://github.com/diasurgical/devilutionX diff --git a/uwp-project/Assets/BadgeLogo.scale-200.png b/uwp-project/Assets/BadgeLogo.scale-200.png new file mode 100644 index 000000000..eccea15bf Binary files /dev/null and b/uwp-project/Assets/BadgeLogo.scale-200.png differ diff --git a/uwp-project/Assets/LargeTile.scale-200.png b/uwp-project/Assets/LargeTile.scale-200.png new file mode 100644 index 000000000..afb0d8572 Binary files /dev/null and b/uwp-project/Assets/LargeTile.scale-200.png differ diff --git a/uwp-project/Assets/Logo.scale-200.png b/uwp-project/Assets/Logo.scale-200.png new file mode 100644 index 000000000..edf07641a Binary files /dev/null and b/uwp-project/Assets/Logo.scale-200.png differ diff --git a/uwp-project/Assets/SmallLogo.altform-lightunplated_targetsize-48.png b/uwp-project/Assets/SmallLogo.altform-lightunplated_targetsize-48.png new file mode 100644 index 000000000..d89282f8b Binary files /dev/null and b/uwp-project/Assets/SmallLogo.altform-lightunplated_targetsize-48.png differ diff --git a/uwp-project/Assets/SmallLogo.altform-unplated_targetsize-48.png b/uwp-project/Assets/SmallLogo.altform-unplated_targetsize-48.png new file mode 100644 index 000000000..d89282f8b Binary files /dev/null and b/uwp-project/Assets/SmallLogo.altform-unplated_targetsize-48.png differ diff --git a/uwp-project/Assets/SmallLogo.scale-200.png b/uwp-project/Assets/SmallLogo.scale-200.png new file mode 100644 index 000000000..1c2a2cf0e Binary files /dev/null and b/uwp-project/Assets/SmallLogo.scale-200.png differ diff --git a/uwp-project/Assets/SmallLogo.targetsize-48.png b/uwp-project/Assets/SmallLogo.targetsize-48.png new file mode 100644 index 000000000..42426a5ea Binary files /dev/null and b/uwp-project/Assets/SmallLogo.targetsize-48.png differ diff --git a/uwp-project/Assets/SmallTile.scale-200.png b/uwp-project/Assets/SmallTile.scale-200.png new file mode 100644 index 000000000..04e809fe6 Binary files /dev/null and b/uwp-project/Assets/SmallTile.scale-200.png differ diff --git a/uwp-project/Assets/SplashScreen.scale-200.png b/uwp-project/Assets/SplashScreen.scale-200.png new file mode 100644 index 000000000..52de47a0b Binary files /dev/null and b/uwp-project/Assets/SplashScreen.scale-200.png differ diff --git a/uwp-project/Assets/StoreLogo.scale-200.png b/uwp-project/Assets/StoreLogo.scale-200.png new file mode 100644 index 000000000..98bf20632 Binary files /dev/null and b/uwp-project/Assets/StoreLogo.scale-200.png differ diff --git a/uwp-project/Assets/WideTile.scale-200.png b/uwp-project/Assets/WideTile.scale-200.png new file mode 100644 index 000000000..12c39a567 Binary files /dev/null and b/uwp-project/Assets/WideTile.scale-200.png differ diff --git a/uwp-project/Package.appxmanifest b/uwp-project/Package.appxmanifest new file mode 100644 index 000000000..42b27d1b8 --- /dev/null +++ b/uwp-project/Package.appxmanifest @@ -0,0 +1,51 @@ + + + + + + + + + + devilutionX + devilution Team + Assets\StoreLogo.png + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/uwp-project/Package.appxmanifest.template b/uwp-project/Package.appxmanifest.template new file mode 100644 index 000000000..bed983668 --- /dev/null +++ b/uwp-project/Package.appxmanifest.template @@ -0,0 +1,51 @@ + + + + + + + + + + devilutionX + devilution Team + Assets\StoreLogo.png + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/uwp-project/devilutionx.sln b/uwp-project/devilutionx.sln new file mode 100644 index 000000000..0e7992770 --- /dev/null +++ b/uwp-project/devilutionx.sln @@ -0,0 +1,27 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.0.32014.148 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "devilutionX", "devilutionx.vcxproj", "{3183A558-46F4-4FEF-8684-0A79B793599F}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {3183A558-46F4-4FEF-8684-0A79B793599F}.Debug|x64.ActiveCfg = Debug|x64 + {3183A558-46F4-4FEF-8684-0A79B793599F}.Debug|x64.Build.0 = Debug|x64 + {3183A558-46F4-4FEF-8684-0A79B793599F}.Debug|x64.Deploy.0 = Debug|x64 + {3183A558-46F4-4FEF-8684-0A79B793599F}.Release|x64.ActiveCfg = Release|x64 + {3183A558-46F4-4FEF-8684-0A79B793599F}.Release|x64.Build.0 = Release|x64 + {3183A558-46F4-4FEF-8684-0A79B793599F}.Release|x64.Deploy.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {D91CBA35-4ECA-4F87-81C4-EBD110EDEE56} + EndGlobalSection +EndGlobal diff --git a/uwp-project/devilutionx.vcxproj b/uwp-project/devilutionx.vcxproj new file mode 100644 index 000000000..01e96f771 --- /dev/null +++ b/uwp-project/devilutionx.vcxproj @@ -0,0 +1,140 @@ + + + + + Debug + x64 + + + Release + x64 + + + + {3183a558-46f4-4fef-8684-0a79b793599f} + DirectXApp + devilutionX + en-US + 14.0 + true + Windows Store + 8.2 + 10.0.10069.0 + 10.0.10069.0 + 10.0.22000.0 + 10.0.14393.0 + devilutionX + + + + Application + true + v143 + + + Application + false + true + v143 + + + + + + + + + + + + + + + + devilutionX_TemporaryKey.pfx + True + False + SHA256 + True + True + Always + x64 + 0 + ..\build\uwp-project\AppxPackages + + + ..\build\uwp-project\$(Configuration)\ + ..\build\uwp-project\obj\ + + + ..\build\uwp-project\$(Configuration)\ + ..\build\uwp-project\obj\ + + + + sdl_image.lib;libpng16_staticd.lib;pkware.lib;fmtd.lib;zlib.lib;bzip2.lib;libsmackerdec.lib;libmpq.lib;libdevilutionx.lib;sdl2.lib;sdl_audiolib.lib;sodium.lib;zt.lib;lwip_pic.lib;miniupnpc_pic.lib;natpmp_pic.lib;zt_pic.lib;zto_pic.lib;shlwapi.lib;shell32.lib;%(AdditionalDependencies) + ..\build\SDL\VisualC-WinRT\x64\Debug\SDL-UWP;..\build\3rdParty\SDL_image\Debug;..\build\3rdParty\zlib\Debug;..\build\3rdParty\PKWare\Debug;..\build\3rdParty\bzip2\Debug;..\build\3rdParty\libsmackerdec\Debug;..\build\3rdParty\libmpq\Debug;..\build\_deps\sdl_audiolib-build\Debug;..\build\_deps\libsodium-build\Debug;..\build\_deps\libzt-build\lib\Debug;..\build\_deps\libfmt-build\Debug;..\build\_deps\libpng-build\Debug;..\build\Source\libdevilutionx.dir\Debug;%(AdditionalLibraryDirectories) + + + pch.h + $(IntDir)pch.pch + ..\Source;..\build\SDL\include;..\build\_deps\sdl_audiolib-src\include;..\build\_deps\sdl_audiolib-build;%(AdditionalIncludeDirectories) + /bigobj %(AdditionalOptions) + 4453;28204 + _DEBUG;__UWP__=1;%(PreprocessorDefinitions) + NotUsing + stdcpp17 + true + true + false + + + + + sdl_image.lib;libpng16_static.lib;pkware.lib;fmt.lib;zlib.lib;bzip2.lib;libsmackerdec.lib;libmpq.lib;libdevilutionx.lib;sdl2.lib;sdl_audiolib.lib;sodium.lib;zt.lib;lwip_pic.lib;miniupnpc_pic.lib;natpmp_pic.lib;zt_pic.lib;zto_pic.lib;shlwapi.lib;shell32.lib;%(AdditionalDependencies) + ..\build\SDL\VisualC-WinRT\x64\Release\SDL-UWP;..\build\3rdParty\SDL_image\Release;..\build\3rdParty\zlib\Release;..\build\3rdParty\PKWare\Release;..\build\3rdParty\bzip2\Release;..\build\3rdParty\libsmackerdec\Release;..\build\3rdParty\libmpq\Release;..\build\_deps\sdl_audiolib-build\Release;..\build\_deps\libsodium-build\Release;..\build\_deps\libzt-build\lib\Release;..\build\_deps\libfmt-build\Release;..\build\_deps\libpng-build\Release;..\build\Source\libdevilutionx.dir\Release;%(AdditionalLibraryDirectories) + + + pch.h + $(IntDir)pch.pch + /bigobj %(AdditionalOptions) + 4453;28204 + NDEBUG;__UWP__=1;%(PreprocessorDefinitions) + NotUsing + ..\Source;..\build\SDL\include;..\build\_deps\sdl_audiolib-src\include;..\build\_deps\sdl_audiolib-build;%(AdditionalIncludeDirectories) + stdcpp17 + + + + + + + + + + + + + + + + + + Designer + + + true + Assets\%(RecursiveDir)%(Filename)%(Extension) + + + + + + + + + + + + + \ No newline at end of file diff --git a/uwp-project/src/SDL_winrt_main_NonXAML.cpp b/uwp-project/src/SDL_winrt_main_NonXAML.cpp new file mode 100644 index 000000000..145ef964a --- /dev/null +++ b/uwp-project/src/SDL_winrt_main_NonXAML.cpp @@ -0,0 +1,89 @@ +/* + SDL_winrt_main_NonXAML.cpp, placed in the public domain by David Ludwig 3/13/14 +*/ + +#include +#include +#include +#include +#include + +/* At least one file in any SDL/WinRT app appears to require compilation + with C++/CX, otherwise a Windows Metadata file won't get created, and + an APPX0702 build error can appear shortly after linking. + + The following set of preprocessor code forces this file to be compiled + as C++/CX, which appears to cause Visual C++ 2012's build tools to + create this .winmd file, and will help allow builds of SDL/WinRT apps + to proceed without error. + + If other files in an app's project enable C++/CX compilation, then it might + be possible for SDL_winrt_main_NonXAML.cpp to be compiled without /ZW, + for Visual C++'s build tools to create a winmd file, and for the app to + build without APPX0702 errors. In this case, if + SDL_WINRT_METADATA_FILE_AVAILABLE is defined as a C/C++ macro, then + the #error (to force C++/CX compilation) will be disabled. + + Please note that /ZW can be specified on a file-by-file basis. To do this, + right click on the file in Visual C++, click Properties, then change the + setting through the dialog that comes up. +*/ +#ifndef SDL_WINRT_METADATA_FILE_AVAILABLE +#ifndef __cplusplus_winrt +#error SDL_winrt_main_NonXAML.cpp must be compiled with /ZW, otherwise build errors due to missing .winmd files can occur. +#endif +#endif + +/* Prevent MSVC++ from warning about threading models when defining our + custom WinMain. The threading model will instead be set via a direct + call to Windows::Foundation::Initialize (rather than via an attributed + function). + + To note, this warning (C4447) does not seem to come up unless this file + is compiled with C++/CX enabled (via the /ZW compiler flag). +*/ +#ifdef _MSC_VER +#pragma warning(disable:4447) +#endif + +/* Make sure the function to initialize the Windows Runtime gets linked in. */ +#ifdef _MSC_VER +#pragma comment(lib, "runtimeobject.lib") +#endif + +// This handler is needed otherwise B button will exit the game as it is the behavior default for UWP apps +void OnBackRequested(Platform::Object^, Windows::UI::Core::BackRequestedEventArgs^ args) +{ + args->Handled = true; +} + +void onInitialized() +{ + Windows::UI::Core::SystemNavigationManager::GetForCurrentView()->BackRequested += ref new Windows::Foundation::EventHandler(OnBackRequested); + + // workaround untill new config is released + std::string controllerMapping = ",*,a:b1,b:b0,x:b3,y:b2,back:b6,start:b7,leftstick:b8,rightstick:b9,leftshoulder:b4,rightshoulder:b5,dpup:b10,dpdown:b12,dpleft:b13,dpright:b11,leftx:a1,lefty:a0~,rightx:a3,righty:a2~,lefttrigger:a4,righttrigger:a5,platform:WinRT"; + + for(int i = 0; i < SDL_NumJoysticks(); ++i) + { + SDL_JoystickType type = SDL_JoystickGetDeviceType(i); + + if(type == SDL_JOYSTICK_POWER_UNKNOWN) + continue; + + SDL_JoystickGUID guid = SDL_JoystickGetDeviceGUID(i); + + if(!guid.data) + continue; + + char guidString[33]; + SDL_JoystickGetGUIDString(guid, guidString, 33); + SDL_GameControllerAddMapping((guidString + controllerMapping).c_str()); + } +} + +int CALLBACK WinMain(HINSTANCE, HINSTANCE, LPSTR, int) +{ + devilution::setOnInitialized(&onInitialized); + return SDL_WinRTRunApp(devilution::DiabloMain, NULL); +}