Browse Source

Xbox One/Series support (#3946)

pull/3965/head
Felipe Wannmacher 4 years ago committed by GitHub
parent
commit
8efbcf2058
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      .gitignore
  2. 18
      3rdParty/SDL2/CMake/FindSDL2.cmake
  3. 4
      3rdParty/SDL2/CMakeLists.txt
  4. 5
      3rdParty/SDL_image/CMakeLists.txt
  5. 4
      3rdParty/libsmackerdec/CMakeLists.txt
  6. 49
      3rdParty/zlib/CMakeLists.txt
  7. 39
      CMake/Dependencies.cmake
  8. 4
      CMake/Platforms.cmake
  9. 26
      CMake/platforms/uwp_lib.cmake
  10. 13
      CMakeLists.txt
  11. 20
      Packaging/xbox-one/build.bat
  12. 13
      Source/diablo.cpp
  13. 4
      Source/diablo.h
  14. 4
      Source/init.cpp
  15. 2
      Source/utils/display.cpp
  16. 2
      Source/utils/stdcompat/optional.hpp
  17. 2
      Source/utils/stdcompat/string_view.hpp
  18. 16
      appveyor-uwp.yml
  19. 34
      docs/building.md
  20. 40
      docs/manual/platforms/xbox-one.md
  21. BIN
      uwp-project/Assets/BadgeLogo.scale-200.png
  22. BIN
      uwp-project/Assets/LargeTile.scale-200.png
  23. BIN
      uwp-project/Assets/Logo.scale-200.png
  24. BIN
      uwp-project/Assets/SmallLogo.altform-lightunplated_targetsize-48.png
  25. BIN
      uwp-project/Assets/SmallLogo.altform-unplated_targetsize-48.png
  26. BIN
      uwp-project/Assets/SmallLogo.scale-200.png
  27. BIN
      uwp-project/Assets/SmallLogo.targetsize-48.png
  28. BIN
      uwp-project/Assets/SmallTile.scale-200.png
  29. BIN
      uwp-project/Assets/SplashScreen.scale-200.png
  30. BIN
      uwp-project/Assets/StoreLogo.scale-200.png
  31. BIN
      uwp-project/Assets/WideTile.scale-200.png
  32. 51
      uwp-project/Package.appxmanifest
  33. 51
      uwp-project/Package.appxmanifest.template
  34. 27
      uwp-project/devilutionx.sln
  35. 140
      uwp-project/devilutionx.vcxproj
  36. 89
      uwp-project/src/SDL_winrt_main_NonXAML.cpp

7
.gitignore vendored

@ -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

18
3rdParty/SDL2/CMake/FindSDL2.cmake vendored

@ -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()

4
3rdParty/SDL2/CMakeLists.txt vendored

@ -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()

5
3rdParty/SDL_image/CMakeLists.txt vendored

@ -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()

4
3rdParty/libsmackerdec/CMakeLists.txt vendored

@ -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()

49
3rdParty/zlib/CMakeLists.txt vendored

@ -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)

39
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()

4
CMake/Platforms.cmake

@ -59,3 +59,7 @@ endif()
if(EMSCRIPTEN)
include(platforms/emscripten)
endif()
if(UWP_LIB)
include(platforms/uwp_lib)
endif()

26
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)

13
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")

20
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

13
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();

4
Source/diablo.h

@ -120,4 +120,8 @@ extern bool gbFriendlyMode;
*/
extern GameLogicStep gGameLogicStep;
#ifdef __UWP__
void setOnInitialized(void (*)());
#endif
} // namespace devilution

4
Source/init.cpp

@ -8,7 +8,7 @@
#include <string>
#include <vector>
#if defined(_WIN64) || defined(_WIN32)
#if (defined(_WIN64) || defined(_WIN32)) && !defined(__UWP__)
#include <find_steam_game.h>
#endif
@ -96,7 +96,7 @@ std::vector<std::string> 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) {

2
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);

2
Source/utils/stdcompat/optional.hpp

@ -1,7 +1,7 @@
#pragma once
#ifdef __has_include
#if defined(__cplusplus) && __cplusplus >= 201606L && __has_include(<optional>)
#if defined(__cplusplus) && (__cplusplus >= 201606L || _MSC_VER >= 1930) && __has_include(<optional>)
#include <optional> // IWYU pragma: export
#elif __has_include(<experimental/optional>)
#include <experimental/optional> // IWYU pragma: export

2
Source/utils/stdcompat/string_view.hpp

