-
Notifications
You must be signed in to change notification settings - Fork 791
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Xbox NXDK platform #4838
Merged
Merged
Xbox NXDK platform #4838
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
2e75c0e
Xbox NXDK platform
glebm a33e3ea
[xbox] Initialize the video system and specify search path
AJenbo 445b4ba
Xbox NXDK: Generate ISO
glebm e934a57
Xbox NXDK: Build a zip instead of iso
glebm 64f3b41
Xbox NXDK: Handle drives
glebm 2f1b82f
Xbox NXDK: Default vsync to false and hide option
glebm c22df26
Xbox NXDK: Disable upscaling by default
glebm 88c7aca
Xbox NXDK: Add xbe logo
glebm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: Xbox | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
types: [ opened, synchronize ] | ||
|
||
jobs: | ||
xbox: | ||
# `ubuntu-latest` is currently 20.04 but we require a newer clang. | ||
runs-on: ubuntu-22.04 | ||
env: | ||
NXDK_DIR: /opt/nxdk | ||
steps: | ||
- name: Install APT packages | ||
run: sudo apt-get update && sudo apt-get install -y clang llvm lld bison flex cmake git gettext | ||
|
||
- name: Clone NXDK Repo | ||
shell: bash | ||
run: git clone --recursive --depth 1 --branch devilutionx https://github.com/glebm/nxdk.git "$NXDK_DIR" | ||
|
||
- name: Build NXDK | ||
shell: bash | ||
run: PATH="${NXDK_DIR}/bin:$PATH" make -j $(nproc) -C "$NXDK_DIR" NXDK_ONLY=1 all cxbe | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Configure CMake | ||
working-directory: ${{github.workspace}} | ||
run: cmake -S. -Bbuild-xbox -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_TOOLCHAIN_FILE=/opt/nxdk/share/toolchain-nxdk.cmake | ||
|
||
- name: Build | ||
working-directory: ${{github.workspace}} | ||
shell: bash | ||
run: cmake --build build-xbox -j $(nproc) --target nxdk_xbe | ||
|
||
- name: Upload-Package | ||
if: ${{ !env.ACT }} | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: devilutionx | ||
path: build-xbox/pkg/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,3 +67,7 @@ endif() | |
if(UWP_LIB) | ||
include(platforms/uwp_lib) | ||
endif() | ||
|
||
if(NXDK) | ||
include(platforms/xbox_nxdk) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
set(NONET ON) | ||
set(ASAN OFF) | ||
set(UBSAN OFF) | ||
|
||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/xbox_nxdk/finders") | ||
|
||
set(DEVILUTIONX_SYSTEM_BZIP2 OFF) | ||
|
||
set(BUILD_ASSETS_MPQ OFF) | ||
set(DEVILUTIONX_ASSETS_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/pkg/assets") | ||
|
||
set(DEVILUTIONX_RESAMPLER_SPEEX OFF) | ||
set(DEFAULT_AUDIO_BUFFER_SIZE 5120) | ||
|
||
set(CMAKE_THREAD_LIBS_INIT "-lpthread") | ||
set(CMAKE_HAVE_THREADS_LIBRARY 1) | ||
set(CMAKE_USE_WIN32_THREADS_INIT 0) | ||
set(CMAKE_USE_PTHREADS_INIT 1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
if(NOT TARGET PNG::PNG) | ||
find_package(PkgConfig REQUIRED) | ||
pkg_check_modules(PNG REQUIRED IMPORTED_TARGET libpng) | ||
add_library(PNG::PNG ALIAS PkgConfig::PNG) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
if(NOT TARGET SDL2::SDL2) | ||
find_package(PkgConfig REQUIRED) | ||
pkg_check_modules(SDL2 REQUIRED IMPORTED_TARGET sdl2) | ||
add_library(SDL2::SDL2 ALIAS PkgConfig::SDL2) | ||
add_library(SDL2_nomain INTERFACE) | ||
add_library(SDL2::SDL2main ALIAS SDL2_nomain) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
if(NOT TARGET ZLIB::ZLIB) | ||
find_package(PkgConfig REQUIRED) | ||
pkg_check_modules(ZLIB REQUIRED IMPORTED_TARGET zlib) | ||
add_library(ZLIB::ZLIB ALIAS PkgConfig::ZLIB) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
if(NOT TARGET fmt::fmt) | ||
find_package(PkgConfig REQUIRED) | ||
pkg_check_modules(fmt REQUIRED IMPORTED_TARGET fmt) | ||
add_library(fmt::fmt ALIAS PkgConfig::fmt) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,7 @@ void ReadOnlyTest() | |
} | ||
|
||
fclose(f); | ||
RemoveFile(path); | ||
RemoveFile(path.c_str()); | ||
} | ||
|
||
} // namespace devilution |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,10 @@ | |
#include "platform/ctr/display.hpp" | ||
#endif | ||
|
||
#ifdef NXDK | ||
#include <hal/video.h> | ||
#endif | ||
|
||
#include "DiabloUI/diabloui.h" | ||
#include "control.h" | ||
#include "controls/controller.h" | ||
|
@@ -98,7 +102,7 @@ void CalculatePreferredWindowSize(int &width, int &height) | |
|
||
void FreeRenderer() | ||
{ | ||
#ifdef _WIN32 | ||
#if defined(_WIN32) && !defined(NXDK) | ||
bool wasD3D9 = false; | ||
bool wasD3D11 = false; | ||
if (renderer != nullptr) { | ||
|
@@ -114,7 +118,7 @@ void FreeRenderer() | |
renderer = nullptr; | ||
} | ||
|
||
#ifdef _WIN32 | ||
#if defined(_WIN32) && !defined(NXDK) | ||
// On Windows 11 the directx9 VSYNC timer doesn't get recreated properly, see https://github.com/libsdl-org/SDL/issues/5099 | ||
// Furthermore, the direct3d11 driver "poisons" the window so it can't be used by another renderer | ||
if ((wasD3D9 && *sgOptions.Graphics.upscale && *sgOptions.Graphics.vSync) || (wasD3D11 && !*sgOptions.Graphics.upscale)) { | ||
|
@@ -235,6 +239,18 @@ bool SpawnWindow(const char *lpWindowName) | |
#ifdef __vita__ | ||
scePowerSetArmClockFrequency(444); | ||
#endif | ||
#ifdef NXDK | ||
{ | ||
Size windowSize = *sgOptions.Graphics.resolution; | ||
VIDEO_MODE xmode; | ||
void *p = nullptr; | ||
while (XVideoListModes(&xmode, 0, 0, &p)) { | ||
if (windowSize.width >= xmode.width && windowSize.height == xmode.height) | ||
break; | ||
Comment on lines
+248
to
+249
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This logic could be better, but lets wait until XNDK gets the SDL calls implemented. |
||
} | ||
XVideoSetMode(xmode.width, xmode.height, xmode.bpp, xmode.refresh); | ||
} | ||
#endif | ||
|
||
#if SDL_VERSION_ATLEAST(2, 0, 6) && defined(__vita__) | ||
SDL_SetHint(SDL_HINT_TOUCH_MOUSE_EVENTS, "0"); | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: The preferred spelling of nxdk is "nxdk" (all lowercase, even as first word in sentence).
Initially there were some disagreements about that spelling, but we settled on the all-lowercase variant a couple of years ago (if I remember correctly, also to differentiate it from the MS XDK). All-caps
NXDK
is only used in code for defines and such.There were other instances in this PR which use the all-caps spelling, too.
Slightly related: While MS didn't agree on a stylization around 2001, the XboxDev community prefers to use the now-preferred MS spelling of "Xbox" (capital "X", lower-case "box") for the console name. If there might be confusion with other consoles, "original Xbox" is used ("original" in lowercase unless at start of sentence or similar).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, noted!