mkxp-z/subprojects/packagefiles/openal-soft.patch
刘皓 4a730f5e8b
Use a newer version of OpenAL Soft in libretro builds
The Emscripten build was crashing because of some unaligned memory
access in OpenAL Soft. Hopefully this fixes it.
2025-01-31 17:28:34 -05:00

82 lines
2.8 KiB
Diff

# Sets the C standard to C11 instead of C17 since Emscripten doesn't support C17.
# Also removes the call to `__android_log_printf()` on Android.
# Also removes the Apple-specific code from alconfig.cpp.
diff --git a/CMakeLists.txt b/CMakeLists.txt
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -79,8 +79,8 @@ set(ALSOFT_STD_VERSION_PROPS
# Require C++17.
CXX_STANDARD 17
CXX_STANDARD_REQUIRED TRUE
- # Prefer C17, but support earlier when necessary.
- C_STANDARD 17)
+
+ C_STANDARD 11)
set(CMAKE_MODULE_PATH "${OpenAL_SOURCE_DIR}/cmake")
diff --git a/alc/alconfig.cpp b/alc/alconfig.cpp
--- a/alc/alconfig.cpp
+++ b/alc/alconfig.cpp
@@ -419,21 +419,6 @@ void ReadALConfig()
}
}
-#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"))
{
diff --git a/core/helpers.cpp b/core/helpers.cpp
--- a/core/helpers.cpp
+++ b/core/helpers.cpp
@@ -368,7 +368,7 @@ namespace {
bool SetRTPriorityPthread(int prio [[maybe_unused]])
{
int err{ENOTSUP};
-#if defined(HAVE_PTHREAD_SETSCHEDPARAM) && !defined(__OpenBSD__)
+#if defined(HAVE_PTHREAD_SETSCHEDPARAM) && !defined(__OpenBSD__) && !defined(__EMSCRIPTEN__)
/* Get the min and max priority for SCHED_RR. Limit the max priority to
* half, for now, to ensure the thread can't take the highest priority and
* go rogue.
diff --git a/core/logging.cpp b/core/logging.cpp
--- a/core/logging.cpp
+++ b/core/logging.cpp
@@ -103,23 +103,6 @@ void al_print_impl(LogLevel level, const fmt::string_view fmt, fmt::format_args
* non-Release builds.
*/
OutputDebugStringW(utf8_to_wstr(fmt::format("{}{}\n", prefix, msg)).c_str());
-#elif defined(__ANDROID__)
- auto android_severity = [](LogLevel l) noexcept
- {
- switch(l)
- {
- case LogLevel::Trace: return ANDROID_LOG_DEBUG;
- case LogLevel::Warning: return ANDROID_LOG_WARN;
- case LogLevel::Error: return ANDROID_LOG_ERROR;
- /* Should not happen. */
- case LogLevel::Disable:
- break;
- }
- return ANDROID_LOG_ERROR;
- };
- /* NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg) */
- __android_log_print(android_severity(level), "openal", "%.*s%s", al::sizei(prefix),
- prefix.data(), msg.c_str());
#endif
auto cblock = std::lock_guard{LogCallbackMutex};