diff --git a/.github/workflows/autobuild.yml b/.github/workflows/autobuild.yml index b2f42162..9abd21d0 100644 --- a/.github/workflows/autobuild.yml +++ b/.github/workflows/autobuild.yml @@ -345,34 +345,6 @@ jobs: name: stage1.${{ github.event_name == 'pull_request' && format('PR{0}', github.event.number) || github.ref_name }}-${{ steps.short-sha.outputs.sha }} path: libretro/build/libretro-stage1 - wiiurpxtool: - name: wiiurpxtool - runs-on: ubuntu-latest - container: alpine:latest - steps: - - name: Install dependencies - run: | - apk update - apk add build-base git zlib-dev zlib-static cmake ninja - - - name: Build wiiurpxtool - run: | - git clone https://github.com/yawut/wiiurpxtool-ng - cd wiiurpxtool-ng - git checkout 682cc9f587dee507b400a307f5a0787efc5dcb72 - git submodule update --init --recursive - mv /usr/lib/libz.so /usr/lib/libz.so.backup - LDFLAGS='-static' cmake -G Ninja . - ninja -v - mv /usr/lib/libz.so.backup /usr/lib/libz.so - mv wiiurpxtool-ng wiiurpxtool - - - name: Upload artifact - uses: actions/upload-artifact@v4 - with: - name: wiiurpxtool - path: wiiurpxtool-ng/wiiurpxtool - build-libretro-windows: needs: build-libretro-stage1 name: LR Windows @@ -1136,15 +1108,11 @@ jobs: path: ~/dist build-libretro-wiiu: - needs: - - build-libretro-stage1 - - wiiurpxtool + needs: build-libretro-stage1 name: LR Wii U runs-on: ubuntu-latest container: - # We're supposed to use libretro-build-wiiu, but that currently has a really old version of devkitPPC that doesn't support C++17, so it can't compile OpenAL Soft. - # The libretro-build-devkitpro image that we're using here instead currently has a newer version of devkitPPC but lacks wiiurpxtool, which is why we need to separately install wiiurpxtool. - image: git.libretro.com:5050/libretro-infrastructure/libretro-build-devkitpro:latest + image: git.libretro.com:5050/libretro-infrastructure/libretro-build-wiiu:latest options: -u root volumes: - /tmp:/__e/node20 @@ -1174,24 +1142,6 @@ jobs: name: stage1.${{ github.event_name == 'pull_request' && format('PR{0}', github.event.number) || github.ref_name }}-${{ steps.short-sha.outputs.sha }} path: libretro/build/libretro-stage1 - - name: Download wiiurpxtool - uses: actions/download-artifact@v4 - with: - name: wiiurpxtool - path: '~' - - - name: Install wiiurpxtool - run: | - if command -v wiiurpxtool - then - echo 'wiiurpxtool already installed' - else - mv ~/wiiurpxtool /usr/local/bin - chmod +x /usr/local/bin/wiiurpxtool - echo 'wiiurpxtool successfully installed' - fi - wiiurpxtool - - name: Configure core run: | echo "[binaries]" | tee -a ~/cross.ini diff --git a/meson.build b/meson.build index 425f5eae..9eb49ada 100644 --- a/meson.build +++ b/meson.build @@ -153,14 +153,38 @@ if is_libretro libretro_defines += '-DBOOST_NO_EXCEPTIONS' endif + if not compilers['cpp'].has_header_symbol('stdio.h', 'sprintf') + libretro_defines += '-DMKXPZ_NO_SPRINTF' + 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', 'vsprintf') + libretro_defines += '-DMKXPZ_NO_VSPRINTF' + endif + if not compilers['cpp'].has_header_symbol('stdio.h', 'vsnprintf') libretro_defines += '-DMKXPZ_NO_VSNPRINTF' endif + if not compilers['cpp'].has_header_symbol('cstdio', 'std::sprintf') + libretro_defines += '-DMKXPZ_NO_STD_SPRINTF' + endif + + if not compilers['cpp'].has_header_symbol('cstdio', 'std::snprintf') + libretro_defines += '-DMKXPZ_NO_STD_SNPRINTF' + endif + + if not compilers['cpp'].has_header_symbol('cstdio', 'std::vsprintf') + libretro_defines += '-DMKXPZ_NO_STD_VSPRINTF' + endif + + if not compilers['cpp'].has_header_symbol('cstdio', 'std::vsnprintf') + libretro_defines += '-DMKXPZ_NO_STD_VSNPRINTF' + endif + if not compilers['cpp'].has_header_symbol('cmath', 'std::round') libretro_defines += '-DMKXPZ_NO_STD_ROUND' endif @@ -551,7 +575,6 @@ if is_libretro cmake.subproject(host_system == 'darwin' ? 'zlib-darwin' : 'zlib', options: zlib_options).dependency('zlibstatic'), cmake.subproject('physfs', options: physfs_options).dependency('physfs-static'), cmake.subproject('openal-soft', options: openal_options).dependency('OpenAL'), - cmake.subproject('openal-soft', options: openal_options).dependency('alsoft.fmt'), cmake.subproject('fluidsynth', options: fluidsynth_options).dependency('libfluidsynth'), cmake.subproject('ogg', options: ogg_options).dependency('ogg'), cmake.subproject('vorbis', options: vorbis_options).dependency('vorbis'), @@ -659,6 +682,7 @@ if is_libretro 'src/mkxp-polyfill.cpp', 'src/sharedstate.cpp', 'src/stb_image.cpp', + 'src/stb_snprintf.cpp', 'src/audio/alstream.cpp', 'src/audio/audio.cpp', 'src/audio/audiostream.cpp', diff --git a/src/audio/alstream.cpp b/src/audio/alstream.cpp index d7295d8d..10600903 100644 --- a/src/audio/alstream.cpp +++ b/src/audio/alstream.cpp @@ -21,6 +21,8 @@ #include "alstream.h" +#include "mkxp-polyfill.h" // snprintf + #include "sharedstate.h" #include "sharedmidistate.h" #include "eventthread.h" @@ -298,15 +300,11 @@ 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/soundemitter.cpp b/src/audio/soundemitter.cpp index ba7d28c1..67c187ad 100644 --- a/src/audio/soundemitter.cpp +++ b/src/audio/soundemitter.cpp @@ -21,6 +21,8 @@ #include "soundemitter.h" +#include "mkxp-polyfill.h" // snprintf + #include "sharedstate.h" #include "filesystem.h" #include "exception.h" @@ -304,14 +306,19 @@ SoundBuffer *SoundEmitter::allocateBuffer(const std::string &filename) if (!buffer) { -#ifdef MKXPZ_RETRO - mkxp_retro::log_printf(RETRO_LOG_WARN, "Unable to decode sound: %s: %s\n", filename.c_str(), sf_error_number(handler.errnum)); -#else char buf[512]; - snprintf(buf, sizeof(buf), "Unable to decode sound: %s: %s", filename.c_str(), Sound_GetError()); - Debug() << buf; + snprintf( + buf, + sizeof(buf), + "Unable to decode sound: %s: %s", + filename.c_str(), +#ifdef MKXPZ_RETRO + sf_error_number(handler.errnum) +#else + Sound_GetError() #endif // MKXPZ_RETRO - + ); + Debug() << buf; return 0; } diff --git a/src/core.cpp b/src/core.cpp index d45e2a03..53747200 100644 --- a/src/core.cpp +++ b/src/core.cpp @@ -24,10 +24,8 @@ #include #include #include -#ifdef MKXPZ_HAVE_ALIGNED_MALLOC -# include -#endif #include +#include "mkxp-polyfill.h" #include #include #include @@ -59,27 +57,6 @@ namespace mkxp_retro { } } -static inline void *malloc_align(size_t alignment, size_t size) { -#if defined(MKXPZ_HAVE_POSIX_MEMALIGN) || defined(MKXPZ_BUILD_XCODE) - void *mem; - return posix_memalign(&mem, alignment, size) ? NULL : mem; -#elif defined(MKXPZ_HAVE_ALIGNED_MALLOC) - return _aligned_malloc(size, alignment); -#elif defined(MKXPZ_HAVE_ALIGNED_ALLOC) - return aligned_alloc(alignment, size); -#else - return std::malloc(size); -#endif -} - -static inline void free_align(void *ptr) { -#if defined(MKXPZ_HAVE_ALIGNED_MALLOC) - _aligned_free(ptr); -#else - std::free(ptr); -#endif -} - extern const uint8_t mkxp_retro_dist_zip[]; extern const size_t mkxp_retro_dist_zip_len; @@ -336,11 +313,11 @@ extern "C" RETRO_API void retro_set_input_state(retro_input_state_t cb) { extern "C" RETRO_API void retro_init() { initialized = true; frame_buf = (uint32_t *)std::calloc(640 * 480, sizeof *frame_buf); - sound_buf = (int16_t *)malloc_align(16, 735 * 2 * sizeof *sound_buf); + sound_buf = (int16_t *)mkxp_aligned_malloc(16, 735 * 2 * sizeof *sound_buf); } extern "C" RETRO_API void retro_deinit() { - free_align(sound_buf); + mkxp_aligned_free(sound_buf); std::free(frame_buf); initialized = false; } diff --git a/src/filesystem/filesystem.cpp b/src/filesystem/filesystem.cpp index f712081e..d379a37a 100644 --- a/src/filesystem/filesystem.cpp +++ b/src/filesystem/filesystem.cpp @@ -21,6 +21,8 @@ #include "filesystem.h" +#include "mkxp-polyfill.h" // snprintf + #include "util/boost-hash.h" #include "util/debugwriter.h" #include "util/exception.h" @@ -422,13 +424,10 @@ static PHYSFS_EnumerateCallbackResult cacheEnumCB(void *d, const char *origdir, CacheEnumData &data = *static_cast(d); char fullPath[512]; - 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)); - } + if (!*origdir) + snprintf(fullPath, sizeof(fullPath), "%s", fname); + else + snprintf(fullPath, sizeof(fullPath), "%s/%s", origdir, fname); /* Deal with OSX' weird UTF-8 standards */ data.toNFC(fullPath); @@ -510,9 +509,7 @@ static PHYSFS_EnumerateCallbackResult fontSetEnumCB(void *data, const char *dir, return PHYSFS_ENUM_OK; char filename[512]; - 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)); + snprintf(filename, sizeof(filename), "%s/%s", dir, fname); PHYSFS_File *handle = PHYSFS_openRead(filename); @@ -605,9 +602,7 @@ openReadEnumCB(void *d, const char *dirpath, const char *filename) { if (!*dirpath) { fullPath = filename; } else { - 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)); + snprintf(buffer, sizeof(buffer), "%s/%s", dirpath, filename); fullPath = buffer; } diff --git a/src/mkxp-polyfill.cpp b/src/mkxp-polyfill.cpp index 1f619cd3..f2e79b7c 100644 --- a/src/mkxp-polyfill.cpp +++ b/src/mkxp-polyfill.cpp @@ -21,6 +21,64 @@ #include "mkxp-polyfill.h" #include +#include + +#ifdef MKXPZ_HAVE_ALIGNED_MALLOC +# include +#endif + +#ifdef MKXPZ_NO_SPRINTF +extern "C" int sprintf(char *buffer, const char *format, ...) { + va_list vlist; + va_start(vlist, format); + int result = stbsp_vsprintf(buffer, buf_size, format, vlist); + va_end(vlist); + return result; +} +#endif + +#ifdef MKXPZ_NO_SNPRINTF +extern "C" int snprintf(char *buffer, size_t buf_size, const char *format, ...) { + va_list vlist; + va_start(vlist, format); + int result = stbsp_vsnprintf(buffer, buf_size, format, vlist); + va_end(vlist); + return result; +} +#endif + +#ifdef MKXPZ_NO_VSPRINTF +extern "C" int vsprintf(char *buffer, const char *format, va_list vlist) { + return stbsp_vsprintf(buffer, buf_size, format, vlist); +} +#endif + +#ifdef MKXPZ_NO_VSNPRINTF +extern "C" int vsnprintf(char *buffer, size_t buf_size, const char *format, va_list vlist) { + return stbsp_vsnprintf(buffer, buf_size, format, vlist); +} +#endif + +extern "C" void *mkxp_aligned_malloc(size_t alignment, size_t size) { +#if defined(MKXPZ_HAVE_POSIX_MEMALIGN) || defined(MKXPZ_BUILD_XCODE) + void *mem; + return posix_memalign(&mem, alignment, size) ? NULL : mem; +#elif defined(MKXPZ_HAVE_ALIGNED_MALLOC) + return _aligned_malloc(size, alignment); +#elif defined(MKXPZ_HAVE_ALIGNED_ALLOC) + return aligned_alloc(alignment, size); +#else + return std::malloc(size); +#endif +} + +extern "C" void mkxp_aligned_free(void *ptr) { +#if defined(MKXPZ_HAVE_ALIGNED_MALLOC) + _aligned_free(ptr); +#else + std::free(ptr); +#endif +} #if defined(MKXPZ_NO_SEMAPHORE_H) && !defined(MKXPZ_NO_PTHREAD_H) struct mkxp_sem_private { diff --git a/src/mkxp-polyfill.h b/src/mkxp-polyfill.h index fe92bfa4..641c3cf7 100644 --- a/src/mkxp-polyfill.h +++ b/src/mkxp-polyfill.h @@ -24,6 +24,7 @@ #include #include +#include #include #include @@ -67,6 +68,30 @@ typedef void *mkxp_sem_t; typedef unsigned int mkxp_sem_t; #endif +#if defined(MKXPZ_HAVE_POSIX_MEMALIGN) || defined(MKXPZ_HAVE_ALIGNED_MALLOC) || defined(MKXPZ_HAVE_ALIGNED_ALLOC) || defined(MKXPZ_BUILD_XCODE) +# define MKXPZ_HAVE_ANY_ALIGNED_MALLOC 1 +#endif + +#ifdef MKXPZ_NO_SPRINTF +int sprintf(char *buffer, const char *format, ...); +#endif + +#ifdef MKXPZ_NO_SNPRINTF +int snprintf(char *buffer, size_t buf_size, const char *format, ...); +#endif + +#ifdef MKXPZ_NO_VSPRINTF +int vsprintf(char *buffer, const char *format, va_list vlist); +#endif + +#ifdef MKXPZ_NO_VSNPRINTF +int vsnprintf(char *buffer, size_t buf_size, const char *format, va_list vlist); +#endif + +void *mkxp_aligned_malloc(size_t alignment, size_t size); + +void mkxp_aligned_free(void *ptr); + mkxp_thread_t mkxp_thread_self(void); int mkxp_mutex_init(mkxp_mutex_t *mutex, bool recursive); @@ -209,6 +234,46 @@ namespace std { } # endif +# ifdef MKXPZ_NO_STD_SPRINTF +namespace std { + inline int sprintf(char *buffer, const char *format, ...) { + va_list vlist; + va_start(vlist, format); + int result = vsprintf(buffer, buf_size, format, vlist); + va_end(vlist); + return result; + } +} +# endif + +# ifdef MKXPZ_NO_STD_SNPRINTF +namespace std { + inline int snprintf(char *buffer, size_t buf_size, const char *format, ...) { + va_list vlist; + va_start(vlist, format); + int result = vsnprintf(buffer, buf_size, format, vlist); + va_end(vlist); + return result; + } +} +# endif + +# ifdef MKXPZ_NO_STD_VSPRINTF +namespace std { + inline int vsprintf(char *buffer, const char *format, va_list vlist) { + return vsprintf(buffer, buf_size, format, vlist); + } +} +# endif + +# ifdef MKXPZ_NO_STD_VSNPRINTF +namespace std { + inline int vsnprintf(char *buffer, size_t buf_size, const char *format, va_list vlist) { + return vsnprintf(buffer, buf_size, format, vlist); + } +} +# endif + # ifdef MKXPZ_NO_STD_ROUND namespace std { inline constexpr float round(float x) { diff --git a/src/stb_snprintf.cpp b/src/stb_snprintf.cpp new file mode 100644 index 00000000..70005c2f --- /dev/null +++ b/src/stb_snprintf.cpp @@ -0,0 +1,2 @@ +#define STB_SPRINTF_IMPLEMENTATION +#include diff --git a/src/util/exception.h b/src/util/exception.h index f0637bbd..c3757520 100644 --- a/src/util/exception.h +++ b/src/util/exception.h @@ -25,6 +25,7 @@ #include #include #include +#include "mkxp-polyfill.h" // vsnprintf struct Exception { @@ -53,7 +54,6 @@ struct Exception Exception(Type type, const char *format, ...) : type(type) { -#ifndef MKXPZ_NO_VSNPRINTF va_list ap; va_start(ap, format); @@ -61,7 +61,6 @@ struct Exception vsnprintf(&msg[0], msg.size(), format, ap); va_end(ap); -#endif } }; diff --git a/subprojects/openal-soft.wrap b/subprojects/openal-soft.wrap index ef290404..2af468d8 100644 --- a/subprojects/openal-soft.wrap +++ b/subprojects/openal-soft.wrap @@ -1,5 +1,5 @@ [wrap-git] url = https://github.com/kcat/openal-soft -revision = 1.24.2 +revision = 1.23.1 depth = 1 -diff_files = openal-soft-android-log.patch, openal-soft-atomic.patch, openal-soft-buildtype.patch, openal-soft-c11.patch, openal-soft-constexpr.patch, openal-soft-emscripten-pthread.patch, openal-soft-emscripten-setschedparam.patch, openal-soft-emscripten-symbol-conflict.patch, openal-soft-event-thread.patch, openal-soft-filesystem.patch, openal-soft-flockfile.patch, openal-soft-int32.patch, openal-soft-mkxp-polyfill.patch, openal-soft-null.patch, openal-soft-pic.patch, openal-soft-ps3.patch +diff_files = openal-soft-android-log.patch, openal-soft-buildtype.patch, openal-soft-config.patch, openal-soft-emscripten-pthread.patch, openal-soft-emscripten-symbol-conflict.patch, openal-soft-event-thread.patch, openal-soft-int32.patch, openal-soft-mkxp-polyfill.patch, openal-soft-null.patch, openal-soft-pic.patch, openal-soft-setschedparam.patch diff --git a/subprojects/packagefiles/openal-soft-android-log.patch b/subprojects/packagefiles/openal-soft-android-log.patch index ebd47fb0..48589e0e 100644 --- a/subprojects/packagefiles/openal-soft-android-log.patch +++ b/subprojects/packagefiles/openal-soft-android-log.patch @@ -2,10 +2,10 @@ --- a/core/logging.cpp +++ b/core/logging.cpp -@@ -103,23 +103,6 @@ void al_print_impl(LogLevel level, const fmt::string_view fmt, fmt::format_args - * non-Release builds. +@@ -70,20 +70,20 @@ void al_print(LogLevel level, FILE *logfile, const char *fmt, ...) */ - OutputDebugStringW(utf8_to_wstr(fmt::format("{}{}\n", prefix, msg)).c_str()); + std::wstring wstr{utf8_to_wstr(str)}; + OutputDebugStringW(wstr.c_str()); -#elif defined(__ANDROID__) - auto android_severity = [](LogLevel l) noexcept - { @@ -20,9 +20,21 @@ - } - return ANDROID_LOG_ERROR; - }; -- /* NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg) */ -- __android_log_print(android_severity(level), "openal", "%.*s%s", al::sizei(prefix), -- prefix.data(), msg.c_str()); +- __android_log_print(android_severity(level), "openal", "%s", str); ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ #endif - - auto cblock = std::lock_guard{LogCallbackMutex}; + } diff --git a/subprojects/packagefiles/openal-soft-atomic.patch b/subprojects/packagefiles/openal-soft-atomic.patch deleted file mode 100644 index 355cf9c7..00000000 --- a/subprojects/packagefiles/openal-soft-atomic.patch +++ /dev/null @@ -1,36 +0,0 @@ -# Prevents OpenAL Soft from trying to check if atomic types are lock-free since it causes compilation errors when cross building for Alpine Linux. (But why does it cause compilation errors ???) -# Besides, who cares if the atomic types are lock-free or not? The one platform where something like this could matter, Emscripten, does have all the atomic types that OpenAL Soft uses as lock-free, so it doesn't really matter. - ---- a/common/atomic.h -+++ b/common/atomic.h -@@ -94,9 +94,9 @@ public: - { return unique_ptr_t{mPointer.exchange(ptr.release(), m)}; } - - [[nodiscard]] -- auto is_lock_free() const noexcept -> bool { return mPointer.is_lock_free(); } -+ auto is_lock_free() const noexcept -> bool { return true; } - -- static constexpr auto is_always_lock_free = std::atomic>::is_always_lock_free; -+ static constexpr auto is_always_lock_free = true; - }; - - } // namespace al ---- a/core/context.cpp -+++ b/core/context.cpp -@@ -18,12 +18,12 @@ - #include "voice_change.h" - - --#ifdef __cpp_lib_atomic_is_always_lock_free --static_assert(std::atomic::is_always_lock_free, "atomic isn't lock-free"); --#endif -+ -+ -+ - - ContextBase::ContextBase(DeviceBase *device) : mDevice{device} --{ assert(mEnabledEvts.is_lock_free()); } -+{ } - - ContextBase::~ContextBase() - { diff --git a/subprojects/packagefiles/openal-soft-c11.patch b/subprojects/packagefiles/openal-soft-c11.patch deleted file mode 100644 index 2f8472b4..00000000 --- a/subprojects/packagefiles/openal-soft-c11.patch +++ /dev/null @@ -1,15 +0,0 @@ -# Sets the C standard to C11 instead of C17 since Emscripten doesn't support C17. - ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -79,8 +79,8 @@ set(ALSOFT_STD_VERSION_PROPS - # Require C++17. - CXX_STANDARD 17 - CXX_STANDARD_REQUIRED TRUE -- # Prefer C17, but support earlier when necessary. -- C_STANDARD 17) -+ -+ C_STANDARD 11) - - set(CMAKE_MODULE_PATH "${OpenAL_SOURCE_DIR}/cmake") - diff --git a/subprojects/packagefiles/openal-soft-config.patch b/subprojects/packagefiles/openal-soft-config.patch new file mode 100644 index 00000000..a5731c0f --- /dev/null +++ b/subprojects/packagefiles/openal-soft-config.patch @@ -0,0 +1,295 @@ +# Prevents OpenAL Soft from loading from its config file. + +--- a/alc/alconfig.cpp ++++ b/alc/alconfig.cpp +@@ -329,157 +329,157 @@ const char *GetConfigValue(const char *devName, const char *blockName, const cha + #ifdef _WIN32 + void ReadALConfig() + { +- WCHAR buffer[MAX_PATH]; +- if(SHGetSpecialFolderPathW(nullptr, buffer, CSIDL_APPDATA, FALSE) != FALSE) +- { +- std::string filepath{wstr_to_utf8(buffer)}; +- filepath += "\\alsoft.ini"; + +- TRACE("Loading config %s...\n", filepath.c_str()); +- al::ifstream f{filepath}; +- if(f.is_open()) +- LoadConfigFromFile(f); +- } + +- std::string ppath{GetProcBinary().path}; +- if(!ppath.empty()) +- { +- ppath += "\\alsoft.ini"; +- TRACE("Loading config %s...\n", ppath.c_str()); +- al::ifstream f{ppath}; +- if(f.is_open()) +- LoadConfigFromFile(f); +- } + +- if(auto confpath = al::getenv(L"ALSOFT_CONF")) +- { +- TRACE("Loading config %s...\n", wstr_to_utf8(confpath->c_str()).c_str()); +- al::ifstream f{*confpath}; +- if(f.is_open()) +- LoadConfigFromFile(f); +- } ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ + } + + #else + + void ReadALConfig() + { +- const char *str{"/etc/openal/alsoft.conf"}; +- +- TRACE("Loading config %s...\n", str); +- al::ifstream f{str}; +- if(f.is_open()) +- LoadConfigFromFile(f); +- f.close(); +- +- std::string confpaths{al::getenv("XDG_CONFIG_DIRS").value_or("/etc/xdg")}; +- /* Go through the list in reverse, since "the order of base directories +- * denotes their importance; the first directory listed is the most +- * important". Ergo, we need to load the settings from the later dirs +- * first so that the settings in the earlier dirs override them. +- */ +- std::string fname; +- while(!confpaths.empty()) +- { +- auto next = confpaths.find_last_of(':'); +- if(next < confpaths.length()) +- { +- fname = confpaths.substr(next+1); +- confpaths.erase(next); +- } +- else +- { +- fname = confpaths; +- confpaths.clear(); +- } + +- if(fname.empty() || fname.front() != '/') +- WARN("Ignoring XDG config dir: %s\n", fname.c_str()); +- else +- { +- if(fname.back() != '/') fname += "/alsoft.conf"; +- else fname += "alsoft.conf"; + +- TRACE("Loading config %s...\n", fname.c_str()); +- f = al::ifstream{fname}; +- if(f.is_open()) +- LoadConfigFromFile(f); +- } +- fname.clear(); +- } + +-#ifdef __APPLE__ +- CFBundleRef mainBundle = CFBundleGetMainBundle(); +- if(mainBundle) +- { +- unsigned char fileName[PATH_MAX]; +- CFURLRef configURL; + +- if((configURL=CFBundleCopyResourceURL(mainBundle, CFSTR(".alsoftrc"), CFSTR(""), nullptr)) && +- CFURLGetFileSystemRepresentation(configURL, true, fileName, sizeof(fileName))) +- { +- f = al::ifstream{reinterpret_cast(fileName)}; +- if(f.is_open()) +- LoadConfigFromFile(f); +- } +- } +-#endif + +- if(auto homedir = al::getenv("HOME")) +- { +- fname = *homedir; +- if(fname.back() != '/') fname += "/.alsoftrc"; +- else fname += ".alsoftrc"; +- +- TRACE("Loading config %s...\n", fname.c_str()); +- f = al::ifstream{fname}; +- if(f.is_open()) +- LoadConfigFromFile(f); +- } + +- if(auto configdir = al::getenv("XDG_CONFIG_HOME")) +- { +- fname = *configdir; +- if(fname.back() != '/') fname += "/alsoft.conf"; +- else fname += "alsoft.conf"; +- } +- else +- { +- fname.clear(); +- if(auto homedir = al::getenv("HOME")) +- { +- fname = *homedir; +- if(fname.back() != '/') fname += "/.config/alsoft.conf"; +- else fname += ".config/alsoft.conf"; +- } +- } +- if(!fname.empty()) +- { +- TRACE("Loading config %s...\n", fname.c_str()); +- f = al::ifstream{fname}; +- if(f.is_open()) +- LoadConfigFromFile(f); +- } + +- std::string ppath{GetProcBinary().path}; +- if(!ppath.empty()) +- { +- if(ppath.back() != '/') ppath += "/alsoft.conf"; +- else ppath += "alsoft.conf"; + +- TRACE("Loading config %s...\n", ppath.c_str()); +- f = al::ifstream{ppath}; +- if(f.is_open()) +- LoadConfigFromFile(f); +- } + +- if(auto confname = al::getenv("ALSOFT_CONF")) +- { +- TRACE("Loading config %s...\n", confname->c_str()); +- f = al::ifstream{*confname}; +- if(f.is_open()) +- LoadConfigFromFile(f); +- } ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ + } + #endif + diff --git a/subprojects/packagefiles/openal-soft-constexpr.patch b/subprojects/packagefiles/openal-soft-constexpr.patch deleted file mode 100644 index 58291e9f..00000000 --- a/subprojects/packagefiles/openal-soft-constexpr.patch +++ /dev/null @@ -1,193 +0,0 @@ -# Removes all exception throwing and logging inside of functions marked `constexpr` since old versions of GCC don't support it. -# When building for PlayStation 3, we use an old enough version of GCC for this to be a problem. - ---- a/al/auxeffectslot.cpp -+++ b/al/auxeffectslot.cpp -@@ -243,7 +243,7 @@ constexpr auto EffectSlotTypeFromEnum(ALenum type) noexcept -> EffectSlotType - case AL_EFFECT_DEDICATED_DIALOGUE: return EffectSlotType::Dedicated; - case AL_EFFECT_CONVOLUTION_SOFT: return EffectSlotType::Convolution; - } -- ERR("Unhandled effect enum: {:#04x}", as_unsigned(type)); -+ - return EffectSlotType::None; - } - ---- a/al/buffer.cpp -+++ b/al/buffer.cpp -@@ -88,8 +88,8 @@ constexpr auto EnumFromAmbiLayout(AmbiLayout layout) -> ALenum - case AmbiLayout::FuMa: return AL_FUMA_SOFT; - case AmbiLayout::ACN: return AL_ACN_SOFT; - } -- throw std::runtime_error{fmt::format("Invalid AmbiLayout: {}", -- int{al::to_underlying(layout)})}; -+ -+ abort(); - } - - constexpr auto AmbiScalingFromEnum(ALenum scale) noexcept -> std::optional -@@ -111,8 +111,8 @@ constexpr auto EnumFromAmbiScaling(AmbiScaling scale) -> ALenum - case AmbiScaling::N3D: return AL_N3D_SOFT; - case AmbiScaling::UHJ: break; - } -- throw std::runtime_error{fmt::format("Invalid AmbiScaling: {}", -- int{al::to_underlying(scale)})}; -+ -+ abort(); - } - - #if ALSOFT_EAX ---- a/al/debug.cpp -+++ b/al/debug.cpp -@@ -110,8 +110,8 @@ constexpr auto GetDebugSourceEnum(DebugSource source) -> ALenum - case DebugSource::Application: return AL_DEBUG_SOURCE_APPLICATION_EXT; - case DebugSource::Other: return AL_DEBUG_SOURCE_OTHER_EXT; - } -- throw std::runtime_error{fmt::format("Unexpected debug source value: {}", -- int{al::to_underlying(source)})}; -+ -+ abort(); - } - - constexpr auto GetDebugTypeEnum(DebugType type) -> ALenum -@@ -128,8 +128,8 @@ constexpr auto GetDebugTypeEnum(DebugType type) -> ALenum - case DebugType::PopGroup: return AL_DEBUG_TYPE_POP_GROUP_EXT; - case DebugType::Other: return AL_DEBUG_TYPE_OTHER_EXT; - } -- throw std::runtime_error{fmt::format("Unexpected debug type value: {}", -- int{al::to_underlying(type)})}; -+ -+ abort(); - } - - constexpr auto GetDebugSeverityEnum(DebugSeverity severity) -> ALenum -@@ -141,8 +141,8 @@ constexpr auto GetDebugSeverityEnum(DebugSeverity severity) -> ALenum - case DebugSeverity::Low: return AL_DEBUG_SEVERITY_LOW_EXT; - case DebugSeverity::Notification: return AL_DEBUG_SEVERITY_NOTIFICATION_EXT; - } -- throw std::runtime_error{fmt::format("Unexpected debug severity value: {}", -- int{al::to_underlying(severity)})}; -+ -+ abort(); - } - - ---- a/al/effects/chorus.cpp -+++ b/al/effects/chorus.cpp -@@ -43,8 +43,8 @@ constexpr ALenum EnumFromWaveform(ChorusWaveform type) - case ChorusWaveform::Sinusoid: return AL_CHORUS_WAVEFORM_SINUSOID; - case ChorusWaveform::Triangle: return AL_CHORUS_WAVEFORM_TRIANGLE; - } -- throw std::runtime_error{fmt::format("Invalid chorus waveform: {}", -- int{al::to_underlying(type)})}; -+ -+ abort(); - } - - constexpr EffectProps genDefaultChorusProps() noexcept ---- a/al/effects/fshifter.cpp -+++ b/al/effects/fshifter.cpp -@@ -40,7 +40,7 @@ constexpr ALenum EnumFromDirection(FShifterDirection dir) - case FShifterDirection::Up: return AL_FREQUENCY_SHIFTER_DIRECTION_UP; - case FShifterDirection::Off: return AL_FREQUENCY_SHIFTER_DIRECTION_OFF; - } -- throw std::runtime_error{fmt::format("Invalid direction: {}", int{al::to_underlying(dir)})}; -+ abort(); - } - - constexpr EffectProps genDefaultProps() noexcept ---- a/al/effects/modulator.cpp -+++ b/al/effects/modulator.cpp -@@ -40,8 +40,8 @@ constexpr ALenum EnumFromWaveform(ModulatorWaveform type) - case ModulatorWaveform::Sawtooth: return AL_RING_MODULATOR_SAWTOOTH; - case ModulatorWaveform::Square: return AL_RING_MODULATOR_SQUARE; - } -- throw std::runtime_error{fmt::format("Invalid modulator waveform: {}", -- int{al::to_underlying(type)})}; -+ -+ abort(); - } - - constexpr EffectProps genDefaultProps() noexcept ---- a/al/effects/vmorpher.cpp -+++ b/al/effects/vmorpher.cpp -@@ -97,7 +97,7 @@ constexpr ALenum EnumFromPhenome(VMorpherPhenome phenome) - HANDLE_PHENOME(V); - HANDLE_PHENOME(Z); - } -- throw std::runtime_error{fmt::format("Invalid phenome: {}", int{al::to_underlying(phenome)})}; -+ abort(); - #undef HANDLE_PHENOME - } - -@@ -119,8 +119,8 @@ constexpr ALenum EnumFromWaveform(VMorpherWaveform type) - case VMorpherWaveform::Triangle: return AL_VOCAL_MORPHER_WAVEFORM_TRIANGLE; - case VMorpherWaveform::Sawtooth: return AL_VOCAL_MORPHER_WAVEFORM_SAWTOOTH; - } -- throw std::runtime_error{fmt::format("Invalid vocal morpher waveform: {}", -- int{al::to_underlying(type)})}; -+ -+ abort(); - } - - constexpr EffectProps genDefaultProps() noexcept ---- a/al/state.cpp -+++ b/al/state.cpp -@@ -141,7 +141,7 @@ constexpr auto ALenumFromDistanceModel(DistanceModel model) -> ALenum - case DistanceModel::Exponent: return AL_EXPONENT_DISTANCE; - case DistanceModel::ExponentClamped: return AL_EXPONENT_DISTANCE_CLAMPED; - } -- throw std::runtime_error{"Unexpected distance model "+std::to_string(static_cast(model))}; -+ abort(); - } - - 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-emscripten-pthread.patch b/subprojects/packagefiles/openal-soft-emscripten-pthread.patch index dcebe760..d8388160 100644 --- a/subprojects/packagefiles/openal-soft-emscripten-pthread.patch +++ b/subprojects/packagefiles/openal-soft-emscripten-pthread.patch @@ -2,7 +2,7 @@ --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -561,7 +561,10 @@ if(NOT WIN32) +@@ -558,7 +558,10 @@ if(NOT WIN32) message(FATAL_ERROR "PThreads is required for non-Windows builds!") endif() diff --git a/subprojects/packagefiles/openal-soft-emscripten-setschedparam.patch b/subprojects/packagefiles/openal-soft-emscripten-setschedparam.patch deleted file mode 100644 index 4d8ed242..00000000 --- a/subprojects/packagefiles/openal-soft-emscripten-setschedparam.patch +++ /dev/null @@ -1,13 +0,0 @@ -# Stops OpenAL Soft from trying to get realtime priority on Emscripten because Emscripten doesn't support all the necessary APIs and this will result in compilation errors when targeting Emscripten. - ---- a/core/helpers.cpp -+++ b/core/helpers.cpp -@@ -368,7 +368,7 @@ namespace { - bool SetRTPriorityPthread(int prio [[maybe_unused]]) - { - int err{ENOTSUP}; --#if defined(HAVE_PTHREAD_SETSCHEDPARAM) && !defined(__OpenBSD__) -+#if defined(HAVE_PTHREAD_SETSCHEDPARAM) && !defined(__OpenBSD__) && !defined(__EMSCRIPTEN__) - /* Get the min and max priority for SCHED_RR. Limit the max priority to - * half, for now, to ensure the thread can't take the highest priority and - * go rogue. diff --git a/subprojects/packagefiles/openal-soft-emscripten-symbol-conflict.patch b/subprojects/packagefiles/openal-soft-emscripten-symbol-conflict.patch index f593b283..29564eeb 100644 --- a/subprojects/packagefiles/openal-soft-emscripten-symbol-conflict.patch +++ b/subprojects/packagefiles/openal-soft-emscripten-symbol-conflict.patch @@ -3,47 +3,47 @@ --- a/include/AL/al.h +++ b/include/AL/al.h -@@ -3,7 +3,7 @@ +@@ -2,7 +2,7 @@ + #define AL_AL_H - /* NOLINTBEGIN */ #ifdef __cplusplus -extern "C" { + + #endif - #ifdef _MSVC_LANG - #define AL_CPLUSPLUS _MSVC_LANG -@@ -700,7 +700,7 @@ typedef void (AL_APIENTRY *LPALSPEEDOFSOUND)(ALfloat value) AL_API_NOEX - typedef void (AL_APIENTRY *LPALDISTANCEMODEL)(ALenum distanceModel) AL_API_NOEXCEPT17; + #ifndef AL_API +@@ -668,7 +668,7 @@ typedef void (AL_APIENTRY *LPALSPEEDOFSOUND)(ALfloat value); + typedef void (AL_APIENTRY *LPALDISTANCEMODEL)(ALenum distanceModel); #ifdef __cplusplus -} /* extern "C" */ + #endif - /* NOLINTEND */ + #endif /* AL_AL_H */ --- a/include/AL/alc.h +++ b/include/AL/alc.h -@@ -3,7 +3,7 @@ +@@ -2,7 +2,7 @@ + #define AL_ALC_H - /* NOLINTBEGIN */ #ifdef __cplusplus -extern "C" { + + #endif - #ifdef _MSVC_LANG - #define ALC_CPLUSPLUS _MSVC_LANG -@@ -300,7 +300,7 @@ typedef void (ALC_APIENTRY *LPALCCAPTURESTOP)(ALCdevice *device) ALC_A - typedef void (ALC_APIENTRY *LPALCCAPTURESAMPLES)(ALCdevice *device, ALCvoid *buffer, ALCsizei samples) ALC_API_NOEXCEPT17; + #ifndef ALC_API +@@ -268,7 +268,7 @@ typedef void (ALC_APIENTRY *LPALCCAPTURESTOP)(ALCdevice *device); + typedef void (ALC_APIENTRY *LPALCCAPTURESAMPLES)(ALCdevice *device, ALCvoid *buffer, ALCsizei samples); #ifdef __cplusplus -} /* extern "C" */ + #endif - /* NOLINTEND */ + #endif /* AL_ALC_H */ --- a/include/AL/alext.h +++ b/include/AL/alext.h -@@ -23,7 +23,7 @@ typedef uint64_t _alsoft_uint64_t; +@@ -22,7 +22,7 @@ typedef uint64_t _alsoft_uint64_t; #include "al.h" #ifdef __cplusplus @@ -51,19 +51,19 @@ + #endif - struct _GUID; -@@ -1085,7 +1085,7 @@ ALenum AL_APIENTRY EAXGetBufferModeDirect(ALCcontext *context, ALuint buffer, AL + #ifndef AL_LOKI_IMA_ADPCM_format +@@ -649,7 +649,7 @@ void AL_APIENTRY alSourcePlayAtTimevSOFT(ALsizei n, const ALuint *sources, ALint #endif #ifdef __cplusplus -} + #endif - /* NOLINTEND */ + #endif --- a/include/AL/efx.h +++ b/include/AL/efx.h -@@ -8,7 +8,7 @@ +@@ -7,7 +7,7 @@ #include "al.h" #ifdef __cplusplus @@ -72,12 +72,12 @@ #endif #define ALC_EXT_EFX_NAME "ALC_EXT_EFX" -@@ -757,7 +757,7 @@ AL_API void AL_APIENTRY alGetAuxiliaryEffectSlotfv(ALuint effectslot, ALenum par +@@ -756,7 +756,7 @@ AL_API void AL_APIENTRY alGetAuxiliaryEffectSlotfv(ALuint effectslot, ALenum par #ifdef __cplusplus -} /* extern "C" */ + #endif - /* NOLINTEND */ + #endif /* AL_EFX_H */ diff --git a/subprojects/packagefiles/openal-soft-event-thread.patch b/subprojects/packagefiles/openal-soft-event-thread.patch index 2d8dc4cf..afc8809b 100644 --- a/subprojects/packagefiles/openal-soft-event-thread.patch +++ b/subprojects/packagefiles/openal-soft-event-thread.patch @@ -2,7 +2,7 @@ --- a/al/event.cpp +++ b/al/event.cpp -@@ -149,34 +149,34 @@ constexpr std::optional GetEventType(ALenum etype) noexcept +@@ -116,34 +116,34 @@ static int EventThread(ALCcontext *context) void StartEventThrd(ALCcontext *ctx) { @@ -10,10 +10,10 @@ - ctx->mEventThread = std::thread{EventThread, ctx}; - } - catch(std::exception& e) { -- ERR("Failed to start event thread: {}", e.what()); +- ERR("Failed to start event thread: %s\n", e.what()); - } - catch(...) { -- ERR("Failed to start event thread! Expect problems."); +- ERR("Failed to start event thread! Expect problems.\n"); - } + + @@ -29,15 +29,15 @@ void StopEventThrd(ALCcontext *ctx) { - RingBuffer *ring{ctx->mAsyncEvents.get()}; -- auto evt_data = ring->getWriteVector()[0]; +- auto evt_data = ring->getWriteVector().first; - if(evt_data.len == 0) - { - do { - std::this_thread::yield(); -- evt_data = ring->getWriteVector()[0]; +- evt_data = ring->getWriteVector().first; - } while(evt_data.len == 0); - } -- std::ignore = InitAsyncEvent(evt_data.buf); +- al::construct_at(reinterpret_cast(evt_data.buf), AsyncEvent::KillThread); - ring->writeAdvance(1); - ctx->mEventSem.post(); @@ -59,4 +59,15 @@ + } - AL_API DECL_FUNCEXT3(void, alEventControl,SOFT, ALsizei,count, const ALenum*,types, ALboolean,enable) + AL_API void AL_APIENTRY alEventControlSOFT(ALsizei count, const ALenum *types, ALboolean enable) +--- a/core/context.h ++++ b/core/context.h +@@ -134,7 +134,7 @@ struct ContextBase { + using EffectSlotArray = al::FlexArray; + std::atomic mActiveAuxSlots{nullptr}; + +- std::thread mEventThread; ++ + al::semaphore mEventSem; + std::unique_ptr mAsyncEvents; + using AsyncEventBitset = std::bitset; diff --git a/subprojects/packagefiles/openal-soft-filesystem.patch b/subprojects/packagefiles/openal-soft-filesystem.patch deleted file mode 100644 index aacec028..00000000 --- a/subprojects/packagefiles/openal-soft-filesystem.patch +++ /dev/null @@ -1,627 +0,0 @@ -# Disables OpenAL Soft's dependency on both `ghc::filesystem` and `std::filesystem`. None of those work when building for PlayStation 3. -# As a side effect, also prevents OpenAL Soft from loading from its config file. - ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -610,7 +610,7 @@ set(COMMON_OBJS - common/comptr.h - common/dynload.cpp - common/dynload.h -- common/filesystem.cpp -+ - common/filesystem.h - common/flexarray.h - common/intrusive_ptr.h -@@ -673,7 +673,7 @@ set(CORE_OBJS - core/fpu_ctrl.cpp - core/fpu_ctrl.h - core/front_stablizer.h -- core/helpers.cpp -+ - core/helpers.h - core/hrtf.cpp - core/hrtf.h ---- a/alc/alconfig.cpp -+++ b/alc/alconfig.cpp -@@ -46,7 +46,7 @@ - #include "alstring.h" - #include "core/helpers.h" - #include "core/logging.h" --#include "filesystem.h" -+ - #include "strutils.h" - - #if ALSOFT_UWP -@@ -332,156 +332,156 @@ auto GetConfigValue(const std::string_view devName, const std::string_view block - #ifdef _WIN32 - void ReadALConfig() - { -- fs::path path; - --#if !defined(_GAMING_XBOX) -- { --#if !ALSOFT_UWP -- std::unique_ptr bufstore; -- const HRESULT hr{SHGetKnownFolderPath(FOLDERID_RoamingAppData, KF_FLAG_DONT_UNEXPAND, -- nullptr, al::out_ptr(bufstore))}; -- if(SUCCEEDED(hr)) -- { -- const std::wstring_view buffer{bufstore.get()}; --#else -- winrt::Windows::Storage::ApplicationDataContainer localSettings = winrt::Windows::Storage::ApplicationData::Current().LocalSettings(); -- auto bufstore = Windows::Storage::ApplicationData::Current().RoamingFolder().Path(); -- std::wstring_view buffer{bufstore}; -- { --#endif -- path = fs::path{buffer}; -- path /= L"alsoft.ini"; - -- TRACE("Loading config {}...", al::u8_as_char(path.u8string())); -- if(fs::ifstream f{path}; f.is_open()) -- LoadConfigFromFile(f); -- } -- } --#endif - -- path = fs::u8path(GetProcBinary().path); -- if(!path.empty()) -- { -- path /= L"alsoft.ini"; -- TRACE("Loading config {}...", al::u8_as_char(path.u8string())); -- if(fs::ifstream f{path}; f.is_open()) -- LoadConfigFromFile(f); -- } - -- if(auto confpath = al::getenv(L"ALSOFT_CONF")) -- { -- path = *confpath; -- TRACE("Loading config {}...", al::u8_as_char(path.u8string())); -- if(fs::ifstream f{path}; f.is_open()) -- LoadConfigFromFile(f); -- } -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ - } - - #else - - void ReadALConfig() - { -- fs::path path{"/etc/openal/alsoft.conf"}; -- -- TRACE("Loading config {}...", al::u8_as_char(path.u8string())); -- if(fs::ifstream f{path}; f.is_open()) -- LoadConfigFromFile(f); -- -- std::string confpaths{al::getenv("XDG_CONFIG_DIRS").value_or("/etc/xdg")}; -- /* Go through the list in reverse, since "the order of base directories -- * denotes their importance; the first directory listed is the most -- * important". Ergo, we need to load the settings from the later dirs -- * first so that the settings in the earlier dirs override them. -- */ -- while(!confpaths.empty()) -- { -- auto next = confpaths.rfind(':'); -- if(next < confpaths.length()) -- { -- path = fs::path{std::string_view{confpaths}.substr(next+1)}.lexically_normal(); -- confpaths.erase(next); -- } -- else -- { -- path = fs::path{confpaths}.lexically_normal(); -- confpaths.clear(); -- } - -- if(!path.is_absolute()) -- WARN("Ignoring XDG config dir: {}", al::u8_as_char(path.u8string())); -- else -- { -- path /= "alsoft.conf"; - -- TRACE("Loading config {}...", al::u8_as_char(path.u8string())); -- if(fs::ifstream f{path}; f.is_open()) -- LoadConfigFromFile(f); -- } -- } - --#ifdef __APPLE__ -- CFBundleRef mainBundle = CFBundleGetMainBundle(); -- if(mainBundle) -- { -- CFURLRef configURL{CFBundleCopyResourceURL(mainBundle, CFSTR(".alsoftrc"), CFSTR(""), -- nullptr)}; - -- std::array fileName{}; -- if(configURL && CFURLGetFileSystemRepresentation(configURL, true, fileName.data(), fileName.size())) -- { -- if(std::ifstream f{reinterpret_cast(fileName.data())}; f.is_open()) -- LoadConfigFromFile(f); -- } -- } --#endif - -- if(auto homedir = al::getenv("HOME")) -- { -- path = *homedir; -- path /= ".alsoftrc"; - -- TRACE("Loading config {}...", al::u8_as_char(path.u8string())); -- if(std::ifstream f{path}; f.is_open()) -- LoadConfigFromFile(f); -- } - -- if(auto configdir = al::getenv("XDG_CONFIG_HOME")) -- { -- path = *configdir; -- path /= "alsoft.conf"; -- } -- else -- { -- path.clear(); -- if(auto homedir = al::getenv("HOME")) -- { -- path = *homedir; -- path /= ".config/alsoft.conf"; -- } -- } -- if(!path.empty()) -- { -- TRACE("Loading config {}...", al::u8_as_char(path.u8string())); -- if(std::ifstream f{path}; f.is_open()) -- LoadConfigFromFile(f); -- } - -- path = GetProcBinary().path; -- if(!path.empty()) -- { -- path /= "alsoft.conf"; - -- TRACE("Loading config {}...", al::u8_as_char(path.u8string())); -- if(std::ifstream f{path}; f.is_open()) -- LoadConfigFromFile(f); -- } - -- if(auto confname = al::getenv("ALSOFT_CONF")) -- { -- TRACE("Loading config {}...", *confname); -- if(std::ifstream f{*confname}; f.is_open()) -- LoadConfigFromFile(f); -- } -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ - } - #endif - ---- a/core/ambdec.cpp -+++ b/core/ambdec.cpp -@@ -15,7 +15,7 @@ - - #include "albit.h" - #include "alspan.h" --#include "filesystem.h" -+ - #include "fmt/core.h" - - -@@ -60,231 +60,5 @@ AmbDecConf::~AmbDecConf() = default; - - std::optional AmbDecConf::load(const char *fname) noexcept - { -- fs::ifstream f{fs::u8path(fname)}; -- if(!f.is_open()) -- return std::string("Failed to open file \"")+fname+"\""; -- -- ReaderScope scope{ReaderScope::Global}; -- size_t speaker_pos{0}; -- size_t lfmatrix_pos{0}; -- size_t hfmatrix_pos{0}; -- size_t linenum{0}; -- -- std::string buffer; -- while(f.good() && std::getline(f, buffer)) -- { -- ++linenum; -- -- std::istringstream istr{buffer}; -- std::string command{read_word(istr)}; -- if(command.empty() || command[0] == '#') -- continue; -- -- if(command == "/}") -- { -- if(scope == ReaderScope::Global) -- return make_error(linenum, "Unexpected /}} in global scope"); -- scope = ReaderScope::Global; -- continue; -- } -- -- if(scope == ReaderScope::Speakers) -- { -- if(command == "add_spkr") -- { -- if(speaker_pos == Speakers.size()) -- return make_error(linenum, "Too many speakers specified"); -- -- AmbDecConf::SpeakerConf &spkr = Speakers[speaker_pos++]; -- istr >> spkr.Name; -- istr >> spkr.Distance; -- istr >> spkr.Azimuth; -- istr >> spkr.Elevation; -- istr >> spkr.Connection; -- } -- else -- return make_error(linenum, "Unexpected speakers command: {}", command); -- } -- else if(scope == ReaderScope::LFMatrix || scope == ReaderScope::HFMatrix) -- { -- auto &gains = (scope == ReaderScope::LFMatrix) ? LFOrderGain : HFOrderGain; -- auto matrix = (scope == ReaderScope::LFMatrix) ? LFMatrix : HFMatrix; -- auto &pos = (scope == ReaderScope::LFMatrix) ? lfmatrix_pos : hfmatrix_pos; -- -- if(command == "order_gain") -- { -- size_t toread{(ChanMask > Ambi3OrderMask) ? 5u : 4u}; -- std::size_t curgain{0u}; -- float value{}; -- while(toread) -- { -- --toread; -- istr >> value; -- if(curgain < std::size(gains)) -- gains[curgain++] = value; -- } -- } -- else if(command == "add_row") -- { -- if(pos == Speakers.size()) -- return make_error(linenum, "Too many matrix rows specified"); -- -- unsigned int mask{ChanMask}; -- -- AmbDecConf::CoeffArray &mtxrow = matrix[pos++]; -- mtxrow.fill(0.0f); -- -- float value{}; -- while(mask) -- { -- auto idx = static_cast(al::countr_zero(mask)); -- mask &= ~(1u << idx); -- -- istr >> value; -- if(idx < mtxrow.size()) -- mtxrow[idx] = value; -- } -- } -- else -- return make_error(linenum, "Unexpected matrix command: {}", command); -- } -- // Global scope commands -- else if(command == "/description") -- { -- while(istr.good() && std::isspace(istr.peek())) -- istr.ignore(); -- std::getline(istr, Description); -- while(!Description.empty() && std::isspace(Description.back())) -- Description.pop_back(); -- } -- else if(command == "/version") -- { -- if(Version) -- return make_error(linenum, "Duplicate version definition"); -- istr >> Version; -- if(Version != 3) -- return make_error(linenum, "Unsupported version: {}", Version); -- } -- else if(command == "/dec/chan_mask") -- { -- if(ChanMask) -- return make_error(linenum, "Duplicate chan_mask definition"); -- istr >> std::hex >> ChanMask >> std::dec; -- -- if(!ChanMask || ChanMask > Ambi4OrderMask) -- return make_error(linenum, "Invalid chan_mask: {:#x}", ChanMask); -- if(ChanMask > Ambi3OrderMask && CoeffScale == AmbDecScale::FuMa) -- return make_error(linenum, "FuMa not compatible with over third-order"); -- } -- else if(command == "/dec/freq_bands") -- { -- if(FreqBands) -- return make_error(linenum, "Duplicate freq_bands"); -- istr >> FreqBands; -- if(FreqBands != 1 && FreqBands != 2) -- return make_error(linenum, "Invalid freq_bands: {}", FreqBands); -- } -- else if(command == "/dec/speakers") -- { -- if(!Speakers.empty()) -- return make_error(linenum, "Duplicate speakers"); -- size_t numspeakers{}; -- istr >> numspeakers; -- if(!numspeakers) -- return make_error(linenum, "Invalid speakers: {}", numspeakers); -- Speakers.resize(numspeakers); -- } -- else if(command == "/dec/coeff_scale") -- { -- if(CoeffScale != AmbDecScale::Unset) -- return make_error(linenum, "Duplicate coeff_scale"); -- -- std::string scale{read_word(istr)}; -- if(scale == "n3d") CoeffScale = AmbDecScale::N3D; -- else if(scale == "sn3d") CoeffScale = AmbDecScale::SN3D; -- else if(scale == "fuma") CoeffScale = AmbDecScale::FuMa; -- else -- return make_error(linenum, "Unexpected coeff_scale: {}", scale); -- -- if(ChanMask > Ambi3OrderMask && CoeffScale == AmbDecScale::FuMa) -- return make_error(linenum, "FuMa not compatible with over third-order"); -- } -- else if(command == "/opt/xover_freq") -- { -- istr >> XOverFreq; -- } -- else if(command == "/opt/xover_ratio") -- { -- istr >> XOverRatio; -- } -- else if(command == "/opt/input_scale" || command == "/opt/nfeff_comp" -- || command == "/opt/delay_comp" || command == "/opt/level_comp") -- { -- /* Unused */ -- read_word(istr); -- } -- else if(command == "/speakers/{") -- { -- if(Speakers.empty()) -- return make_error(linenum, "Speakers defined without a count"); -- scope = ReaderScope::Speakers; -- } -- else if(command == "/lfmatrix/{" || command == "/hfmatrix/{" || command == "/matrix/{") -- { -- if(Speakers.empty()) -- return make_error(linenum, "Matrix defined without a speaker count"); -- if(!ChanMask) -- return make_error(linenum, "Matrix defined without a channel mask"); -- -- if(Matrix.empty()) -- { -- Matrix.resize(Speakers.size() * FreqBands); -- LFMatrix = al::span{Matrix}.first(Speakers.size()); -- HFMatrix = al::span{Matrix}.subspan(Speakers.size()*(FreqBands-1)); -- } -- -- if(FreqBands == 1) -- { -- if(command != "/matrix/{") -- return make_error(linenum, "Unexpected \"{}\" for a single-band decoder", -- command); -- scope = ReaderScope::HFMatrix; -- } -- else -- { -- if(command == "/lfmatrix/{") -- scope = ReaderScope::LFMatrix; -- else if(command == "/hfmatrix/{") -- scope = ReaderScope::HFMatrix; -- else -- return make_error(linenum, "Unexpected \"{}\" for a dual-band decoder", -- command); -- } -- } -- else if(command == "/end") -- { -- const auto endpos = static_cast(istr.tellg()); -- if(!is_at_end(buffer, endpos)) -- return make_error(linenum, "Extra junk on end: {}", -- std::string_view{buffer}.substr(endpos)); -- -- if(speaker_pos < Speakers.size() || hfmatrix_pos < Speakers.size() -- || (FreqBands == 2 && lfmatrix_pos < Speakers.size())) -- return make_error(linenum, "Incomplete decoder definition"); -- if(CoeffScale == AmbDecScale::Unset) -- return make_error(linenum, "No coefficient scaling defined"); -- -- return std::nullopt; -- } -- else -- return make_error(linenum, "Unexpected command: {}", command); -- -- istr.clear(); -- const auto endpos = static_cast(istr.tellg()); -- if(!is_at_end(buffer, endpos)) -- return make_error(linenum, "Extra junk on line: {}", -- std::string_view{buffer}.substr(endpos)); -- buffer.clear(); -- } -- return make_error(linenum, "Unexpected end of file"); -+ return std::string("OpenAL Soft's Ambisonics config loader is disabled by mkxp-z"); - } ---- a/core/hrtf.cpp -+++ b/core/hrtf.cpp -@@ -30,7 +30,7 @@ - #include "alspan.h" - #include "alstring.h" - #include "ambidefs.h" --#include "filesystem.h" -+ - #include "filters/splitter.h" - #include "fmt/core.h" - #include "helpers.h" -@@ -1202,8 +1202,8 @@ std::vector EnumerateHrtf(std::optional pathopt) - std::lock_guard enumlock{EnumeratedHrtfLock}; - EnumeratedHrtfs.clear(); - -- for(const auto &fname : SearchDataFiles(".mhr"sv)) -- AddFileEntry(fname); -+ -+ - - bool usedefaults{true}; - if(pathopt) -@@ -1230,16 +1230,16 @@ std::vector EnumerateHrtf(std::optional pathopt) - entry.remove_suffix(1); - if(!entry.empty()) - { -- for(const auto &fname : SearchDataFiles(".mhr"sv, entry)) -- AddFileEntry(fname); -+ -+ - } - } - } - - if(usedefaults) - { -- for(const auto &fname : SearchDataFiles(".mhr"sv, "openal/hrtf"sv)) -- AddFileEntry(fname); -+ -+ - - if(!GetResource(IDR_DEFAULT_HRTF_MHR).empty()) - AddBuiltInEntry("Built-In HRTF", IDR_DEFAULT_HRTF_MHR); -@@ -1303,14 +1303,14 @@ try { - else - { - TRACE("Loading {}...", fname); -- auto fstr = std::make_unique(fs::u8path(fname), -- std::ios::binary); -- if(!fstr->is_open()) -+ -+ ERR("OpenAL Soft's HRTF loader is disabled by mkxp-z"); -+ if(true) - { - ERR("Could not open {}", fname); - return nullptr; - } -- stream = std::move(fstr); -+ - } - - auto hrtf = std::unique_ptr{}; diff --git a/subprojects/packagefiles/openal-soft-flockfile.patch b/subprojects/packagefiles/openal-soft-flockfile.patch deleted file mode 100644 index 8181785d..00000000 --- a/subprojects/packagefiles/openal-soft-flockfile.patch +++ /dev/null @@ -1,14 +0,0 @@ -# Disables OpenAL Soft's use of flockfile and funlockfile since not every platform we support has those functions. -# Besides, OpenAL Soft shouldn't even be using the filesystem or the standard streams. - ---- a/fmt-11.1.1/include/fmt/format-inl.h -+++ b/fmt-11.1.1/include/fmt/format-inl.h -@@ -1479,7 +1479,7 @@ struct has_flockfile : std::false_type {}; - - template - struct has_flockfile()))>> -- : std::true_type {}; -+ : std::false_type {}; - - // A FILE wrapper. F is FILE defined as a template parameter to make system API - // detection work. diff --git a/subprojects/packagefiles/openal-soft-int32.patch b/subprojects/packagefiles/openal-soft-int32.patch index b1e8d940..e5b457af 100644 --- a/subprojects/packagefiles/openal-soft-int32.patch +++ b/subprojects/packagefiles/openal-soft-int32.patch @@ -3,7 +3,7 @@ --- a/alc/alu.cpp +++ b/alc/alu.cpp -@@ -2114,7 +2114,7 @@ inline T SampleConv(float) noexcept; +@@ -2008,7 +2008,7 @@ inline T SampleConv(float) noexcept; template<> inline float SampleConv(float val) noexcept { return val; } @@ -12,17 +12,17 @@ { /* Floats have a 23-bit mantissa, plus an implied 1 bit and a sign bit. * This means a normalized float has at most 25 bits of signed precision. -@@ -2123,13 +2123,16 @@ template<> inline int32_t SampleConv(float val) noexcept +@@ -2017,13 +2017,16 @@ template<> inline int32_t SampleConv(float val) noexcept */ - return fastf2i(std::clamp(val*2147483648.0f, -2147483648.0f, 2147483520.0f)); + return fastf2i(clampf(val*2147483648.0f, -2147483648.0f, 2147483520.0f)); } +#ifdef __DEVKITARM__ +template<> inline long SampleConv(float val) noexcept { return (long)SampleConv(val); } +#endif template<> inline int16_t SampleConv(float val) noexcept - { return static_cast(fastf2i(std::clamp(val*32768.0f, -32768.0f, 32767.0f))); } + { return static_cast(fastf2i(clampf(val*32768.0f, -32768.0f, 32767.0f))); } template<> inline int8_t SampleConv(float val) noexcept - { return static_cast(fastf2i(std::clamp(val*128.0f, -128.0f, 127.0f))); } + { return static_cast(fastf2i(clampf(val*128.0f, -128.0f, 127.0f))); } /* Define unsigned output variations. */ -template<> inline uint32_t SampleConv(float val) noexcept @@ -32,30 +32,30 @@ { return static_cast(SampleConv(val) + 32768); } --- a/core/converter.cpp +++ b/core/converter.cpp -@@ -83,16 +83,16 @@ inline DevFmtType_t StoreSample(float) noexcept; +@@ -80,16 +80,16 @@ inline DevFmtType_t StoreSample(float) noexcept; template<> inline float StoreSample(float val) noexcept { return val; } -template<> inline int32_t StoreSample(float val) noexcept --{ return fastf2i(std::clamp(val*2147483648.0f, -2147483648.0f, 2147483520.0f)); } +-{ return fastf2i(clampf(val*2147483648.0f, -2147483648.0f, 2147483520.0f)); } +template<> inline int StoreSample(float val) noexcept -+{ static_assert(sizeof(int) == sizeof(int32_t), "`int` should be a 32-bit integer"); return fastf2i(std::clamp(val*2147483648.0f, -2147483648.0f, 2147483520.0f)); } ++{ static_assert(sizeof(int) == sizeof(int32_t), "`int` should be a 32-bit integer"); return fastf2i(clampf(val*2147483648.0f, -2147483648.0f, 2147483520.0f)); } template<> inline int16_t StoreSample(float val) noexcept - { return static_cast(fastf2i(std::clamp(val*32768.0f, -32768.0f, 32767.0f))); } + { return static_cast(fastf2i(clampf(val*32768.0f, -32768.0f, 32767.0f))); } template<> inline int8_t StoreSample(float val) noexcept - { return static_cast(fastf2i(std::clamp(val*128.0f, -128.0f, 127.0f))); } + { return static_cast(fastf2i(clampf(val*128.0f, -128.0f, 127.0f))); } /* Define unsigned output variations. */ -template<> inline uint32_t StoreSample(float val) noexcept -{ return static_cast(StoreSample(val)) + 2147483648u; } +template<> inline unsigned int StoreSample(float val) noexcept -+{ static_assert(sizeof(unsigned int) == sizeof(uint32_t), "`unsigned int` should be a 32-bit integer"); return static_cast(StoreSample(val)) + 2147483648u; } ++{ static_assert(sizeof(unsigned int) == sizeof(uint32_t), "`unsigned int` should be a 32-bit integer"); return static_cast(StoreSample(val)) + 2147483648u; } template<> inline uint16_t StoreSample(float val) noexcept { return static_cast(StoreSample(val) + 32768); } template<> inline uint8_t StoreSample(float val) noexcept --- a/core/devformat.h +++ b/core/devformat.h -@@ -94,9 +94,9 @@ struct DevFmtTypeTraits { using Type = int16_t; }; +@@ -86,9 +86,9 @@ struct DevFmtTypeTraits { using Type = int16_t; }; template<> struct DevFmtTypeTraits { using Type = uint16_t; }; template<> diff --git a/subprojects/packagefiles/openal-soft-mkxp-polyfill.patch b/subprojects/packagefiles/openal-soft-mkxp-polyfill.patch index 943ef5a1..17c6116f 100644 --- a/subprojects/packagefiles/openal-soft-mkxp-polyfill.patch +++ b/subprojects/packagefiles/openal-soft-mkxp-polyfill.patch @@ -2,15 +2,15 @@ --- a/al/auxeffectslot.cpp +++ b/al/auxeffectslot.cpp -@@ -28,7 +28,7 @@ - #include +@@ -27,7 +27,7 @@ + #include #include #include -#include +#include "../../src/mkxp-polyfill.h" #include - #include - #include + #include + --- a/al/buffer.cpp +++ b/al/buffer.cpp @@ -32,7 +32,7 @@ @@ -19,20 +19,9 @@ #include -#include +#include "../../src/mkxp-polyfill.h" + #include #include - #include #include ---- a/al/debug.cpp -+++ b/al/debug.cpp -@@ -7,7 +7,7 @@ - #include - #include - #include --#include -+#include "../../src/mkxp-polyfill.h" - #include - #include - #include --- a/al/effect.cpp +++ b/al/effect.cpp @@ -27,7 +27,7 @@ @@ -41,20 +30,31 @@ #include -#include +#include "../../src/mkxp-polyfill.h" + #include #include - #include - #include + #include +--- a/al/error.cpp ++++ b/al/error.cpp +@@ -30,7 +30,7 @@ + #include + #include + #include +-#include ++#include "../../src/mkxp-polyfill.h" + + #include "AL/al.h" + #include "AL/alc.h" --- a/al/event.cpp +++ b/al/event.cpp -@@ -7,7 +7,7 @@ - #include +@@ -8,7 +8,7 @@ + #include #include #include -#include +#include "../../src/mkxp-polyfill.h" #include - #include #include + #include --- a/al/filter.cpp +++ b/al/filter.cpp @@ -28,7 +28,7 @@ @@ -63,14 +63,14 @@ #include -#include +#include "../../src/mkxp-polyfill.h" + #include #include - #include - #include + --- a/al/listener.cpp +++ b/al/listener.cpp -@@ -24,7 +24,7 @@ +@@ -23,7 +23,7 @@ + #include "listener.h" - #include #include -#include +#include "../../src/mkxp-polyfill.h" @@ -79,38 +79,38 @@ #include "AL/alc.h" --- a/al/source.cpp +++ b/al/source.cpp -@@ -34,7 +34,7 @@ - #include - #include - #include --#include -+#include "../../src/mkxp-polyfill.h" - #include - #include - #include ---- a/al/state.cpp -+++ b/al/state.cpp -@@ -26,7 +26,7 @@ - #include - #include - #include --#include -+#include "../../src/mkxp-polyfill.h" - #include - #include - #include ---- a/alc/alc.cpp -+++ b/alc/alc.cpp -@@ -48,7 +48,7 @@ +@@ -35,7 +35,7 @@ #include #include #include -#include +#include "../../src/mkxp-polyfill.h" #include - #include + #include #include -@@ -314,7 +314,7 @@ std::atomic LastNullDeviceError{ALC_NO_ERROR}; +--- a/al/state.cpp ++++ b/al/state.cpp +@@ -24,7 +24,7 @@ + + #include + #include +-#include ++#include "../../src/mkxp-polyfill.h" + #include + #include + +--- a/alc/alc.cpp ++++ b/alc/alc.cpp +@@ -46,7 +46,7 @@ + #include + #include + #include +-#include ++#include "../../src/mkxp-polyfill.h" + #include + #include + #include +@@ -956,7 +956,7 @@ std::atomic LastNullDeviceError{ALC_NO_ERROR}; bool TrapALCError{false}; /* One-time configuration init control */ @@ -119,7 +119,7 @@ /* Flag to specify if alcSuspendContext/alcProcessContext should defer/process * updates. -@@ -743,7 +743,7 @@ void alc_initconfig() +@@ -1370,7 +1370,7 @@ void alc_initconfig(void) #endif // ALSOFT_EAX } inline void InitConfig() @@ -130,157 +130,191 @@ /************************************************ --- a/alc/alconfig.cpp +++ b/alc/alconfig.cpp -@@ -37,7 +37,7 @@ - #include - #include - #include +@@ -35,7 +35,7 @@ + + #include + #include -#include +#include "../../src/mkxp-polyfill.h" - #include #include - #include ---- a/alc/backends/alsa.cpp -+++ b/alc/backends/alsa.cpp -@@ -30,7 +30,7 @@ - #include - #include - #include --#include -+#include "../../src/mkxp-polyfill.h" - #include - #include - #include ---- a/alc/backends/jack.cpp -+++ b/alc/backends/jack.cpp -@@ -27,7 +27,7 @@ - #include - #include - #include --#include -+#include "../../src/mkxp-polyfill.h" - #include - #include ---- a/alc/backends/opensl.cpp -+++ b/alc/backends/opensl.cpp -@@ -28,7 +28,7 @@ - #include - #include - #include --#include -+#include "../../src/mkxp-polyfill.h" - #include - #include - #include ---- a/alc/backends/otherio.cpp -+++ b/alc/backends/otherio.cpp -@@ -49,7 +49,7 @@ - #include - #include - #include --#include -+#include "../../src/mkxp-polyfill.h" - #include - #include - #include ---- a/alc/backends/pipewire.cpp -+++ b/alc/backends/pipewire.cpp -@@ -37,7 +37,7 @@ - #include - #include - #include --#include -+#include "../../src/mkxp-polyfill.h" - #include - #include - #include ---- a/alc/backends/pulseaudio.cpp -+++ b/alc/backends/pulseaudio.cpp -@@ -33,7 +33,7 @@ - #include - #include - #include --#include -+#include "../../src/mkxp-polyfill.h" - #include - #include - #include ---- a/alc/backends/wasapi.cpp -+++ b/alc/backends/wasapi.cpp -@@ -52,7 +52,7 @@ - #include - #include - #include --#include -+#include "../../src/mkxp-polyfill.h" - #include - #include - #include + #include "alfstream.h" +@@ -493,21 +493,21 @@ al::optional ConfigValueStr(const char *devName, const char *blockN + al::optional ConfigValueInt(const char *devName, const char *blockName, const char *keyName) + { + if(const char *val{GetConfigValue(devName, blockName, keyName)}) +- return static_cast(std::strtol(val, nullptr, 0)); ++ return static_cast(std::stol(val, nullptr, 0)); + return al::nullopt; + } + + al::optional ConfigValueUInt(const char *devName, const char *blockName, const char *keyName) + { + if(const char *val{GetConfigValue(devName, blockName, keyName)}) +- return static_cast(std::strtoul(val, nullptr, 0)); ++ return static_cast(std::stoul(val, nullptr, 0)); + return al::nullopt; + } + + al::optional ConfigValueFloat(const char *devName, const char *blockName, const char *keyName) + { + if(const char *val{GetConfigValue(devName, blockName, keyName)}) +- return std::strtof(val, nullptr); ++ return std::stof(val, nullptr); + return al::nullopt; + } + --- a/alc/context.h +++ b/alc/context.h -@@ -8,7 +8,7 @@ - #include - #include - #include --#include -+#include "../../src/mkxp-polyfill.h" - #include - #include - #include ---- a/alc/device.h -+++ b/alc/device.h -@@ -5,7 +5,7 @@ +@@ -3,7 +3,7 @@ #include #include -#include +#include "../../src/mkxp-polyfill.h" - #include - #include - #include ---- a/alc/events.h -+++ b/alc/events.h -@@ -5,7 +5,7 @@ - #include "opthelpers.h" + #include + #include - #include +--- a/alc/device.h ++++ b/alc/device.h +@@ -3,7 +3,7 @@ + + #include + #include -#include +#include "../../src/mkxp-polyfill.h" - #include - #include - ---- a/common/alassert.cpp -+++ b/common/alassert.cpp + #include + #include + #include +--- a/alc/effects/base.h ++++ b/alc/effects/base.h @@ -2,7 +2,7 @@ - #include "alassert.h" + #define EFFECTS_BASE_H - #include --#include + #include "core/effects/base.h" +- ++#include "../../../src/mkxp-polyfill.h" + + EffectStateFactory *NullStateFactory_getFactory(void); + EffectStateFactory *ReverbStateFactory_getFactory(void); +--- a/common/almalloc.cpp ++++ b/common/almalloc.cpp +@@ -11,20 +11,15 @@ + #ifdef HAVE_MALLOC_H + #include + #endif +- +#include "../../src/mkxp-polyfill.h" - namespace { + void *al_malloc(size_t alignment, size_t size) + { + assert((alignment & (alignment-1)) == 0); + alignment = std::max(alignment, alignof(std::max_align_t)); ---- a/common/alsem.cpp -+++ b/common/alsem.cpp -@@ -55,8 +55,6 @@ void semaphore::post() +-#if defined(HAVE_POSIX_MEMALIGN) +- void *ret{}; +- if(posix_memalign(&ret, alignment, size) == 0) +- return ret; +- return nullptr; +-#elif defined(HAVE__ALIGNED_MALLOC) +- return _aligned_malloc(size, alignment); ++#ifdef MKXPZ_HAVE_ANY_ALIGNED_MALLOC ++ return mkxp_aligned_malloc(alignment, size); + #else + size_t total_size{size + alignment-1 + sizeof(void*)}; + void *base{std::malloc(total_size)}; +@@ -50,10 +45,8 @@ void *al_calloc(size_t alignment, size_t size) + + void al_free(void *ptr) noexcept + { +-#if defined(HAVE_POSIX_MEMALIGN) +- std::free(ptr); +-#elif defined(HAVE__ALIGNED_MALLOC) +- _aligned_free(ptr); ++#ifdef MKXPZ_HAVE_ANY_ALIGNED_MALLOC ++ mkxp_aligned_free(ptr); + #else + if(ptr != nullptr) + std::free(*(static_cast(ptr) - 1)); +--- a/common/threads.cpp ++++ b/common/threads.cpp +@@ -86,47 +86,47 @@ void semaphore::post() void semaphore::wait() noexcept { WaitForSingleObject(static_cast(mSem), INFINITE); } -bool semaphore::try_wait() noexcept -{ return WaitForSingleObject(static_cast(mSem), 0) == WAIT_OBJECT_0; } ++ ++ } // namespace al -@@ -83,8 +81,6 @@ void semaphore::post() + #else + +-#include +-#ifdef HAVE_PTHREAD_NP_H +-#include +-#endif ++#include "../../src/mkxp-polyfill.h" ++ ++ ++ + #include + + namespace { + + using setname_t1 = int(*)(const char*); +-using setname_t2 = int(*)(pthread_t, const char*); +-using setname_t3 = void(*)(pthread_t, const char*); +-using setname_t4 = int(*)(pthread_t, const char*, void*); ++using setname_t2 = int(*)(mkxp_thread_t, const char*); ++using setname_t3 = void(*)(mkxp_thread_t, const char*); ++using setname_t4 = int(*)(mkxp_thread_t, const char*, void*); + + void setname_caller(setname_t1 func, const char *name) + { func(name); } + + void setname_caller(setname_t2 func, const char *name) +-{ func(pthread_self(), name); } ++{ func(mkxp_thread_self(), name); } + + void setname_caller(setname_t3 func, const char *name) +-{ func(pthread_self(), name); } ++{ func(mkxp_thread_self(), name); } + + void setname_caller(setname_t4 func, const char *name) +-{ func(pthread_self(), "%s", static_cast(const_cast(name))); } ++{ func(mkxp_thread_self(), "%s", static_cast(const_cast(name))); } + + } // namespace + + void althrd_setname(const char *name) + { +-#if defined(HAVE_PTHREAD_SET_NAME_NP) +- setname_caller(pthread_set_name_np, name); +-#elif defined(HAVE_PTHREAD_SETNAME_NP) +- setname_caller(pthread_setname_np, name); +-#endif ++ ++ ++ ++ ++ + /* Avoid unused function/parameter warnings. */ + std::ignore = name; + std::ignore = static_cast(&setname_caller); +@@ -155,8 +155,8 @@ void semaphore::post() void semaphore::wait() noexcept { dispatch_semaphore_wait(mSem, DISPATCH_TIME_FOREVER); } -bool semaphore::try_wait() noexcept -{ return dispatch_semaphore_wait(mSem, DISPATCH_TIME_NOW) == 0; } ++ ++ } // namespace al -@@ -96,27 +92,25 @@ namespace al { +@@ -168,27 +168,27 @@ namespace al { semaphore::semaphore(unsigned int initial) { @@ -311,195 +345,56 @@ -bool semaphore::try_wait() noexcept -{ return sem_trywait(&mSem) == 0; } ++ ++ } // namespace al ---- a/common/alsem.h -+++ b/common/alsem.h -@@ -11,7 +11,7 @@ - #include /* Fallback option for Apple without a working libdispatch */ - #endif +--- a/common/threads.h ++++ b/common/threads.h +@@ -14,7 +14,7 @@ + #if defined(__APPLE__) + #include #elif !defined(_WIN32) -#include +#include "../../src/mkxp-polyfill.h" #endif - namespace al { -@@ -22,7 +22,7 @@ class semaphore { - #elif defined(AL_APPLE_HAVE_DISPATCH) + void althrd_setname(const char *name); +@@ -27,7 +27,7 @@ class semaphore { + #elif defined(__APPLE__) using native_type = dispatch_semaphore_t; #else - using native_type = sem_t; + using native_type = mkxp_sem_t; #endif - native_type mSem{}; + native_type mSem; -@@ -35,7 +35,6 @@ public: +@@ -40,7 +40,7 @@ public: void post(); void wait() noexcept; - bool try_wait() noexcept; ++ }; } // namespace al ---- a/common/althrd_setname.cpp -+++ b/common/althrd_setname.cpp -@@ -39,39 +39,39 @@ void althrd_setname(const char *name [[maybe_unused]]) - - #else - --#include --#ifdef HAVE_PTHREAD_NP_H --#include --#endif +--- a/core/ambdec.cpp ++++ b/core/ambdec.cpp +@@ -16,7 +16,7 @@ + #include "alfstream.h" + #include "alspan.h" + #include "opthelpers.h" +- +#include "../../src/mkxp-polyfill.h" -+ -+ -+ -+ namespace { - using setname_t1 = int(*)(const char*); --using setname_t2 = int(*)(pthread_t, const char*); --using setname_t3 = void(*)(pthread_t, const char*); --using setname_t4 = int(*)(pthread_t, const char*, void*); -+using setname_t2 = int(*)(mkxp_thread_t, const char*); -+using setname_t3 = void(*)(mkxp_thread_t, const char*); -+using setname_t4 = int(*)(mkxp_thread_t, const char*, void*); - - [[maybe_unused]] void setname_caller(setname_t1 func, const char *name) - { func(name); } - - [[maybe_unused]] void setname_caller(setname_t2 func, const char *name) --{ func(pthread_self(), name); } -+{ func(mkxp_thread_self(), name); } - - [[maybe_unused]] void setname_caller(setname_t3 func, const char *name) --{ func(pthread_self(), name); } -+{ func(mkxp_thread_self(), name); } - - [[maybe_unused]] void setname_caller(setname_t4 func, const char *name) --{ func(pthread_self(), "%s", const_cast(name)); /* NOLINT(*-const-cast) */ } -+{ func(mkxp_thread_self(), "%s", const_cast(name)); /* NOLINT(*-const-cast) */ } - - } // namespace - - void althrd_setname(const char *name [[maybe_unused]]) - { --#if defined(HAVE_PTHREAD_SET_NAME_NP) -- setname_caller(pthread_set_name_np, name); --#elif defined(HAVE_PTHREAD_SETNAME_NP) -- setname_caller(pthread_setname_np, name); --#endif --} - -+ -+ -+ -+ -+} - #endif ---- a/common/althreads.h -+++ b/common/althreads.h -@@ -5,7 +5,7 @@ - #include - #include - --#ifdef _WIN32 -+#if false - #define WIN32_LEAN_AND_MEAN - #include - -@@ -13,7 +13,7 @@ - - #include - --#else -+#elif false - - #include - #endif -@@ -54,7 +54,7 @@ class tss { - return static_cast(al::bit_cast(ptr)); - } - --#ifdef _WIN32 -+/* - DWORD mTss{TLS_OUT_OF_INDEXES}; - - public: -@@ -105,32 +105,33 @@ public: - [[nodiscard]] - auto get() const noexcept -> T { return from_ptr(pthread_getspecific(mTss)); } - --#else -+*/ - -- tss_t mTss{}; -+ void **mTss; - - public: - tss() - { -- if(int res{tss_create(&mTss, nullptr)}; res != thrd_success) -+ if ((mTss = (void **)std::malloc(sizeof *mTss)) == NULL) - throw std::runtime_error{"al::tss::tss()"}; -+ *mTss = nullptr; - } - explicit tss(const T &init) : tss{} - { -- if(int res{tss_set(mTss, to_ptr(init))}; res != thrd_success) -- throw std::runtime_error{"al::tss::tss(T)"}; -+ if ((mTss = (void **)std::malloc(sizeof *mTss)) == NULL) -+ throw std::runtime_error{"al::tss::tss()"}; -+ *mTss = to_ptr(init); - } -- ~tss() { tss_delete(mTss); } -+ ~tss() { std::free(mTss); } - - void set(const T &value) const - { -- if(int res{tss_set(mTss, to_ptr(value))}; res != thrd_success) -- throw std::runtime_error{"al::tss::set(T)"}; -+ *mTss = to_ptr(value); - } - - [[nodiscard]] -- auto get() const noexcept -> T { return from_ptr(tss_get(mTss)); } --#endif /* _WIN32 */ -+ auto get() const noexcept -> T { return from_ptr(*mTss); } -+ - - tss(const tss&) = delete; - tss(tss&&) = delete; ---- a/core/context.h -+++ b/core/context.h -@@ -140,7 +140,7 @@ struct ContextBase { - */ - al::atomic_unique_ptr mActiveAuxSlots; - -- std::thread mEventThread; -+ - 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-polyfill.h" - #include - #include - #include --- a/core/dbus_wrap.cpp +++ b/core/dbus_wrap.cpp @@ -5,7 +5,7 @@ - #if HAVE_DYNLOAD + #ifdef HAVE_DYNLOAD -#include +#include "../../src/mkxp-polyfill.h" @@ -510,87 +405,76 @@ +++ b/core/dbus_wrap.h @@ -9,7 +9,7 @@ - #if HAVE_DYNLOAD + #ifdef HAVE_DYNLOAD -#include +#include "../../src/mkxp-polyfill.h" #define DBUS_FUNCTIONS(MAGIC) \ MAGIC(dbus_error_init) \ ---- a/core/helpers.cpp -+++ b/core/helpers.cpp -@@ -12,7 +12,7 @@ - #include - #include - #include +--- a/core/device.h ++++ b/core/device.h +@@ -8,7 +8,7 @@ + #include + #include + #include -#include +#include "../../src/mkxp-polyfill.h" - #include #include - #include + + #include "almalloc.h" +--- a/core/except.cpp ++++ b/core/except.cpp +@@ -7,7 +7,7 @@ + #include + + #include "opthelpers.h" +- ++#include "../../src/mkxp-polyfill.h" + + namespace al { + +--- a/core/helpers.cpp ++++ b/core/helpers.cpp +@@ -9,7 +9,7 @@ + #include + #include + #include +-#include ++#include "../../src/mkxp-polyfill.h" + #include + #include + #include --- a/core/hrtf.cpp +++ b/core/hrtf.cpp -@@ -15,7 +15,7 @@ +@@ -14,7 +14,7 @@ #include #include #include -#include +#include "../../src/mkxp-polyfill.h" #include - #include - #include + #include + #include --- a/core/logging.cpp +++ b/core/logging.cpp -@@ -7,7 +7,7 @@ - #include - #include - #include --#include +@@ -10,7 +10,7 @@ + #include "alspan.h" + #include "strutils.h" + #include "vector.h" +- +#include "../../src/mkxp-polyfill.h" - #include - #include - #include + + #if defined(_WIN32) + #define WIN32_LEAN_AND_MEAN --- a/core/mastering.cpp +++ b/core/mastering.cpp -@@ -4,7 +4,7 @@ - #include "mastering.h" +@@ -15,7 +15,7 @@ + #include "alnumeric.h" + #include "alspan.h" + #include "opthelpers.h" +- ++#include "../../src/mkxp-polyfill.h" - #include --#include -+#include "../../src/mkxp-polyfill.h" - #include - #include - #include ---- a/examples/alffplay.cpp -+++ b/examples/alffplay.cpp -@@ -20,7 +20,7 @@ - #include - #include - #include --#include -+#include "../../src/mkxp-polyfill.h" - #include - #include - #include ---- a/router/alc.cpp -+++ b/router/alc.cpp -@@ -7,7 +7,7 @@ - #include - #include - #include --#include -+#include "../../src/mkxp-polyfill.h" - #include - #include - #include ---- a/router/router.h -+++ b/router/router.h -@@ -8,7 +8,7 @@ - #include - #include - #include --#include -+#include "../../src/mkxp-polyfill.h" - #include - #include - #include + /* These structures assume BufferLineSize is a power of 2. */ + static_assert((BufferLineSize & (BufferLineSize-1)) == 0, "BufferLineSize is not a power of 2"); diff --git a/subprojects/packagefiles/openal-soft-null.patch b/subprojects/packagefiles/openal-soft-null.patch index 95ae96ac..6caafb98 100644 --- a/subprojects/packagefiles/openal-soft-null.patch +++ b/subprojects/packagefiles/openal-soft-null.patch @@ -2,7 +2,7 @@ --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -897,7 +897,7 @@ set(ALC_OBJS ${ALC_OBJS} +@@ -881,7 +881,7 @@ set(ALC_OBJS ${ALC_OBJS} # Default backends, always available alc/backends/loopback.cpp alc/backends/loopback.h @@ -11,23 +11,25 @@ alc/backends/null.h ) +diff --git a/alc/alc.cpp b/alc/alc.cpp +index af8ff55d..0319a486 100644 --- a/alc/alc.cpp +++ b/alc/alc.cpp -@@ -216,7 +216,7 @@ struct BackendInfo { - BackendFactory& (*getFactory)(); - }; - --std::array BackendList{ -+std::array BackendList{ - #if HAVE_PIPEWIRE - BackendInfo{"pipewire", PipeWireBackendFactory::getFactory}, - #endif -@@ -269,7 +269,7 @@ std::array BackendList{ - BackendInfo{"otherio", OtherIOBackendFactory::getFactory}, +@@ -251,7 +251,7 @@ BackendInfo BackendList[] = { + { "sdl2", SDL2BackendFactory::getFactory }, #endif -- BackendInfo{"null", NullBackendFactory::getFactory}, -+ - #if HAVE_WAVE - BackendInfo{"wave", WaveBackendFactory::getFactory}, +- { "null", NullBackendFactory::getFactory }, ++ { "null", nullptr }, + #ifdef HAVE_WAVE + { "wave", WaveBackendFactory::getFactory }, #endif +@@ -1289,7 +1289,7 @@ void alc_initconfig(void) + { + if(PlaybackFactory && CaptureFactory) + return; +- ++ if (!std::strcmp(backend.name, "null")) return; + BackendFactory &factory = backend.getFactory(); + if(!factory.init()) + { diff --git a/subprojects/packagefiles/openal-soft-pic.patch b/subprojects/packagefiles/openal-soft-pic.patch index d99e2e67..2b8f63b4 100644 --- a/subprojects/packagefiles/openal-soft-pic.patch +++ b/subprojects/packagefiles/openal-soft-pic.patch @@ -2,32 +2,12 @@ --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -1377,7 +1377,7 @@ target_compile_definitions(alsoft.common PRIVATE ${CPP_DEFS}) - target_compile_options(alsoft.common PRIVATE ${C_FLAGS}) - target_link_libraries(alsoft.common PRIVATE alsoft::fmt) - set_target_properties(alsoft.common PROPERTIES ${ALSOFT_STD_VERSION_PROPS} -- POSITION_INDEPENDENT_CODE TRUE) -+ ) +@@ -1313,7 +1313,7 @@ add_library(common STATIC EXCLUDE_FROM_ALL ${COMMON_OBJS}) + target_include_directories(common PRIVATE ${OpenAL_BINARY_DIR} ${OpenAL_SOURCE_DIR}/include) + target_compile_definitions(common PRIVATE ${CPP_DEFS}) + target_compile_options(common PRIVATE ${C_FLAGS}) +-set_target_properties(common PROPERTIES ${DEFAULT_TARGET_PROPS} POSITION_INDEPENDENT_CODE TRUE) ++set_target_properties(common PROPERTIES ${DEFAULT_TARGET_PROPS}) unset(HAS_ROUTER) ---- a/fmt-11.1.1/CMakeLists.txt -+++ b/fmt-11.1.1/CMakeLists.txt -@@ -58,7 +58,7 @@ add_headers(FMT_HEADERS args.h base.h chrono.h color.h compile.h core.h format.h - xchar.h) - set(FMT_SOURCES src/format.cc src/os.cc) - --add_library(alsoft.fmt OBJECT ${FMT_SOURCES} ${FMT_HEADERS} README.md ChangeLog.md) -+add_library(alsoft.fmt STATIC ${FMT_SOURCES} ${FMT_HEADERS} README.md ChangeLog.md) - add_library(alsoft::fmt ALIAS alsoft.fmt) - - if (cxx_std_11 IN_LIST CMAKE_CXX_COMPILE_FEATURES) -@@ -73,7 +73,7 @@ target_include_directories(alsoft.fmt PUBLIC - set_target_properties(alsoft.fmt PROPERTIES ${ALSOFT_STD_VERSION_PROPS} - VERSION ${FMT_VERSION} SOVERSION ${CPACK_PACKAGE_VERSION_MAJOR} - DEBUG_POSTFIX "${ALSOFT_FMT_DEBUG_POSTFIX}" -- POSITION_INDEPENDENT_CODE TRUE -+ - C_VISIBILITY_PRESET hidden - CXX_VISIBILITY_PRESET hidden - EXCLUDE_FROM_ALL TRUE) diff --git a/subprojects/packagefiles/openal-soft-ps3.patch b/subprojects/packagefiles/openal-soft-ps3.patch deleted file mode 100644 index 00e4d2cf..00000000 --- a/subprojects/packagefiles/openal-soft-ps3.patch +++ /dev/null @@ -1,35 +0,0 @@ -# The PlayStation 3 toolchain appears to be missing some functions from the C++ standard library. This replaces the missing functions with other ones that are available. - ---- a/alc/alu.cpp -+++ b/alc/alu.cpp -@@ -2155,7 +2155,7 @@ void Write(const al::span InBuffer, void *OutBuffer, cons - out[c] = SampleConv(s); - out += ptrdiff_t(FrameStep); - }; -- std::for_each_n(inbuf.cbegin(), SamplesToDo, conv_sample); -+ std::for_each(inbuf.cbegin(), inbuf.cbegin() + SamplesToDo, conv_sample); - ++c; - } - if(const size_t extra{FrameStep - c}) ---- a/alc/effects/reverb.cpp -+++ b/alc/effects/reverb.cpp -@@ -931,7 +931,7 @@ void EarlyReflections::updateLines(const float density_mult, const float diffusi - /* Calculate the gain (coefficient) for the secondary reflections based on - * the average delay and decay time. - */ -- const auto length = std::reduce(EARLY_LINE_LENGTHS.begin(), EARLY_LINE_LENGTHS.end(), 0.0f) -+ const auto length = std::accumulate(EARLY_LINE_LENGTHS.begin(), EARLY_LINE_LENGTHS.end(), 0.0f) - / 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); diff --git a/subprojects/packagefiles/openal-soft-setschedparam.patch b/subprojects/packagefiles/openal-soft-setschedparam.patch new file mode 100644 index 00000000..667d8c02 --- /dev/null +++ b/subprojects/packagefiles/openal-soft-setschedparam.patch @@ -0,0 +1,13 @@ +# Stops OpenAL Soft from trying to get realtime priority because Emscripten doesn't support all the necessary APIs and this will result in compilation errors when targeting Emscripten. + +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -565,7 +565,7 @@ if(NOT WIN32) + set(LINKER_FLAGS ${LINKER_FLAGS} -pthread) + endif() + +- check_symbol_exists(pthread_setschedparam pthread.h HAVE_PTHREAD_SETSCHEDPARAM) ++ + + # Some systems need pthread_np.h to get pthread_setname_np + check_include_files("pthread.h;pthread_np.h" HAVE_PTHREAD_NP_H)