mirror of
https://github.com/mkxp-z/mkxp-z.git
synced 2025-09-03 20:53:11 +02:00
Downgrade OpenAL Soft from 1.24.2 to 1.23.1 in libretro builds
OpenAL Soft 1.24 introduces a lot of code that doesn't work well with the PlayStation 3 homebrew toolchain, and also the old version of the Wii U homebrew toolchain currently used by the libretro buildbot. Instead of maintaining a bunch of patches to get 1.24 to work on these toolchains, I think it'd be easier to just use 1.23.
This commit is contained in:
parent
0bd07c8dc8
commit
74f4c0e714
28 changed files with 857 additions and 1518 deletions
54
.github/workflows/autobuild.yml
vendored
54
.github/workflows/autobuild.yml
vendored
|
@ -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 }}
|
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
|
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:
|
build-libretro-windows:
|
||||||
needs: build-libretro-stage1
|
needs: build-libretro-stage1
|
||||||
name: LR Windows
|
name: LR Windows
|
||||||
|
@ -1136,15 +1108,11 @@ jobs:
|
||||||
path: ~/dist
|
path: ~/dist
|
||||||
|
|
||||||
build-libretro-wiiu:
|
build-libretro-wiiu:
|
||||||
needs:
|
needs: build-libretro-stage1
|
||||||
- build-libretro-stage1
|
|
||||||
- wiiurpxtool
|
|
||||||
name: LR Wii U
|
name: LR Wii U
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container:
|
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.
|
image: git.libretro.com:5050/libretro-infrastructure/libretro-build-wiiu:latest
|
||||||
# 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
|
|
||||||
options: -u root
|
options: -u root
|
||||||
volumes:
|
volumes:
|
||||||
- /tmp:/__e/node20
|
- /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 }}
|
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
|
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
|
- name: Configure core
|
||||||
run: |
|
run: |
|
||||||
echo "[binaries]" | tee -a ~/cross.ini
|
echo "[binaries]" | tee -a ~/cross.ini
|
||||||
|
|
26
meson.build
26
meson.build
|
@ -153,14 +153,38 @@ if is_libretro
|
||||||
libretro_defines += '-DBOOST_NO_EXCEPTIONS'
|
libretro_defines += '-DBOOST_NO_EXCEPTIONS'
|
||||||
endif
|
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')
|
if not compilers['cpp'].has_header_symbol('stdio.h', 'snprintf')
|
||||||
libretro_defines += '-DMKXPZ_NO_SNPRINTF'
|
libretro_defines += '-DMKXPZ_NO_SNPRINTF'
|
||||||
endif
|
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')
|
if not compilers['cpp'].has_header_symbol('stdio.h', 'vsnprintf')
|
||||||
libretro_defines += '-DMKXPZ_NO_VSNPRINTF'
|
libretro_defines += '-DMKXPZ_NO_VSNPRINTF'
|
||||||
endif
|
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')
|
if not compilers['cpp'].has_header_symbol('cmath', 'std::round')
|
||||||
libretro_defines += '-DMKXPZ_NO_STD_ROUND'
|
libretro_defines += '-DMKXPZ_NO_STD_ROUND'
|
||||||
endif
|
endif
|
||||||
|
@ -551,7 +575,6 @@ if is_libretro
|
||||||
cmake.subproject(host_system == 'darwin' ? 'zlib-darwin' : 'zlib', options: zlib_options).dependency('zlibstatic'),
|
cmake.subproject(host_system == 'darwin' ? 'zlib-darwin' : 'zlib', options: zlib_options).dependency('zlibstatic'),
|
||||||
cmake.subproject('physfs', options: physfs_options).dependency('physfs-static'),
|
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('OpenAL'),
|
||||||
cmake.subproject('openal-soft', options: openal_options).dependency('alsoft.fmt'),
|
|
||||||
cmake.subproject('fluidsynth', options: fluidsynth_options).dependency('libfluidsynth'),
|
cmake.subproject('fluidsynth', options: fluidsynth_options).dependency('libfluidsynth'),
|
||||||
cmake.subproject('ogg', options: ogg_options).dependency('ogg'),
|
cmake.subproject('ogg', options: ogg_options).dependency('ogg'),
|
||||||
cmake.subproject('vorbis', options: vorbis_options).dependency('vorbis'),
|
cmake.subproject('vorbis', options: vorbis_options).dependency('vorbis'),
|
||||||
|
@ -659,6 +682,7 @@ if is_libretro
|
||||||
'src/mkxp-polyfill.cpp',
|
'src/mkxp-polyfill.cpp',
|
||||||
'src/sharedstate.cpp',
|
'src/sharedstate.cpp',
|
||||||
'src/stb_image.cpp',
|
'src/stb_image.cpp',
|
||||||
|
'src/stb_snprintf.cpp',
|
||||||
'src/audio/alstream.cpp',
|
'src/audio/alstream.cpp',
|
||||||
'src/audio/audio.cpp',
|
'src/audio/audio.cpp',
|
||||||
'src/audio/audiostream.cpp',
|
'src/audio/audiostream.cpp',
|
||||||
|
|
|
@ -21,6 +21,8 @@
|
||||||
|
|
||||||
#include "alstream.h"
|
#include "alstream.h"
|
||||||
|
|
||||||
|
#include "mkxp-polyfill.h" // snprintf
|
||||||
|
|
||||||
#include "sharedstate.h"
|
#include "sharedstate.h"
|
||||||
#include "sharedmidistate.h"
|
#include "sharedmidistate.h"
|
||||||
#include "eventthread.h"
|
#include "eventthread.h"
|
||||||
|
@ -298,15 +300,11 @@ void ALStream::openSource(const std::string &filename)
|
||||||
|
|
||||||
if (!handler.source)
|
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];
|
char buf[512];
|
||||||
snprintf(buf, sizeof(buf), "Unable to decode audio stream: %s: %s",
|
snprintf(buf, sizeof(buf), "Unable to decode audio stream: %s: %s",
|
||||||
filename.c_str(), handler.errorMsg.c_str());
|
filename.c_str(), handler.errorMsg.c_str());
|
||||||
|
|
||||||
Debug() << buf;
|
Debug() << buf;
|
||||||
#endif // MKXPZ_RETRO
|
|
||||||
}
|
}
|
||||||
|
|
||||||
source = handler.source;
|
source = handler.source;
|
||||||
|
|
|
@ -21,6 +21,8 @@
|
||||||
|
|
||||||
#include "soundemitter.h"
|
#include "soundemitter.h"
|
||||||
|
|
||||||
|
#include "mkxp-polyfill.h" // snprintf
|
||||||
|
|
||||||
#include "sharedstate.h"
|
#include "sharedstate.h"
|
||||||
#include "filesystem.h"
|
#include "filesystem.h"
|
||||||
#include "exception.h"
|
#include "exception.h"
|
||||||
|
@ -304,14 +306,19 @@ SoundBuffer *SoundEmitter::allocateBuffer(const std::string &filename)
|
||||||
|
|
||||||
if (!buffer)
|
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];
|
char buf[512];
|
||||||
snprintf(buf, sizeof(buf), "Unable to decode sound: %s: %s", filename.c_str(), Sound_GetError());
|
snprintf(
|
||||||
Debug() << buf;
|
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
|
#endif // MKXPZ_RETRO
|
||||||
|
);
|
||||||
|
Debug() << buf;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
29
src/core.cpp
29
src/core.cpp
|
@ -24,10 +24,8 @@
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <cstdarg>
|
#include <cstdarg>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#ifdef MKXPZ_HAVE_ALIGNED_MALLOC
|
|
||||||
# include <malloc.h>
|
|
||||||
#endif
|
|
||||||
#include <boost/optional.hpp>
|
#include <boost/optional.hpp>
|
||||||
|
#include "mkxp-polyfill.h"
|
||||||
#include <alc.h>
|
#include <alc.h>
|
||||||
#include <alext.h>
|
#include <alext.h>
|
||||||
#include <fluidsynth.h>
|
#include <fluidsynth.h>
|
||||||
|
@ -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 uint8_t mkxp_retro_dist_zip[];
|
||||||
extern const size_t mkxp_retro_dist_zip_len;
|
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() {
|
extern "C" RETRO_API void retro_init() {
|
||||||
initialized = true;
|
initialized = true;
|
||||||
frame_buf = (uint32_t *)std::calloc(640 * 480, sizeof *frame_buf);
|
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() {
|
extern "C" RETRO_API void retro_deinit() {
|
||||||
free_align(sound_buf);
|
mkxp_aligned_free(sound_buf);
|
||||||
std::free(frame_buf);
|
std::free(frame_buf);
|
||||||
initialized = false;
|
initialized = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,8 @@
|
||||||
|
|
||||||
#include "filesystem.h"
|
#include "filesystem.h"
|
||||||
|
|
||||||
|
#include "mkxp-polyfill.h" // snprintf
|
||||||
|
|
||||||
#include "util/boost-hash.h"
|
#include "util/boost-hash.h"
|
||||||
#include "util/debugwriter.h"
|
#include "util/debugwriter.h"
|
||||||
#include "util/exception.h"
|
#include "util/exception.h"
|
||||||
|
@ -422,13 +424,10 @@ static PHYSFS_EnumerateCallbackResult cacheEnumCB(void *d, const char *origdir,
|
||||||
CacheEnumData &data = *static_cast<CacheEnumData *>(d);
|
CacheEnumData &data = *static_cast<CacheEnumData *>(d);
|
||||||
char fullPath[512];
|
char fullPath[512];
|
||||||
|
|
||||||
if (!*origdir) {
|
if (!*origdir)
|
||||||
std::strncpy(fullPath, fname, sizeof(fullPath));
|
snprintf(fullPath, sizeof(fullPath), "%s", fname);
|
||||||
} else {
|
else
|
||||||
std::strncpy(fullPath, origdir, sizeof(fullPath) - 1);
|
snprintf(fullPath, sizeof(fullPath), "%s/%s", origdir, fname);
|
||||||
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 */
|
/* Deal with OSX' weird UTF-8 standards */
|
||||||
data.toNFC(fullPath);
|
data.toNFC(fullPath);
|
||||||
|
@ -510,9 +509,7 @@ static PHYSFS_EnumerateCallbackResult fontSetEnumCB(void *data, const char *dir,
|
||||||
return PHYSFS_ENUM_OK;
|
return PHYSFS_ENUM_OK;
|
||||||
|
|
||||||
char filename[512];
|
char filename[512];
|
||||||
std::strncpy(filename, dir, sizeof(filename) - 1);
|
snprintf(filename, sizeof(filename), "%s/%s", dir, fname);
|
||||||
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);
|
PHYSFS_File *handle = PHYSFS_openRead(filename);
|
||||||
|
|
||||||
|
@ -605,9 +602,7 @@ openReadEnumCB(void *d, const char *dirpath, const char *filename) {
|
||||||
if (!*dirpath) {
|
if (!*dirpath) {
|
||||||
fullPath = filename;
|
fullPath = filename;
|
||||||
} else {
|
} else {
|
||||||
std::strncpy(buffer, dirpath, sizeof(buffer) - 1);
|
snprintf(buffer, sizeof(buffer), "%s/%s", dirpath, filename);
|
||||||
std::strncat(buffer, "/", sizeof(buffer) - 1 - std::strlen(buffer));
|
|
||||||
std::strncat(buffer, filename, sizeof(buffer) - 1 - std::strlen(buffer));
|
|
||||||
fullPath = buffer;
|
fullPath = buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,64 @@
|
||||||
|
|
||||||
#include "mkxp-polyfill.h"
|
#include "mkxp-polyfill.h"
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
#include <stb_sprintf.h>
|
||||||
|
|
||||||
|
#ifdef MKXPZ_HAVE_ALIGNED_MALLOC
|
||||||
|
# include <malloc.h>
|
||||||
|
#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)
|
#if defined(MKXPZ_NO_SEMAPHORE_H) && !defined(MKXPZ_NO_PTHREAD_H)
|
||||||
struct mkxp_sem_private {
|
struct mkxp_sem_private {
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <tgmath.h>
|
#include <tgmath.h>
|
||||||
|
#include <stdarg.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
@ -67,6 +68,30 @@ typedef void *mkxp_sem_t;
|
||||||
typedef unsigned int mkxp_sem_t;
|
typedef unsigned int mkxp_sem_t;
|
||||||
#endif
|
#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);
|
mkxp_thread_t mkxp_thread_self(void);
|
||||||
|
|
||||||
int mkxp_mutex_init(mkxp_mutex_t *mutex, bool recursive);
|
int mkxp_mutex_init(mkxp_mutex_t *mutex, bool recursive);
|
||||||
|
@ -209,6 +234,46 @@ namespace std {
|
||||||
}
|
}
|
||||||
# endif
|
# 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
|
# ifdef MKXPZ_NO_STD_ROUND
|
||||||
namespace std {
|
namespace std {
|
||||||
inline constexpr float round(float x) {
|
inline constexpr float round(float x) {
|
||||||
|
|
2
src/stb_snprintf.cpp
Normal file
2
src/stb_snprintf.cpp
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
#define STB_SPRINTF_IMPLEMENTATION
|
||||||
|
#include <stb_sprintf.h>
|
|
@ -25,6 +25,7 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
#include "mkxp-polyfill.h" // vsnprintf
|
||||||
|
|
||||||
struct Exception
|
struct Exception
|
||||||
{
|
{
|
||||||
|
@ -53,7 +54,6 @@ struct Exception
|
||||||
Exception(Type type, const char *format, ...)
|
Exception(Type type, const char *format, ...)
|
||||||
: type(type)
|
: type(type)
|
||||||
{
|
{
|
||||||
#ifndef MKXPZ_NO_VSNPRINTF
|
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start(ap, format);
|
va_start(ap, format);
|
||||||
|
|
||||||
|
@ -61,7 +61,6 @@ struct Exception
|
||||||
vsnprintf(&msg[0], msg.size(), format, ap);
|
vsnprintf(&msg[0], msg.size(), format, ap);
|
||||||
|
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
[wrap-git]
|
[wrap-git]
|
||||||
url = https://github.com/kcat/openal-soft
|
url = https://github.com/kcat/openal-soft
|
||||||
revision = 1.24.2
|
revision = 1.23.1
|
||||||
depth = 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
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
--- a/core/logging.cpp
|
--- a/core/logging.cpp
|
||||||
+++ b/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
|
@@ -70,20 +70,20 @@ void al_print(LogLevel level, FILE *logfile, const char *fmt, ...)
|
||||||
* non-Release builds.
|
|
||||||
*/
|
*/
|
||||||
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__)
|
-#elif defined(__ANDROID__)
|
||||||
- auto android_severity = [](LogLevel l) noexcept
|
- auto android_severity = [](LogLevel l) noexcept
|
||||||
- {
|
- {
|
||||||
|
@ -20,9 +20,21 @@
|
||||||
- }
|
- }
|
||||||
- return ANDROID_LOG_ERROR;
|
- return ANDROID_LOG_ERROR;
|
||||||
- };
|
- };
|
||||||
- /* NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg) */
|
- __android_log_print(android_severity(level), "openal", "%s", str);
|
||||||
- __android_log_print(android_severity(level), "openal", "%.*s%s", al::sizei(prefix),
|
+
|
||||||
- prefix.data(), msg.c_str());
|
+
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
auto cblock = std::lock_guard{LogCallbackMutex};
|
|
||||||
|
|
|
@ -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<gsl::owner<T*>>::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<ContextBase::AsyncEventBitset>::is_always_lock_free, "atomic<bitset> isn't lock-free");
|
|
||||||
-#endif
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+
|
|
||||||
|
|
||||||
ContextBase::ContextBase(DeviceBase *device) : mDevice{device}
|
|
||||||
-{ assert(mEnabledEvts.is_lock_free()); }
|
|
||||||
+{ }
|
|
||||||
|
|
||||||
ContextBase::~ContextBase()
|
|
||||||
{
|
|
|
@ -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")
|
|
||||||
|
|
295
subprojects/packagefiles/openal-soft-config.patch
Normal file
295
subprojects/packagefiles/openal-soft-config.patch
Normal file
|
@ -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<char*>(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
|
||||||
|
|
|
@ -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<AmbiScaling>
|
|
||||||
@@ -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<int>(model))};
|
|
||||||
+ abort();
|
|
||||||
}
|
|
||||||
|
|
||||||
enum PropertyValue : ALenum {
|
|
||||||
--- a/common/alstring.h
|
|
||||||
+++ b/common/alstring.h
|
|
||||||
@@ -22,15 +22,15 @@ auto sizei(const std::basic_string<Ts...> &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<UInt>() + 1];
|
|
||||||
+ char buffer[digits10<UInt>() + 1] = {};
|
|
||||||
if (is_constant_evaluated()) fill_n(buffer, sizeof(buffer), '\0');
|
|
||||||
do_format_decimal(buffer, value, num_digits);
|
|
||||||
return copy_noinline<Char>(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<UInt>()];
|
|
||||||
+ char buffer[num_bits<UInt>()] = {};
|
|
||||||
if (is_constant_evaluated()) fill_n(buffer, sizeof(buffer), '\0');
|
|
||||||
format_base2e(base_bits, buffer, value, num_digits, upper);
|
|
||||||
return detail::copy_noinline<Char>(buffer, buffer + num_digits, out);
|
|
||||||
@@ -2015,7 +2015,7 @@ FMT_CONSTEXPR FMT_INLINE auto write_int(OutputIt out, write_int_arg<T> arg,
|
|
||||||
static_assert(std::is_same<T, uint32_or_64_or_128_t<T>>::value, "");
|
|
||||||
|
|
||||||
constexpr int buffer_size = num_bits<T>();
|
|
||||||
- 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;
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
--- a/CMakeLists.txt
|
--- a/CMakeLists.txt
|
||||||
+++ b/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!")
|
message(FATAL_ERROR "PThreads is required for non-Windows builds!")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
|
@ -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.
|
|
|
@ -3,47 +3,47 @@
|
||||||
|
|
||||||
--- a/include/AL/al.h
|
--- a/include/AL/al.h
|
||||||
+++ b/include/AL/al.h
|
+++ b/include/AL/al.h
|
||||||
@@ -3,7 +3,7 @@
|
@@ -2,7 +2,7 @@
|
||||||
|
#define AL_AL_H
|
||||||
|
|
||||||
/* NOLINTBEGIN */
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
-extern "C" {
|
-extern "C" {
|
||||||
+
|
+
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef _MSVC_LANG
|
#ifndef AL_API
|
||||||
#define AL_CPLUSPLUS _MSVC_LANG
|
@@ -668,7 +668,7 @@ typedef void (AL_APIENTRY *LPALSPEEDOFSOUND)(ALfloat value);
|
||||||
@@ -700,7 +700,7 @@ typedef void (AL_APIENTRY *LPALSPEEDOFSOUND)(ALfloat value) AL_API_NOEX
|
typedef void (AL_APIENTRY *LPALDISTANCEMODEL)(ALenum distanceModel);
|
||||||
typedef void (AL_APIENTRY *LPALDISTANCEMODEL)(ALenum distanceModel) AL_API_NOEXCEPT17;
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
-} /* extern "C" */
|
-} /* extern "C" */
|
||||||
+
|
+
|
||||||
#endif
|
#endif
|
||||||
/* NOLINTEND */
|
|
||||||
|
|
||||||
|
#endif /* AL_AL_H */
|
||||||
--- a/include/AL/alc.h
|
--- a/include/AL/alc.h
|
||||||
+++ b/include/AL/alc.h
|
+++ b/include/AL/alc.h
|
||||||
@@ -3,7 +3,7 @@
|
@@ -2,7 +2,7 @@
|
||||||
|
#define AL_ALC_H
|
||||||
|
|
||||||
/* NOLINTBEGIN */
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
-extern "C" {
|
-extern "C" {
|
||||||
+
|
+
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef _MSVC_LANG
|
#ifndef ALC_API
|
||||||
#define ALC_CPLUSPLUS _MSVC_LANG
|
@@ -268,7 +268,7 @@ typedef void (ALC_APIENTRY *LPALCCAPTURESTOP)(ALCdevice *device);
|
||||||
@@ -300,7 +300,7 @@ typedef void (ALC_APIENTRY *LPALCCAPTURESTOP)(ALCdevice *device) ALC_A
|
typedef void (ALC_APIENTRY *LPALCCAPTURESAMPLES)(ALCdevice *device, ALCvoid *buffer, ALCsizei samples);
|
||||||
typedef void (ALC_APIENTRY *LPALCCAPTURESAMPLES)(ALCdevice *device, ALCvoid *buffer, ALCsizei samples) ALC_API_NOEXCEPT17;
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
-} /* extern "C" */
|
-} /* extern "C" */
|
||||||
+
|
+
|
||||||
#endif
|
#endif
|
||||||
/* NOLINTEND */
|
|
||||||
|
|
||||||
|
#endif /* AL_ALC_H */
|
||||||
--- a/include/AL/alext.h
|
--- a/include/AL/alext.h
|
||||||
+++ b/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"
|
#include "al.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -51,19 +51,19 @@
|
||||||
+
|
+
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct _GUID;
|
#ifndef AL_LOKI_IMA_ADPCM_format
|
||||||
@@ -1085,7 +1085,7 @@ ALenum AL_APIENTRY EAXGetBufferModeDirect(ALCcontext *context, ALuint buffer, AL
|
@@ -649,7 +649,7 @@ void AL_APIENTRY alSourcePlayAtTimevSOFT(ALsizei n, const ALuint *sources, ALint
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
-}
|
-}
|
||||||
+
|
+
|
||||||
#endif
|
#endif
|
||||||
/* NOLINTEND */
|
|
||||||
|
|
||||||
|
#endif
|
||||||
--- a/include/AL/efx.h
|
--- a/include/AL/efx.h
|
||||||
+++ b/include/AL/efx.h
|
+++ b/include/AL/efx.h
|
||||||
@@ -8,7 +8,7 @@
|
@@ -7,7 +7,7 @@
|
||||||
#include "al.h"
|
#include "al.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -72,12 +72,12 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define ALC_EXT_EFX_NAME "ALC_EXT_EFX"
|
#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
|
#ifdef __cplusplus
|
||||||
-} /* extern "C" */
|
-} /* extern "C" */
|
||||||
+
|
+
|
||||||
#endif
|
#endif
|
||||||
/* NOLINTEND */
|
|
||||||
|
|
||||||
|
#endif /* AL_EFX_H */
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
--- a/al/event.cpp
|
--- a/al/event.cpp
|
||||||
+++ b/al/event.cpp
|
+++ b/al/event.cpp
|
||||||
@@ -149,34 +149,34 @@ constexpr std::optional<AsyncEnableBits> GetEventType(ALenum etype) noexcept
|
@@ -116,34 +116,34 @@ static int EventThread(ALCcontext *context)
|
||||||
|
|
||||||
void StartEventThrd(ALCcontext *ctx)
|
void StartEventThrd(ALCcontext *ctx)
|
||||||
{
|
{
|
||||||
|
@ -10,10 +10,10 @@
|
||||||
- ctx->mEventThread = std::thread{EventThread, ctx};
|
- ctx->mEventThread = std::thread{EventThread, ctx};
|
||||||
- }
|
- }
|
||||||
- catch(std::exception& e) {
|
- catch(std::exception& e) {
|
||||||
- ERR("Failed to start event thread: {}", e.what());
|
- ERR("Failed to start event thread: %s\n", e.what());
|
||||||
- }
|
- }
|
||||||
- catch(...) {
|
- 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)
|
void StopEventThrd(ALCcontext *ctx)
|
||||||
{
|
{
|
||||||
- RingBuffer *ring{ctx->mAsyncEvents.get()};
|
- RingBuffer *ring{ctx->mAsyncEvents.get()};
|
||||||
- auto evt_data = ring->getWriteVector()[0];
|
- auto evt_data = ring->getWriteVector().first;
|
||||||
- if(evt_data.len == 0)
|
- if(evt_data.len == 0)
|
||||||
- {
|
- {
|
||||||
- do {
|
- do {
|
||||||
- std::this_thread::yield();
|
- std::this_thread::yield();
|
||||||
- evt_data = ring->getWriteVector()[0];
|
- evt_data = ring->getWriteVector().first;
|
||||||
- } while(evt_data.len == 0);
|
- } while(evt_data.len == 0);
|
||||||
- }
|
- }
|
||||||
- std::ignore = InitAsyncEvent<AsyncKillThread>(evt_data.buf);
|
- al::construct_at(reinterpret_cast<AsyncEvent*>(evt_data.buf), AsyncEvent::KillThread);
|
||||||
- ring->writeAdvance(1);
|
- ring->writeAdvance(1);
|
||||||
|
|
||||||
- ctx->mEventSem.post();
|
- 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<EffectSlot*>;
|
||||||
|
std::atomic<EffectSlotArray*> mActiveAuxSlots{nullptr};
|
||||||
|
|
||||||
|
- std::thread mEventThread;
|
||||||
|
+
|
||||||
|
al::semaphore mEventSem;
|
||||||
|
std::unique_ptr<RingBuffer> mAsyncEvents;
|
||||||
|
using AsyncEventBitset = std::bitset<AsyncEvent::UserEventCount>;
|
||||||
|
|
|
@ -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<WCHAR,CoTaskMemDeleter> 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<unsigned char,PATH_MAX> fileName{};
|
|
||||||
- if(configURL && CFURLGetFileSystemRepresentation(configURL, true, fileName.data(), fileName.size()))
|
|
||||||
- {
|
|
||||||
- if(std::ifstream f{reinterpret_cast<char*>(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<std::string> 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<unsigned>(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<std::size_t>(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<std::size_t>(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<std::string> EnumerateHrtf(std::optional<std::string> pathopt)
|
|
||||||
std::lock_guard<std::mutex> enumlock{EnumeratedHrtfLock};
|
|
||||||
EnumeratedHrtfs.clear();
|
|
||||||
|
|
||||||
- for(const auto &fname : SearchDataFiles(".mhr"sv))
|
|
||||||
- AddFileEntry(fname);
|
|
||||||
+
|
|
||||||
+
|
|
||||||
|
|
||||||
bool usedefaults{true};
|
|
||||||
if(pathopt)
|
|
||||||
@@ -1230,16 +1230,16 @@ std::vector<std::string> EnumerateHrtf(std::optional<std::string> 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::ifstream>(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<HrtfStore>{};
|
|
|
@ -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 <typename F>
|
|
||||||
struct has_flockfile<F, void_t<decltype(flockfile(&std::declval<F&>()))>>
|
|
||||||
- : std::true_type {};
|
|
||||||
+ : std::false_type {};
|
|
||||||
|
|
||||||
// A FILE wrapper. F is FILE defined as a template parameter to make system API
|
|
||||||
// detection work.
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
--- a/alc/alu.cpp
|
--- a/alc/alu.cpp
|
||||||
+++ b/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
|
template<> inline float SampleConv(float val) noexcept
|
||||||
{ return val; }
|
{ return val; }
|
||||||
|
@ -12,17 +12,17 @@
|
||||||
{
|
{
|
||||||
/* Floats have a 23-bit mantissa, plus an implied 1 bit and a sign bit.
|
/* 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.
|
* 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__
|
+#ifdef __DEVKITARM__
|
||||||
+template<> inline long SampleConv(float val) noexcept { return (long)SampleConv<int>(val); }
|
+template<> inline long SampleConv(float val) noexcept { return (long)SampleConv<int>(val); }
|
||||||
+#endif
|
+#endif
|
||||||
template<> inline int16_t SampleConv(float val) noexcept
|
template<> inline int16_t SampleConv(float val) noexcept
|
||||||
{ return static_cast<int16_t>(fastf2i(std::clamp(val*32768.0f, -32768.0f, 32767.0f))); }
|
{ return static_cast<int16_t>(fastf2i(clampf(val*32768.0f, -32768.0f, 32767.0f))); }
|
||||||
template<> inline int8_t SampleConv(float val) noexcept
|
template<> inline int8_t SampleConv(float val) noexcept
|
||||||
{ return static_cast<int8_t>(fastf2i(std::clamp(val*128.0f, -128.0f, 127.0f))); }
|
{ return static_cast<int8_t>(fastf2i(clampf(val*128.0f, -128.0f, 127.0f))); }
|
||||||
|
|
||||||
/* Define unsigned output variations. */
|
/* Define unsigned output variations. */
|
||||||
-template<> inline uint32_t SampleConv(float val) noexcept
|
-template<> inline uint32_t SampleConv(float val) noexcept
|
||||||
|
@ -32,30 +32,30 @@
|
||||||
{ return static_cast<uint16_t>(SampleConv<int16_t>(val) + 32768); }
|
{ return static_cast<uint16_t>(SampleConv<int16_t>(val) + 32768); }
|
||||||
--- a/core/converter.cpp
|
--- a/core/converter.cpp
|
||||||
+++ b/core/converter.cpp
|
+++ b/core/converter.cpp
|
||||||
@@ -83,16 +83,16 @@ inline DevFmtType_t<T> StoreSample(float) noexcept;
|
@@ -80,16 +80,16 @@ inline DevFmtType_t<T> StoreSample(float) noexcept;
|
||||||
|
|
||||||
template<> inline float StoreSample<DevFmtFloat>(float val) noexcept
|
template<> inline float StoreSample<DevFmtFloat>(float val) noexcept
|
||||||
{ return val; }
|
{ return val; }
|
||||||
-template<> inline int32_t StoreSample<DevFmtInt>(float val) noexcept
|
-template<> inline int32_t StoreSample<DevFmtInt>(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<DevFmtInt>(float val) noexcept
|
+template<> inline int StoreSample<DevFmtInt>(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<DevFmtShort>(float val) noexcept
|
template<> inline int16_t StoreSample<DevFmtShort>(float val) noexcept
|
||||||
{ return static_cast<int16_t>(fastf2i(std::clamp(val*32768.0f, -32768.0f, 32767.0f))); }
|
{ return static_cast<int16_t>(fastf2i(clampf(val*32768.0f, -32768.0f, 32767.0f))); }
|
||||||
template<> inline int8_t StoreSample<DevFmtByte>(float val) noexcept
|
template<> inline int8_t StoreSample<DevFmtByte>(float val) noexcept
|
||||||
{ return static_cast<int8_t>(fastf2i(std::clamp(val*128.0f, -128.0f, 127.0f))); }
|
{ return static_cast<int8_t>(fastf2i(clampf(val*128.0f, -128.0f, 127.0f))); }
|
||||||
|
|
||||||
/* Define unsigned output variations. */
|
/* Define unsigned output variations. */
|
||||||
-template<> inline uint32_t StoreSample<DevFmtUInt>(float val) noexcept
|
-template<> inline uint32_t StoreSample<DevFmtUInt>(float val) noexcept
|
||||||
-{ return static_cast<uint32_t>(StoreSample<DevFmtInt>(val)) + 2147483648u; }
|
-{ return static_cast<uint32_t>(StoreSample<DevFmtInt>(val)) + 2147483648u; }
|
||||||
+template<> inline unsigned int StoreSample<DevFmtUInt>(float val) noexcept
|
+template<> inline unsigned int StoreSample<DevFmtUInt>(float val) noexcept
|
||||||
+{ static_assert(sizeof(unsigned int) == sizeof(uint32_t), "`unsigned int` should be a 32-bit integer"); return static_cast<unsigned int>(StoreSample<DevFmtInt>(val)) + 2147483648u; }
|
+{ static_assert(sizeof(unsigned int) == sizeof(uint32_t), "`unsigned int` should be a 32-bit integer"); return static_cast<uint32_t>(StoreSample<DevFmtInt>(val)) + 2147483648u; }
|
||||||
template<> inline uint16_t StoreSample<DevFmtUShort>(float val) noexcept
|
template<> inline uint16_t StoreSample<DevFmtUShort>(float val) noexcept
|
||||||
{ return static_cast<uint16_t>(StoreSample<DevFmtShort>(val) + 32768); }
|
{ return static_cast<uint16_t>(StoreSample<DevFmtShort>(val) + 32768); }
|
||||||
template<> inline uint8_t StoreSample<DevFmtUByte>(float val) noexcept
|
template<> inline uint8_t StoreSample<DevFmtUByte>(float val) noexcept
|
||||||
--- a/core/devformat.h
|
--- a/core/devformat.h
|
||||||
+++ b/core/devformat.h
|
+++ b/core/devformat.h
|
||||||
@@ -94,9 +94,9 @@ struct DevFmtTypeTraits<DevFmtShort> { using Type = int16_t; };
|
@@ -86,9 +86,9 @@ struct DevFmtTypeTraits<DevFmtShort> { using Type = int16_t; };
|
||||||
template<>
|
template<>
|
||||||
struct DevFmtTypeTraits<DevFmtUShort> { using Type = uint16_t; };
|
struct DevFmtTypeTraits<DevFmtUShort> { using Type = uint16_t; };
|
||||||
template<>
|
template<>
|
||||||
|
|
|
@ -2,15 +2,15 @@
|
||||||
|
|
||||||
--- a/al/auxeffectslot.cpp
|
--- a/al/auxeffectslot.cpp
|
||||||
+++ b/al/auxeffectslot.cpp
|
+++ b/al/auxeffectslot.cpp
|
||||||
@@ -28,7 +28,7 @@
|
@@ -27,7 +27,7 @@
|
||||||
#include <functional>
|
#include <cstdint>
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
-#include <mutex>
|
-#include <mutex>
|
||||||
+#include "../../src/mkxp-polyfill.h"
|
+#include "../../src/mkxp-polyfill.h"
|
||||||
#include <numeric>
|
#include <numeric>
|
||||||
#include <stdexcept>
|
#include <thread>
|
||||||
#include <tuple>
|
|
||||||
--- a/al/buffer.cpp
|
--- a/al/buffer.cpp
|
||||||
+++ b/al/buffer.cpp
|
+++ b/al/buffer.cpp
|
||||||
@@ -32,7 +32,7 @@
|
@@ -32,7 +32,7 @@
|
||||||
|
@ -19,20 +19,9 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
-#include <mutex>
|
-#include <mutex>
|
||||||
+#include "../../src/mkxp-polyfill.h"
|
+#include "../../src/mkxp-polyfill.h"
|
||||||
|
#include <new>
|
||||||
#include <numeric>
|
#include <numeric>
|
||||||
#include <optional>
|
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
--- a/al/debug.cpp
|
|
||||||
+++ b/al/debug.cpp
|
|
||||||
@@ -7,7 +7,7 @@
|
|
||||||
#include <atomic>
|
|
||||||
#include <cstring>
|
|
||||||
#include <deque>
|
|
||||||
-#include <mutex>
|
|
||||||
+#include "../../src/mkxp-polyfill.h"
|
|
||||||
#include <optional>
|
|
||||||
#include <stdexcept>
|
|
||||||
#include <string>
|
|
||||||
--- a/al/effect.cpp
|
--- a/al/effect.cpp
|
||||||
+++ b/al/effect.cpp
|
+++ b/al/effect.cpp
|
||||||
@@ -27,7 +27,7 @@
|
@@ -27,7 +27,7 @@
|
||||||
|
@ -41,20 +30,31 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
-#include <mutex>
|
-#include <mutex>
|
||||||
+#include "../../src/mkxp-polyfill.h"
|
+#include "../../src/mkxp-polyfill.h"
|
||||||
|
#include <new>
|
||||||
#include <numeric>
|
#include <numeric>
|
||||||
#include <string>
|
#include <utility>
|
||||||
#include <type_traits>
|
--- a/al/error.cpp
|
||||||
|
+++ b/al/error.cpp
|
||||||
|
@@ -30,7 +30,7 @@
|
||||||
|
#include <cstdarg>
|
||||||
|
#include <cstdio>
|
||||||
|
#include <cstring>
|
||||||
|
-#include <mutex>
|
||||||
|
+#include "../../src/mkxp-polyfill.h"
|
||||||
|
|
||||||
|
#include "AL/al.h"
|
||||||
|
#include "AL/alc.h"
|
||||||
--- a/al/event.cpp
|
--- a/al/event.cpp
|
||||||
+++ b/al/event.cpp
|
+++ b/al/event.cpp
|
||||||
@@ -7,7 +7,7 @@
|
@@ -8,7 +8,7 @@
|
||||||
#include <bitset>
|
#include <cstring>
|
||||||
#include <exception>
|
#include <exception>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
-#include <mutex>
|
-#include <mutex>
|
||||||
+#include "../../src/mkxp-polyfill.h"
|
+#include "../../src/mkxp-polyfill.h"
|
||||||
#include <new>
|
#include <new>
|
||||||
#include <optional>
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <thread>
|
||||||
--- a/al/filter.cpp
|
--- a/al/filter.cpp
|
||||||
+++ b/al/filter.cpp
|
+++ b/al/filter.cpp
|
||||||
@@ -28,7 +28,7 @@
|
@@ -28,7 +28,7 @@
|
||||||
|
@ -63,14 +63,14 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
-#include <mutex>
|
-#include <mutex>
|
||||||
+#include "../../src/mkxp-polyfill.h"
|
+#include "../../src/mkxp-polyfill.h"
|
||||||
|
#include <new>
|
||||||
#include <numeric>
|
#include <numeric>
|
||||||
#include <unordered_map>
|
|
||||||
#include <vector>
|
|
||||||
--- a/al/listener.cpp
|
--- a/al/listener.cpp
|
||||||
+++ b/al/listener.cpp
|
+++ b/al/listener.cpp
|
||||||
@@ -24,7 +24,7 @@
|
@@ -23,7 +23,7 @@
|
||||||
|
#include "listener.h"
|
||||||
|
|
||||||
#include <algorithm>
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
-#include <mutex>
|
-#include <mutex>
|
||||||
+#include "../../src/mkxp-polyfill.h"
|
+#include "../../src/mkxp-polyfill.h"
|
||||||
|
@ -79,38 +79,38 @@
|
||||||
#include "AL/alc.h"
|
#include "AL/alc.h"
|
||||||
--- a/al/source.cpp
|
--- a/al/source.cpp
|
||||||
+++ b/al/source.cpp
|
+++ b/al/source.cpp
|
||||||
@@ -34,7 +34,7 @@
|
@@ -35,7 +35,7 @@
|
||||||
#include <iterator>
|
|
||||||
#include <limits>
|
|
||||||
#include <memory>
|
|
||||||
-#include <mutex>
|
|
||||||
+#include "../../src/mkxp-polyfill.h"
|
|
||||||
#include <numeric>
|
|
||||||
#include <optional>
|
|
||||||
#include <stdexcept>
|
|
||||||
--- a/al/state.cpp
|
|
||||||
+++ b/al/state.cpp
|
|
||||||
@@ -26,7 +26,7 @@
|
|
||||||
#include <atomic>
|
|
||||||
#include <cmath>
|
|
||||||
#include <deque>
|
|
||||||
-#include <mutex>
|
|
||||||
+#include "../../src/mkxp-polyfill.h"
|
|
||||||
#include <optional>
|
|
||||||
#include <stdexcept>
|
|
||||||
#include <string>
|
|
||||||
--- a/alc/alc.cpp
|
|
||||||
+++ b/alc/alc.cpp
|
|
||||||
@@ -48,7 +48,7 @@
|
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
-#include <mutex>
|
-#include <mutex>
|
||||||
+#include "../../src/mkxp-polyfill.h"
|
+#include "../../src/mkxp-polyfill.h"
|
||||||
#include <new>
|
#include <new>
|
||||||
#include <optional>
|
#include <numeric>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
@@ -314,7 +314,7 @@ std::atomic<ALCenum> LastNullDeviceError{ALC_NO_ERROR};
|
--- a/al/state.cpp
|
||||||
|
+++ b/al/state.cpp
|
||||||
|
@@ -24,7 +24,7 @@
|
||||||
|
|
||||||
|
#include <atomic>
|
||||||
|
#include <cmath>
|
||||||
|
-#include <mutex>
|
||||||
|
+#include "../../src/mkxp-polyfill.h"
|
||||||
|
#include <stdexcept>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
--- a/alc/alc.cpp
|
||||||
|
+++ b/alc/alc.cpp
|
||||||
|
@@ -46,7 +46,7 @@
|
||||||
|
#include <iterator>
|
||||||
|
#include <limits>
|
||||||
|
#include <memory>
|
||||||
|
-#include <mutex>
|
||||||
|
+#include "../../src/mkxp-polyfill.h"
|
||||||
|
#include <new>
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <stdexcept>
|
||||||
|
@@ -956,7 +956,7 @@ std::atomic<ALCenum> LastNullDeviceError{ALC_NO_ERROR};
|
||||||
bool TrapALCError{false};
|
bool TrapALCError{false};
|
||||||
|
|
||||||
/* One-time configuration init control */
|
/* One-time configuration init control */
|
||||||
|
@ -119,7 +119,7 @@
|
||||||
|
|
||||||
/* Flag to specify if alcSuspendContext/alcProcessContext should defer/process
|
/* Flag to specify if alcSuspendContext/alcProcessContext should defer/process
|
||||||
* updates.
|
* updates.
|
||||||
@@ -743,7 +743,7 @@ void alc_initconfig()
|
@@ -1370,7 +1370,7 @@ void alc_initconfig(void)
|
||||||
#endif // ALSOFT_EAX
|
#endif // ALSOFT_EAX
|
||||||
}
|
}
|
||||||
inline void InitConfig()
|
inline void InitConfig()
|
||||||
|
@ -130,157 +130,191 @@
|
||||||
/************************************************
|
/************************************************
|
||||||
--- a/alc/alconfig.cpp
|
--- a/alc/alconfig.cpp
|
||||||
+++ b/alc/alconfig.cpp
|
+++ b/alc/alconfig.cpp
|
||||||
@@ -37,7 +37,7 @@
|
@@ -35,7 +35,7 @@
|
||||||
#include <fstream>
|
|
||||||
#include <istream>
|
#include <algorithm>
|
||||||
#include <limits>
|
#include <cstdio>
|
||||||
-#include <string>
|
-#include <string>
|
||||||
+#include "../../src/mkxp-polyfill.h"
|
+#include "../../src/mkxp-polyfill.h"
|
||||||
#include <string_view>
|
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <vector>
|
|
||||||
--- a/alc/backends/alsa.cpp
|
|
||||||
+++ b/alc/backends/alsa.cpp
|
|
||||||
@@ -30,7 +30,7 @@
|
|
||||||
#include <cstring>
|
|
||||||
#include <exception>
|
|
||||||
#include <memory>
|
|
||||||
-#include <mutex>
|
|
||||||
+#include "../../src/mkxp-polyfill.h"
|
|
||||||
#include <string>
|
|
||||||
#include <string_view>
|
|
||||||
#include <thread>
|
|
||||||
--- a/alc/backends/jack.cpp
|
|
||||||
+++ b/alc/backends/jack.cpp
|
|
||||||
@@ -27,7 +27,7 @@
|
|
||||||
#include <cstdio>
|
|
||||||
#include <cstring>
|
|
||||||
#include <memory.h>
|
|
||||||
-#include <mutex>
|
|
||||||
+#include "../../src/mkxp-polyfill.h"
|
|
||||||
#include <thread>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
--- a/alc/backends/opensl.cpp
|
#include "alfstream.h"
|
||||||
+++ b/alc/backends/opensl.cpp
|
@@ -493,21 +493,21 @@ al::optional<std::string> ConfigValueStr(const char *devName, const char *blockN
|
||||||
@@ -28,7 +28,7 @@
|
al::optional<int> ConfigValueInt(const char *devName, const char *blockName, const char *keyName)
|
||||||
#include <array>
|
{
|
||||||
#include <cstdlib>
|
if(const char *val{GetConfigValue(devName, blockName, keyName)})
|
||||||
#include <cstring>
|
- return static_cast<int>(std::strtol(val, nullptr, 0));
|
||||||
-#include <mutex>
|
+ return static_cast<int>(std::stol(val, nullptr, 0));
|
||||||
+#include "../../src/mkxp-polyfill.h"
|
return al::nullopt;
|
||||||
#include <new>
|
}
|
||||||
#include <thread>
|
|
||||||
#include <functional>
|
al::optional<unsigned int> ConfigValueUInt(const char *devName, const char *blockName, const char *keyName)
|
||||||
--- a/alc/backends/otherio.cpp
|
{
|
||||||
+++ b/alc/backends/otherio.cpp
|
if(const char *val{GetConfigValue(devName, blockName, keyName)})
|
||||||
@@ -49,7 +49,7 @@
|
- return static_cast<unsigned int>(std::strtoul(val, nullptr, 0));
|
||||||
#include <cstring>
|
+ return static_cast<unsigned int>(std::stoul(val, nullptr, 0));
|
||||||
#include <deque>
|
return al::nullopt;
|
||||||
#include <future>
|
}
|
||||||
-#include <mutex>
|
|
||||||
+#include "../../src/mkxp-polyfill.h"
|
al::optional<float> ConfigValueFloat(const char *devName, const char *blockName, const char *keyName)
|
||||||
#include <string>
|
{
|
||||||
#include <string_view>
|
if(const char *val{GetConfigValue(devName, blockName, keyName)})
|
||||||
#include <thread>
|
- return std::strtof(val, nullptr);
|
||||||
--- a/alc/backends/pipewire.cpp
|
+ return std::stof(val, nullptr);
|
||||||
+++ b/alc/backends/pipewire.cpp
|
return al::nullopt;
|
||||||
@@ -37,7 +37,7 @@
|
}
|
||||||
#include <ctime>
|
|
||||||
#include <iterator>
|
|
||||||
#include <memory>
|
|
||||||
-#include <mutex>
|
|
||||||
+#include "../../src/mkxp-polyfill.h"
|
|
||||||
#include <optional>
|
|
||||||
#include <string_view>
|
|
||||||
#include <thread>
|
|
||||||
--- a/alc/backends/pulseaudio.cpp
|
|
||||||
+++ b/alc/backends/pulseaudio.cpp
|
|
||||||
@@ -33,7 +33,7 @@
|
|
||||||
#include <cstdint>
|
|
||||||
#include <cstring>
|
|
||||||
#include <limits>
|
|
||||||
-#include <mutex>
|
|
||||||
+#include "../../src/mkxp-polyfill.h"
|
|
||||||
#include <optional>
|
|
||||||
#include <string>
|
|
||||||
#include <string_view>
|
|
||||||
--- a/alc/backends/wasapi.cpp
|
|
||||||
+++ b/alc/backends/wasapi.cpp
|
|
||||||
@@ -52,7 +52,7 @@
|
|
||||||
#include <condition_variable>
|
|
||||||
#include <cstring>
|
|
||||||
#include <future>
|
|
||||||
-#include <mutex>
|
|
||||||
+#include "../../src/mkxp-polyfill.h"
|
|
||||||
#include <string>
|
|
||||||
#include <string_view>
|
|
||||||
#include <thread>
|
|
||||||
--- a/alc/context.h
|
--- a/alc/context.h
|
||||||
+++ b/alc/context.h
|
+++ b/alc/context.h
|
||||||
@@ -8,7 +8,7 @@
|
@@ -3,7 +3,7 @@
|
||||||
#include <cstdint>
|
|
||||||
#include <deque>
|
|
||||||
#include <memory>
|
|
||||||
-#include <mutex>
|
|
||||||
+#include "../../src/mkxp-polyfill.h"
|
|
||||||
#include <string>
|
|
||||||
#include <string_view>
|
|
||||||
#include <unordered_map>
|
|
||||||
--- a/alc/device.h
|
|
||||||
+++ b/alc/device.h
|
|
||||||
@@ -5,7 +5,7 @@
|
|
||||||
|
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
-#include <mutex>
|
-#include <mutex>
|
||||||
+#include "../../src/mkxp-polyfill.h"
|
+#include "../../src/mkxp-polyfill.h"
|
||||||
#include <optional>
|
#include <stdint.h>
|
||||||
#include <string>
|
#include <utility>
|
||||||
#include <unordered_map>
|
|
||||||
--- a/alc/events.h
|
|
||||||
+++ b/alc/events.h
|
|
||||||
@@ -5,7 +5,7 @@
|
|
||||||
#include "opthelpers.h"
|
|
||||||
|
|
||||||
#include <bitset>
|
--- a/alc/device.h
|
||||||
|
+++ b/alc/device.h
|
||||||
|
@@ -3,7 +3,7 @@
|
||||||
|
|
||||||
|
#include <atomic>
|
||||||
|
#include <memory>
|
||||||
-#include <mutex>
|
-#include <mutex>
|
||||||
+#include "../../src/mkxp-polyfill.h"
|
+#include "../../src/mkxp-polyfill.h"
|
||||||
#include <optional>
|
#include <stdint.h>
|
||||||
#include <string_view>
|
#include <string>
|
||||||
|
#include <utility>
|
||||||
--- a/common/alassert.cpp
|
--- a/alc/effects/base.h
|
||||||
+++ b/common/alassert.cpp
|
+++ b/alc/effects/base.h
|
||||||
@@ -2,7 +2,7 @@
|
@@ -2,7 +2,7 @@
|
||||||
#include "alassert.h"
|
#define EFFECTS_BASE_H
|
||||||
|
|
||||||
#include <stdexcept>
|
#include "core/effects/base.h"
|
||||||
-#include <string>
|
-
|
||||||
|
+#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 <malloc.h>
|
||||||
|
#endif
|
||||||
|
-
|
||||||
+#include "../../src/mkxp-polyfill.h"
|
+#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
|
-#if defined(HAVE_POSIX_MEMALIGN)
|
||||||
+++ b/common/alsem.cpp
|
- void *ret{};
|
||||||
@@ -55,8 +55,6 @@ void semaphore::post()
|
- 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<void**>(ptr) - 1));
|
||||||
|
--- a/common/threads.cpp
|
||||||
|
+++ b/common/threads.cpp
|
||||||
|
@@ -86,47 +86,47 @@ void semaphore::post()
|
||||||
void semaphore::wait() noexcept
|
void semaphore::wait() noexcept
|
||||||
{ WaitForSingleObject(static_cast<HANDLE>(mSem), INFINITE); }
|
{ WaitForSingleObject(static_cast<HANDLE>(mSem), INFINITE); }
|
||||||
|
|
||||||
-bool semaphore::try_wait() noexcept
|
-bool semaphore::try_wait() noexcept
|
||||||
-{ return WaitForSingleObject(static_cast<HANDLE>(mSem), 0) == WAIT_OBJECT_0; }
|
-{ return WaitForSingleObject(static_cast<HANDLE>(mSem), 0) == WAIT_OBJECT_0; }
|
||||||
|
+
|
||||||
|
+
|
||||||
|
|
||||||
} // namespace al
|
} // namespace al
|
||||||
|
|
||||||
@@ -83,8 +81,6 @@ void semaphore::post()
|
#else
|
||||||
|
|
||||||
|
-#include <pthread.h>
|
||||||
|
-#ifdef HAVE_PTHREAD_NP_H
|
||||||
|
-#include <pthread_np.h>
|
||||||
|
-#endif
|
||||||
|
+#include "../../src/mkxp-polyfill.h"
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+
|
||||||
|
#include <tuple>
|
||||||
|
|
||||||
|
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<void*>(const_cast<char*>(name))); }
|
||||||
|
+{ func(mkxp_thread_self(), "%s", static_cast<void*>(const_cast<char*>(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<void(*)(setname_t1,const char*)>(&setname_caller);
|
||||||
|
@@ -155,8 +155,8 @@ void semaphore::post()
|
||||||
void semaphore::wait() noexcept
|
void semaphore::wait() noexcept
|
||||||
{ dispatch_semaphore_wait(mSem, DISPATCH_TIME_FOREVER); }
|
{ dispatch_semaphore_wait(mSem, DISPATCH_TIME_FOREVER); }
|
||||||
|
|
||||||
-bool semaphore::try_wait() noexcept
|
-bool semaphore::try_wait() noexcept
|
||||||
-{ return dispatch_semaphore_wait(mSem, DISPATCH_TIME_NOW) == 0; }
|
-{ return dispatch_semaphore_wait(mSem, DISPATCH_TIME_NOW) == 0; }
|
||||||
|
+
|
||||||
|
+
|
||||||
|
|
||||||
} // namespace al
|
} // namespace al
|
||||||
|
|
||||||
@@ -96,27 +92,25 @@ namespace al {
|
@@ -168,27 +168,27 @@ namespace al {
|
||||||
|
|
||||||
semaphore::semaphore(unsigned int initial)
|
semaphore::semaphore(unsigned int initial)
|
||||||
{
|
{
|
||||||
|
@ -311,195 +345,56 @@
|
||||||
|
|
||||||
-bool semaphore::try_wait() noexcept
|
-bool semaphore::try_wait() noexcept
|
||||||
-{ return sem_trywait(&mSem) == 0; }
|
-{ return sem_trywait(&mSem) == 0; }
|
||||||
|
+
|
||||||
|
+
|
||||||
|
|
||||||
} // namespace al
|
} // namespace al
|
||||||
|
|
||||||
--- a/common/alsem.h
|
--- a/common/threads.h
|
||||||
+++ b/common/alsem.h
|
+++ b/common/threads.h
|
||||||
@@ -11,7 +11,7 @@
|
@@ -14,7 +14,7 @@
|
||||||
#include <semaphore.h> /* Fallback option for Apple without a working libdispatch */
|
#if defined(__APPLE__)
|
||||||
#endif
|
#include <dispatch/dispatch.h>
|
||||||
#elif !defined(_WIN32)
|
#elif !defined(_WIN32)
|
||||||
-#include <semaphore.h>
|
-#include <semaphore.h>
|
||||||
+#include "../../src/mkxp-polyfill.h"
|
+#include "../../src/mkxp-polyfill.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace al {
|
void althrd_setname(const char *name);
|
||||||
@@ -22,7 +22,7 @@ class semaphore {
|
@@ -27,7 +27,7 @@ class semaphore {
|
||||||
#elif defined(AL_APPLE_HAVE_DISPATCH)
|
#elif defined(__APPLE__)
|
||||||
using native_type = dispatch_semaphore_t;
|
using native_type = dispatch_semaphore_t;
|
||||||
#else
|
#else
|
||||||
- using native_type = sem_t;
|
- using native_type = sem_t;
|
||||||
+ using native_type = mkxp_sem_t;
|
+ using native_type = mkxp_sem_t;
|
||||||
#endif
|
#endif
|
||||||
native_type mSem{};
|
native_type mSem;
|
||||||
|
|
||||||
@@ -35,7 +35,6 @@ public:
|
@@ -40,7 +40,7 @@ public:
|
||||||
|
|
||||||
void post();
|
void post();
|
||||||
void wait() noexcept;
|
void wait() noexcept;
|
||||||
- bool try_wait() noexcept;
|
- bool try_wait() noexcept;
|
||||||
|
+
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace al
|
} // namespace al
|
||||||
--- a/common/althrd_setname.cpp
|
--- a/core/ambdec.cpp
|
||||||
+++ b/common/althrd_setname.cpp
|
+++ b/core/ambdec.cpp
|
||||||
@@ -39,39 +39,39 @@ void althrd_setname(const char *name [[maybe_unused]])
|
@@ -16,7 +16,7 @@
|
||||||
|
#include "alfstream.h"
|
||||||
#else
|
#include "alspan.h"
|
||||||
|
#include "opthelpers.h"
|
||||||
-#include <pthread.h>
|
-
|
||||||
-#ifdef HAVE_PTHREAD_NP_H
|
|
||||||
-#include <pthread_np.h>
|
|
||||||
-#endif
|
|
||||||
+#include "../../src/mkxp-polyfill.h"
|
+#include "../../src/mkxp-polyfill.h"
|
||||||
+
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+
|
|
||||||
|
|
||||||
namespace {
|
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<char*>(name)); /* NOLINT(*-const-cast) */ }
|
|
||||||
+{ func(mkxp_thread_self(), "%s", const_cast<char*>(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 <stdexcept>
|
|
||||||
#include <type_traits>
|
|
||||||
|
|
||||||
-#ifdef _WIN32
|
|
||||||
+#if false
|
|
||||||
#define WIN32_LEAN_AND_MEAN
|
|
||||||
#include <windows.h>
|
|
||||||
|
|
||||||
@@ -13,7 +13,7 @@
|
|
||||||
|
|
||||||
#include <pthread.h>
|
|
||||||
|
|
||||||
-#else
|
|
||||||
+#elif false
|
|
||||||
|
|
||||||
#include <threads.h>
|
|
||||||
#endif
|
|
||||||
@@ -54,7 +54,7 @@ class tss {
|
|
||||||
return static_cast<T>(al::bit_cast<std::uintptr_t>(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<EffectSlotArray> mActiveAuxSlots;
|
|
||||||
|
|
||||||
- std::thread mEventThread;
|
|
||||||
+
|
|
||||||
al::semaphore mEventSem;
|
|
||||||
std::unique_ptr<RingBuffer> mAsyncEvents;
|
|
||||||
using AsyncEventBitset = std::bitset<al::to_underlying(AsyncEnableBits::Count)>;
|
|
||||||
--- a/core/converter.cpp
|
|
||||||
+++ b/core/converter.cpp
|
|
||||||
@@ -5,7 +5,7 @@
|
|
||||||
|
|
||||||
#include <algorithm>
|
|
||||||
#include <cassert>
|
|
||||||
-#include <cmath>
|
|
||||||
+#include "../../src/mkxp-polyfill.h"
|
|
||||||
#include <cstddef>
|
|
||||||
#include <cstdint>
|
|
||||||
#include <iterator>
|
|
||||||
--- a/core/dbus_wrap.cpp
|
--- a/core/dbus_wrap.cpp
|
||||||
+++ b/core/dbus_wrap.cpp
|
+++ b/core/dbus_wrap.cpp
|
||||||
@@ -5,7 +5,7 @@
|
@@ -5,7 +5,7 @@
|
||||||
|
|
||||||
#if HAVE_DYNLOAD
|
#ifdef HAVE_DYNLOAD
|
||||||
|
|
||||||
-#include <mutex>
|
-#include <mutex>
|
||||||
+#include "../../src/mkxp-polyfill.h"
|
+#include "../../src/mkxp-polyfill.h"
|
||||||
|
@ -510,87 +405,76 @@
|
||||||
+++ b/core/dbus_wrap.h
|
+++ b/core/dbus_wrap.h
|
||||||
@@ -9,7 +9,7 @@
|
@@ -9,7 +9,7 @@
|
||||||
|
|
||||||
#if HAVE_DYNLOAD
|
#ifdef HAVE_DYNLOAD
|
||||||
|
|
||||||
-#include <mutex>
|
-#include <mutex>
|
||||||
+#include "../../src/mkxp-polyfill.h"
|
+#include "../../src/mkxp-polyfill.h"
|
||||||
|
|
||||||
#define DBUS_FUNCTIONS(MAGIC) \
|
#define DBUS_FUNCTIONS(MAGIC) \
|
||||||
MAGIC(dbus_error_init) \
|
MAGIC(dbus_error_init) \
|
||||||
--- a/core/helpers.cpp
|
--- a/core/device.h
|
||||||
+++ b/core/helpers.cpp
|
+++ b/core/device.h
|
||||||
@@ -12,7 +12,7 @@
|
@@ -8,7 +8,7 @@
|
||||||
#include <cstdlib>
|
#include <bitset>
|
||||||
#include <cstring>
|
#include <chrono>
|
||||||
#include <limits>
|
#include <memory>
|
||||||
-#include <mutex>
|
-#include <mutex>
|
||||||
+#include "../../src/mkxp-polyfill.h"
|
+#include "../../src/mkxp-polyfill.h"
|
||||||
#include <optional>
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <string_view>
|
|
||||||
|
#include "almalloc.h"
|
||||||
|
--- a/core/except.cpp
|
||||||
|
+++ b/core/except.cpp
|
||||||
|
@@ -7,7 +7,7 @@
|
||||||
|
#include <cstdarg>
|
||||||
|
|
||||||
|
#include "opthelpers.h"
|
||||||
|
-
|
||||||
|
+#include "../../src/mkxp-polyfill.h"
|
||||||
|
|
||||||
|
namespace al {
|
||||||
|
|
||||||
|
--- a/core/helpers.cpp
|
||||||
|
+++ b/core/helpers.cpp
|
||||||
|
@@ -9,7 +9,7 @@
|
||||||
|
#include <cstdlib>
|
||||||
|
#include <cstdio>
|
||||||
|
#include <cstring>
|
||||||
|
-#include <mutex>
|
||||||
|
+#include "../../src/mkxp-polyfill.h"
|
||||||
|
#include <limits>
|
||||||
|
#include <string>
|
||||||
|
#include <tuple>
|
||||||
--- a/core/hrtf.cpp
|
--- a/core/hrtf.cpp
|
||||||
+++ b/core/hrtf.cpp
|
+++ b/core/hrtf.cpp
|
||||||
@@ -15,7 +15,7 @@
|
@@ -14,7 +14,7 @@
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
-#include <mutex>
|
-#include <mutex>
|
||||||
+#include "../../src/mkxp-polyfill.h"
|
+#include "../../src/mkxp-polyfill.h"
|
||||||
#include <numeric>
|
#include <numeric>
|
||||||
#include <optional>
|
#include <type_traits>
|
||||||
#include <tuple>
|
#include <utility>
|
||||||
--- a/core/logging.cpp
|
--- a/core/logging.cpp
|
||||||
+++ b/core/logging.cpp
|
+++ b/core/logging.cpp
|
||||||
@@ -7,7 +7,7 @@
|
@@ -10,7 +10,7 @@
|
||||||
#include <cstdarg>
|
#include "alspan.h"
|
||||||
#include <cstdio>
|
#include "strutils.h"
|
||||||
#include <cstring>
|
#include "vector.h"
|
||||||
-#include <mutex>
|
-
|
||||||
+#include "../../src/mkxp-polyfill.h"
|
+#include "../../src/mkxp-polyfill.h"
|
||||||
#include <optional>
|
|
||||||
#include <string>
|
#if defined(_WIN32)
|
||||||
#include <string_view>
|
#define WIN32_LEAN_AND_MEAN
|
||||||
--- a/core/mastering.cpp
|
--- a/core/mastering.cpp
|
||||||
+++ b/core/mastering.cpp
|
+++ b/core/mastering.cpp
|
||||||
@@ -4,7 +4,7 @@
|
@@ -15,7 +15,7 @@
|
||||||
#include "mastering.h"
|
#include "alnumeric.h"
|
||||||
|
#include "alspan.h"
|
||||||
|
#include "opthelpers.h"
|
||||||
|
-
|
||||||
|
+#include "../../src/mkxp-polyfill.h"
|
||||||
|
|
||||||
#include <algorithm>
|
/* These structures assume BufferLineSize is a power of 2. */
|
||||||
-#include <cmath>
|
static_assert((BufferLineSize & (BufferLineSize-1)) == 0, "BufferLineSize is not a power of 2");
|
||||||
+#include "../../src/mkxp-polyfill.h"
|
|
||||||
#include <cstddef>
|
|
||||||
#include <functional>
|
|
||||||
#include <iterator>
|
|
||||||
--- a/examples/alffplay.cpp
|
|
||||||
+++ b/examples/alffplay.cpp
|
|
||||||
@@ -20,7 +20,7 @@
|
|
||||||
#include <functional>
|
|
||||||
#include <future>
|
|
||||||
#include <memory>
|
|
||||||
-#include <mutex>
|
|
||||||
+#include "../../src/mkxp-polyfill.h"
|
|
||||||
#include <ratio>
|
|
||||||
#include <string>
|
|
||||||
#include <string_view>
|
|
||||||
--- a/router/alc.cpp
|
|
||||||
+++ b/router/alc.cpp
|
|
||||||
@@ -7,7 +7,7 @@
|
|
||||||
#include <cstdlib>
|
|
||||||
#include <cstring>
|
|
||||||
#include <cstdio>
|
|
||||||
-#include <mutex>
|
|
||||||
+#include "../../src/mkxp-polyfill.h"
|
|
||||||
#include <optional>
|
|
||||||
#include <string_view>
|
|
||||||
#include <tuple>
|
|
||||||
--- a/router/router.h
|
|
||||||
+++ b/router/router.h
|
|
||||||
@@ -8,7 +8,7 @@
|
|
||||||
#include <atomic>
|
|
||||||
#include <cstdio>
|
|
||||||
#include <memory>
|
|
||||||
-#include <mutex>
|
|
||||||
+#include "../../src/mkxp-polyfill.h"
|
|
||||||
#include <string>
|
|
||||||
#include <utility>
|
|
||||||
#include <vector>
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
--- a/CMakeLists.txt
|
--- a/CMakeLists.txt
|
||||||
+++ b/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
|
# Default backends, always available
|
||||||
alc/backends/loopback.cpp
|
alc/backends/loopback.cpp
|
||||||
alc/backends/loopback.h
|
alc/backends/loopback.h
|
||||||
|
@ -11,23 +11,25 @@
|
||||||
alc/backends/null.h
|
alc/backends/null.h
|
||||||
)
|
)
|
||||||
|
|
||||||
|
diff --git a/alc/alc.cpp b/alc/alc.cpp
|
||||||
|
index af8ff55d..0319a486 100644
|
||||||
--- a/alc/alc.cpp
|
--- a/alc/alc.cpp
|
||||||
+++ b/alc/alc.cpp
|
+++ b/alc/alc.cpp
|
||||||
@@ -216,7 +216,7 @@ struct BackendInfo {
|
@@ -251,7 +251,7 @@ BackendInfo BackendList[] = {
|
||||||
BackendFactory& (*getFactory)();
|
{ "sdl2", SDL2BackendFactory::getFactory },
|
||||||
};
|
|
||||||
|
|
||||||
-std::array BackendList{
|
|
||||||
+std::array<BackendInfo, 0> BackendList{
|
|
||||||
#if HAVE_PIPEWIRE
|
|
||||||
BackendInfo{"pipewire", PipeWireBackendFactory::getFactory},
|
|
||||||
#endif
|
|
||||||
@@ -269,7 +269,7 @@ std::array BackendList{
|
|
||||||
BackendInfo{"otherio", OtherIOBackendFactory::getFactory},
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
- BackendInfo{"null", NullBackendFactory::getFactory},
|
- { "null", NullBackendFactory::getFactory },
|
||||||
+
|
+ { "null", nullptr },
|
||||||
#if HAVE_WAVE
|
#ifdef HAVE_WAVE
|
||||||
BackendInfo{"wave", WaveBackendFactory::getFactory},
|
{ "wave", WaveBackendFactory::getFactory },
|
||||||
#endif
|
#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())
|
||||||
|
{
|
||||||
|
|
|
@ -2,32 +2,12 @@
|
||||||
|
|
||||||
--- a/CMakeLists.txt
|
--- a/CMakeLists.txt
|
||||||
+++ b/CMakeLists.txt
|
+++ b/CMakeLists.txt
|
||||||
@@ -1377,7 +1377,7 @@ target_compile_definitions(alsoft.common PRIVATE ${CPP_DEFS})
|
@@ -1313,7 +1313,7 @@ add_library(common STATIC EXCLUDE_FROM_ALL ${COMMON_OBJS})
|
||||||
target_compile_options(alsoft.common PRIVATE ${C_FLAGS})
|
target_include_directories(common PRIVATE ${OpenAL_BINARY_DIR} ${OpenAL_SOURCE_DIR}/include)
|
||||||
target_link_libraries(alsoft.common PRIVATE alsoft::fmt)
|
target_compile_definitions(common PRIVATE ${CPP_DEFS})
|
||||||
set_target_properties(alsoft.common PROPERTIES ${ALSOFT_STD_VERSION_PROPS}
|
target_compile_options(common PRIVATE ${C_FLAGS})
|
||||||
- POSITION_INDEPENDENT_CODE TRUE)
|
-set_target_properties(common PROPERTIES ${DEFAULT_TARGET_PROPS} POSITION_INDEPENDENT_CODE TRUE)
|
||||||
+ )
|
+set_target_properties(common PROPERTIES ${DEFAULT_TARGET_PROPS})
|
||||||
|
|
||||||
|
|
||||||
unset(HAS_ROUTER)
|
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)
|
|
||||||
|
|
|
@ -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<const FloatBufferLine> InBuffer, void *OutBuffer, cons
|
|
||||||
out[c] = SampleConv<T>(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<typename T>
|
|
||||||
std::enable_if_t<std::is_integral_v<T>,
|
|
||||||
T> byteswap(T value) noexcept
|
|
||||||
{
|
|
||||||
- static_assert(std::has_unique_object_representations_v<T>);
|
|
||||||
+ static_assert(std::has_unique_object_representations<T>::value);
|
|
||||||
auto bytes = al::bit_cast<std::array<std::byte,sizeof(T)>>(value);
|
|
||||||
std::reverse(bytes.begin(), bytes.end());
|
|
||||||
return al::bit_cast<T>(bytes);
|
|
13
subprojects/packagefiles/openal-soft-setschedparam.patch
Normal file
13
subprojects/packagefiles/openal-soft-setschedparam.patch
Normal file
|
@ -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)
|
Loading…
Add table
Reference in a new issue