From 9ed11ecffac60db034a2e52f27e3b710f16f5360 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E7=9A=93?= Date: Sat, 22 Feb 2025 16:04:51 -0500 Subject: [PATCH] Use libretro's PlayStation 3 Docker image instead of ScummVM's --- .github/workflows/autobuild.yml | 12 +- binding-sandbox/sandbox.cpp | 1 + libretro/Makefile | 1 + meson.build | 72 ++++++ src/audio/alstream.cpp | 4 + src/audio/sndfilesource.cpp | 3 +- src/audio/soundemitter.cpp | 14 +- src/core.cpp | 11 +- src/filesystem/filesystem.cpp | 19 +- src/mkxp-threads.h | 241 ++++++++++++++++++ src/util/exception.h | 2 + subprojects/boost_assert.wrap | 1 + subprojects/libsndfile.wrap | 2 +- .../packagefiles/boost_assert-snprintf.patch | 13 + .../packagefiles/libsndfile-ssize.patch | 17 ++ .../packagefiles/openal-soft-constexpr.patch | 50 ++++ .../openal-soft-mkxp-threads.patch | 57 ++++- .../packagefiles/openal-soft-ps3.patch | 11 + 18 files changed, 501 insertions(+), 30 deletions(-) create mode 100644 subprojects/packagefiles/boost_assert-snprintf.patch create mode 100644 subprojects/packagefiles/libsndfile-ssize.patch diff --git a/.github/workflows/autobuild.yml b/.github/workflows/autobuild.yml index c0f52189..d6fd2b99 100644 --- a/.github/workflows/autobuild.yml +++ b/.github/workflows/autobuild.yml @@ -865,14 +865,16 @@ jobs: needs: build-libretro-stage1 name: LR PlayStation 3 runs-on: ubuntu-latest - container: scummvm/dockerized-toolchains:ps3 + container: + image: git.libretro.com:5050/libretro-infrastructure/libretro-build-psl1ght:latest + options: -u root steps: - name: Install dependencies run: | apt update apt install -y git build-essential pip ninja-build jq apt remove -y meson cmake - pip install --break-system-packages meson cmake + pip install meson cmake - id: short-sha name: Get Git commit hash @@ -892,9 +894,9 @@ jobs: - name: Configure core run: | echo "[binaries]" | tee -a ~/cross.ini - echo "c = 'powerpc64-ps3-elf-gcc'" | tee -a ~/cross.ini - echo "cpp = 'powerpc64-ps3-elf-g++'" | tee -a ~/cross.ini - echo "ar = 'powerpc64-ps3-elf-ar'" | tee -a ~/cross.ini + echo "c = 'ppu-gcc'" | tee -a ~/cross.ini + echo "cpp = 'ppu-g++'" | tee -a ~/cross.ini + echo "ar = 'ppu-ar'" | tee -a ~/cross.ini echo "[host_machine]" | tee -a ~/cross.ini echo "system = 'bare'" | tee -a ~/cross.ini echo "cpu_family = 'ppc64'" | tee -a ~/cross.ini diff --git a/binding-sandbox/sandbox.cpp b/binding-sandbox/sandbox.cpp index 2bc04dfa..9f2b9129 100644 --- a/binding-sandbox/sandbox.cpp +++ b/binding-sandbox/sandbox.cpp @@ -25,6 +25,7 @@ #include #include "wasi.h" #include +#include "mkxp-threads.h" #include "sandbox.h" #define MJIT_ENABLED 0 diff --git a/libretro/Makefile b/libretro/Makefile index 3d985bdd..632660ac 100644 --- a/libretro/Makefile +++ b/libretro/Makefile @@ -100,6 +100,7 @@ $(OUTDIR)/mkxp-retro-ruby/mkxp-retro-ruby.h $(OUTDIR)/mkxp-retro-ruby/mkxp-retro $(SED) -i 's/ *# *define * FUNC_TYPE_DECL_EXTERN_T *([^()]).*/#define FUNC_TYPE_DECL_EXTERN_T(x)/g' $(OUTDIR)/mkxp-retro-ruby/mkxp-retro-ruby-impl.h $(SED) -i 's/ *# *define * FUNC_TYPE_EXTERN_T *([^()]).*/#define FUNC_TYPE_EXTERN_T(x) const char _mkxp_unused_##x[]/g' $(OUTDIR)/mkxp-retro-ruby/mkxp-retro-ruby-impl.h $(SED) -i 's/ *# *define * FUNC_TYPE_T *([^()]).*/#define FUNC_TYPE_T(x) static const char _mkxp_unused_##x[]/g' $(OUTDIR)/mkxp-retro-ruby/mkxp-retro-ruby-impl.h + $(SED) -i 's/__has_builtin *([^()]*)/0/g' $(OUTDIR)/mkxp-retro-ruby/mkxp-retro-ruby-impl.h $(OUTDIR)/mkxp-retro-dist.zip.cpp: $(LIBDIR)/mkxp-retro-dist.zip mkdir -p $(OUTDIR) diff --git a/meson.build b/meson.build index de9ba920..81374aac 100644 --- a/meson.build +++ b/meson.build @@ -84,6 +84,70 @@ if is_libretro libretro_defines += '-DBOOST_NO_EXCEPTIONS' endif + if not compilers['cpp'].has_header_symbol('stdio.h', 'snprintf') + libretro_defines += '-DMKXPZ_NO_SNPRINTF' + endif + + if not compilers['cpp'].has_header_symbol('stdio.h', 'vsnprintf') + libretro_defines += '-DMKXPZ_NO_VSNPRINTF' + endif + + if not compilers['cpp'].has_header_symbol('cmath', 'std::round') + libretro_defines += '-DMKXPZ_NO_STD_ROUND' + endif + + if not compilers['cpp'].has_header_symbol('cmath', 'std::lround') + libretro_defines += '-DMKXPZ_NO_STD_LROUND' + endif + + if not compilers['cpp'].has_header_symbol('cmath', 'std::copysign') + libretro_defines += '-DMKXPZ_NO_STD_COPYSIGN' + endif + + if not compilers['cpp'].has_header_symbol('cmath', 'std::cbrt') + libretro_defines += '-DMKXPZ_NO_STD_CBRT' + endif + + if not compilers['cpp'].has_header_symbol('cmath', 'std::log2') + libretro_defines += '-DMKXPZ_NO_STD_LOG2' + endif + + if not compilers['cpp'].has_header_symbol('string', 'std::to_string') + libretro_defines += '-DMKXPZ_NO_STD_TO_STRING' + endif + + if not compilers['cpp'].has_header_symbol('string', 'std::stoi') + libretro_defines += '-DMKXPZ_NO_STD_STOI' + endif + + if not compilers['cpp'].has_header_symbol('string', 'std::stol') + libretro_defines += '-DMKXPZ_NO_STD_STOL' + endif + + if not compilers['cpp'].has_header_symbol('string', 'std::stoll') + libretro_defines += '-DMKXPZ_NO_STD_STOLL' + endif + + if not compilers['cpp'].has_header_symbol('string', 'std::stoul') + libretro_defines += '-DMKXPZ_NO_STD_STOUL' + endif + + if not compilers['cpp'].has_header_symbol('string', 'std::stoull') + libretro_defines += '-DMKXPZ_NO_STD_STOULL' + endif + + if not compilers['cpp'].has_header_symbol('string', 'std::stof') + libretro_defines += '-DMKXPZ_NO_STD_STOF' + endif + + if not compilers['cpp'].has_header_symbol('string', 'std::stod') + libretro_defines += '-DMKXPZ_NO_STD_STOD' + endif + + if not compilers['cpp'].has_header_symbol('string', 'std::stold') + libretro_defines += '-DMKXPZ_NO_STD_STOLD' + endif + if not compilers['cpp'].has_header_symbol('mutex', 'std::mutex') libretro_defines += '-DMKXPZ_NO_STD_MUTEX' endif @@ -129,6 +193,14 @@ if is_libretro libretro_defines += '-DMKXPZ_NO_SEMAPHORE_H' endif + if (not core_is_static or is_emscripten) and compilers['cpp'].has_header_symbol('stdlib.h', 'posix_memalign') + libretro_defines += '-DMKXPZ_HAVE_POSIX_MEMALIGN' + elif (not core_is_static or is_emscripten) and compilers['cpp'].has_header_symbol('malloc.h', '_aligned_malloc') + libretro_defines += '-DMKXPZ_HAVE_ALIGNED_MALLOC' + elif compilers['cpp'].has_header_symbol('stdlib.h', 'aligned_alloc') + libretro_defines += '-DMKXPZ_HAVE_ALIGNED_ALLOC' + endif + # Enable integer-only mode in FLAC when building with Vita SDK. Otherwise, we get an internal compiler error in FLAC__window_triangle: # # ../subprojects/flac/src/libFLAC/window.c: In function 'FLAC__window_triangle': diff --git a/src/audio/alstream.cpp b/src/audio/alstream.cpp index b7c3bff3..d7295d8d 100644 --- a/src/audio/alstream.cpp +++ b/src/audio/alstream.cpp @@ -298,11 +298,15 @@ void ALStream::openSource(const std::string &filename) if (!handler.source) { +#ifdef MKXPZ_RETRO + mkxp_retro::log_printf(RETRO_LOG_WARN, "Unable to decode audio stream: %s: %s\n", filename.c_str(), handler.errorMsg.c_str()); +#else char buf[512]; snprintf(buf, sizeof(buf), "Unable to decode audio stream: %s: %s", filename.c_str(), handler.errorMsg.c_str()); Debug() << buf; +#endif // MKXPZ_RETRO } source = handler.source; diff --git a/src/audio/sndfilesource.cpp b/src/audio/sndfilesource.cpp index 0bb56723..c1a802f4 100644 --- a/src/audio/sndfilesource.cpp +++ b/src/audio/sndfilesource.cpp @@ -22,6 +22,7 @@ #include "aldatasource.h" #include "exception.h" +#include #include #include #include @@ -170,7 +171,7 @@ struct SndfileSource : ALDataSource void seekToOffset(double seconds) { - currentFrame = std::lround(seconds * (double)info.rate); + currentFrame = lround(seconds * (double)info.rate); if (currentFrame < 0 || currentFrame >= (uint64_t)handle.frames()) { diff --git a/src/audio/soundemitter.cpp b/src/audio/soundemitter.cpp index 0ec18596..ba7d28c1 100644 --- a/src/audio/soundemitter.cpp +++ b/src/audio/soundemitter.cpp @@ -304,19 +304,13 @@ SoundBuffer *SoundEmitter::allocateBuffer(const std::string &filename) if (!buffer) { - char buf[512]; - snprintf( - buf, - sizeof(buf), - "Unable to decode sound: %s: %s", - filename.c_str(), #ifdef MKXPZ_RETRO - sf_error_number(handler.errnum) + mkxp_retro::log_printf(RETRO_LOG_WARN, "Unable to decode sound: %s: %s\n", filename.c_str(), sf_error_number(handler.errnum)); #else - Sound_GetError() -#endif // MKXPZ_RETRO - ); + char buf[512]; + snprintf(buf, sizeof(buf), "Unable to decode sound: %s: %s", filename.c_str(), Sound_GetError()); Debug() << buf; +#endif // MKXPZ_RETRO return 0; } diff --git a/src/core.cpp b/src/core.cpp index fd627c7f..b269f002 100644 --- a/src/core.cpp +++ b/src/core.cpp @@ -24,6 +24,9 @@ #include #include #include +#ifdef MKXPZ_HAVE_ALIGNED_MALLOC +# include +#endif #include #include #include @@ -39,13 +42,15 @@ using namespace mkxp_retro; using namespace mkxp_sandbox; static inline void *malloc_align(size_t alignment, size_t size) { -#if defined(__unix__) || defined(__APPLE__) +#if defined(MKXPZ_HAVE_POSIX_MEMALIGN) || defined(MKXPZ_BUILD_XCODE) void *mem; return posix_memalign(&mem, alignment, size) ? NULL : mem; -#elif defined(_WIN32) || defined(__CYGWIN__) || defined(__MINGW32__) +#elif defined(MKXPZ_HAVE_ALIGNED_MALLOC) return _aligned_malloc(size, alignment); -#else +#elif defined(MKXPZ_HAVE_ALIGNED_ALLOC) return aligned_alloc(alignment, size); +#else + return malloc(size); #endif } diff --git a/src/filesystem/filesystem.cpp b/src/filesystem/filesystem.cpp index d557257a..79cadb66 100644 --- a/src/filesystem/filesystem.cpp +++ b/src/filesystem/filesystem.cpp @@ -420,10 +420,13 @@ static PHYSFS_EnumerateCallbackResult cacheEnumCB(void *d, const char *origdir, CacheEnumData &data = *static_cast(d); char fullPath[512]; - if (!*origdir) - snprintf(fullPath, sizeof(fullPath), "%s", fname); - else - snprintf(fullPath, sizeof(fullPath), "%s/%s", origdir, fname); + if (!*origdir) { + std::strncpy(fullPath, fname, sizeof(fullPath)); + } else { + std::strncpy(fullPath, origdir, sizeof(fullPath) - 1); + std::strncat(fullPath, "/", sizeof(fullPath) - 1 - std::strlen(fullPath)); + std::strncat(fullPath, fname, sizeof(fullPath) - 1 - std::strlen(fullPath)); + } /* Deal with OSX' weird UTF-8 standards */ data.toNFC(fullPath); @@ -505,7 +508,9 @@ static PHYSFS_EnumerateCallbackResult fontSetEnumCB(void *data, const char *dir, return PHYSFS_ENUM_OK; char filename[512]; - snprintf(filename, sizeof(filename), "%s/%s", dir, fname); + std::strncpy(filename, dir, sizeof(filename) - 1); + std::strncat(filename, "/", sizeof(filename) - 1 - std::strlen(filename)); + std::strncat(filename, fname, sizeof(filename) - 1 - std::strlen(filename)); PHYSFS_File *handle = PHYSFS_openRead(filename); @@ -598,7 +603,9 @@ openReadEnumCB(void *d, const char *dirpath, const char *filename) { if (!*dirpath) { fullPath = filename; } else { - snprintf(buffer, sizeof(buffer), "%s/%s", dirpath, filename); + std::strncpy(buffer, dirpath, sizeof(buffer) - 1); + std::strncat(buffer, "/", sizeof(buffer) - 1 - std::strlen(buffer)); + std::strncat(buffer, filename, sizeof(buffer) - 1 - std::strlen(buffer)); fullPath = buffer; } diff --git a/src/mkxp-threads.h b/src/mkxp-threads.h index 84b6614e..c813792f 100644 --- a/src/mkxp-threads.h +++ b/src/mkxp-threads.h @@ -22,6 +22,8 @@ #ifndef MKXPZ_THREADS_H #define MKXPZ_THREADS_H +#include +#include #include #include @@ -34,7 +36,14 @@ #endif #ifdef __cplusplus +#include +#include +#include #include +#include + +extern "C" long long strtoll(const char *str, char **str_end, int base); +extern "C" unsigned long long strtoull(const char *str, char **str_end, int base); extern "C" { #endif @@ -149,6 +158,238 @@ namespace std { }; } # endif + +# ifdef MKXPZ_NO_STD_ROUND +namespace std { + inline constexpr float round(float x) { + return roundf(x); + } + + inline constexpr double round(double x) { + return round(x); + } + + inline constexpr long double round(long double x) { + return roundl(x); + } +} +# endif + +# ifdef MKXPZ_NO_STD_LROUND +namespace std { + inline constexpr long lround(float x) { + return lroundf(x); + } + + inline constexpr long lround(double x) { + return lround(x); + } + + inline constexpr long lround(long double x) { + return lroundl(x); + } +} +# endif + +# ifdef MKXPZ_NO_STD_COPYSIGN +namespace std { + inline constexpr float copysign(float x, float y) { + return copysignf(x, y); + } + + inline constexpr double copysign(double x, double y) { + return copysign(x, y); + } + + inline constexpr long double copysign(long double x, long double y) { + return copysignl(x, y); + } +} +# endif + +# ifdef MKXPZ_NO_STD_CBRT +namespace std { + inline constexpr float cbrt(float x) { + return cbrtf(x); + } + + inline constexpr double cbrt(double x) { + return cbrt(x); + } + + inline constexpr long double cbrt(long double x) { + return cbrtl(x); + } +} +# endif + +# ifdef MKXPZ_NO_STD_LOG2 +namespace std { + inline constexpr float log2(float x) { + return log2f(x); + } + + inline constexpr double log2(double x) { + return log2(x); + } +} +# endif + +# ifdef MKXPZ_NO_STD_TO_STRING +namespace std { + inline std::string to_string(int x) { + std::array array; + std::sprintf(array.data(), "%d", x); + return array.data(); + } + + inline std::string to_string(long x) { + std::array array; + std::sprintf(array.data(), "%ld", x); + return array.data(); + } + + inline std::string to_string(long long x) { + std::array array; + std::sprintf(array.data(), "%lld", x); + return array.data(); + } + + inline std::string to_string(unsigned int x) { + std::array array; + std::sprintf(array.data(), "%u", x); + return array.data(); + } + + inline std::string to_string(unsigned long x) { + std::array array; + std::sprintf(array.data(), "%lu", x); + return array.data(); + } + + inline std::string to_string(unsigned long long x) { + std::array array; + std::sprintf(array.data(), "%llu", x); + return array.data(); + } + + inline std::string to_string(float x) { + std::array array; + std::sprintf(array.data(), "%f", x); + return array.data(); + } + + inline std::string to_string(double x) { + std::array array; + std::sprintf(array.data(), "%f", x); + return array.data(); + } +} +# endif + +# ifdef MKXPZ_NO_STD_STOI +namespace std { + inline int stoi(const std::string &str, size_t *pos = nullptr, int base = 10) { + char *ptr; + int result = (int)strtol(str.c_str(), &ptr, base); + if (pos != nullptr) { + *pos = ptr - str.c_str(); + } + return result; + } +} +# endif + +# ifdef MKXPZ_NO_STD_STOL +namespace std { + inline long stol(const std::string &str, size_t *pos = nullptr, int base = 10) { + char *ptr; + long result = strtol(str.c_str(), &ptr, base); + if (pos != nullptr) { + *pos = ptr - str.c_str(); + } + return result; + } +} +# endif + +# ifdef MKXPZ_NO_STD_STOLL +namespace std { + inline long long stoll(const std::string &str, size_t *pos = nullptr, int base = 10) { + char *ptr; + long long result = strtoll(str.c_str(), &ptr, base); + if (pos != nullptr) { + *pos = ptr - str.c_str(); + } + return result; + } +} +# endif + +# ifdef MKXPZ_NO_STD_STOUL +namespace std { + inline unsigned long stoul(const std::string &str, size_t *pos = nullptr, int base = 10) { + char *ptr; + unsigned long result = strtoul(str.c_str(), &ptr, base); + if (pos != nullptr) { + *pos = ptr - str.c_str(); + } + return result; + } +} +# endif + +# ifdef MKXPZ_NO_STD_STOULL +namespace std { + inline unsigned long long stoull(const std::string &str, size_t *pos = nullptr, int base = 10) { + char *ptr; + unsigned long long result = strtoull(str.c_str(), &ptr, base); + if (pos != nullptr) { + *pos = ptr - str.c_str(); + } + return result; + } +} +# endif + +# ifdef MKXPZ_NO_STD_STOF +namespace std { + inline float stof(const std::string &str, size_t *pos = nullptr) { + char *ptr; + float result = strtof(str.c_str(), &ptr); + if (pos != nullptr) { + *pos = ptr - str.c_str(); + } + return result; + } +} +# endif + +# ifdef MKXPZ_NO_STD_STOD +namespace std { + inline double stod(const std::string &str, size_t *pos = nullptr) { + char *ptr; + double result = strtod(str.c_str(), &ptr); + if (pos != nullptr) { + *pos = ptr - str.c_str(); + } + return result; + } +} +# endif + +# ifdef MKXPZ_NO_STD_STOLD +namespace std { + inline long double stold(const std::string &str, size_t *pos = nullptr) { + char *ptr; + long double result = strtold(str.c_str(), &ptr); + if (pos != nullptr) { + *pos = ptr - str.c_str(); + } + return result; + } +} +# endif #endif #endif // MKXPZ_THREADS_H diff --git a/src/util/exception.h b/src/util/exception.h index ae956000..f0637bbd 100644 --- a/src/util/exception.h +++ b/src/util/exception.h @@ -53,6 +53,7 @@ struct Exception Exception(Type type, const char *format, ...) : type(type) { +#ifndef MKXPZ_NO_VSNPRINTF va_list ap; va_start(ap, format); @@ -60,6 +61,7 @@ struct Exception vsnprintf(&msg[0], msg.size(), format, ap); va_end(ap); +#endif } }; diff --git a/subprojects/boost_assert.wrap b/subprojects/boost_assert.wrap index 37ff42b9..bdf39e50 100644 --- a/subprojects/boost_assert.wrap +++ b/subprojects/boost_assert.wrap @@ -2,3 +2,4 @@ url = https://github.com/boostorg/assert revision = boost-1.87.0 depth = 1 +diff_files = boost_assert-snprintf.patch diff --git a/subprojects/libsndfile.wrap b/subprojects/libsndfile.wrap index aac66563..84a8c450 100644 --- a/subprojects/libsndfile.wrap +++ b/subprojects/libsndfile.wrap @@ -2,4 +2,4 @@ url = https://github.com/libsndfile/libsndfile revision = 1.2.2 depth = 1 -diff_files = libsndfile-deps.patch, libsndfile-emscripten-endian.patch, libsndfile-int32.patch +diff_files = libsndfile-deps.patch, libsndfile-emscripten-endian.patch, libsndfile-int32.patch, libsndfile-ssize.patch diff --git a/subprojects/packagefiles/boost_assert-snprintf.patch b/subprojects/packagefiles/boost_assert-snprintf.patch new file mode 100644 index 00000000..ab7c0beb --- /dev/null +++ b/subprojects/packagefiles/boost_assert-snprintf.patch @@ -0,0 +1,13 @@ +# Makes Boost use `sprintf` instead of `snprintf` on platforms with no `snprintf` support. + +--- a/include/boost/assert/source_location.hpp ++++ b/include/boost/assert/source_location.hpp +@@ -73,7 +73,7 @@ public: + # pragma warning( disable: 4996 ) + #endif + +-#if ( defined(_MSC_VER) && _MSC_VER < 1900 ) || ( defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR) ) ++#if ( defined(_MSC_VER) && _MSC_VER < 1900 ) || ( defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR) ) || defined(MKXPZ_NO_SNPRINTF) + # define BOOST_ASSERT_SNPRINTF(buffer, format, arg) std::sprintf(buffer, format, arg) + #else + # define BOOST_ASSERT_SNPRINTF(buffer, format, arg) std::snprintf(buffer, sizeof(buffer)/sizeof(buffer[0]), format, arg) diff --git a/subprojects/packagefiles/libsndfile-ssize.patch b/subprojects/packagefiles/libsndfile-ssize.patch new file mode 100644 index 00000000..ee76765f --- /dev/null +++ b/subprojects/packagefiles/libsndfile-ssize.patch @@ -0,0 +1,17 @@ +# Stops libsndfile from manually defining `ssize_t` because it breaks builds for PlayStation 3. + +--- a/src/config.h.cmake ++++ b/src/config.h.cmake +@@ -148,9 +148,9 @@ + /* Define to 1 if the system has the type `ssize_t'. */ + #cmakedefine01 HAVE_SSIZE_T + +-#if (HAVE_SSIZE_T == 0) +-#define ssize_t intptr_t +-#endif ++ ++ ++ + + /* Define to 1 if you have the header file. */ + #cmakedefine01 HAVE_STDINT_H diff --git a/subprojects/packagefiles/openal-soft-constexpr.patch b/subprojects/packagefiles/openal-soft-constexpr.patch index 5a256f4a..58291e9f 100644 --- a/subprojects/packagefiles/openal-soft-constexpr.patch +++ b/subprojects/packagefiles/openal-soft-constexpr.patch @@ -141,3 +141,53 @@ } enum PropertyValue : ALenum { +--- a/common/alstring.h ++++ b/common/alstring.h +@@ -22,15 +22,15 @@ auto sizei(const std::basic_string &str) noexcept -> int + + + [[nodiscard]] +-constexpr bool contains(const std::string_view str0, const std::string_view str1) noexcept ++inline bool contains(const std::string_view str0, const std::string_view str1) noexcept + { return str0.find(str1) != std::string_view::npos; } + + [[nodiscard]] +-constexpr bool starts_with(const std::string_view str0, const std::string_view str1) noexcept ++inline bool starts_with(const std::string_view str0, const std::string_view str1) noexcept + { return str0.substr(0, std::min(str0.size(), str1.size())) == str1; } + + [[nodiscard]] +-constexpr bool ends_with(const std::string_view str0, const std::string_view str1) noexcept ++inline bool ends_with(const std::string_view str0, const std::string_view str1) noexcept + { return str0.substr(str0.size() - std::min(str0.size(), str1.size())) == str1; } + + [[nodiscard]] +--- a/fmt-11.1.1/include/fmt/format.h ++++ b/fmt-11.1.1/include/fmt/format.h +@@ -1211,7 +1211,7 @@ FMT_CONSTEXPR auto format_decimal(OutputIt out, UInt value, int num_digits) + return out; + } + // Buffer is large enough to hold all digits (digits10 + 1). +- char buffer[digits10() + 1]; ++ char buffer[digits10() + 1] = {}; + if (is_constant_evaluated()) fill_n(buffer, sizeof(buffer), '\0'); + do_format_decimal(buffer, value, num_digits); + return copy_noinline(buffer, buffer + num_digits, out); +@@ -1248,7 +1248,7 @@ FMT_CONSTEXPR inline auto format_base2e(int base_bits, OutputIt out, UInt value, + return out; + } + // Make buffer large enough for any base. +- char buffer[num_bits()]; ++ char buffer[num_bits()] = {}; + if (is_constant_evaluated()) fill_n(buffer, sizeof(buffer), '\0'); + format_base2e(base_bits, buffer, value, num_digits, upper); + return detail::copy_noinline(buffer, buffer + num_digits, out); +@@ -2015,7 +2015,7 @@ FMT_CONSTEXPR FMT_INLINE auto write_int(OutputIt out, write_int_arg arg, + static_assert(std::is_same>::value, ""); + + constexpr int buffer_size = num_bits(); +- char buffer[buffer_size]; ++ char buffer[buffer_size] = {}; + if (is_constant_evaluated()) fill_n(buffer, buffer_size, '\0'); + const char* begin = nullptr; + const char* end = buffer + buffer_size; diff --git a/subprojects/packagefiles/openal-soft-mkxp-threads.patch b/subprojects/packagefiles/openal-soft-mkxp-threads.patch index 6b5e62c8..efc3edc5 100644 --- a/subprojects/packagefiles/openal-soft-mkxp-threads.patch +++ b/subprojects/packagefiles/openal-soft-mkxp-threads.patch @@ -128,6 +128,17 @@ /************************************************ +--- a/alc/alconfig.cpp ++++ b/alc/alconfig.cpp +@@ -37,7 +37,7 @@ + #include + #include + #include +-#include ++#include "../../src/mkxp-threads.h" + #include + #include + #include --- a/alc/backends/alsa.cpp +++ b/alc/backends/alsa.cpp @@ -30,7 +30,7 @@ @@ -238,6 +249,17 @@ #include #include +--- a/common/alassert.cpp ++++ b/common/alassert.cpp +@@ -2,7 +2,7 @@ + #include "alassert.h" + + #include +-#include ++#include "../../src/mkxp-threads.h" + + namespace { + --- a/common/alsem.cpp +++ b/common/alsem.cpp @@ -55,8 +55,6 @@ void semaphore::post() @@ -403,13 +425,16 @@ } -#ifdef _WIN32 -+#if false ++/* DWORD mTss{TLS_OUT_OF_INDEXES}; public: -@@ -107,29 +107,30 @@ public: +@@ -105,32 +105,33 @@ public: + [[nodiscard]] + auto get() const noexcept -> T { return from_ptr(pthread_getspecific(mTss)); } - #else +-#else ++*/ - tss_t mTss{}; + void **mTss; @@ -442,10 +467,12 @@ [[nodiscard]] - auto get() const noexcept -> T { return from_ptr(tss_get(mTss)); } +-#endif /* _WIN32 */ + auto get() const noexcept -> T { return from_ptr(*mTss); } - #endif /* _WIN32 */ ++ tss(const tss&) = delete; + tss(tss&&) = delete; --- a/core/context.h +++ b/core/context.h @@ -140,7 +140,7 @@ struct ContextBase { @@ -457,6 +484,17 @@ al::semaphore mEventSem; std::unique_ptr mAsyncEvents; using AsyncEventBitset = std::bitset; +--- a/core/converter.cpp ++++ b/core/converter.cpp +@@ -5,7 +5,7 @@ + + #include + #include +-#include ++#include "../../src/mkxp-threads.h" + #include + #include + #include --- a/core/dbus_wrap.cpp +++ b/core/dbus_wrap.cpp @@ -5,7 +5,7 @@ @@ -512,6 +550,17 @@ #include #include #include +--- a/core/mastering.cpp ++++ b/core/mastering.cpp +@@ -4,7 +4,7 @@ + #include "mastering.h" + + #include +-#include ++#include "../../src/mkxp-threads.h" + #include + #include + #include --- a/examples/alffplay.cpp +++ b/examples/alffplay.cpp @@ -20,7 +20,7 @@ diff --git a/subprojects/packagefiles/openal-soft-ps3.patch b/subprojects/packagefiles/openal-soft-ps3.patch index cb97303c..00e4d2cf 100644 --- a/subprojects/packagefiles/openal-soft-ps3.patch +++ b/subprojects/packagefiles/openal-soft-ps3.patch @@ -22,3 +22,14 @@ / float{EARLY_LINE_LENGTHS.size()} * density_mult; Coeff = CalcDecayCoeff(length, decayTime); +--- a/common/albit.h ++++ b/common/albit.h +@@ -30,7 +30,7 @@ template + std::enable_if_t, + T> byteswap(T value) noexcept + { +- static_assert(std::has_unique_object_representations_v); ++ static_assert(std::has_unique_object_representations::value); + auto bytes = al::bit_cast>(value); + std::reverse(bytes.begin(), bytes.end()); + return al::bit_cast(bytes);