@ -1,7 +1,7 @@
#pragma once
#ifdef __has_include
#if defined(__cplusplus) && __cplusplus >= 201703L && __has_include(<string_view>) // should be 201606L, but STL headers disagree
#if defined(__cplusplus) && (__cplusplus >= 201703L || _MSC_VER >= 1930) && __has_include(<string_view>) // should be 201606L, but STL headers disagree
#include <string_view> // IWYU pragma: export
namespace devilution {

16
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

34
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
~~~
</details>
<details><summary>Xbox One/Series</summary>
### 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)
</details>
<details><summary><b>CMake build options</b></summary>
### General

40
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>\_<version>\_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

BIN
uwp-project/Assets/BadgeLogo.scale-200.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 319 B

BIN
uwp-project/Assets/LargeTile.scale-200.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

BIN
uwp-project/Assets/Logo.scale-200.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

BIN
uwp-project/Assets/SmallLogo.altform-lightunplated_targetsize-48.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

BIN
uwp-project/Assets/SmallLogo.altform-unplated_targetsize-48.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

BIN
uwp-project/Assets/SmallLogo.scale-200.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

BIN
uwp-project/Assets/SmallLogo.targetsize-48.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

BIN
uwp-project/Assets/SmallTile.scale-200.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

BIN
uwp-project/Assets/SplashScreen.scale-200.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

BIN
uwp-project/Assets/StoreLogo.scale-200.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

BIN
uwp-project/Assets/WideTile.scale-200.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

51
uwp-project/Package.appxmanifest

@ -0,0 +1,51 @@
<?xml version="1.0" encoding="utf-8"?>
<Package
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest"
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
IgnorableNamespaces="uap mp">
<Identity
Name="b6830ff4-1ef5-4907-9d9e-1ba808edf70f"
Publisher="CN=devilutionX"
Version="0.0.0.0" />
<mp:PhoneIdentity PhoneProductId="b6830ff4-1ef5-4907-9d9e-1ba808edf70f" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>
<Properties>
<DisplayName>devilutionX</DisplayName>
<PublisherDisplayName>devilution Team</PublisherDisplayName>
<Logo>Assets\StoreLogo.png</Logo>
</Properties>
<Dependencies>
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.10069.0" MaxVersionTested="10.0.10069.0" />
</Dependencies>
<Resources>
<Resource Language="x-generate"/>
</Resources>
<Applications>
<Application Id="App"
Executable="$targetnametoken$.exe"
EntryPoint="devilutionX.App">
<uap:VisualElements
DisplayName="DevilutionX"
Square150x150Logo="Assets\Logo.png"
Square44x44Logo="Assets\SmallLogo.png"
Description="DevilutionX"
BackgroundColor="#000000">
<uap:SplashScreen Image="Assets\SplashScreen.png" BackgroundColor="#000000"/>
<uap:DefaultTile Square71x71Logo="Assets\SmallTile.png" Wide310x150Logo="Assets\WideTile.png" Square310x310Logo="Assets\LargeTile.png"/>
<uap:LockScreen BadgeLogo="Assets\BadgeLogo.png" Notification="badgeAndTileText"/>
</uap:VisualElements>
</Application>
</Applications>
<Capabilities>
<Capability Name="internetClient" />
<Capability Name="internetClientServer"/>
</Capabilities>
</Package>

51
uwp-project/Package.appxmanifest.template

@ -0,0 +1,51 @@
<?xml version="1.0" encoding="utf-8"?>
<Package
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest"
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
IgnorableNamespaces="uap mp">
<Identity
Name="b6830ff4-1ef5-4907-9d9e-1ba808edf70f"
Publisher="CN=devilutionX"
Version="__PROJECT_VERSION__" />
<mp:PhoneIdentity PhoneProductId="b6830ff4-1ef5-4907-9d9e-1ba808edf70f" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>
<Properties>
<DisplayName>devilutionX</DisplayName>
<PublisherDisplayName>devilution Team</PublisherDisplayName>
<Logo>Assets\StoreLogo.png</Logo>
</Properties>
<Dependencies>
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.10069.0" MaxVersionTested="10.0.10069.0" />
</Dependencies>
<Resources>
<Resource Language="x-generate"/>
</Resources>
<Applications>
<Application Id="App"
Executable="$targetnametoken$.exe"
EntryPoint="devilutionX.App">
<uap:VisualElements
DisplayName="DevilutionX"
Square150x150Logo="Assets\Logo.png"
Square44x44Logo="Assets\SmallLogo.png"
Description="DevilutionX"
BackgroundColor="#000000">
<uap:SplashScreen Image="Assets\SplashScreen.png" BackgroundColor="#000000"/>
<uap:DefaultTile Square71x71Logo="Assets\SmallTile.png" Wide310x150Logo="Assets\WideTile.png" Square310x310Logo="Assets\LargeTile.png"/>
<uap:LockScreen BadgeLogo="Assets\BadgeLogo.png" Notification="badgeAndTileText"/>
</uap:VisualElements>
</Application>
</Applications>
<Capabilities>
<Capability Name="internetClient" />
<Capability Name="internetClientServer"/>
</Capabilities>
</Package>

27
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

140
uwp-project/devilutionx.vcxproj

@ -0,0 +1,140 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{3183a558-46f4-4fef-8684-0a79b793599f}</ProjectGuid>
<Keyword>DirectXApp</Keyword>
<RootNamespace>devilutionX</RootNamespace>
<DefaultLanguage>en-US</DefaultLanguage>
<MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>
<AppContainerApplication>true</AppContainerApplication>
<ApplicationType>Windows Store</ApplicationType>
<ApplicationTypeRevision>8.2</ApplicationTypeRevision>
<TargetPlatformVersion>10.0.10069.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.10069.0</TargetPlatformMinVersion>
<WindowsTargetPlatformVersion>10.0.22000.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformMinVersion>10.0.14393.0</WindowsTargetPlatformMinVersion>
<ProjectName>devilutionX</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v143</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
<Import Project="$(VSINSTALLDIR)\Common7\IDE\Extensions\Microsoft\VsGraphics\ImageContentTask.props" />
<Import Project="$(VSINSTALLDIR)\Common7\IDE\Extensions\Microsoft\VsGraphics\MeshContentTask.props" />
<Import Project="$(VSINSTALLDIR)\Common7\IDE\Extensions\Microsoft\VsGraphics\ShaderGraphContentTask.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<PackageCertificateKeyFile>devilutionX_TemporaryKey.pfx</PackageCertificateKeyFile>
<AppxPackageSigningEnabled>True</AppxPackageSigningEnabled>
<GenerateAppInstallerFile>False</GenerateAppInstallerFile>
<AppxPackageSigningTimestampDigestAlgorithm>SHA256</AppxPackageSigningTimestampDigestAlgorithm>
<AppxAutoIncrementPackageRevision>True</AppxAutoIncrementPackageRevision>
<GenerateTestArtifacts>True</GenerateTestArtifacts>
<AppxBundle>Always</AppxBundle>
<AppxBundlePlatforms>x64</AppxBundlePlatforms>
<HoursBetweenUpdateChecks>0</HoursBetweenUpdateChecks>
<AppxPackageDir>..\build\uwp-project\AppxPackages</AppxPackageDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<OutDir>..\build\uwp-project\$(Configuration)\</OutDir>
<IntDir>..\build\uwp-project\obj\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>..\build\uwp-project\$(Configuration)\</OutDir>
<IntDir>..\build\uwp-project\obj\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Link>
<AdditionalDependencies>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)</AdditionalDependencies>
<AdditionalLibraryDirectories>..\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)</AdditionalLibraryDirectories>
</Link>
<ClCompile>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>$(IntDir)pch.pch</PrecompiledHeaderOutputFile>
<AdditionalIncludeDirectories>..\Source;..\build\SDL\include;..\build\_deps\sdl_audiolib-src\include;..\build\_deps\sdl_audiolib-build;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
<DisableSpecificWarnings>4453;28204</DisableSpecificWarnings>
<PreprocessorDefinitions>_DEBUG;__UWP__=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<LanguageStandard>stdcpp17</LanguageStandard>
<CompileAsWinRT>true</CompileAsWinRT>
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<EnableModules>false</EnableModules>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Link>
<AdditionalDependencies>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)</AdditionalDependencies>
<AdditionalLibraryDirectories>..\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)</AdditionalLibraryDirectories>
</Link>
<ClCompile>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>$(IntDir)pch.pch</PrecompiledHeaderOutputFile>
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
<DisableSpecificWarnings>4453;28204</DisableSpecificWarnings>
<PreprocessorDefinitions>NDEBUG;__UWP__=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<AdditionalIncludeDirectories>..\Source;..\build\SDL\include;..\build\_deps\sdl_audiolib-src\include;..\build\_deps\sdl_audiolib-build;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
</ItemDefinitionGroup>
<ItemGroup>
<Image Include="Assets\BadgeLogo.scale-200.png" />
<Image Include="Assets\LargeTile.scale-200.png" />
<Image Include="Assets\Logo.scale-200.png" />
<Image Include="Assets\SmallLogo.altform-lightunplated_targetsize-48.png" />
<Image Include="Assets\SmallLogo.altform-unplated_targetsize-48.png" />
<Image Include="Assets\SmallLogo.scale-200.png" />
<Image Include="Assets\SmallLogo.targetsize-48.png" />
<Image Include="Assets\SmallTile.scale-200.png" />
<Image Include="Assets\SplashScreen.scale-200.png" />
<Image Include="Assets\StoreLogo.scale-200.png" />
<Image Include="Assets\WideTile.scale-200.png" />
</ItemGroup>
<ItemGroup>
<AppxManifest Include="Package.appxmanifest">
<SubType>Designer</SubType>
</AppxManifest>
<None Include="..\build\assets\*\*.*">
<DeploymentContent>true</DeploymentContent>
<Link>Assets\%(RecursiveDir)%(Filename)%(Extension)</Link>
</None>
<None Include="devilutionX_TemporaryKey.pfx" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\SDL_winrt_main_NonXAML.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="$(VSINSTALLDIR)\Common7\IDE\Extensions\Microsoft\VsGraphics\ImageContentTask.targets" />
<Import Project="$(VSINSTALLDIR)\Common7\IDE\Extensions\Microsoft\VsGraphics\MeshContentTask.targets" />
<Import Project="$(VSINSTALLDIR)\Common7\IDE\Extensions\Microsoft\VsGraphics\ShaderGraphContentTask.targets" />
</ImportGroup>
</Project>

89
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 <SDL.h>
#include <diablo.h>
#include <wrl.h>
#include <iostream>
#include <string>
/* 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<Windows::UI::Core::BackRequestedEventArgs^>(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);
}
Loading…
Cancel
Save