mirror of
https://github.com/mkxp-z/mkxp-z.git
synced 2025-09-03 12:43:04 +02:00
Use libretro's PlayStation 3 Docker image instead of ScummVM's
This commit is contained in:
parent
71fa2453e8
commit
9ed11ecffa
18 changed files with 501 additions and 30 deletions
12
.github/workflows/autobuild.yml
vendored
12
.github/workflows/autobuild.yml
vendored
|
@ -865,14 +865,16 @@ jobs:
|
||||||
needs: build-libretro-stage1
|
needs: build-libretro-stage1
|
||||||
name: LR PlayStation 3
|
name: LR PlayStation 3
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container: scummvm/dockerized-toolchains:ps3
|
container:
|
||||||
|
image: git.libretro.com:5050/libretro-infrastructure/libretro-build-psl1ght:latest
|
||||||
|
options: -u root
|
||||||
steps:
|
steps:
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
apt update
|
apt update
|
||||||
apt install -y git build-essential pip ninja-build jq
|
apt install -y git build-essential pip ninja-build jq
|
||||||
apt remove -y meson cmake
|
apt remove -y meson cmake
|
||||||
pip install --break-system-packages meson cmake
|
pip install meson cmake
|
||||||
|
|
||||||
- id: short-sha
|
- id: short-sha
|
||||||
name: Get Git commit hash
|
name: Get Git commit hash
|
||||||
|
@ -892,9 +894,9 @@ jobs:
|
||||||
- name: Configure core
|
- name: Configure core
|
||||||
run: |
|
run: |
|
||||||
echo "[binaries]" | tee -a ~/cross.ini
|
echo "[binaries]" | tee -a ~/cross.ini
|
||||||
echo "c = 'powerpc64-ps3-elf-gcc'" | tee -a ~/cross.ini
|
echo "c = 'ppu-gcc'" | tee -a ~/cross.ini
|
||||||
echo "cpp = 'powerpc64-ps3-elf-g++'" | tee -a ~/cross.ini
|
echo "cpp = 'ppu-g++'" | tee -a ~/cross.ini
|
||||||
echo "ar = 'powerpc64-ps3-elf-ar'" | tee -a ~/cross.ini
|
echo "ar = 'ppu-ar'" | tee -a ~/cross.ini
|
||||||
echo "[host_machine]" | tee -a ~/cross.ini
|
echo "[host_machine]" | tee -a ~/cross.ini
|
||||||
echo "system = 'bare'" | tee -a ~/cross.ini
|
echo "system = 'bare'" | tee -a ~/cross.ini
|
||||||
echo "cpu_family = 'ppc64'" | tee -a ~/cross.ini
|
echo "cpu_family = 'ppc64'" | tee -a ~/cross.ini
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include <wasm-rt.h>
|
#include <wasm-rt.h>
|
||||||
#include "wasi.h"
|
#include "wasi.h"
|
||||||
#include <mkxp-retro-ruby.h>
|
#include <mkxp-retro-ruby.h>
|
||||||
|
#include "mkxp-threads.h"
|
||||||
#include "sandbox.h"
|
#include "sandbox.h"
|
||||||
|
|
||||||
#define MJIT_ENABLED 0
|
#define MJIT_ENABLED 0
|
||||||
|
|
|
@ -100,6 +100,7 @@ $(OUTDIR)/mkxp-retro-ruby/mkxp-retro-ruby.h $(OUTDIR)/mkxp-retro-ruby/mkxp-retro
|
||||||
$(SED) -i 's/ *# *define * FUNC_TYPE_DECL_EXTERN_T *([^()]).*/#define FUNC_TYPE_DECL_EXTERN_T(x)/g' $(OUTDIR)/mkxp-retro-ruby/mkxp-retro-ruby-impl.h
|
$(SED) -i 's/ *# *define * FUNC_TYPE_DECL_EXTERN_T *([^()]).*/#define FUNC_TYPE_DECL_EXTERN_T(x)/g' $(OUTDIR)/mkxp-retro-ruby/mkxp-retro-ruby-impl.h
|
||||||
$(SED) -i 's/ *# *define * FUNC_TYPE_EXTERN_T *([^()]).*/#define FUNC_TYPE_EXTERN_T(x) const char _mkxp_unused_##x[]/g' $(OUTDIR)/mkxp-retro-ruby/mkxp-retro-ruby-impl.h
|
$(SED) -i 's/ *# *define * FUNC_TYPE_EXTERN_T *([^()]).*/#define FUNC_TYPE_EXTERN_T(x) const char _mkxp_unused_##x[]/g' $(OUTDIR)/mkxp-retro-ruby/mkxp-retro-ruby-impl.h
|
||||||
$(SED) -i 's/ *# *define * FUNC_TYPE_T *([^()]).*/#define FUNC_TYPE_T(x) static const char _mkxp_unused_##x[]/g' $(OUTDIR)/mkxp-retro-ruby/mkxp-retro-ruby-impl.h
|
$(SED) -i 's/ *# *define * FUNC_TYPE_T *([^()]).*/#define FUNC_TYPE_T(x) static const char _mkxp_unused_##x[]/g' $(OUTDIR)/mkxp-retro-ruby/mkxp-retro-ruby-impl.h
|
||||||
|
$(SED) -i 's/__has_builtin *([^()]*)/0/g' $(OUTDIR)/mkxp-retro-ruby/mkxp-retro-ruby-impl.h
|
||||||
|
|
||||||
$(OUTDIR)/mkxp-retro-dist.zip.cpp: $(LIBDIR)/mkxp-retro-dist.zip
|
$(OUTDIR)/mkxp-retro-dist.zip.cpp: $(LIBDIR)/mkxp-retro-dist.zip
|
||||||
mkdir -p $(OUTDIR)
|
mkdir -p $(OUTDIR)
|
||||||
|
|
72
meson.build
72
meson.build
|
@ -84,6 +84,70 @@ if is_libretro
|
||||||
libretro_defines += '-DBOOST_NO_EXCEPTIONS'
|
libretro_defines += '-DBOOST_NO_EXCEPTIONS'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if not compilers['cpp'].has_header_symbol('stdio.h', 'snprintf')
|
||||||
|
libretro_defines += '-DMKXPZ_NO_SNPRINTF'
|
||||||
|
endif
|
||||||
|
|
||||||
|
if not compilers['cpp'].has_header_symbol('stdio.h', 'vsnprintf')
|
||||||
|
libretro_defines += '-DMKXPZ_NO_VSNPRINTF'
|
||||||
|
endif
|
||||||
|
|
||||||
|
if not compilers['cpp'].has_header_symbol('cmath', 'std::round')
|
||||||
|
libretro_defines += '-DMKXPZ_NO_STD_ROUND'
|
||||||
|
endif
|
||||||
|
|
||||||
|
if not compilers['cpp'].has_header_symbol('cmath', 'std::lround')
|
||||||
|
libretro_defines += '-DMKXPZ_NO_STD_LROUND'
|
||||||
|
endif
|
||||||
|
|
||||||
|
if not compilers['cpp'].has_header_symbol('cmath', 'std::copysign')
|
||||||
|
libretro_defines += '-DMKXPZ_NO_STD_COPYSIGN'
|
||||||
|
endif
|
||||||
|
|
||||||
|
if not compilers['cpp'].has_header_symbol('cmath', 'std::cbrt')
|
||||||
|
libretro_defines += '-DMKXPZ_NO_STD_CBRT'
|
||||||
|
endif
|
||||||
|
|
||||||
|
if not compilers['cpp'].has_header_symbol('cmath', 'std::log2')
|
||||||
|
libretro_defines += '-DMKXPZ_NO_STD_LOG2'
|
||||||
|
endif
|
||||||
|
|
||||||
|
if not compilers['cpp'].has_header_symbol('string', 'std::to_string')
|
||||||
|
libretro_defines += '-DMKXPZ_NO_STD_TO_STRING'
|
||||||
|
endif
|
||||||
|
|
||||||
|
if not compilers['cpp'].has_header_symbol('string', 'std::stoi')
|
||||||
|
libretro_defines += '-DMKXPZ_NO_STD_STOI'
|
||||||
|
endif
|
||||||
|
|
||||||
|
if not compilers['cpp'].has_header_symbol('string', 'std::stol')
|
||||||
|
libretro_defines += '-DMKXPZ_NO_STD_STOL'
|
||||||
|
endif
|
||||||
|
|
||||||
|
if not compilers['cpp'].has_header_symbol('string', 'std::stoll')
|
||||||
|
libretro_defines += '-DMKXPZ_NO_STD_STOLL'
|
||||||
|
endif
|
||||||
|
|
||||||
|
if not compilers['cpp'].has_header_symbol('string', 'std::stoul')
|
||||||
|
libretro_defines += '-DMKXPZ_NO_STD_STOUL'
|
||||||
|
endif
|
||||||
|
|
||||||
|
if not compilers['cpp'].has_header_symbol('string', 'std::stoull')
|
||||||
|
libretro_defines += '-DMKXPZ_NO_STD_STOULL'
|
||||||
|
endif
|
||||||
|
|
||||||
|
if not compilers['cpp'].has_header_symbol('string', 'std::stof')
|
||||||
|
libretro_defines += '-DMKXPZ_NO_STD_STOF'
|
||||||
|
endif
|
||||||
|
|
||||||
|
if not compilers['cpp'].has_header_symbol('string', 'std::stod')
|
||||||
|
libretro_defines += '-DMKXPZ_NO_STD_STOD'
|
||||||
|
endif
|
||||||
|
|
||||||
|
if not compilers['cpp'].has_header_symbol('string', 'std::stold')
|
||||||
|
libretro_defines += '-DMKXPZ_NO_STD_STOLD'
|
||||||
|
endif
|
||||||
|
|
||||||
if not compilers['cpp'].has_header_symbol('mutex', 'std::mutex')
|
if not compilers['cpp'].has_header_symbol('mutex', 'std::mutex')
|
||||||
libretro_defines += '-DMKXPZ_NO_STD_MUTEX'
|
libretro_defines += '-DMKXPZ_NO_STD_MUTEX'
|
||||||
endif
|
endif
|
||||||
|
@ -129,6 +193,14 @@ if is_libretro
|
||||||
libretro_defines += '-DMKXPZ_NO_SEMAPHORE_H'
|
libretro_defines += '-DMKXPZ_NO_SEMAPHORE_H'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if (not core_is_static or is_emscripten) and compilers['cpp'].has_header_symbol('stdlib.h', 'posix_memalign')
|
||||||
|
libretro_defines += '-DMKXPZ_HAVE_POSIX_MEMALIGN'
|
||||||
|
elif (not core_is_static or is_emscripten) and compilers['cpp'].has_header_symbol('malloc.h', '_aligned_malloc')
|
||||||
|
libretro_defines += '-DMKXPZ_HAVE_ALIGNED_MALLOC'
|
||||||
|
elif compilers['cpp'].has_header_symbol('stdlib.h', 'aligned_alloc')
|
||||||
|
libretro_defines += '-DMKXPZ_HAVE_ALIGNED_ALLOC'
|
||||||
|
endif
|
||||||
|
|
||||||
# Enable integer-only mode in FLAC when building with Vita SDK. Otherwise, we get an internal compiler error in FLAC__window_triangle:
|
# Enable integer-only mode in FLAC when building with Vita SDK. Otherwise, we get an internal compiler error in FLAC__window_triangle:
|
||||||
#
|
#
|
||||||
# ../subprojects/flac/src/libFLAC/window.c: In function 'FLAC__window_triangle':
|
# ../subprojects/flac/src/libFLAC/window.c: In function 'FLAC__window_triangle':
|
||||||
|
|
|
@ -298,11 +298,15 @@ 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;
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include "aldatasource.h"
|
#include "aldatasource.h"
|
||||||
#include "exception.h"
|
#include "exception.h"
|
||||||
|
|
||||||
|
#include <cmath>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <sndfile.hh>
|
#include <sndfile.hh>
|
||||||
|
@ -170,7 +171,7 @@ struct SndfileSource : ALDataSource
|
||||||
|
|
||||||
void seekToOffset(double seconds)
|
void seekToOffset(double seconds)
|
||||||
{
|
{
|
||||||
currentFrame = std::lround(seconds * (double)info.rate);
|
currentFrame = lround(seconds * (double)info.rate);
|
||||||
|
|
||||||
if (currentFrame < 0 || currentFrame >= (uint64_t)handle.frames())
|
if (currentFrame < 0 || currentFrame >= (uint64_t)handle.frames())
|
||||||
{
|
{
|
||||||
|
|
|
@ -304,19 +304,13 @@ SoundBuffer *SoundEmitter::allocateBuffer(const std::string &filename)
|
||||||
|
|
||||||
if (!buffer)
|
if (!buffer)
|
||||||
{
|
{
|
||||||
char buf[512];
|
|
||||||
snprintf(
|
|
||||||
buf,
|
|
||||||
sizeof(buf),
|
|
||||||
"Unable to decode sound: %s: %s",
|
|
||||||
filename.c_str(),
|
|
||||||
#ifdef MKXPZ_RETRO
|
#ifdef MKXPZ_RETRO
|
||||||
sf_error_number(handler.errnum)
|
mkxp_retro::log_printf(RETRO_LOG_WARN, "Unable to decode sound: %s: %s\n", filename.c_str(), sf_error_number(handler.errnum));
|
||||||
#else
|
#else
|
||||||
Sound_GetError()
|
char buf[512];
|
||||||
#endif // MKXPZ_RETRO
|
snprintf(buf, sizeof(buf), "Unable to decode sound: %s: %s", filename.c_str(), Sound_GetError());
|
||||||
);
|
|
||||||
Debug() << buf;
|
Debug() << buf;
|
||||||
|
#endif // MKXPZ_RETRO
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
11
src/core.cpp
11
src/core.cpp
|
@ -24,6 +24,9 @@
|
||||||
#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 <alc.h>
|
#include <alc.h>
|
||||||
#include <alext.h>
|
#include <alext.h>
|
||||||
|
@ -39,13 +42,15 @@ using namespace mkxp_retro;
|
||||||
using namespace mkxp_sandbox;
|
using namespace mkxp_sandbox;
|
||||||
|
|
||||||
static inline void *malloc_align(size_t alignment, size_t size) {
|
static inline void *malloc_align(size_t alignment, size_t size) {
|
||||||
#if defined(__unix__) || defined(__APPLE__)
|
#if defined(MKXPZ_HAVE_POSIX_MEMALIGN) || defined(MKXPZ_BUILD_XCODE)
|
||||||
void *mem;
|
void *mem;
|
||||||
return posix_memalign(&mem, alignment, size) ? NULL : mem;
|
return posix_memalign(&mem, alignment, size) ? NULL : mem;
|
||||||
#elif defined(_WIN32) || defined(__CYGWIN__) || defined(__MINGW32__)
|
#elif defined(MKXPZ_HAVE_ALIGNED_MALLOC)
|
||||||
return _aligned_malloc(size, alignment);
|
return _aligned_malloc(size, alignment);
|
||||||
#else
|
#elif defined(MKXPZ_HAVE_ALIGNED_ALLOC)
|
||||||
return aligned_alloc(alignment, size);
|
return aligned_alloc(alignment, size);
|
||||||
|
#else
|
||||||
|
return malloc(size);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -420,10 +420,13 @@ 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) {
|
||||||
snprintf(fullPath, sizeof(fullPath), "%s", fname);
|
std::strncpy(fullPath, fname, sizeof(fullPath));
|
||||||
else
|
} else {
|
||||||
snprintf(fullPath, sizeof(fullPath), "%s/%s", origdir, fname);
|
std::strncpy(fullPath, origdir, sizeof(fullPath) - 1);
|
||||||
|
std::strncat(fullPath, "/", sizeof(fullPath) - 1 - std::strlen(fullPath));
|
||||||
|
std::strncat(fullPath, fname, sizeof(fullPath) - 1 - std::strlen(fullPath));
|
||||||
|
}
|
||||||
|
|
||||||
/* Deal with OSX' weird UTF-8 standards */
|
/* Deal with OSX' weird UTF-8 standards */
|
||||||
data.toNFC(fullPath);
|
data.toNFC(fullPath);
|
||||||
|
@ -505,7 +508,9 @@ static PHYSFS_EnumerateCallbackResult fontSetEnumCB(void *data, const char *dir,
|
||||||
return PHYSFS_ENUM_OK;
|
return PHYSFS_ENUM_OK;
|
||||||
|
|
||||||
char filename[512];
|
char filename[512];
|
||||||
snprintf(filename, sizeof(filename), "%s/%s", dir, fname);
|
std::strncpy(filename, dir, sizeof(filename) - 1);
|
||||||
|
std::strncat(filename, "/", sizeof(filename) - 1 - std::strlen(filename));
|
||||||
|
std::strncat(filename, fname, sizeof(filename) - 1 - std::strlen(filename));
|
||||||
|
|
||||||
PHYSFS_File *handle = PHYSFS_openRead(filename);
|
PHYSFS_File *handle = PHYSFS_openRead(filename);
|
||||||
|
|
||||||
|
@ -598,7 +603,9 @@ openReadEnumCB(void *d, const char *dirpath, const char *filename) {
|
||||||
if (!*dirpath) {
|
if (!*dirpath) {
|
||||||
fullPath = filename;
|
fullPath = filename;
|
||||||
} else {
|
} else {
|
||||||
snprintf(buffer, sizeof(buffer), "%s/%s", dirpath, filename);
|
std::strncpy(buffer, dirpath, sizeof(buffer) - 1);
|
||||||
|
std::strncat(buffer, "/", sizeof(buffer) - 1 - std::strlen(buffer));
|
||||||
|
std::strncat(buffer, filename, sizeof(buffer) - 1 - std::strlen(buffer));
|
||||||
fullPath = buffer;
|
fullPath = buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,8 @@
|
||||||
#ifndef MKXPZ_THREADS_H
|
#ifndef MKXPZ_THREADS_H
|
||||||
#define MKXPZ_THREADS_H
|
#define MKXPZ_THREADS_H
|
||||||
|
|
||||||
|
#include <math.h>
|
||||||
|
#include <tgmath.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
@ -34,7 +36,14 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
#include <array>
|
||||||
|
#include <cstdio>
|
||||||
|
#include <cstdlib>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
extern "C" long long strtoll(const char *str, char **str_end, int base);
|
||||||
|
extern "C" unsigned long long strtoull(const char *str, char **str_end, int base);
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
@ -149,6 +158,238 @@ namespace std {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
# ifdef MKXPZ_NO_STD_ROUND
|
||||||
|
namespace std {
|
||||||
|
inline constexpr float round(float x) {
|
||||||
|
return roundf(x);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline constexpr double round(double x) {
|
||||||
|
return round(x);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline constexpr long double round(long double x) {
|
||||||
|
return roundl(x);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# ifdef MKXPZ_NO_STD_LROUND
|
||||||
|
namespace std {
|
||||||
|
inline constexpr long lround(float x) {
|
||||||
|
return lroundf(x);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline constexpr long lround(double x) {
|
||||||
|
return lround(x);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline constexpr long lround(long double x) {
|
||||||
|
return lroundl(x);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# ifdef MKXPZ_NO_STD_COPYSIGN
|
||||||
|
namespace std {
|
||||||
|
inline constexpr float copysign(float x, float y) {
|
||||||
|
return copysignf(x, y);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline constexpr double copysign(double x, double y) {
|
||||||
|
return copysign(x, y);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline constexpr long double copysign(long double x, long double y) {
|
||||||
|
return copysignl(x, y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# ifdef MKXPZ_NO_STD_CBRT
|
||||||
|
namespace std {
|
||||||
|
inline constexpr float cbrt(float x) {
|
||||||
|
return cbrtf(x);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline constexpr double cbrt(double x) {
|
||||||
|
return cbrt(x);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline constexpr long double cbrt(long double x) {
|
||||||
|
return cbrtl(x);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# ifdef MKXPZ_NO_STD_LOG2
|
||||||
|
namespace std {
|
||||||
|
inline constexpr float log2(float x) {
|
||||||
|
return log2f(x);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline constexpr double log2(double x) {
|
||||||
|
return log2(x);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# ifdef MKXPZ_NO_STD_TO_STRING
|
||||||
|
namespace std {
|
||||||
|
inline std::string to_string(int x) {
|
||||||
|
std::array<char, 22> array;
|
||||||
|
std::sprintf(array.data(), "%d", x);
|
||||||
|
return array.data();
|
||||||
|
}
|
||||||
|
|
||||||
|
inline std::string to_string(long x) {
|
||||||
|
std::array<char, 22> array;
|
||||||
|
std::sprintf(array.data(), "%ld", x);
|
||||||
|
return array.data();
|
||||||
|
}
|
||||||
|
|
||||||
|
inline std::string to_string(long long x) {
|
||||||
|
std::array<char, 22> array;
|
||||||
|
std::sprintf(array.data(), "%lld", x);
|
||||||
|
return array.data();
|
||||||
|
}
|
||||||
|
|
||||||
|
inline std::string to_string(unsigned int x) {
|
||||||
|
std::array<char, 22> array;
|
||||||
|
std::sprintf(array.data(), "%u", x);
|
||||||
|
return array.data();
|
||||||
|
}
|
||||||
|
|
||||||
|
inline std::string to_string(unsigned long x) {
|
||||||
|
std::array<char, 22> array;
|
||||||
|
std::sprintf(array.data(), "%lu", x);
|
||||||
|
return array.data();
|
||||||
|
}
|
||||||
|
|
||||||
|
inline std::string to_string(unsigned long long x) {
|
||||||
|
std::array<char, 22> array;
|
||||||
|
std::sprintf(array.data(), "%llu", x);
|
||||||
|
return array.data();
|
||||||
|
}
|
||||||
|
|
||||||
|
inline std::string to_string(float x) {
|
||||||
|
std::array<char, 256> array;
|
||||||
|
std::sprintf(array.data(), "%f", x);
|
||||||
|
return array.data();
|
||||||
|
}
|
||||||
|
|
||||||
|
inline std::string to_string(double x) {
|
||||||
|
std::array<char, 256> array;
|
||||||
|
std::sprintf(array.data(), "%f", x);
|
||||||
|
return array.data();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# ifdef MKXPZ_NO_STD_STOI
|
||||||
|
namespace std {
|
||||||
|
inline int stoi(const std::string &str, size_t *pos = nullptr, int base = 10) {
|
||||||
|
char *ptr;
|
||||||
|
int result = (int)strtol(str.c_str(), &ptr, base);
|
||||||
|
if (pos != nullptr) {
|
||||||
|
*pos = ptr - str.c_str();
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# ifdef MKXPZ_NO_STD_STOL
|
||||||
|
namespace std {
|
||||||
|
inline long stol(const std::string &str, size_t *pos = nullptr, int base = 10) {
|
||||||
|
char *ptr;
|
||||||
|
long result = strtol(str.c_str(), &ptr, base);
|
||||||
|
if (pos != nullptr) {
|
||||||
|
*pos = ptr - str.c_str();
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# ifdef MKXPZ_NO_STD_STOLL
|
||||||
|
namespace std {
|
||||||
|
inline long long stoll(const std::string &str, size_t *pos = nullptr, int base = 10) {
|
||||||
|
char *ptr;
|
||||||
|
long long result = strtoll(str.c_str(), &ptr, base);
|
||||||
|
if (pos != nullptr) {
|
||||||
|
*pos = ptr - str.c_str();
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# ifdef MKXPZ_NO_STD_STOUL
|
||||||
|
namespace std {
|
||||||
|
inline unsigned long stoul(const std::string &str, size_t *pos = nullptr, int base = 10) {
|
||||||
|
char *ptr;
|
||||||
|
unsigned long result = strtoul(str.c_str(), &ptr, base);
|
||||||
|
if (pos != nullptr) {
|
||||||
|
*pos = ptr - str.c_str();
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# ifdef MKXPZ_NO_STD_STOULL
|
||||||
|
namespace std {
|
||||||
|
inline unsigned long long stoull(const std::string &str, size_t *pos = nullptr, int base = 10) {
|
||||||
|
char *ptr;
|
||||||
|
unsigned long long result = strtoull(str.c_str(), &ptr, base);
|
||||||
|
if (pos != nullptr) {
|
||||||
|
*pos = ptr - str.c_str();
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# ifdef MKXPZ_NO_STD_STOF
|
||||||
|
namespace std {
|
||||||
|
inline float stof(const std::string &str, size_t *pos = nullptr) {
|
||||||
|
char *ptr;
|
||||||
|
float result = strtof(str.c_str(), &ptr);
|
||||||
|
if (pos != nullptr) {
|
||||||
|
*pos = ptr - str.c_str();
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# ifdef MKXPZ_NO_STD_STOD
|
||||||
|
namespace std {
|
||||||
|
inline double stod(const std::string &str, size_t *pos = nullptr) {
|
||||||
|
char *ptr;
|
||||||
|
double result = strtod(str.c_str(), &ptr);
|
||||||
|
if (pos != nullptr) {
|
||||||
|
*pos = ptr - str.c_str();
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# ifdef MKXPZ_NO_STD_STOLD
|
||||||
|
namespace std {
|
||||||
|
inline long double stold(const std::string &str, size_t *pos = nullptr) {
|
||||||
|
char *ptr;
|
||||||
|
long double result = strtold(str.c_str(), &ptr);
|
||||||
|
if (pos != nullptr) {
|
||||||
|
*pos = ptr - str.c_str();
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // MKXPZ_THREADS_H
|
#endif // MKXPZ_THREADS_H
|
||||||
|
|
|
@ -53,6 +53,7 @@ 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);
|
||||||
|
|
||||||
|
@ -60,6 +61,7 @@ struct Exception
|
||||||
vsnprintf(&msg[0], msg.size(), format, ap);
|
vsnprintf(&msg[0], msg.size(), format, ap);
|
||||||
|
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -2,3 +2,4 @@
|
||||||
url = https://github.com/boostorg/assert
|
url = https://github.com/boostorg/assert
|
||||||
revision = boost-1.87.0
|
revision = boost-1.87.0
|
||||||
depth = 1
|
depth = 1
|
||||||
|
diff_files = boost_assert-snprintf.patch
|
||||||
|
|
|
@ -2,4 +2,4 @@
|
||||||
url = https://github.com/libsndfile/libsndfile
|
url = https://github.com/libsndfile/libsndfile
|
||||||
revision = 1.2.2
|
revision = 1.2.2
|
||||||
depth = 1
|
depth = 1
|
||||||
diff_files = libsndfile-deps.patch, libsndfile-emscripten-endian.patch, libsndfile-int32.patch
|
diff_files = libsndfile-deps.patch, libsndfile-emscripten-endian.patch, libsndfile-int32.patch, libsndfile-ssize.patch
|
||||||
|
|
13
subprojects/packagefiles/boost_assert-snprintf.patch
Normal file
13
subprojects/packagefiles/boost_assert-snprintf.patch
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
# Makes Boost use `sprintf` instead of `snprintf` on platforms with no `snprintf` support.
|
||||||
|
|
||||||
|
--- a/include/boost/assert/source_location.hpp
|
||||||
|
+++ b/include/boost/assert/source_location.hpp
|
||||||
|
@@ -73,7 +73,7 @@ public:
|
||||||
|
# pragma warning( disable: 4996 )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
-#if ( defined(_MSC_VER) && _MSC_VER < 1900 ) || ( defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR) )
|
||||||
|
+#if ( defined(_MSC_VER) && _MSC_VER < 1900 ) || ( defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR) ) || defined(MKXPZ_NO_SNPRINTF)
|
||||||
|
# define BOOST_ASSERT_SNPRINTF(buffer, format, arg) std::sprintf(buffer, format, arg)
|
||||||
|
#else
|
||||||
|
# define BOOST_ASSERT_SNPRINTF(buffer, format, arg) std::snprintf(buffer, sizeof(buffer)/sizeof(buffer[0]), format, arg)
|
17
subprojects/packagefiles/libsndfile-ssize.patch
Normal file
17
subprojects/packagefiles/libsndfile-ssize.patch
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
# Stops libsndfile from manually defining `ssize_t` because it breaks builds for PlayStation 3.
|
||||||
|
|
||||||
|
--- a/src/config.h.cmake
|
||||||
|
+++ b/src/config.h.cmake
|
||||||
|
@@ -148,9 +148,9 @@
|
||||||
|
/* Define to 1 if the system has the type `ssize_t'. */
|
||||||
|
#cmakedefine01 HAVE_SSIZE_T
|
||||||
|
|
||||||
|
-#if (HAVE_SSIZE_T == 0)
|
||||||
|
-#define ssize_t intptr_t
|
||||||
|
-#endif
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <stdint.h> header file. */
|
||||||
|
#cmakedefine01 HAVE_STDINT_H
|
|
@ -141,3 +141,53 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
enum PropertyValue : ALenum {
|
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;
|
||||||
|
|
|
@ -128,6 +128,17 @@
|
||||||
|
|
||||||
|
|
||||||
/************************************************
|
/************************************************
|
||||||
|
--- a/alc/alconfig.cpp
|
||||||
|
+++ b/alc/alconfig.cpp
|
||||||
|
@@ -37,7 +37,7 @@
|
||||||
|
#include <fstream>
|
||||||
|
#include <istream>
|
||||||
|
#include <limits>
|
||||||
|
-#include <string>
|
||||||
|
+#include "../../src/mkxp-threads.h"
|
||||||
|
#include <string_view>
|
||||||
|
#include <utility>
|
||||||
|
#include <vector>
|
||||||
--- a/alc/backends/alsa.cpp
|
--- a/alc/backends/alsa.cpp
|
||||||
+++ b/alc/backends/alsa.cpp
|
+++ b/alc/backends/alsa.cpp
|
||||||
@@ -30,7 +30,7 @@
|
@@ -30,7 +30,7 @@
|
||||||
|
@ -238,6 +249,17 @@
|
||||||
#include <optional>
|
#include <optional>
|
||||||
#include <string_view>
|
#include <string_view>
|
||||||
|
|
||||||
|
--- a/common/alassert.cpp
|
||||||
|
+++ b/common/alassert.cpp
|
||||||
|
@@ -2,7 +2,7 @@
|
||||||
|
#include "alassert.h"
|
||||||
|
|
||||||
|
#include <stdexcept>
|
||||||
|
-#include <string>
|
||||||
|
+#include "../../src/mkxp-threads.h"
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
--- a/common/alsem.cpp
|
--- a/common/alsem.cpp
|
||||||
+++ b/common/alsem.cpp
|
+++ b/common/alsem.cpp
|
||||||
@@ -55,8 +55,6 @@ void semaphore::post()
|
@@ -55,8 +55,6 @@ void semaphore::post()
|
||||||
|
@ -403,13 +425,16 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
-#ifdef _WIN32
|
-#ifdef _WIN32
|
||||||
+#if false
|
+/*
|
||||||
DWORD mTss{TLS_OUT_OF_INDEXES};
|
DWORD mTss{TLS_OUT_OF_INDEXES};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -107,29 +107,30 @@ public:
|
@@ -105,32 +105,33 @@ public:
|
||||||
|
[[nodiscard]]
|
||||||
|
auto get() const noexcept -> T { return from_ptr(pthread_getspecific(mTss)); }
|
||||||
|
|
||||||
#else
|
-#else
|
||||||
|
+*/
|
||||||
|
|
||||||
- tss_t mTss{};
|
- tss_t mTss{};
|
||||||
+ void **mTss;
|
+ void **mTss;
|
||||||
|
@ -442,10 +467,12 @@
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
- auto get() const noexcept -> T { return from_ptr(tss_get(mTss)); }
|
- auto get() const noexcept -> T { return from_ptr(tss_get(mTss)); }
|
||||||
|
-#endif /* _WIN32 */
|
||||||
+ auto get() const noexcept -> T { return from_ptr(*mTss); }
|
+ auto get() const noexcept -> T { return from_ptr(*mTss); }
|
||||||
#endif /* _WIN32 */
|
+
|
||||||
|
|
||||||
tss(const tss&) = delete;
|
tss(const tss&) = delete;
|
||||||
|
tss(tss&&) = delete;
|
||||||
--- a/core/context.h
|
--- a/core/context.h
|
||||||
+++ b/core/context.h
|
+++ b/core/context.h
|
||||||
@@ -140,7 +140,7 @@ struct ContextBase {
|
@@ -140,7 +140,7 @@ struct ContextBase {
|
||||||
|
@ -457,6 +484,17 @@
|
||||||
al::semaphore mEventSem;
|
al::semaphore mEventSem;
|
||||||
std::unique_ptr<RingBuffer> mAsyncEvents;
|
std::unique_ptr<RingBuffer> mAsyncEvents;
|
||||||
using AsyncEventBitset = std::bitset<al::to_underlying(AsyncEnableBits::Count)>;
|
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-threads.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 @@
|
||||||
|
@ -512,6 +550,17 @@
|
||||||
#include <optional>
|
#include <optional>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <string_view>
|
#include <string_view>
|
||||||
|
--- a/core/mastering.cpp
|
||||||
|
+++ b/core/mastering.cpp
|
||||||
|
@@ -4,7 +4,7 @@
|
||||||
|
#include "mastering.h"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
-#include <cmath>
|
||||||
|
+#include "../../src/mkxp-threads.h"
|
||||||
|
#include <cstddef>
|
||||||
|
#include <functional>
|
||||||
|
#include <iterator>
|
||||||
--- a/examples/alffplay.cpp
|
--- a/examples/alffplay.cpp
|
||||||
+++ b/examples/alffplay.cpp
|
+++ b/examples/alffplay.cpp
|
||||||
@@ -20,7 +20,7 @@
|
@@ -20,7 +20,7 @@
|
||||||
|
|
|
@ -22,3 +22,14 @@
|
||||||
/ float{EARLY_LINE_LENGTHS.size()} * density_mult;
|
/ float{EARLY_LINE_LENGTHS.size()} * density_mult;
|
||||||
Coeff = CalcDecayCoeff(length, decayTime);
|
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);
|
||||||
|
|
Loading…
Add table
Reference in a new issue