From 58d830930e321d2bf04f557de822d29500e738da Mon Sep 17 00:00:00 2001 From: Vannevar X Date: Sat, 20 Jun 2026 21:35:38 -0400 Subject: [PATCH 1/2] Builds most libraries for Xbox, sans Fluidsynth (too slow) and Harfbuzz (too big). As of now the EasyRPG-Player code for Xbox is not pushed yet, so this is here for preliminary review if anyone feels like it. In general there were issues where NXDK defines WIN32 and part of the Windows API, but not all of it. In most cases this was fixed by removing unused file access functions. Also there were issues with autoconf choking on the compiler configuration, so there are some patches around that. --- .gitignore | 5 + shared/add_lib.sh | 2 +- shared/mk-meson-cross.sh | 8 + xbox/1_download_library.sh | 127 ++++++++ xbox/2_build_toolchain.sh | 296 ++++++++++++++++++ xbox/3_cleanup.sh | 13 + xbox/compat_headers/fcntl.h | 20 ++ xbox/compat_headers/io.h | 13 + xbox/compat_headers/sal.h | 26 ++ xbox/compat_headers/sys/stat.h | 14 + xbox/compat_headers/sys/types.h | 17 + xbox/compat_headers/winnls.h | 11 + .../expat/avoid_export_underscores.patch | 3 + xbox/patches/expat/ignore_memory_dot_h.patch | 5 + xbox/patches/expat/no_errno.patch | 8 + xbox/patches/expat/no_get_pid.patch | 8 + .../fluidlite/force_c99_compilation.patch | 4 + xbox/patches/harfbuzz/ignore_glib.patch | 74 +++++ xbox/patches/harfbuzz/no_win32_io.patch | 2 + xbox/patches/icu/avoid_rti_str_ptr_cmp.patch | 8 + xbox/patches/icu/data_no_pie.patch | 4 + xbox/patches/icu/ignore_timezone.patch | 107 +++++++ .../patches/icu/ignore_windows_datetime.patch | 36 +++ xbox/patches/icu/ignore_windows_locale.patch | 45 +++ .../icu/ignore_windows_number_formats.patch | 36 +++ .../patches/icu/ignore_windows_timezone.patch | 54 ++++ xbox/patches/icu/normalizer_static_cast.patch | 8 + xbox/patches/icu/patch_configure_checks.patch | 65 ++++ .../patches/lhasa/avoid_autoconf_issues.patch | 24 ++ .../lhasa/stub_lha_arch_set_binary.patch | 4 + .../libogg/avoid_autoconf_issues.patch | 21 ++ xbox/patches/libogg/skip_tests.patch | 28 ++ .../libsndfile/avoid_autoconf_issues.patch | 28 ++ xbox/patches/libsndfile/skip_file_io.patch | 244 +++++++++++++++ xbox/patches/libsndfile/skip_logging.patch | 18 ++ xbox/patches/libsndfile/update_defines.patch | 11 + .../libvorbis/avoid_autoconf_issues.patch | 21 ++ xbox/patches/libvorbis/skip_tests.patch | 98 ++++++ .../force_libxmp_static_define.patch | 3 + xbox/patches/libxmp-lite/use_c99.patch | 4 + .../mpg123/output_as_dot_a_use_llvm_ar.patch | 12 + .../mpg123/patch_configure_checks.patch | 225 +++++++++++++ xbox/patches/mpg123/stub_out_file_io.patch | 161 ++++++++++ .../patches/mpg123/use_stricmp_strnicmp.patch | 7 + xbox/patches/opus/skip_abort_behavior.patch | 4 + xbox/patches/opus/skip_intrinsics.patch | 4 + .../opusfile/avoid_autoconf_issues.patch | 21 ++ xbox/patches/opusfile/no_win32_io.patch | 18 ++ .../sdl3-nxdk/add_install_to_cmakelists.patch | 59 ++++ .../speexdsp/avoid_autoconf_issues.patch | 21 ++ .../use_generic_io_and_atof_shim.patch | 8 + xbox/patches/zlib/skip_io_stuff.patch | 143 +++++++++ xbox/scripts/dump_nxdk_env.mk | 8 + xbox/scripts/dump_sdl3_env.mk | 5 + 54 files changed, 2218 insertions(+), 1 deletion(-) create mode 100644 xbox/1_download_library.sh create mode 100644 xbox/2_build_toolchain.sh create mode 100644 xbox/3_cleanup.sh create mode 100644 xbox/compat_headers/fcntl.h create mode 100644 xbox/compat_headers/io.h create mode 100644 xbox/compat_headers/sal.h create mode 100644 xbox/compat_headers/sys/stat.h create mode 100644 xbox/compat_headers/sys/types.h create mode 100644 xbox/compat_headers/winnls.h create mode 100644 xbox/patches/expat/avoid_export_underscores.patch create mode 100644 xbox/patches/expat/ignore_memory_dot_h.patch create mode 100644 xbox/patches/expat/no_errno.patch create mode 100644 xbox/patches/expat/no_get_pid.patch create mode 100644 xbox/patches/fluidlite/force_c99_compilation.patch create mode 100644 xbox/patches/harfbuzz/ignore_glib.patch create mode 100644 xbox/patches/harfbuzz/no_win32_io.patch create mode 100644 xbox/patches/icu/avoid_rti_str_ptr_cmp.patch create mode 100644 xbox/patches/icu/data_no_pie.patch create mode 100644 xbox/patches/icu/ignore_timezone.patch create mode 100644 xbox/patches/icu/ignore_windows_datetime.patch create mode 100644 xbox/patches/icu/ignore_windows_locale.patch create mode 100644 xbox/patches/icu/ignore_windows_number_formats.patch create mode 100644 xbox/patches/icu/ignore_windows_timezone.patch create mode 100644 xbox/patches/icu/normalizer_static_cast.patch create mode 100644 xbox/patches/icu/patch_configure_checks.patch create mode 100644 xbox/patches/lhasa/avoid_autoconf_issues.patch create mode 100644 xbox/patches/lhasa/stub_lha_arch_set_binary.patch create mode 100644 xbox/patches/libogg/avoid_autoconf_issues.patch create mode 100644 xbox/patches/libogg/skip_tests.patch create mode 100644 xbox/patches/libsndfile/avoid_autoconf_issues.patch create mode 100644 xbox/patches/libsndfile/skip_file_io.patch create mode 100644 xbox/patches/libsndfile/skip_logging.patch create mode 100644 xbox/patches/libsndfile/update_defines.patch create mode 100644 xbox/patches/libvorbis/avoid_autoconf_issues.patch create mode 100644 xbox/patches/libvorbis/skip_tests.patch create mode 100644 xbox/patches/libxmp-lite/force_libxmp_static_define.patch create mode 100644 xbox/patches/libxmp-lite/use_c99.patch create mode 100644 xbox/patches/mpg123/output_as_dot_a_use_llvm_ar.patch create mode 100644 xbox/patches/mpg123/patch_configure_checks.patch create mode 100644 xbox/patches/mpg123/stub_out_file_io.patch create mode 100644 xbox/patches/mpg123/use_stricmp_strnicmp.patch create mode 100644 xbox/patches/opus/skip_abort_behavior.patch create mode 100644 xbox/patches/opus/skip_intrinsics.patch create mode 100644 xbox/patches/opusfile/avoid_autoconf_issues.patch create mode 100644 xbox/patches/opusfile/no_win32_io.patch create mode 100644 xbox/patches/sdl3-nxdk/add_install_to_cmakelists.patch create mode 100644 xbox/patches/speexdsp/avoid_autoconf_issues.patch create mode 100644 xbox/patches/wildmidi/use_generic_io_and_atof_shim.patch create mode 100644 xbox/patches/zlib/skip_io_stuff.patch create mode 100644 xbox/scripts/dump_nxdk_env.mk create mode 100644 xbox/scripts/dump_sdl3_env.mk diff --git a/.gitignore b/.gitignore index d7490186..77324565 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,11 @@ !/windows/fluidsynth-easyrpg/ !/windows/helper/ +# And some Original Xbox ones +!/xbox/patches/ +!/xbox/compat_headers/ +!/xbox/scripts/ + # Except everything in shared !/shared/* diff --git a/shared/add_lib.sh b/shared/add_lib.sh index eb208969..056e2e26 100644 --- a/shared/add_lib.sh +++ b/shared/add_lib.sh @@ -7,7 +7,7 @@ echo "REMOVE THIS LINE";exit 1 # Remove _cmake when the lib uses autotools for building NAME=lhasa LIBVAR=LHASA -TOOLCHAIN_DIRS=(linux-static macos android emscripten 3ds switch vita wii ios) +TOOLCHAIN_DIRS=(linux-static macos android emscripten 3ds switch vita wii ios xbox) CMAKE= #------- diff --git a/shared/mk-meson-cross.sh b/shared/mk-meson-cross.sh index 254da299..b5ddab75 100755 --- a/shared/mk-meson-cross.sh +++ b/shared/mk-meson-cross.sh @@ -84,6 +84,14 @@ case "$1" in esac STRIP="llvm-strip" ;; +"xbox") + PLAT_SYSTEM="windows" + PLAT_CPU_FAMILY="x86" + PLAT_CPU="i686" + AR="llvm-lib" + STRIP="llvm-strip" + PLAT_OPTIONS_ADD="b_staticpic = false" + ;; *apple-darwin) PLAT_SYSTEM="darwin" case "$1" in diff --git a/xbox/1_download_library.sh b/xbox/1_download_library.sh new file mode 100644 index 00000000..4f503ac2 --- /dev/null +++ b/xbox/1_download_library.sh @@ -0,0 +1,127 @@ +#!/bin/bash + +# abort on errors +set -e + +export WORKSPACE=$PWD + +# Called NXDK_DEVKIT_DIR because NXDK_DIR is used by NXDK, sorry about the redundancy +export NXDK_DEVKIT_DIR="nxdk" + +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +source $SCRIPT_DIR/../shared/import.sh + +NXDK_URL="https://github.com/VannevarXbox/nxdk-EasyRPG/releases/download/0.1/nxdk-easyRPG.zip" +SDL3_URL="https://github.com/VannevarXbox/nxdk-sdl3/releases/download/0.1a/nxdk-sdl3.zip" + +msg " [1] Preparing libraries" + +# nxdk (New Xbox Development Kit) +rm -rf $NXDK_DEVKIT_DIR +download_and_extract $NXDK_URL + +# ALSO INCLUDED WITH NXDK +# zlib +rm -rf $ZLIB_DIR +download_and_extract $ZLIB_URL + +# ALSO INCLUDED WITH NXDK +# libpng +rm -rf $LIBPNG_DIR +download_and_extract $LIBPNG_URL + +# freetype +rm -rf $FREETYPE_DIR +download_and_extract $FREETYPE_URL + +# lhasa +rm -rf $LHASA_DIR +download_and_extract $LHASA_URL + +# libxmp-lite +rm -rf $LIBXMP_LITE_DIR +download_and_extract $LIBXMP_LITE_URL + +# libsndfile +rm -rf $LIBSNDFILE_DIR +download_and_extract $LIBSNDFILE_URL + +# opus +rm -rf $OPUS_DIR +download_and_extract $OPUS_URL + +# # opusfile +rm -rf $OPUSFILE_DIR +download_and_extract $OPUSFILE_URL + +# libogg +rm -rf $LIBOGG_DIR +download_and_extract $LIBOGG_URL + +# libvorbis +rm -rf $LIBVORBIS_DIR +download_and_extract $LIBVORBIS_URL + +# nlohmann-json +rm -rf $NLOHMANNJSON_DIR +download_and_extract $NLOHMANNJSON_URL + +# # expat +rm -rf $EXPAT_DIR +download_and_extract $EXPAT_URL + +# speexdsp +rm -rf $SPEEXDSP_DIR +download_and_extract $SPEEXDSP_URL + +# SDL3 (NXDK VERSION) +rm -rf $SDL3_DIR +download_and_extract $SDL3_URL + +# ICU +rm -rf $ICU_DIR +download_and_extract $ICU_URL + +# # icudata +rm -f $ICUDATA_FILES +download_and_extract $ICUDATA_URL + +# FluidLite +rm -rf $FLUIDLITE_DIR +download_and_extract $FLUIDLITE_URL + +# fmt +rm -rf $FMT_DIR +download_and_extract $FMT_URL + +# inih +rm -rf $INIH_DIR +download_and_extract $INIH_URL + +# mpg123 +rm -rf $MPG123_DIR +download_and_extract $MPG123_URL + +# pixman +rm -rf $PIXMAN_DIR +download_and_extract $PIXMAN_URL + +# wildmidi +rm -rf $WILDMIDI_DIR +download_and_extract $WILDMIDI_URL + +# liblcf +rm -rf liblcf +download_liblcf + + +################## NO ###################### + +# Too heavy for original Xbox +# harfbuzz +# rm -rf $HARFBUZZ_DIR +# download_and_extract $HARFBUZZ_URL + + + + diff --git a/xbox/2_build_toolchain.sh b/xbox/2_build_toolchain.sh new file mode 100644 index 00000000..15ace60f --- /dev/null +++ b/xbox/2_build_toolchain.sh @@ -0,0 +1,296 @@ +#!/bin/bash + +# abort on error +set -e + +export NXDK_DEVKIT_DIR="nxdk" +eval "$("$NXDK_DEVKIT_DIR/bin/activate" -s)" + +# Verify NXDK environment +if [ -z "${NXDK_DIR}" ]; then + echo "Error: NXDK_DIR is not set. Run 'source nxdk/bin/activate' before building." >&2 + exit 1 +fi + +echo $NXDK_DIR + +export WORKSPACE=$PWD + +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +source $SCRIPT_DIR/../shared/import.sh + +# Number of CPUs +nproc=$(nproc) + +# Use ccache? +test_ccache + +# Ensure that only NXDK libs get built, since there's no target right now +export NXDK_ONLY=y + +# Compile NXDK +(cd $NXDK_DIR + make + make tools +) + +if [ ! -f .patches-applied ]; then + echo "Patching libraries" + + patches_common + + verbosemsg "SDL3-NXDK" + (cd $SDL3_DIR + patch CMakeLists.txt < $WORKSPACE/patches/sdl3-nxdk/add_install_to_cmakelists.patch + ) + + verbosemsg "mpg123" + (cd $MPG123_DIR + # This fixes some trip ups in compilation, where configure doesn't think that the compiler works (it does). + # It also bypasses a failure to determine the output file extension, and fixes a failure to detect Windows + # unicode filename support. + patch configure < $WORKSPACE/patches/mpg123/patch_configure_checks.patch + # Outputs lib in .a format, since compiler detection stuff was putting out a .lib, and use llvm-ar instead of + # lib.exe which it wants to use for MSVC + patch configure < $WORKSPACE/patches/mpg123/output_as_dot_a_use_llvm_ar.patch + patch src/config.h.in < $WORKSPACE/patches/mpg123/use_stricmp_strnicmp.patch + # Stub out various file access functions & add a couple defines to reduce file IO function count + patch -Np1 < $WORKSPACE/patches/mpg123/stub_out_file_io.patch + ) + verbosemsg "fluidlite" + (cd $FLUIDLITE_DIR + # Compiles based on C99 standard to avoid issues linking with NXDK + patch CMakeLists.txt < $WORKSPACE/patches/fluidlite/force_c99_compilation.patch + ) + + verbosemsg "wildmidi" + (cd $WILDMIDI_DIR + # Sets file I/O to use C STL (file I/O is unused by EasyRPG) + # Also shims atof which was compiling as _atof & thus not finding it in NXDK + patch src/file_io.c < $WORKSPACE/patches/wildmidi/use_generic_io_and_atof_shim.patch + + ) + + verbosemsg "speexdsp" + (cd $SPEEXDSP_DIR + # Same old autoconf issues + patch configure < $WORKSPACE/patches/speexdsp/avoid_autoconf_issues.patch + ) + + verbosemsg "expat" + (cd $EXPAT_DIR + # Prevent underscores being expected on function names; can't do via CMakeLists logic easily + patch lib/expat_external.h < $WORKSPACE/patches/expat/avoid_export_underscores.patch + # This doesn't seem to have any downstream effects in this configuration + patch lib/winconfig.h < $WORKSPACE/patches/expat/ignore_memory_dot_h.patch + # Remove get PID since Xbox has no meaningful PID + patch lib/xmlparse.c < $WORKSPACE/patches/expat/no_get_pid.patch + # Skip errno since not found + patch lib/xmlparse.c < $WORKSPACE/patches/expat/no_errno.patch + ) + + verbosemsg "libogg" + (cd $LIBOGG_DIR + patch configure < $WORKSPACE/patches/libogg/avoid_autoconf_issues.patch + # This couldn't be done via autoconf + patch src/Makefile.am < $WORKSPACE/patches/libogg/skip_tests.patch + ) + + verbosemsg "libvorbis" + (cd $LIBVORBIS_DIR + patch configure < $WORKSPACE/patches/libvorbis/avoid_autoconf_issues.patch + # nuclear option, could possibly be skipped more elegantly + patch lib/Makefile.in < $WORKSPACE/patches/libvorbis/skip_tests.patch + ) + + verbosemsg "opus" + (cd $OPUS_DIR + patch celt/arch.h < $WORKSPACE/patches/opus/skip_abort_behavior.patch + patch celt/ecintrin.h < $WORKSPACE/patches/opus/skip_intrinsics.patch + ) + + verbosemsg "opusfile" + (cd $OPUSFILE_DIR + patch configure < $WORKSPACE/patches/opusfile/avoid_autoconf_issues.patch + patch src/stream.c < $WORKSPACE/patches/opusfile/no_win32_io.patch + ) + + verbosemsg "libsndfile" + (cd $LIBSNDFILE_DIR + # This also changes a flag to skip windows version file + patch configure < $WORKSPACE/patches/libsndfile/avoid_autoconf_issues.patch + patch src/sfconfig.h < $WORKSPACE/patches/libsndfile/update_defines.patch + patch src/common.c < $WORKSPACE/patches/libsndfile/skip_logging.patch + patch -Np1 < $WORKSPACE/patches/libsndfile/skip_file_io.patch + ) + + verbosemsg "libxmp-lite" + (cd $LIBXMP_LITE_DIR + # Fixes some NXDK defs + patch CMakeLists.txt < $WORKSPACE/patches/libxmp-lite/use_c99.patch + # The define for LIBXMP_STATIC wasn't making it into the headers + patch include/libxmp-lite/xmp.h < $WORKSPACE/patches/libxmp-lite/force_libxmp_static_define.patch + ) + + verbosemsg "lhasa" + (cd $LHASA_DIR + patch configure < $WORKSPACE/patches/lhasa/avoid_autoconf_issues.patch + patch lib/lha_arch_win32.c < $WORKSPACE/patches/lhasa/stub_lha_arch_set_binary.patch + ) + + # No Harfbuzz right now, too heavy. Builds though + # verbosemsg "harfbuzz" + # (cd $HARFBUZZ_DIR + # patch -Np1 < $WORKSPACE/patches/harfbuzz/ignore_glib.patch + # patch src/hb-blob.cc < $WORKSPACE/patches/harfbuzz/no_win32_io.patch + # ) + + (cd $ZLIB_DIR + patch -Np1 < $WORKSPACE/patches/zlib/skip_io_stuff.patch + ) + + #FIX ICU + verbosemsg "icu" + (cd $ICU_DIR + # Bypasses compiler checks which don't work (why?), also sets host fragment to + # icu_cv_host_frag=mh-mingw instead of icu_cv_host_frag=mh-msys-msvc to avoid + # unwanted preprocessor directives + patch source/configure < $WORKSPACE/patches/icu/patch_configure_checks.patch + # Prevent using Windows API for stuff not provided by NXDK. Most of this + # depends on registry values, and should not be used by EasyRPG anyway. + patch source/config/pkgdataMakefile.in < $WORKSPACE/patches/icu/data_no_pie.patch + patch source/common/normalizer2.cpp < $WORKSPACE/patches/icu/normalizer_static_cast.patch + patch source/common/ustrenum.cpp < $WORKSPACE/patches/icu/avoid_rti_str_ptr_cmp.patch + patch -Np1 < $WORKSPACE/patches/icu/ignore_windows_locale.patch + patch -Np1 < $WORKSPACE/patches/icu/ignore_windows_datetime.patch + patch -Np1 < $WORKSPACE/patches/icu/ignore_timezone.patch + patch -Np1 < $WORKSPACE/patches/icu/ignore_windows_number_formats.patch + ) + + touch .patches-applied +fi + +export XBE_TITLE="EasyRPG Player" #TODO: Where to put this. Probably not here + + +cd $WORKSPACE + +echo "Preparing toolchain" + +export PLATFORM_PREFIX=$WORKSPACE + +function set_build_flags { + export CMAKE_SYSTEM_NAME="Generic" + export CMAKE_SYSTEM_PROCESSOR="x86" + export CMAKE_SYSTEM_LIBRARY_PATH="${NXDK_DIR}/lib" + export CMAKE_SYSTEM_INCLUDE_PATH="${NXDK_DIR}/include" + export MAKEFLAGS="-j${nproc:-2}" + + export TARGET_HOST="i386-pc-windows-msvc" + + # Include headers that provide some Win32 types not provided by NXDK + export CPPFLAGS="$CPPFLAGS -I$WORKSPACE/compat_headers -I$WORKSPACE/include" + + # TRY_COMPILE_TARGET_TYPE_STATIC prevents compilation from choking on wanting an EXE + export CMAKE_EXTRA_ARGS="$CMAKE_EXTRA_ARGS -DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY -DCMAKE_SYSTEM_PROCESSOR=x86" + + eval "$( + make -f scripts/dump_nxdk_env.mk print | sed 's/^/export /' + )" + export CC=nxdk-cc + export CXX=nxdk-cxx + export LD=nxdk-link + export AS=nxdk-as + export LINK=nxdk-link + + + make_meson_cross xbox > meson-cross.txt +} + +install_lib_icu_native + +set_build_flags + + +eval "$( + make -f scripts/dump_sdl3_env.mk SDL3_DIR="$SDL3_DIR" print | sed 's/^/export /' +)" + +echo "FLAGS:" +echo $SDL3_FLAGS # now how to use these + +####################LITE BUILD####################################### + +install_lib_cmake $ZLIB_DIR $ZLIB_ARGS + +install_lib_cmake $LIBPNG_DIR $LIBPNG_ARGS + +# Flags disable compilation of tests & INI Reader, both of which cause issues with missing Win32 headers in NXDK, and this avoids patching +install_lib_meson $INIH_DIR $INIH_ARGS -Dtests=false -Dwith_INIReader=false + +install_lib_cmake $FMT_DIR $FMT_ARGS -DCMAKE_CXX_FLAGS=-DFMT_USE_WRITE_CONSOLE=1 -DFMT_OS=0 + +install_lib_cmake $NLOHMANNJSON_DIR $NLOHMANNJSON_ARGS + +install_lib_cmake $EXPAT_DIR $EXPAT_ARGS -DXML_STATIC=ON + +install_lib $SPEEXDSP_DIR $SPEEXDSP_ARGS --host=i686-pc-mingw32 + +install_lib_cmake $FLUIDLITE_DIR $FLUIDLITE_ARGS + +install_lib "$MPG123_DIR" $MPG123_ARGS --host=i686-pc-mingw32 --disable-id3v2 --with-cpu=sse --disable-largefile ac_cv_func_strerror=yes ac_cv_sizeof_off_t=4 + +install_lib_cmake $SDL3_DIR $SDL3_ARGS -DNXDK_DIR=$NXDK_DIR + +install_lib_cmake $FREETYPE_DIR $FREETYPE_ARGS -DFT_DISABLE_HARFBUZZ=ON + +install_lib_meson $PIXMAN_DIR $PIXMAN_ARGS -Dmmx=disabled -Dsse2=disabled -Dssse3=disabled + +#####################HEAVY BUILD################################################ + +install_lib $LIBOGG_DIR $LIBOGG_ARGS --host=i686-pc-mingw32 + +install_lib $LIBVORBIS_DIR $LIBVORBIS_ARGS --host=i686-pc-mingw32 + +install_lib_cmake $WILDMIDI_DIR $WILDMIDI_ARGS + +install_lib_cmake $FREETYPE_DIR $FREETYPE_ARGS -DFT_DISABLE_HARFBUZZ=ON + +# Harfbuzz is too heavy memory wise to use at all, probably +#install_lib_meson $HARFBUZZ_DIR $HARFBUZZ_ARGS -Dgobject=disabled + +# No Harfbuzz for now +# install_lib_cmake $FREETYPE_DIR $FREETYPE_ARGS -DFT_DISABLE_HARFBUZZ=OFF + +install_lib $LHASA_DIR $LHASA_ARGS --host=i686-pc-mingw32 + +install_lib_cmake $LIBXMP_LITE_DIR $LIBXMP_LITE_ARGS + +install_lib_cmake $OPUS_DIR $OPUS_ARGS + +install_lib $OPUSFILE_DIR $OPUSFILE_ARGS --host=i686-pc-mingw32 + +install_lib $LIBSNDFILE_DIR $LIBSNDFILE_ARGS --host=i686-pc-mingw32 --disable-win-version-resource ac_cv_func_floor=yes ac_cv_search_floor=yes use_windows_api=0 + +# Set these flags only for ICU (or figure out how to do it with $ICU_ARGS) +export ac_cv_c_bigendian=no +export ac_cv_var_tzname=no +export CPPFLAGS="$CPPFLAGS \ + -DU_STATIC_IMPLEMENTATION \ + -DU_PLATFORM_HAS_WIN32_API=0 \ + -DU_PLATFORM_USES_ONLY_WIN32_API=0 \ + -DU_PLATFORM_IMPLEMENTS_POSIX=0 \ + -DUCONFIG_NO_FILE_IO=1 \ + -DU_WCHAR_IS_UTF16=1 \ + -DU_HAVE_CHAR16_T=0 \ + -DU_HAVE_NL_LANGINFO_CODESET=0 \ + -DU_HAVE_TIMEZONE=0 \ + -DU_HAVE_TZSET=0 \ + -DU_HAVE_TZNAME=0 \ + -DU_HAVE_NL_LANGINFO_CODESET=0" + +export PKGDATA_OPTS="-w -O $PWD/icu-cross/config/pkgdata.inc" +export CXXFLAGS="$CXXFLAGS -Wno-microsoft-include -std=c++17" + +install_lib_icu_cross + diff --git a/xbox/3_cleanup.sh b/xbox/3_cleanup.sh new file mode 100644 index 00000000..6e2f5845 --- /dev/null +++ b/xbox/3_cleanup.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +source $SCRIPT_DIR/../shared/import.sh + +headermsg "Cleaning up library build folders and other stuff..." + +cleanup + +rm -rf ./tool-overrides +rm -rf ./nxdk + +echo " -> done" diff --git a/xbox/compat_headers/fcntl.h b/xbox/compat_headers/fcntl.h new file mode 100644 index 00000000..a75b5447 --- /dev/null +++ b/xbox/compat_headers/fcntl.h @@ -0,0 +1,20 @@ +#ifndef NXDK_FCNTL_H +#define NXDK_FCNTL_H + +/* Provide only minimal compatibility definitions for mpg123 */ + +/* File access flags (not actually used by libmpg123) */ +#define O_RDONLY 0x0000 +#define O_WRONLY 0x0001 +#define O_RDWR 0x0002 +#define O_BINARY 0x8000 /* Used by Windows; ok to stub */ + +/* Stub of open() so linking succeeds if something pulls it in */ +__attribute__((used)) +static int _open(const char *path, int flags, ...) { + (void)path; + (void)flags; + return -1; +} + +#endif /* NXDK_FCNTL_H */ \ No newline at end of file diff --git a/xbox/compat_headers/io.h b/xbox/compat_headers/io.h new file mode 100644 index 00000000..89517cba --- /dev/null +++ b/xbox/compat_headers/io.h @@ -0,0 +1,13 @@ +#pragma once +#ifdef NXDK +#include + +#ifdef __cplusplus +extern "C" { + inline int _isatty(int) { return 0; } + inline int _setmode(int, int) { return 0; } + inline int _fileno(FILE*) { return 0; } +} +#endif + +#endif diff --git a/xbox/compat_headers/sal.h b/xbox/compat_headers/sal.h new file mode 100644 index 00000000..04510397 --- /dev/null +++ b/xbox/compat_headers/sal.h @@ -0,0 +1,26 @@ +#ifndef _NXDK_SAL_H_ +#define _NXDK_SAL_H_ + +/* Basic SAL attribute stubs */ +#define _In_ +#define _Out_ +#define _Inout_ +#define _In_opt_ +#define _Out_opt_ +#define _Inout_opt_ +#define _Ret_ +#define _Success_(x) + +/* Buffer-size annotations */ +#define _In_bytecount_(x) +#define _Inout_z_cap_(x) +#define _Out_z_cap_(x) +#define _Out_cap_(x) +#define _Out_bytecap_(x) +#define _Out_z_bytecap_(x) + +/* Format string annotations */ +#define _Printf_format_string_ +#define _Scanf_format_string_impl_ + +#endif \ No newline at end of file diff --git a/xbox/compat_headers/sys/stat.h b/xbox/compat_headers/sys/stat.h new file mode 100644 index 00000000..e0b9373e --- /dev/null +++ b/xbox/compat_headers/sys/stat.h @@ -0,0 +1,14 @@ +#ifndef _SYS_STAT_H +#define _SYS_STAT_H + +#include + +struct stat { + uint32_t st_mode; + uint32_t st_size; +}; + +#define S_ISREG(m) (((m) & 0170000) == 0100000) +#define S_ISDIR(m) (((m) & 0170000) == 0040000) + +#endif diff --git a/xbox/compat_headers/sys/types.h b/xbox/compat_headers/sys/types.h new file mode 100644 index 00000000..38cd5bc3 --- /dev/null +++ b/xbox/compat_headers/sys/types.h @@ -0,0 +1,17 @@ +#ifndef _SYS_TYPES_H +#define _SYS_TYPES_H + +/* Minimal stub for NXDK to satisfy SDL2 */ + +#include +#include + +/* Define a few common typedefs used by SDL2 and libc */ +typedef int pid_t; +typedef long ssize_t; +typedef unsigned long off_t; +typedef unsigned long mode_t; +typedef unsigned int uid_t; +typedef unsigned int gid_t; + +#endif /* _SYS_TYPES_H */ diff --git a/xbox/compat_headers/winnls.h b/xbox/compat_headers/winnls.h new file mode 100644 index 00000000..fbab00db --- /dev/null +++ b/xbox/compat_headers/winnls.h @@ -0,0 +1,11 @@ +#define MB_ERR_INVALID_CHARS 0x00000008 +#define CP_UTF8 65001 +#define CP_UTF7 65000 + +static inline int WideCharToMultiByte(unsigned int cp, unsigned long flags, + const wchar_t *wstr, int wlen, char *mbstr, int mblen, const char *def, int *used) +{ (void)cp;(void)flags;(void)wstr;(void)wlen;(void)mbstr;(void)mblen;(void)def;(void)used; return 0; } + +static inline int MultiByteToWideChar(unsigned int cp, unsigned long flags, + const char *mbstr, int mblen, wchar_t *wstr, int wlen) +{ (void)cp;(void)flags;(void)mbstr;(void)mblen;(void)wstr;(void)wlen; return 0; } \ No newline at end of file diff --git a/xbox/patches/expat/avoid_export_underscores.patch b/xbox/patches/expat/avoid_export_underscores.patch new file mode 100644 index 00000000..3a562133 --- /dev/null +++ b/xbox/patches/expat/avoid_export_underscores.patch @@ -0,0 +1,3 @@ +39a40,41 +> #define XML_STATIC +> diff --git a/xbox/patches/expat/ignore_memory_dot_h.patch b/xbox/patches/expat/ignore_memory_dot_h.patch new file mode 100644 index 00000000..a886794c --- /dev/null +++ b/xbox/patches/expat/ignore_memory_dot_h.patch @@ -0,0 +1,5 @@ +44a45 +> #ifndef NXDK +45a47,48 +> #endif +> diff --git a/xbox/patches/expat/no_errno.patch b/xbox/patches/expat/no_errno.patch new file mode 100644 index 00000000..2b116608 --- /dev/null +++ b/xbox/patches/expat/no_errno.patch @@ -0,0 +1,8 @@ +9257c9257,9259 +< +--- +> #ifdef NXDK +> int errno = 0; +> #else +9258a9261 +> #endif diff --git a/xbox/patches/expat/no_get_pid.patch b/xbox/patches/expat/no_get_pid.patch new file mode 100644 index 00000000..6368dc9a --- /dev/null +++ b/xbox/patches/expat/no_get_pid.patch @@ -0,0 +1,8 @@ +110c110 +< #ifdef _WIN32 +--- +> #ifdef _WIN32 && !defined NXDK +1235c1235 +< # if ! defined(__wasi__) +--- +> # if ! defined(__wasi__) && !defined(NXDK) diff --git a/xbox/patches/fluidlite/force_c99_compilation.patch b/xbox/patches/fluidlite/force_c99_compilation.patch new file mode 100644 index 00000000..6b206516 --- /dev/null +++ b/xbox/patches/fluidlite/force_c99_compilation.patch @@ -0,0 +1,4 @@ +184c184 +< set_target_properties(${PROJECT_NAME}-static PROPERTIES C_STANDARD 90) +--- +> set_target_properties(${PROJECT_NAME}-static PROPERTIES C_STANDARD 99) diff --git a/xbox/patches/harfbuzz/ignore_glib.patch b/xbox/patches/harfbuzz/ignore_glib.patch new file mode 100644 index 00000000..532f85fa --- /dev/null +++ b/xbox/patches/harfbuzz/ignore_glib.patch @@ -0,0 +1,74 @@ +diff -ruN harfbuzz-14.1.0/src/hb-glib.cc harfbuzz-14.1.0-noglib/src/hb-glib.cc +--- harfbuzz-14.1.0/src/hb-glib.cc 2026-04-04 14:31:18.000000000 -0400 ++++ harfbuzz-14.1.0-noglib/src/hb-glib.cc 2026-05-22 17:20:51.403134500 -0400 +@@ -26,10 +26,11 @@ + * Google Author(s): Behdad Esfahbod + */ + ++#ifndef NXDK + #include "hb.hh" + + #ifdef HAVE_GLIB +- ++#error + #include "hb-glib.h" + + #include "hb-machinery.hh" +@@ -222,3 +223,4 @@ + + + #endif ++#endif +\ No newline at end of file +diff -ruN harfbuzz-14.1.0/src/hb-glib.h harfbuzz-14.1.0-noglib/src/hb-glib.h +--- harfbuzz-14.1.0/src/hb-glib.h 2026-04-04 14:31:18.000000000 -0400 ++++ harfbuzz-14.1.0-noglib/src/hb-glib.h 2026-05-22 17:21:04.329903100 -0400 +@@ -25,32 +25,33 @@ + * Red Hat Author(s): Behdad Esfahbod + * Google Author(s): Behdad Esfahbod + */ +- ++#ifndef NXDK + #ifndef HB_GLIB_H + #define HB_GLIB_H + + #include "hb.h" + +-#include ++//#include + +-HB_BEGIN_DECLS ++// HB_BEGIN_DECLS + + +-HB_EXTERN hb_script_t +-hb_glib_script_to_script (GUnicodeScript script); ++// HB_EXTERN hb_script_t ++// hb_glib_script_to_script (GUnicodeScript script); + +-HB_EXTERN GUnicodeScript +-hb_glib_script_from_script (hb_script_t script); ++// HB_EXTERN GUnicodeScript ++// hb_glib_script_from_script (hb_script_t script); + + +-HB_EXTERN hb_unicode_funcs_t * +-hb_glib_get_unicode_funcs (void); ++// HB_EXTERN hb_unicode_funcs_t * ++// hb_glib_get_unicode_funcs (void); + +-#if GLIB_CHECK_VERSION(2,31,10) +-HB_EXTERN hb_blob_t * +-hb_glib_blob_create (GBytes *gbytes); +-#endif ++// #if GLIB_CHECK_VERSION(2,31,10) ++// HB_EXTERN hb_blob_t * ++// hb_glib_blob_create (GBytes *gbytes); ++// #endif + +-HB_END_DECLS ++// HB_END_DECLS + + #endif /* HB_GLIB_H */ ++#endif +\ No newline at end of file diff --git a/xbox/patches/harfbuzz/no_win32_io.patch b/xbox/patches/harfbuzz/no_win32_io.patch new file mode 100644 index 00000000..847cdf35 --- /dev/null +++ b/xbox/patches/harfbuzz/no_win32_io.patch @@ -0,0 +1,2 @@ +37a38 +> #undef _WIN32 diff --git a/xbox/patches/icu/avoid_rti_str_ptr_cmp.patch b/xbox/patches/icu/avoid_rti_str_ptr_cmp.patch new file mode 100644 index 00000000..b719cf47 --- /dev/null +++ b/xbox/patches/icu/avoid_rti_str_ptr_cmp.patch @@ -0,0 +1,8 @@ +125c125 +< return typeid(*this) == typeid(that); +--- +> return this == &that;//typeid(*this) == typeid(that); +130c130 +< return !operator==(that); +--- +> return this == &that;//!operator==(that); diff --git a/xbox/patches/icu/data_no_pie.patch b/xbox/patches/icu/data_no_pie.patch new file mode 100644 index 00000000..189ad17d --- /dev/null +++ b/xbox/patches/icu/data_no_pie.patch @@ -0,0 +1,4 @@ +29c29 +< @echo LIBFLAGS="-I$(prefix)/include $(SHAREDLIBCPPFLAGS) $(SHAREDLIBCFLAGS)" >> $(OUTPUTFILE) +--- +> @echo LIBFLAGS="-I$(prefix)/include $(LIBCPPFLAGS) $(LIBCFLAGS)" >> $(OUTPUTFILE) diff --git a/xbox/patches/icu/ignore_timezone.patch b/xbox/patches/icu/ignore_timezone.patch new file mode 100644 index 00000000..3ba812fa --- /dev/null +++ b/xbox/patches/icu/ignore_timezone.patch @@ -0,0 +1,107 @@ +diff -ruN icu/source/common/putil.cpp icu-withtzpatch/source/common/putil.cpp +--- icu/source/common/putil.cpp 2026-05-23 14:08:12.077310200 -0400 ++++ icu-withtzpatch/source/common/putil.cpp 2026-05-23 13:41:45.365112500 -0400 +@@ -128,7 +128,7 @@ + * + */ + +-#if U_HAVE_NL_LANGINFO_CODESET ++#if U_HAVE_NL_LANGINFO_CODESET && !defined(NXDK) + #include + #endif + +@@ -186,7 +186,7 @@ + functions). + ---------------------------------------------------------------------------*/ + +-#if U_PLATFORM_USES_ONLY_WIN32_API || U_PLATFORM == U_PF_OS400 ++#if U_PLATFORM_USES_ONLY_WIN32_API || U_PLATFORM == U_PF_OS400 || defined(NXDK) + # undef U_POSIX_LOCALE + #else + # define U_POSIX_LOCALE 1 +@@ -720,7 +720,7 @@ + static const char *gTimeZoneBufferPtr = nullptr; + #endif + +-#if !U_PLATFORM_USES_ONLY_WIN32_API ++#if !U_PLATFORM_USES_ONLY_WIN32_API || defined(NXDK) + #define isNonDigit(ch) (ch < '0' || '9' < ch) + #define isDigit(ch) ('0' <= ch && ch <= '9') + static UBool isValidOlsonID(const char *id) { +@@ -1108,7 +1108,7 @@ + { + (void)n; // Avoid unreferenced parameter warning. + const char *tzid = nullptr; +-#if U_PLATFORM_USES_ONLY_WIN32_API ++#if U_PLATFORM_USES_ONLY_WIN32_API && !defined(NXDK) + tzid = uprv_detectWindowsTimeZone(); + + if (tzid != nullptr) { +@@ -1135,7 +1135,7 @@ + #endif*/ + + /* This code can be temporarily disabled to test tzname resolution later on. */ +-#ifndef DEBUG_TZNAME ++#if !defined(DEBUG_TZNAME) + #if U_PLATFORM == U_PF_ANDROID + tzid = gAndroidTimeZone; + #else +diff -ruN icu/source/common/putilimp.h icu-withtzpatch/source/common/putilimp.h +--- icu/source/common/putilimp.h 2026-03-17 13:44:50.000000000 -0400 ++++ icu-withtzpatch/source/common/putilimp.h 2026-05-23 13:39:29.052326700 -0400 +@@ -92,6 +92,7 @@ + /* not defined */ + #elif U_PLATFORM == U_PF_HAIKU + /* not defined */ ++#elif defined(NXDK) + #else + # define U_NL_LANGINFO_CODESET CODESET + #endif +@@ -107,6 +108,7 @@ + /* not defined */ + #elif U_PLATFORM == U_PF_HAIKU + /* not defined */ ++#elif defined(NXDK) + #else + # define U_TZSET tzset + #endif +@@ -132,6 +134,7 @@ + /* not defined */ + #elif U_PLATFORM == U_PF_IPHONE + /* not defined */ ++#elif defined(NXDK) + #else + # define U_TIMEZONE timezone + #endif +@@ -147,6 +150,7 @@ + /* not defined */ + #elif U_PLATFORM == U_PF_HAIKU + /* not defined, (well it is but a loop back to icu) */ ++#elif defined(NXDK) + #else + # define U_TZNAME tzname + #endif +diff -ruN icu/source/common/wintz.cpp icu-withtzpatch/source/common/wintz.cpp +--- icu/source/common/wintz.cpp 2026-03-17 13:44:50.000000000 -0400 ++++ icu-withtzpatch/source/common/wintz.cpp 2026-05-23 14:09:55.111228800 -0400 +@@ -13,7 +13,7 @@ + + #include "unicode/utypes.h" + +-#if U_PLATFORM_USES_ONLY_WIN32_API ++#if U_PLATFORM_USES_ONLY_WIN32_API && !defined(NXDK) + + #include "wintz.h" + #include "charstr.h" +diff -ruN icu/source/common/wintz.h icu-withtzpatch/source/common/wintz.h +--- icu/source/common/wintz.h 2026-03-17 13:44:50.000000000 -0400 ++++ icu-withtzpatch/source/common/wintz.h 2026-05-23 14:09:55.121459300 -0400 +@@ -16,7 +16,7 @@ + + #include "unicode/utypes.h" + +-#if U_PLATFORM_USES_ONLY_WIN32_API ++#if U_PLATFORM_USES_ONLY_WIN32_API && !defined(NXDK) + + /** + * \file diff --git a/xbox/patches/icu/ignore_windows_datetime.patch b/xbox/patches/icu/ignore_windows_datetime.patch new file mode 100644 index 00000000..14d5cfba --- /dev/null +++ b/xbox/patches/icu/ignore_windows_datetime.patch @@ -0,0 +1,36 @@ +diff -ruN icu/source/i18n/datefmt.cpp icu-datetimeonly/source/i18n/datefmt.cpp +--- icu/source/i18n/datefmt.cpp 2026-03-17 13:44:50.000000000 -0400 ++++ icu-datetimeonly/source/i18n/datefmt.cpp 2026-05-19 04:35:08.054202900 -0400 +@@ -521,7 +521,7 @@ + DateFormat::create(EStyle timeStyle, EStyle dateStyle, const Locale& locale) + { + UErrorCode status = U_ZERO_ERROR; +-#if U_PLATFORM_USES_ONLY_WIN32_API ++#if U_PLATFORM_USES_ONLY_WIN32_API && !defined(NXDK) + char buffer[8]; + int32_t count = locale.getKeywordValue("compat", buffer, sizeof(buffer), status); + +diff -ruN icu/source/i18n/windtfmt.cpp icu-datetimeonly/source/i18n/windtfmt.cpp +--- icu/source/i18n/windtfmt.cpp 2026-03-17 13:44:50.000000000 -0400 ++++ icu-datetimeonly/source/i18n/windtfmt.cpp 2026-05-19 04:22:51.845219800 -0400 +@@ -13,7 +13,7 @@ + + #include "unicode/utypes.h" + +-#if U_PLATFORM_USES_ONLY_WIN32_API ++#if U_PLATFORM_USES_ONLY_WIN32_API && !defined(NXDK) + + #if !UCONFIG_NO_FORMATTING + +diff -ruN icu/source/i18n/windtfmt.h icu-datetimeonly/source/i18n/windtfmt.h +--- icu/source/i18n/windtfmt.h 2026-03-17 13:44:50.000000000 -0400 ++++ icu-datetimeonly/source/i18n/windtfmt.h 2026-05-19 04:22:39.374176500 -0400 +@@ -16,7 +16,7 @@ + + #include "unicode/utypes.h" + +-#if U_PLATFORM_USES_ONLY_WIN32_API ++#if U_PLATFORM_USES_ONLY_WIN32_API && !defined(NXDK) + + #if !UCONFIG_NO_FORMATTING + diff --git a/xbox/patches/icu/ignore_windows_locale.patch b/xbox/patches/icu/ignore_windows_locale.patch new file mode 100644 index 00000000..97566b11 --- /dev/null +++ b/xbox/patches/icu/ignore_windows_locale.patch @@ -0,0 +1,45 @@ +diff -ruN icu/source/common/putil.cpp icu-localeonly/source/common/putil.cpp +--- icu/source/common/putil.cpp 2026-03-17 13:44:50.000000000 -0400 ++++ icu-localeonly/source/common/putil.cpp 2026-05-19 01:45:49.310483400 -0400 +@@ -51,7 +51,7 @@ + */ + #include + +-#if !U_PLATFORM_USES_ONLY_WIN32_API ++#if !U_PLATFORM_USES_ONLY_WIN32_API && !defined(NXDK) + #include + #endif + +@@ -1804,9 +1804,10 @@ + } + + // No cached value, need to determine the current value ++#ifndef NXDK + static WCHAR windowsLocale[LOCALE_NAME_MAX_LENGTH] = {}; + int length = GetLocaleInfoEx(LOCALE_NAME_USER_DEFAULT, LOCALE_SNAME, windowsLocale, LOCALE_NAME_MAX_LENGTH); +- ++ + // Now we should have a Windows locale name that needs converted to the POSIX style. + if (length > 0) // If length is 0, then the GetLocaleInfoEx failed. + { +@@ -1857,7 +1858,7 @@ + } + } + } +- ++#endif // ifndef NXDK + // If unable to find a locale we can agree upon, use en-US by default + if (gCorrectedPOSIXLocale == nullptr) { + gCorrectedPOSIXLocale = "en_US"; +@@ -2158,7 +2159,11 @@ + (LPWSTR)&codepageNumber, sizeof(codepageNumber) / sizeof(WCHAR)); + #else + // Win32 apps can call GetACP ++#ifdef NXDK ++ codepageNumber = 65001; // UTF-8 ++#else + codepageNumber = GetACP(); ++#endif // ifdef NXDK + #endif + // Special case for UTF-8 + if (codepageNumber == 65001) diff --git a/xbox/patches/icu/ignore_windows_number_formats.patch b/xbox/patches/icu/ignore_windows_number_formats.patch new file mode 100644 index 00000000..314c50f3 --- /dev/null +++ b/xbox/patches/icu/ignore_windows_number_formats.patch @@ -0,0 +1,36 @@ +diff -ruN icu/source/i18n/numfmt.cpp "icu - numbersonly/source/i18n/numfmt.cpp" +--- icu/source/i18n/numfmt.cpp 2026-03-17 13:44:50.000000000 -0400 ++++ "icu - numbersonly/source/i18n/numfmt.cpp" 2026-05-19 02:50:00.308519900 -0400 +@@ -1332,7 +1332,7 @@ + return nullptr; + } + +-#if U_PLATFORM_USES_ONLY_WIN32_API ++#if U_PLATFORM_USES_ONLY_WIN32_API && !defined(NXDK) + if (!mustBeDecimalFormat) { + char buffer[8]; + int32_t count = desiredLocale.getKeywordValue("compat", buffer, sizeof(buffer), status); +diff -ruN icu/source/i18n/winnmfmt.cpp "icu - numbersonly/source/i18n/winnmfmt.cpp" +--- icu/source/i18n/winnmfmt.cpp 2026-03-17 13:44:50.000000000 -0400 ++++ "icu - numbersonly/source/i18n/winnmfmt.cpp" 2026-05-19 02:42:14.812600300 -0400 +@@ -13,7 +13,7 @@ + + #include "unicode/utypes.h" + +-#if U_PLATFORM_USES_ONLY_WIN32_API ++#if U_PLATFORM_USES_ONLY_WIN32_API && !defined(NXDK) + + #if !UCONFIG_NO_FORMATTING + +diff -ruN icu/source/i18n/winnmfmt.h "icu - numbersonly/source/i18n/winnmfmt.h" +--- icu/source/i18n/winnmfmt.h 2026-03-17 13:44:50.000000000 -0400 ++++ "icu - numbersonly/source/i18n/winnmfmt.h" 2026-05-19 02:43:27.421861400 -0400 +@@ -16,7 +16,7 @@ + + #include "unicode/utypes.h" + +-#if U_PLATFORM_USES_ONLY_WIN32_API ++#if U_PLATFORM_USES_ONLY_WIN32_API && !defined(NXDK) + + #include "unicode/format.h" + #include "unicode/datefmt.h" diff --git a/xbox/patches/icu/ignore_windows_timezone.patch b/xbox/patches/icu/ignore_windows_timezone.patch new file mode 100644 index 00000000..7650f6f8 --- /dev/null +++ b/xbox/patches/icu/ignore_windows_timezone.patch @@ -0,0 +1,54 @@ +diff -ruN icu/source/common/putil.cpp icu-tzonly/source/common/putil.cpp +--- icu/source/common/putil.cpp 2026-05-19 04:41:26.471185300 -0400 ++++ icu-tzonly/source/common/putil.cpp 2026-05-19 04:30:19.031266800 -0400 +@@ -720,7 +720,7 @@ + static const char *gTimeZoneBufferPtr = nullptr; + #endif + +-#if !U_PLATFORM_USES_ONLY_WIN32_API ++#if !U_PLATFORM_USES_ONLY_WIN32_API || defined(NXDK) + #define isNonDigit(ch) (ch < '0' || '9' < ch) + #define isDigit(ch) ('0' <= ch && ch <= '9') + static UBool isValidOlsonID(const char *id) { +@@ -1108,7 +1108,7 @@ + { + (void)n; // Avoid unreferenced parameter warning. + const char *tzid = nullptr; +-#if U_PLATFORM_USES_ONLY_WIN32_API ++#if U_PLATFORM_USES_ONLY_WIN32_API && !defined(NXDK) + tzid = uprv_detectWindowsTimeZone(); + + if (tzid != nullptr) { +@@ -1135,7 +1135,7 @@ + #endif*/ + + /* This code can be temporarily disabled to test tzname resolution later on. */ +-#ifndef DEBUG_TZNAME ++#if !defined(DEBUG_TZNAME) + #if U_PLATFORM == U_PF_ANDROID + tzid = gAndroidTimeZone; + #else +diff -ruN icu/source/common/wintz.cpp icu-tzonly/source/common/wintz.cpp +--- icu/source/common/wintz.cpp 2026-03-17 13:44:50.000000000 -0400 ++++ icu-tzonly/source/common/wintz.cpp 2026-05-19 04:23:10.527167100 -0400 +@@ -13,7 +13,7 @@ + + #include "unicode/utypes.h" + +-#if U_PLATFORM_USES_ONLY_WIN32_API ++#if U_PLATFORM_USES_ONLY_WIN32_API && !defined(NXDK) + + #include "wintz.h" + #include "charstr.h" +diff -ruN icu/source/common/wintz.h icu-tzonly/source/common/wintz.h +--- icu/source/common/wintz.h 2026-03-17 13:44:50.000000000 -0400 ++++ icu-tzonly/source/common/wintz.h 2026-05-19 04:23:13.525373600 -0400 +@@ -16,7 +16,7 @@ + + #include "unicode/utypes.h" + +-#if U_PLATFORM_USES_ONLY_WIN32_API ++#if U_PLATFORM_USES_ONLY_WIN32_API && !defined(NXDK) + + /** + * \file diff --git a/xbox/patches/icu/normalizer_static_cast.patch b/xbox/patches/icu/normalizer_static_cast.patch new file mode 100644 index 00000000..c28732f9 --- /dev/null +++ b/xbox/patches/icu/normalizer_static_cast.patch @@ -0,0 +1,8 @@ +347c347 +< const Normalizer2WithImpl *n2wi=dynamic_cast(n2); +--- +> const Normalizer2WithImpl *n2wi=static_cast(n2); +384c384 +< const Normalizer2WithImpl* n2wi = dynamic_cast(n2); +--- +> const Normalizer2WithImpl* n2wi = static_cast(n2); diff --git a/xbox/patches/icu/patch_configure_checks.patch b/xbox/patches/icu/patch_configure_checks.patch new file mode 100644 index 00000000..f32518c4 --- /dev/null +++ b/xbox/patches/icu/patch_configure_checks.patch @@ -0,0 +1,65 @@ +3573,3576c3573,3574 +< { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +< printf "%s\n" "no" >&6; } +< printf "%s\n" "$as_me: failed program was:" >&5 +< sed 's/^/| /' conftest.$ac_ext >&5 +--- +> { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes, patched for NXDK cross build" >&5 +> printf "%s\n" "yes, patched for NXDK cross build" >&6; } +3578,3581c3576,3587 +< { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 +< printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} +< as_fn_error 77 "C compiler cannot create executables +< See 'config.log' for more details" "$LINENO" 5; } +--- +> ac_file=conftest.exe +> ac_cv_exeext=.exe +> # then : +> # { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +> # printf "%s\n" "no" >&6; } +> # printf "%s\n" "$as_me: failed program was:" >&5 +> # sed 's/^/| /' conftest.$ac_ext >&5 +> +> # { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 +> # printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} +> # as_fn_error 77 "C compiler cannot create executables +> # See 'config.log' for more details" "$LINENO" 5; } +3622,3627c3628,3637 +< else case e in #( +< e) { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 +< printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} +< as_fn_error $? "cannot compute suffix of executables: cannot compile and link +< See 'config.log' for more details" "$LINENO" 5; } ;; +< esac +--- +> # else case e in #( +> # e) { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 +> # printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} +> # as_fn_error $? "cannot compute suffix of executables: cannot compile and link +> # See 'config.log' for more details" "$LINENO" 5; } ;; +> # esac +> # fi +> else +> { printf "%s\n" "$as_me:${as_lineno-$LINENO}: patched: assuming .exe suffix for NXDK" >&5; } +> ac_cv_exeext=.exe +5132a5143,5150 +> # case "${host}" in +> # *-*-cygwin*|*-*-mingw*) +> # if test "$GCC" != yes && test -n "`link --version 2>&1 | grep 'GNU coreutils'`"; then +> # as_fn_error $? "link.exe is not a valid linker. Your PATH is incorrect. +> # Please follow the directions in ICU's readme." "$LINENO" 5 +> # fi;; +> # *);; +> # esac +5135,5138c5153,5154 +< if test "$GCC" != yes && test -n "`link --version 2>&1 | grep 'GNU coreutils'`"; then +< as_fn_error $? "link.exe is not a valid linker. Your PATH is incorrect. +< Please follow the directions in ICU's readme." "$LINENO" 5 +< fi;; +--- +> : # patched for NXDK: ignore GNU coreutils link check +> ;; +5806c5822 +< *-*-mingw*) icu_cv_host_frag=mh-msys-msvc ;; +--- +> *-*-mingw*) icu_cv_host_frag=mh-mingw ;; diff --git a/xbox/patches/lhasa/avoid_autoconf_issues.patch b/xbox/patches/lhasa/avoid_autoconf_issues.patch new file mode 100644 index 00000000..15ce19c8 --- /dev/null +++ b/xbox/patches/lhasa/avoid_autoconf_issues.patch @@ -0,0 +1,24 @@ +624c624 +< PACKAGE_VERSION='0.5.0' +--- +> PACKAGE_VERSION='1.0' +4280c4280,4281 +< if test -z "$ac_file" +--- +> #if test -z "$ac_file" +> ac_file=conftest.exe; if false +4333,4334c4334,4336 +< as_fn_error $? "cannot compute suffix of executables: cannot compile and link +< See \`config.log' for more details" "$LINENO" 5; } +--- +> # as_fn_error $? "cannot compute suffix of executables: cannot compile and link +> # See \`config.log' for more details" "$LINENO" 5; +> ac_cv_exeext=.exe;} +10397c10399 +< libext=lib +--- +> libext=a +10405c10407 +< old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' +--- +> old_archive_cmds='llvm-ar cr $oldlib $oldobjs $old_deplibs' diff --git a/xbox/patches/lhasa/stub_lha_arch_set_binary.patch b/xbox/patches/lhasa/stub_lha_arch_set_binary.patch new file mode 100644 index 00000000..09bea50d --- /dev/null +++ b/xbox/patches/lhasa/stub_lha_arch_set_binary.patch @@ -0,0 +1,4 @@ +57a58 +> #ifndef NXDK +58a60 +> #endif diff --git a/xbox/patches/libogg/avoid_autoconf_issues.patch b/xbox/patches/libogg/avoid_autoconf_issues.patch new file mode 100644 index 00000000..44a62324 --- /dev/null +++ b/xbox/patches/libogg/avoid_autoconf_issues.patch @@ -0,0 +1,21 @@ +3499c3499,3500 +< if test -z "$ac_file" +--- +> #if test -z "$ac_file" +> ac_file=conftest.exe; if false +3552,3553c3553,3556 +< as_fn_error $? "cannot compute suffix of executables: cannot compile and link +< See \`config.log' for more details" "$LINENO" 5; } +--- +> #as_fn_error $? "cannot compute suffix of executables: cannot compile and link +> #See \`config.log' for more details" "$LINENO" 5; +> ac_cv_exeext=.exe; +> } +9655c9658 +< libext=lib +--- +> libext=a +9663c9666 +< old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' +--- +> old_archive_cmds='llvm-ar cr $oldlib $oldobjs $old_deplibs' diff --git a/xbox/patches/libogg/skip_tests.patch b/xbox/patches/libogg/skip_tests.patch new file mode 100644 index 00000000..aa820edd --- /dev/null +++ b/xbox/patches/libogg/skip_tests.patch @@ -0,0 +1,28 @@ +12c12 +< noinst_PROGRAMS = test_bitwise test_framing +--- +> #noinst_PROGRAMS = test_bitwise test_framing +14,15c14,15 +< test_bitwise_SOURCES = bitwise.c +< test_bitwise_CFLAGS = -D_V_SELFTEST +--- +> #test_bitwise_SOURCES = bitwise.c +> #test_bitwise_CFLAGS = -D_V_SELFTEST +17,18c17,18 +< test_framing_SOURCES = framing.c crctable.h +< test_framing_CFLAGS = -D_V_SELFTEST +--- +> #test_framing_SOURCES = framing.c crctable.h +> #test_framing_CFLAGS = -D_V_SELFTEST +20,21c20,21 +< TEST_ENV = @TEST_ENV@ +< LOG_COMPILER=$(LIBTOOL) --mode=execute $(VALGRIND) $(TEST_ENV) +--- +> #TEST_ENV = @TEST_ENV@ +> #LOG_COMPILER=$(LIBTOOL) --mode=execute $(VALGRIND) $(TEST_ENV) +23,24c23,24 +< TESTS = $(noinst_PROGRAMS) +< check_PROGRAMS = $(noinst_PROGRAMS) +--- +> #TESTS = $(noinst_PROGRAMS) +> #check_PROGRAMS = $(noinst_PROGRAMS) diff --git a/xbox/patches/libsndfile/avoid_autoconf_issues.patch b/xbox/patches/libsndfile/avoid_autoconf_issues.patch new file mode 100644 index 00000000..d3e50c52 --- /dev/null +++ b/xbox/patches/libsndfile/avoid_autoconf_issues.patch @@ -0,0 +1,28 @@ +4939c4939,4940 +< if test -z "$ac_file" +--- +> #if test -z "$ac_file" +> ac_file=conftest.exe; if false +4992,4993c4993,4995 +< as_fn_error $? "cannot compute suffix of executables: cannot compile and link +< See \`config.log' for more details" "$LINENO" 5; } +--- +> # as_fn_error $? "cannot compute suffix of executables: cannot compile and link +> # See \`config.log' for more details" "$LINENO" 5; } +> ac_cv_exeext=.exe;} +14641c14643 +< libext=lib +--- +> libext=a +14649c14651 +< old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' +--- +> old_archive_cmds='llvm-ar cr $oldlib $oldobjs $old_deplibs' +24319,24320c24321,24322 +< USE_WIN_VERSION_FILE_TRUE= +< USE_WIN_VERSION_FILE_FALSE='#' +--- +> USE_WIN_VERSION_FILE_TRUE='#' +> USE_WIN_VERSION_FILE_FALSE= +26829d26830 +< "src/version-metadata.rc") CONFIG_FILES="$CONFIG_FILES src/version-metadata.rc" ;; diff --git a/xbox/patches/libsndfile/skip_file_io.patch b/xbox/patches/libsndfile/skip_file_io.patch new file mode 100644 index 00000000..6f97b713 --- /dev/null +++ b/xbox/patches/libsndfile/skip_file_io.patch @@ -0,0 +1,244 @@ +diff -ruN libsndfile-1.2.2/src/file_io.c libsndfile-1.2.2-nofileio/src/file_io.c +--- libsndfile-1.2.2/src/file_io.c 2022-09-12 14:17:56.000000000 -0400 ++++ libsndfile-1.2.2-nofileio/src/file_io.c 2026-05-22 12:44:09.021690900 -0400 +@@ -34,6 +34,8 @@ + + #include "sfconfig.h" + ++#undef USE_WINDOWS_API ++#define USE_WINDOWS_API 1 + #if USE_WINDOWS_API + + /* Don't include rarely used headers, speed up build */ +@@ -786,7 +788,11 @@ + + /* USE_WINDOWS_API */ static HANDLE + psf_open_handle (PSF_FILE * pfile) +-{ DWORD dwDesiredAccess ; ++{ ++#ifdef NXDK ++ return 0; ++#else ++ DWORD dwDesiredAccess ; + DWORD dwShareMode ; + DWORD dwCreationDistribution ; + HANDLE handle ; +@@ -846,12 +852,14 @@ + free (pwszPath) ; + + return handle ; ++#endif + } /* psf_open_handle */ + + /* USE_WINDOWS_API */ static void + psf_log_syserr (SF_PRIVATE *psf, int error) +-{ LPVOID lpMsgBuf ; +- ++{ ++#ifndef NXDK // We shouldn't be getting windows system errors with virtual IO ++ LPVOID lpMsgBuf ; + /* Only log an error if no error has been set yet. */ + if (psf->error == 0) + { psf->error = SFE_SYSTEM ; +@@ -869,7 +877,7 @@ + snprintf (psf->syserr, sizeof (psf->syserr), "System error : %s", (char*) lpMsgBuf) ; + LocalFree (lpMsgBuf) ; + } ; +- ++#endif + return ; + } /* psf_log_syserr */ + +@@ -886,7 +894,7 @@ + psf_set_stdio (SF_PRIVATE *psf) + { HANDLE handle = INVALID_HANDLE_VALUE ; + int error = 0 ; +- ++#ifndef NXDK + switch (psf->file.mode) + { case SFM_RDWR : + error = SFE_OPEN_PIPE_RDWR ; +@@ -906,22 +914,24 @@ + error = SFE_BAD_OPEN_MODE ; + break ; + } ; +- ++#endif + psf->file.handle = handle ; + psf->filelength = 0 ; +- + return error ; + } /* psf_set_stdio */ + + /* USE_WINDOWS_API */ void + psf_set_file (SF_PRIVATE *psf, int fd) +-{ HANDLE handle ; ++{ ++#ifndef NXDK ++ HANDLE handle ; + intptr_t osfhandle ; + + osfhandle = _get_osfhandle (fd) ; + handle = (HANDLE) osfhandle ; + + psf->file.handle = handle ; ++#endif + } /* psf_set_file */ + + /* USE_WINDOWS_API */ int +@@ -933,15 +943,18 @@ + + /* USE_WINDOWS_API */ sf_count_t + psf_fseek (SF_PRIVATE *psf, sf_count_t offset, int whence) +-{ sf_count_t new_position ; ++{ ++#ifndef NXDK ++ sf_count_t new_position ; + LARGE_INTEGER liDistanceToMove, liNewFilePointer ; + DWORD dwMoveMethod ; + BOOL fResult ; + DWORD dwError ; +- ++#endif + if (psf->virtual_io) + return psf->vio.seek (offset, whence, psf->vio_user_data) ; +- ++ return 0; ++#ifndef NXDK + switch (whence) + { case SEEK_SET : + offset += psf->fileoffset ; +@@ -974,17 +987,21 @@ + new_position = liNewFilePointer.QuadPart - psf->fileoffset ; + + return new_position ; ++#endif + } /* psf_fseek */ + + /* USE_WINDOWS_API */ sf_count_t + psf_fread (void *ptr, sf_count_t bytes, sf_count_t items, SF_PRIVATE *psf) +-{ sf_count_t total = 0 ; ++{ ++#ifndef NXDK ++ sf_count_t total = 0 ; + ssize_t count ; + DWORD dwNumberOfBytesRead ; +- ++#endif + if (psf->virtual_io) + return psf->vio.read (ptr, bytes*items, psf->vio_user_data) / bytes ; +- ++ return 0; ++#ifndef NXDK + items *= bytes ; + + /* Do this check after the multiplication above. */ +@@ -1013,17 +1030,21 @@ + psf->pipeoffset += total ; + + return total / bytes ; ++#endif + } /* psf_fread */ + + /* USE_WINDOWS_API */ sf_count_t + psf_fwrite (const void *ptr, sf_count_t bytes, sf_count_t items, SF_PRIVATE *psf) +-{ sf_count_t total = 0 ; ++{ ++#ifndef NXDK ++ sf_count_t total = 0 ; + ssize_t count ; + DWORD dwNumberOfBytesWritten ; +- ++#endif + if (psf->virtual_io) + return psf->vio.write (ptr, bytes * items, psf->vio_user_data) / bytes ; +- ++ return 0; ++#ifndef NXDK + items *= bytes ; + + /* Do this check after the multiplication above. */ +@@ -1052,18 +1073,22 @@ + psf->pipeoffset += total ; + + return total / bytes ; ++#endif + } /* psf_fwrite */ + + /* USE_WINDOWS_API */ sf_count_t + psf_ftell (SF_PRIVATE *psf) +-{ sf_count_t pos ; ++{ ++#ifndef NXDK ++ sf_count_t pos ; + LARGE_INTEGER liDistanceToMove, liNewFilePointer ; + BOOL fResult ; + DWORD dwError ; +- ++#endif + if (psf->virtual_io) + return psf->vio.tell (psf->vio_user_data) ; +- ++ return 0; ++#ifndef NXDK + if (psf->is_pipe) + return psf->pipeoffset ; + +@@ -1084,6 +1109,7 @@ + pos = liNewFilePointer.QuadPart ; + + return pos - psf->fileoffset ; ++#endif + } /* psf_ftell */ + + /* USE_WINDOWS_API */ static int +@@ -1126,10 +1152,10 @@ + { + if (psf->virtual_io) + return SF_FALSE ; +- ++#ifndef NXDK + if (GetFileType (psf->file.handle) == FILE_TYPE_DISK) + return SF_FALSE ; +- ++#endif + /* Default to maximum safety. */ + return SF_TRUE ; + } /* psf_is_pipe */ +@@ -1156,7 +1182,10 @@ + + /* USE_WINDOWS_API */ void + psf_fsync (SF_PRIVATE *psf) +-{ FlushFileBuffers (psf->file.handle) ; ++{ ++ #ifndef NXDK ++ FlushFileBuffers (psf->file.handle) ; ++ #endif + } /* psf_fsync */ + + +diff -ruN libsndfile-1.2.2/src/sndfile.c libsndfile-1.2.2-nofileio/src/sndfile.c +--- libsndfile-1.2.2/src/sndfile.c 2023-08-12 11:14:09.000000000 -0400 ++++ libsndfile-1.2.2-nofileio/src/sndfile.c 2026-05-22 14:02:00.192603700 -0400 +@@ -438,8 +438,11 @@ + + SNDFILE* + sf_open_fd (int fd, int mode, SF_INFO *sfinfo, int close_desc) +-{ SF_PRIVATE *psf ; +- ++{ ++#ifdef NXDK ++ return NULL; ++#else ++ SF_PRIVATE *psf ; + if ((SF_CONTAINER (sfinfo->format)) == SF_FORMAT_SD2) + { sf_errno = SFE_SD2_FD_DISALLOWED ; + if (close_desc) +@@ -466,6 +469,7 @@ + psf->fileoffset = psf_ftell (psf) ; + + return psf_open_file (psf, sfinfo) ; ++#endif + } /* sf_open_fd */ + + SNDFILE* diff --git a/xbox/patches/libsndfile/skip_logging.patch b/xbox/patches/libsndfile/skip_logging.patch new file mode 100644 index 00000000..52964d25 --- /dev/null +++ b/xbox/patches/libsndfile/skip_logging.patch @@ -0,0 +1,18 @@ +105c105,107 +< { va_list ap ; +--- +> { +> #ifndef NXDK +> va_list ap ; +173a176 +> +390a394 +> #endif +1832c1836 +< +--- +> #ifndef NXDK +1838c1842 +< +--- +> #endif diff --git a/xbox/patches/libsndfile/update_defines.patch b/xbox/patches/libsndfile/update_defines.patch new file mode 100644 index 00000000..9cbe7b67 --- /dev/null +++ b/xbox/patches/libsndfile/update_defines.patch @@ -0,0 +1,11 @@ +130a131,140 +> #undef _WIN32 +> #undef USE_WINDOWS_API +> #define USE_WINDOWS_API 0 +> #undef OS_IS_WIN32 +> #define OS_IS_WIN32 0 +> #define __GNUC__ 0 +> #define HAVE_GETTIMEOFDAY 0 +> #define HAVE_SYS_TIME_H 0 +> +> diff --git a/xbox/patches/libvorbis/avoid_autoconf_issues.patch b/xbox/patches/libvorbis/avoid_autoconf_issues.patch new file mode 100644 index 00000000..56ebb1fe --- /dev/null +++ b/xbox/patches/libvorbis/avoid_autoconf_issues.patch @@ -0,0 +1,21 @@ +3520c3520,3521 +< if test -z "$ac_file"; then : +--- +> ac_file=conftest.exe; if false +> then : +3571,3572c3572,3575 +< as_fn_error $? "cannot compute suffix of executables: cannot compile and link +< See \`config.log' for more details" "$LINENO" 5; } +--- +> #as_fn_error $? "cannot compute suffix of executables: cannot compile and link +> #See \`config.log' for more details" "$LINENO" 5; +> ac_cv_exeext=.exe; +> } +10121c10124 +< libext=lib +--- +> libext=a +10129c10132 +< old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' +--- +> old_archive_cmds='llvm-ar cr $oldlib $oldobjs $old_deplibs' diff --git a/xbox/patches/libvorbis/skip_tests.patch b/xbox/patches/libvorbis/skip_tests.patch new file mode 100644 index 00000000..fddcdc12 --- /dev/null +++ b/xbox/patches/libvorbis/skip_tests.patch @@ -0,0 +1,98 @@ +108c108 +< am__EXEEXT_1 = test_sharedbook$(EXEEXT) +--- +> #am__EXEEXT_1 = test_sharedbook$(EXEEXT) +175,181c175,181 +< am_test_sharedbook_OBJECTS = test_sharedbook-sharedbook.$(OBJEXT) +< test_sharedbook_OBJECTS = $(am_test_sharedbook_OBJECTS) +< test_sharedbook_DEPENDENCIES = +< test_sharedbook_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ +< $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ +< $(test_sharedbook_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ +< -o $@ +--- +> #am_test_sharedbook_OBJECTS = test_sharedbook-sharedbook.$(OBJEXT) +> #test_sharedbook_OBJECTS = $(am_test_sharedbook_OBJECTS) +> #test_sharedbook_DEPENDENCIES = +> #test_sharedbook_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ +> # $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ +> # $(test_sharedbook_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ +> # -o $@ +211c211 +< ./$(DEPDIR)/test_sharedbook-sharedbook.Po ./$(DEPDIR)/tone.Po \ +--- +> ./$(DEPDIR)/tone.Po \ +235c235 +< $(psytune_SOURCES) $(test_sharedbook_SOURCES) $(tone_SOURCES) +--- +> $(psytune_SOURCES) $(tone_SOURCES) +238c238 +< $(psytune_SOURCES) $(test_sharedbook_SOURCES) $(tone_SOURCES) +--- +> $(psytune_SOURCES) $(tone_SOURCES) +479c479 +< vorbis_selftests = test_sharedbook +--- +> #vorbis_selftests = test_sharedbook +483,485c483,485 +< test_sharedbook_SOURCES = sharedbook.c +< test_sharedbook_CFLAGS = -D_V_SELFTEST +< test_sharedbook_LDADD = @VORBIS_LIBS@ +--- +> #test_sharedbook_SOURCES = sharedbook.c +> #test_sharedbook_CFLAGS = -D_V_SELFTEST +> #test_sharedbook_LDADD = @VORBIS_LIBS@ +581,583c581,583 +< test_sharedbook$(EXEEXT): $(test_sharedbook_OBJECTS) $(test_sharedbook_DEPENDENCIES) $(EXTRA_test_sharedbook_DEPENDENCIES) +< @rm -f test_sharedbook$(EXEEXT) +< $(AM_V_CCLD)$(test_sharedbook_LINK) $(test_sharedbook_OBJECTS) $(test_sharedbook_LDADD) $(LIBS) +--- +> #test_sharedbook$(EXEEXT): $(test_sharedbook_OBJECTS) $(test_sharedbook_DEPENDENCIES) $(EXTRA_test_sharedbook_DEPENDENCIES) +> # @rm -f test_sharedbook$(EXEEXT) +> # $(AM_V_CCLD)$(test_sharedbook_LINK) $(test_sharedbook_OBJECTS) $(test_sharedbook_LDADD) $(LIBS) +616c616 +< @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_sharedbook-sharedbook.Po@am__quote@ # am--include-marker +--- +> #@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_sharedbook-sharedbook.Po@am__quote@ # am--include-marker +649,661c649,661 +< test_sharedbook-sharedbook.o: sharedbook.c +< @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_sharedbook_CFLAGS) $(CFLAGS) -MT test_sharedbook-sharedbook.o -MD -MP -MF $(DEPDIR)/test_sharedbook-sharedbook.Tpo -c -o test_sharedbook-sharedbook.o `test -f 'sharedbook.c' || echo '$(srcdir)/'`sharedbook.c +< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_sharedbook-sharedbook.Tpo $(DEPDIR)/test_sharedbook-sharedbook.Po +< @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='sharedbook.c' object='test_sharedbook-sharedbook.o' libtool=no @AMDEPBACKSLASH@ +< @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +< @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_sharedbook_CFLAGS) $(CFLAGS) -c -o test_sharedbook-sharedbook.o `test -f 'sharedbook.c' || echo '$(srcdir)/'`sharedbook.c +< +< test_sharedbook-sharedbook.obj: sharedbook.c +< @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_sharedbook_CFLAGS) $(CFLAGS) -MT test_sharedbook-sharedbook.obj -MD -MP -MF $(DEPDIR)/test_sharedbook-sharedbook.Tpo -c -o test_sharedbook-sharedbook.obj `if test -f 'sharedbook.c'; then $(CYGPATH_W) 'sharedbook.c'; else $(CYGPATH_W) '$(srcdir)/sharedbook.c'; fi` +< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_sharedbook-sharedbook.Tpo $(DEPDIR)/test_sharedbook-sharedbook.Po +< @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='sharedbook.c' object='test_sharedbook-sharedbook.obj' libtool=no @AMDEPBACKSLASH@ +< @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +< @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_sharedbook_CFLAGS) $(CFLAGS) -c -o test_sharedbook-sharedbook.obj `if test -f 'sharedbook.c'; then $(CYGPATH_W) 'sharedbook.c'; else $(CYGPATH_W) '$(srcdir)/sharedbook.c'; fi` +--- +> #test_sharedbook-sharedbook.o: sharedbook.c +> #@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_sharedbook_CFLAGS) $(CFLAGS) -MT test_sharedbook-sharedbook.o -MD -MP -MF $(DEPDIR)/test_sharedbook-sharedbook.Tpo -c -o test_sharedbook-sharedbook.o `test -f 'sharedbook.c' || echo '$(srcdir)/'`sharedbook.c +> #@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_sharedbook-sharedbook.Tpo $(DEPDIR)/test_sharedbook-sharedbook.Po +> #@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='sharedbook.c' object='test_sharedbook-sharedbook.o' libtool=no @AMDEPBACKSLASH@ +> #@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +> #@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_sharedbook_CFLAGS) $(CFLAGS) -c -o test_sharedbook-sharedbook.o `test -f 'sharedbook.c' || echo '$(srcdir)/'`sharedbook.c +> +> #test_sharedbook-sharedbook.obj: sharedbook.c +> #@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_sharedbook_CFLAGS) $(CFLAGS) -MT test_sharedbook-sharedbook.obj -MD -MP -MF $(DEPDIR)/test_sharedbook-sharedbook.Tpo -c -o test_sharedbook-sharedbook.obj `if test -f 'sharedbook.c'; then $(CYGPATH_W) 'sharedbook.c'; else $(CYGPATH_W) '$(srcdir)/sharedbook.c'; fi` +> #@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_sharedbook-sharedbook.Tpo $(DEPDIR)/test_sharedbook-sharedbook.Po +> #@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='sharedbook.c' object='test_sharedbook-sharedbook.obj' libtool=no @AMDEPBACKSLASH@ +> #@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +> #@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_sharedbook_CFLAGS) $(CFLAGS) -c -o test_sharedbook-sharedbook.obj `if test -f 'sharedbook.c'; then $(CYGPATH_W) 'sharedbook.c'; else $(CYGPATH_W) '$(srcdir)/sharedbook.c'; fi` +892c892 +< -rm -f ./$(DEPDIR)/test_sharedbook-sharedbook.Po +--- +> # -rm -f ./$(DEPDIR)/test_sharedbook-sharedbook.Po +963c963 +< -rm -f ./$(DEPDIR)/test_sharedbook-sharedbook.Po +--- +> # -rm -f ./$(DEPDIR)/test_sharedbook-sharedbook.Po +1007,1008c1007,1008 +< check: $(noinst_PROGRAMS) +< ./test_sharedbook$(EXEEXT) +--- +> #check: $(noinst_PROGRAMS) +> # ./test_sharedbook$(EXEEXT) diff --git a/xbox/patches/libxmp-lite/force_libxmp_static_define.patch b/xbox/patches/libxmp-lite/force_libxmp_static_define.patch new file mode 100644 index 00000000..5cebf9a6 --- /dev/null +++ b/xbox/patches/libxmp-lite/force_libxmp_static_define.patch @@ -0,0 +1,3 @@ +11a12,13 +> #define LIBXMP_STATIC +> diff --git a/xbox/patches/libxmp-lite/use_c99.patch b/xbox/patches/libxmp-lite/use_c99.patch new file mode 100644 index 00000000..0561e63e --- /dev/null +++ b/xbox/patches/libxmp-lite/use_c99.patch @@ -0,0 +1,4 @@ +64c64 +< set_target_properties(xmp_lite_static PROPERTIES C_STANDARD 90) +--- +> set_target_properties(xmp_lite_static PROPERTIES C_STANDARD 99) diff --git a/xbox/patches/mpg123/output_as_dot_a_use_llvm_ar.patch b/xbox/patches/mpg123/output_as_dot_a_use_llvm_ar.patch new file mode 100644 index 00000000..99ed8948 --- /dev/null +++ b/xbox/patches/mpg123/output_as_dot_a_use_llvm_ar.patch @@ -0,0 +1,12 @@ +13631c13631 +< libext=lib +--- +> libext=a #lib +13670c13670 +< libext=lib +--- +> libext=a #lib +13678c13678 +< old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' +--- +> old_archive_cmds='llvm-ar cr $oldlib $oldobjs $old_deplibs' diff --git a/xbox/patches/mpg123/patch_configure_checks.patch b/xbox/patches/mpg123/patch_configure_checks.patch new file mode 100644 index 00000000..d409d535 --- /dev/null +++ b/xbox/patches/mpg123/patch_configure_checks.patch @@ -0,0 +1,225 @@ +4868,4910c4868,4916 +< if { { ac_try="$ac_link_default" +< case "(($ac_try" in +< *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; +< *) ac_try_echo=$ac_try;; +< esac +< eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +< printf "%s\n" "$ac_try_echo"; } >&5 +< (eval "$ac_link_default") 2>&5 +< ac_status=$? +< printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 +< test $ac_status = 0; } +< then : +< # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. +< # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' +< # in a Makefile. We should not override ac_cv_exeext if it was cached, +< # so that the user can short-circuit this test for compilers unknown to +< # Autoconf. +< for ac_file in $ac_files '' +< do +< test -f "$ac_file" || continue +< case $ac_file in +< *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) +< ;; +< [ab].out ) +< # We found the default executable, but exeext='' is most +< # certainly right. +< break;; +< *.* ) +< if test ${ac_cv_exeext+y} && test "$ac_cv_exeext" != no; +< then :; else +< ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` +< fi +< # We set ac_cv_exeext here because the later test for it is not +< # safe: cross compilers may not add the suffix if given an `-o' +< # argument, so we may need to know it at that point already. +< # Even if this section looks crufty: it has the advantage of +< # actually working. +< break;; +< * ) +< break;; +< esac +< done +< test "$ac_cv_exeext" = no && ac_cv_exeext= +--- +> # if { { ac_try="$ac_link_default" +> # case "(($ac_try" in +> # *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; +> # *) ac_try_echo=$ac_try;; +> # esac +> # eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +> # printf "%s\n" "$ac_try_echo"; } >&5 +> # (eval "$ac_link_default") 2>&5 +> # ac_status=$? +> # printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 +> # test $ac_status = 0; } +> # then : +> # # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. +> # # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' +> # # in a Makefile. We should not override ac_cv_exeext if it was cached, +> # # so that the user can short-circuit this test for compilers unknown to +> # # Autoconf. +> # for ac_file in $ac_files '' +> # do +> # test -f "$ac_file" || continue +> # case $ac_file in +> # *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) +> # ;; +> # [ab].out ) +> # # We found the default executable, but exeext='' is most +> # # certainly right. +> # break;; +> # *.* ) +> # if test ${ac_cv_exeext+y} && test "$ac_cv_exeext" != no; +> # then :; else +> # ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` +> # fi +> # # We set ac_cv_exeext here because the later test for it is not +> # # safe: cross compilers may not add the suffix if given an `-o' +> # # argument, so we may need to know it at that point already. +> # # Even if this section looks crufty: it has the advantage of +> # # actually working. +> # break;; +> # * ) +> # break;; +> # esac +> # done +> # test "$ac_cv_exeext" = no && ac_cv_exeext= +> # +> # else $as_nop +> # ac_file='' +> # fi +> ac_file=conftest.exe +> ac_cv_exeext=.exe +4912,4914d4917 +< else $as_nop +< ac_file='' +< fi +4940,4970c4943,4974 +< if { { ac_try="$ac_link" +< case "(($ac_try" in +< *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; +< *) ac_try_echo=$ac_try;; +< esac +< eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +< printf "%s\n" "$ac_try_echo"; } >&5 +< (eval "$ac_link") 2>&5 +< ac_status=$? +< printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 +< test $ac_status = 0; } +< then : +< # If both `conftest.exe' and `conftest' are `present' (well, observable) +< # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +< # work properly (i.e., refer to `conftest.exe'), while it won't with +< # `rm'. +< for ac_file in conftest.exe conftest conftest.*; do +< test -f "$ac_file" || continue +< case $ac_file in +< *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; +< *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` +< break;; +< * ) break;; +< esac +< done +< else $as_nop +< { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +< printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +< as_fn_error $? "cannot compute suffix of executables: cannot compile and link +< See \`config.log' for more details" "$LINENO" 5; } +< fi +--- +> # if { { ac_try="$ac_link" +> # case "(($ac_try" in +> # *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; +> # *) ac_try_echo=$ac_try;; +> # esac +> # eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +> # printf "%s\n" "$ac_try_echo"; } >&5 +> # (eval "$ac_link") 2>&5 +> # ac_status=$? +> # printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 +> # test $ac_status = 0; } +> # then : +> # # If both `conftest.exe' and `conftest' are `present' (well, observable) +> # # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +> # # work properly (i.e., refer to `conftest.exe'), while it won't with +> # # `rm'. +> # for ac_file in conftest.exe conftest conftest.*; do +> # test -f "$ac_file" || continue +> # case $ac_file in +> # *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; +> # *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` +> # break;; +> # * ) break;; +> # esac +> # done +> # else $as_nop +> # { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +> # printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +> # as_fn_error $? "cannot compute suffix of executables: cannot compile and link +> # See \`config.log' for more details" "$LINENO" 5; } +> # fi +> ac_cv_exeext=.exe +17438,17457c17442,17462 +< { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for basic C99 features" >&5 +< printf %s "checking for basic C99 features... " >&6; } +< cat confdefs.h - <<_ACEOF >conftest.$ac_ext +< /* end confdefs.h. */ +< `cat "$srcdir/test_c99.c"` +< _ACEOF +< if ac_fn_c_try_link "$LINENO" +< then : +< have_c99=yes; { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +< printf "%s\n" "yes" >&6; } +< else $as_nop +< have_c99=no; { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +< printf "%s\n" "no" >&6; } +< +< fi +< rm -f core conftest.err conftest.$ac_objext conftest.beam \ +< conftest$ac_exeext conftest.$ac_ext +< if test "x$have_c99" = xno; then +< as_fn_error $? "Your toolchain lacks basic C99 features. See test_c99.c for the requirements." "$LINENO" 5 +< fi +--- +> # { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for basic C99 features" >&5 +> # printf %s "checking for basic C99 features... " >&6; } +> # cat confdefs.h - <<_ACEOF >conftest.$ac_ext +> # /* end confdefs.h. */ +> # `cat "$srcdir/test_c99.c"` +> # _ACEOF +> # if ac_fn_c_try_link "$LINENO" +> # then : +> # have_c99=yes; { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +> # printf "%s\n" "yes" >&6; } +> # else $as_nop +> # have_c99=no; { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +> # printf "%s\n" "no" >&6; } +> # +> # fi +> # rm -f core conftest.err conftest.$ac_objext conftest.beam \ +> # conftest$ac_exeext conftest.$ac_ext +> # if test "x$have_c99" = xno; then +> # as_fn_error $? "Your toolchain lacks basic C99 features. See test_c99.c for the requirements." "$LINENO" 5 +> # fi +> have_c99=yes +17629a17635,17637 +> # if test "x$ac_cv_sizeof_off_t" = x0; then +> # as_fn_error $? "Not even off_t found. I need some POSIX." "$LINENO" 5 +> # fi +17631c17639 +< as_fn_error $? "Not even off_t found. I need some POSIX." "$LINENO" 5 +--- +> ac_cv_sizeof_off_t=4 +17632a17641 +> +17640c17649 +< as_fn_error $? "bad switched off_t size" "$LINENO" 5 +--- +> switched_off_size=$ac_cv_sizeof_off_t +21001c21010,21011 +< as_fn_error $? "Unicode File Open for Win32 not available" "$LINENO" 5 +--- +> #as_fn_error $? "Unicode File Open for Win32 not available" "$LINENO" 5 +> win32_unicode=disabled diff --git a/xbox/patches/mpg123/stub_out_file_io.patch b/xbox/patches/mpg123/stub_out_file_io.patch new file mode 100644 index 00000000..1f7c6942 --- /dev/null +++ b/xbox/patches/mpg123/stub_out_file_io.patch @@ -0,0 +1,161 @@ +diff -ruN mpg123-1.33.4/src/compat/compat.c mpg123-1.33.4-filesystem/src/compat/compat.c +--- mpg123-1.33.4/src/compat/compat.c 2025-12-19 17:23:34.000000000 -0500 ++++ mpg123-1.33.4-filesystem/src/compat/compat.c 2026-05-21 15:58:29.783660800 -0400 +@@ -9,6 +9,11 @@ + initially written by Thomas Orgis, Windows Unicode stuff by JonY. + */ + ++#ifdef NXDK ++#define WINDOWS_UWP ++#define NO_CATCHSIGNAL ++#endif ++ + #include "config.h" + /* This source file does need _POSIX_SOURCE to get some sigaction. */ + #define _POSIX_SOURCE +@@ -71,6 +76,9 @@ + /* Always add a default permission mask in case of flags|O_CREAT. */ + int INT123_compat_open(const char *filename, int flags) + { ++#ifdef NXDK ++ return 0; ++#else + int ret; + #if defined (WANT_WIN32_UNICODE) + wchar_t *frag = NULL; +@@ -102,6 +110,7 @@ + #endif + + return ret; ++#endif // ifdef NXDK + } + + /* Moved over from wav.c, logic with fallbacks added from the +@@ -138,20 +147,28 @@ + + FILE* INT123_compat_fdopen(int fd, const char *mode) + { ++#ifdef NXDK ++ return 0; ++#else + #if defined(MPG123_COMPAT_MSVCRT_IO) + return _fdopen(fd, mode); + #else + return fdopen(fd, mode); + #endif ++#endif // ifdef NXDK + } + + int INT123_compat_close(int infd) + { ++#ifdef NXDK ++ return 0; ++#else + #if defined(MPG123_COMPAT_MSVCRT_IO) + return _close(infd); + #else + return close(infd); + #endif ++#endif // endif NXDK + } + + int INT123_compat_fclose(FILE *stream) +@@ -444,6 +461,9 @@ + + size_t INT123_unintr_write(int fd, void const *buffer, size_t bytes) + { ++#ifdef NXDK ++ return 0; ++#else + size_t written = 0; + errno = 0; + while(bytes) +@@ -467,11 +487,15 @@ + break; + } + return written; ++#endif // ifdef NXDK + } + + /* Same for reading the data. */ + size_t INT123_unintr_read(int fd, void *buffer, size_t bytes) + { ++#ifdef NXDK ++ return 0; ++#else + size_t got = 0; + errno = 0; + while(bytes) +@@ -490,6 +514,7 @@ + break; + } + return got; ++#endif // ifdef NXDK + } + + // and again for streams +diff -ruN mpg123-1.33.4/src/compat/compat.h mpg123-1.33.4-filesystem/src/compat/compat.h +--- mpg123-1.33.4/src/compat/compat.h 2025-12-19 17:23:34.000000000 -0500 ++++ mpg123-1.33.4-filesystem/src/compat/compat.h 2026-05-21 15:53:42.140992500 -0400 +@@ -116,7 +116,7 @@ + #define INT123_compat_strtok(a, b, c) strtok_r((a), (b), (c)) + #endif + +-#if (defined(_UCRT) || defined(_MSC_VER) || (defined(__MINGW32__) || defined(__MINGW64__)) || (defined(__WATCOMC__) && defined(__NT__))) && !defined(__CYGWIN__) ++#if ((defined(_UCRT) || defined(_MSC_VER) || (defined(__MINGW32__) || defined(__MINGW64__)) || (defined(__WATCOMC__) && defined(__NT__))) && !defined(__CYGWIN__)) && !defined(NXDK) + #define MPG123_COMPAT_MSVCRT_IO + #ifndef INT123_compat_strtok + #define INT123_compat_strtok(a, b, c) strtok_s((a), (b), (c)) +diff -ruN mpg123-1.33.4/src/libmpg123/lfs_wrap.c mpg123-1.33.4-filesystem/src/libmpg123/lfs_wrap.c +--- mpg123-1.33.4/src/libmpg123/lfs_wrap.c 2025-12-19 17:23:34.000000000 -0500 ++++ mpg123-1.33.4-filesystem/src/libmpg123/lfs_wrap.c 2026-05-21 16:03:50.413260200 -0400 +@@ -120,6 +120,9 @@ + That is stored in the frame and only deleted on mpg123_delete(). */ + static void wrap_io_cleanup(void *handle) + { ++#ifdef NXDK ++ return; ++#else + struct wrap_data *ioh = handle; + debug("wrapper I/O cleanup"); + if(ioh->iotype == IO_HANDLE +@@ -144,6 +147,7 @@ + #endif + ioh->my_fd = -1; + } ++#endif // ifdef NXDK + } + + /* Really finish off the handle... freeing all memory. */ +@@ -710,6 +714,9 @@ + // specifics. + static mpg123_ssize_t fallback_read(int fd, void *buf, size_t count) + { ++#ifdef NXDK ++ return 0; ++#else + #if defined(MPG123_COMPAT_MSVCRT_IO) + if(count > UINT_MAX) + { +@@ -720,16 +727,21 @@ + #else + return read(fd, buf, count); + #endif ++#endif // ifdef NXDK + } + + static off_t fallback_lseek(int fd, off_t offset, int whence) + { ++#ifdef NXDK ++ return 0; ++#else + #if defined(MPG123_COMPAT_MSVCRT_IO) + // Off_t is 32 bit and does fit into long. We know that. + return _lseek(fd, (long)offset, whence); + #else + return lseek(fd, offset, whence); + #endif ++#endif // ifdef NXDK + } + + // This is assuming an internally opened file, which usually will be diff --git a/xbox/patches/mpg123/use_stricmp_strnicmp.patch b/xbox/patches/mpg123/use_stricmp_strnicmp.patch new file mode 100644 index 00000000..e12f8258 --- /dev/null +++ b/xbox/patches/mpg123/use_stricmp_strnicmp.patch @@ -0,0 +1,7 @@ +530a531,535 +> +> #ifdef NXDK +> # define strcasecmp _stricmp +> # define strncasecmp _strnicmp +> #endif +\ No newline at end of file diff --git a/xbox/patches/opus/skip_abort_behavior.patch b/xbox/patches/opus/skip_abort_behavior.patch new file mode 100644 index 00000000..87c0cf7a --- /dev/null +++ b/xbox/patches/opus/skip_abort_behavior.patch @@ -0,0 +1,4 @@ +76c76 +< #if defined(_MSC_VER) +--- +> #if defined(_MSC_VER) && !defined(NXDK) diff --git a/xbox/patches/opus/skip_intrinsics.patch b/xbox/patches/opus/skip_intrinsics.patch new file mode 100644 index 00000000..11dfd1f6 --- /dev/null +++ b/xbox/patches/opus/skip_intrinsics.patch @@ -0,0 +1,4 @@ +51c51 +< #if defined(_MSC_VER) && (_MSC_VER >= 1400) +--- +> #if defined(_MSC_VER) && (_MSC_VER >= 1400) && !defined(NXDK) diff --git a/xbox/patches/opusfile/avoid_autoconf_issues.patch b/xbox/patches/opusfile/avoid_autoconf_issues.patch new file mode 100644 index 00000000..9e8312df --- /dev/null +++ b/xbox/patches/opusfile/avoid_autoconf_issues.patch @@ -0,0 +1,21 @@ +2728c2728,2730 +< if test -z "$ac_file"; then : +--- +> #if test -z "$ac_file"; +> ac_file=conftest.exe; if false +> then : +2779,2780c2781,2783 +< as_fn_error $? "cannot compute suffix of executables: cannot compile and link +< See \`config.log' for more details" "$LINENO" 5; } +--- +> #as_fn_error $? "cannot compute suffix of executables: cannot compile and link +> #See \`config.log' for more details" "$LINENO" 5; +> ac_cv_exeext=.exe;} +9912c9915 +< libext=lib +--- +> libext=a +9920c9923 +< old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' +--- +> old_archive_cmds='llvm-ar cr $oldlib $oldobjs $old_deplibs' diff --git a/xbox/patches/opusfile/no_win32_io.patch b/xbox/patches/opusfile/no_win32_io.patch new file mode 100644 index 00000000..2738c597 --- /dev/null +++ b/xbox/patches/opusfile/no_win32_io.patch @@ -0,0 +1,18 @@ +20a21,22 +> #undef _WIN32 +> +30a33,34 +> +> +98a103,104 +> #elif NXDK +> return 0; +113a120,121 +> #elif NXDK +> return 0; +305a314,316 +> #ifdef NXDK +> return 0; +> #else +309a321 +> #endif diff --git a/xbox/patches/sdl3-nxdk/add_install_to_cmakelists.patch b/xbox/patches/sdl3-nxdk/add_install_to_cmakelists.patch new file mode 100644 index 00000000..d50a578d --- /dev/null +++ b/xbox/patches/sdl3-nxdk/add_install_to_cmakelists.patch @@ -0,0 +1,59 @@ +115a116,119 +> set_target_properties(SDL3-static PROPERTIES +> OUTPUT_NAME SDL3 +> ) +> +119c123,126 +< target_include_directories(SDL3_Headers INTERFACE ${SDL3_DIR}/include) +--- +> target_include_directories(SDL3_Headers INTERFACE +> $ +> $ +> ) +124a132 +> +127a136 +> +144a154,194 +> +> include(GNUInstallDirs) +> +> install(TARGETS SDL3-static SDL3_Headers +> EXPORT SDL3Targets +> ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} +> LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} +> RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +> ) +> +> install(DIRECTORY "${SDL3_DIR}/include/SDL3" +> DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} +> ) +> +> install(EXPORT SDL3Targets +> FILE SDL3Targets.cmake +> NAMESPACE SDL3:: +> DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/SDL3 +> ) +> +> include(CMakePackageConfigHelpers) +> +> file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/SDL3Config.cmake" +> "include(\"\${CMAKE_CURRENT_LIST_DIR}/SDL3Targets.cmake\")\n" +> "if(TARGET SDL3::SDL3-static AND NOT TARGET SDL3::SDL3)\n" +> " add_library(SDL3::SDL3 INTERFACE IMPORTED)\n" +> " target_link_libraries(SDL3::SDL3 INTERFACE SDL3::SDL3-static)\n" +> "endif()\n" +> ) +> +> write_basic_package_version_file( +> "${CMAKE_CURRENT_BINARY_DIR}/SDL3ConfigVersion.cmake" +> VERSION 3.0.0 +> COMPATIBILITY AnyNewerVersion +> ) +> +> install(FILES +> "${CMAKE_CURRENT_BINARY_DIR}/SDL3Config.cmake" +> "${CMAKE_CURRENT_BINARY_DIR}/SDL3ConfigVersion.cmake" +> DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/SDL3 +> ) +\ No newline at end of file diff --git a/xbox/patches/speexdsp/avoid_autoconf_issues.patch b/xbox/patches/speexdsp/avoid_autoconf_issues.patch new file mode 100644 index 00000000..805cc4fa --- /dev/null +++ b/xbox/patches/speexdsp/avoid_autoconf_issues.patch @@ -0,0 +1,21 @@ +4576c4576,4577 +< if test -z "$ac_file" +--- +> #if test -z "$ac_file" +> ac_file=conftest.exe; if false +4629,4630c4630,4633 +< as_fn_error $? "cannot compute suffix of executables: cannot compile and link +< See \`config.log' for more details" "$LINENO" 5; } +--- +> #as_fn_error $? "cannot compute suffix of executables: cannot compile and link +> ac_cv_exeext=.exe; +> #See \`config.log' for more details" "$LINENO" 5; +> } +10685c10688 +< libext=lib +--- +> libext=a +10693c10696 +< old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' +--- +> old_archive_cmds='llvm-ar cr $oldlib $oldobjs $old_deplibs' diff --git a/xbox/patches/wildmidi/use_generic_io_and_atof_shim.patch b/xbox/patches/wildmidi/use_generic_io_and_atof_shim.patch new file mode 100644 index 00000000..c1c3970d --- /dev/null +++ b/xbox/patches/wildmidi/use_generic_io_and_atof_shim.patch @@ -0,0 +1,8 @@ +31a32,38 +> #undef _WIN32 +> +> // Fixes atof being compiled as _atof +> double atof(const char* s) { +> return atof(s); +> } +> diff --git a/xbox/patches/zlib/skip_io_stuff.patch b/xbox/patches/zlib/skip_io_stuff.patch new file mode 100644 index 00000000..f35a612f --- /dev/null +++ b/xbox/patches/zlib/skip_io_stuff.patch @@ -0,0 +1,143 @@ +diff -ruN zlib-1.3.2/gzlib.c zlib-1.3.2-good/gzlib.c +--- zlib-1.3.2/gzlib.c 2026-02-17 07:47:06.000000000 -0500 ++++ zlib-1.3.2-good/gzlib.c 2026-05-22 18:13:27.797310000 -0400 +@@ -85,6 +85,9 @@ + + /* Open a gzip file either by name or file descriptor. */ + local gzFile gz_open(const void *path, int fd, const char *mode) { ++#ifdef NXDK ++ return 0; ++#else + gz_statep state; + z_size_t len; + int oflag = 0; +@@ -282,6 +285,7 @@ + + /* return stream */ + return (gzFile)state; ++#endif + } + + /* -- see zlib.h -- */ +@@ -344,6 +348,7 @@ + + /* -- see zlib.h -- */ + int ZEXPORT gzrewind(gzFile file) { ++#ifndef NXDK + gz_statep state; + + /* get internal structure */ +@@ -360,11 +365,15 @@ + if (LSEEK(state->fd, state->start, SEEK_SET) == -1) + return -1; + gz_reset(state); ++#endif + return 0; + } + + /* -- see zlib.h -- */ + z_off64_t ZEXPORT gzseek64(gzFile file, z_off64_t offset, int whence) { ++#ifdef NXDK ++ return 0; ++#else + unsigned n; + z_off64_t ret; + gz_statep state; +@@ -432,6 +441,7 @@ + /* request skip (if not zero) */ + state->skip = offset; + return state->x.pos + offset; ++#endif + } + + /* -- see zlib.h -- */ +@@ -467,6 +477,9 @@ + + /* -- see zlib.h -- */ + z_off64_t ZEXPORT gzoffset64(gzFile file) { ++#ifdef NXDK ++ return 0; ++#else + z_off64_t offset; + gz_statep state; + +@@ -484,6 +497,7 @@ + if (state->mode == GZ_READ) /* reading */ + offset -= state->strm.avail_in; /* don't count buffered input */ + return offset; ++#endif + } + + /* -- see zlib.h -- */ +diff -ruN zlib-1.3.2/gzread.c zlib-1.3.2-good/gzread.c +--- zlib-1.3.2/gzread.c 2026-02-17 07:47:06.000000000 -0500 ++++ zlib-1.3.2-good/gzread.c 2026-05-22 18:09:47.918869000 -0400 +@@ -17,6 +17,7 @@ + signaled from read(). *have is set to the number of bytes read. */ + local int gz_load(gz_statep state, unsigned char *buf, unsigned len, + unsigned *have) { ++#ifndef NXDK + int ret; + unsigned get, max = ((unsigned)-1 >> 2) + 1; + +@@ -43,6 +44,7 @@ + } + if (ret == 0) + state->eof = 1; ++#endif + return 0; + } + +@@ -643,6 +645,9 @@ + + /* -- see zlib.h -- */ + int ZEXPORT gzclose_r(gzFile file) { ++#ifdef NXDK ++ return 0; ++#else + int ret, err; + gz_statep state; + +@@ -665,4 +670,5 @@ + ret = close(state->fd); + free(state); + return ret ? Z_ERRNO : err; ++#endif + } +diff -ruN zlib-1.3.2/gzwrite.c zlib-1.3.2-good/gzwrite.c +--- zlib-1.3.2/gzwrite.c 2026-02-17 07:47:06.000000000 -0500 ++++ zlib-1.3.2-good/gzwrite.c 2026-05-22 18:08:23.437023800 -0400 +@@ -63,6 +63,9 @@ + reset to start a new gzip stream. If gz->direct is true, then simply write + to the output file without compressing, and ignore flush. */ + local int gz_comp(gz_statep state, int flush) { ++#ifdef NXDK ++ return 0; ++#else + int ret, writ; + unsigned have, put, max = ((unsigned)-1 >> 2) + 1; + z_streamp strm = &(state->strm); +@@ -145,6 +148,7 @@ + + /* all done, no errors */ + return 0; ++#endif + } + + /* Compress state->skip (> 0) zeros to output. Return -1 on a write error or +@@ -665,6 +669,9 @@ + + /* -- see zlib.h -- */ + int ZEXPORT gzclose_w(gzFile file) { ++#ifdef NXDK ++ return 0; ++#else + int ret = Z_OK; + gz_statep state; + +@@ -697,4 +704,5 @@ + ret = Z_ERRNO; + free(state); + return ret; ++#endif + } diff --git a/xbox/scripts/dump_nxdk_env.mk b/xbox/scripts/dump_nxdk_env.mk new file mode 100644 index 00000000..d5128bce --- /dev/null +++ b/xbox/scripts/dump_nxdk_env.mk @@ -0,0 +1,8 @@ +# dump-nxdk-env.mk +NXDK_ONLY = y +include $(NXDK_DIR)/Makefile + +print: + @printf "NXDK_CFLAGS='%s'\n" "$(NXDK_CFLAGS)" + @printf "NXDK_CXXFLAGS='%s'\n" "$(NXDK_CXXFLAGS)" + @printf "NXDK_LDFLAGS='%s'\n" "$(NXDK_LDFLAGS)" \ No newline at end of file diff --git a/xbox/scripts/dump_sdl3_env.mk b/xbox/scripts/dump_sdl3_env.mk new file mode 100644 index 00000000..2db7de0f --- /dev/null +++ b/xbox/scripts/dump_sdl3_env.mk @@ -0,0 +1,5 @@ +#include $(NXDK_DIR)/Makefile +include $(SDL3_DIR)/config_sdl.make + +print: + @printf "SDL3_FLAGS='%s'\n" '$(SDL3_FLAGS)' \ No newline at end of file From 529ac24b088edb6d37da04c13cb58a82e686805e Mon Sep 17 00:00:00 2001 From: Vannevar Xbox Date: Sat, 20 Jun 2026 22:32:10 -0400 Subject: [PATCH 2/2] Don't delete NXDK dir during cleanup since the player needs it to build --- xbox/3_cleanup.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/xbox/3_cleanup.sh b/xbox/3_cleanup.sh index 6e2f5845..a487da3c 100644 --- a/xbox/3_cleanup.sh +++ b/xbox/3_cleanup.sh @@ -8,6 +8,5 @@ headermsg "Cleaning up library build folders and other stuff..." cleanup rm -rf ./tool-overrides -rm -rf ./nxdk echo " -> done"