mirror of
https://github.com/mkxp-z/mkxp-z.git
synced 2025-08-24 07:43:44 +02:00

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.
73 lines
1.6 KiB
Diff
73 lines
1.6 KiB
Diff
# Disables OpenAL Soft's event thread because we don't need it (we only need to render to the loopback driver), and because it causes problems on platforms with no threading support.
|
|
|
|
--- a/al/event.cpp
|
|
+++ b/al/event.cpp
|
|
@@ -116,34 +116,34 @@ static int EventThread(ALCcontext *context)
|
|
|
|
void StartEventThrd(ALCcontext *ctx)
|
|
{
|
|
- try {
|
|
- ctx->mEventThread = std::thread{EventThread, ctx};
|
|
- }
|
|
- catch(std::exception& e) {
|
|
- ERR("Failed to start event thread: %s\n", e.what());
|
|
- }
|
|
- catch(...) {
|
|
- ERR("Failed to start event thread! Expect problems.\n");
|
|
- }
|
|
+
|
|
+
|
|
+
|
|
+
|
|
+
|
|
+
|
|
+
|
|
+
|
|
+
|
|
}
|
|
|
|
void StopEventThrd(ALCcontext *ctx)
|
|
{
|
|
- RingBuffer *ring{ctx->mAsyncEvents.get()};
|
|
- auto evt_data = ring->getWriteVector().first;
|
|
- if(evt_data.len == 0)
|
|
- {
|
|
- do {
|
|
- std::this_thread::yield();
|
|
- evt_data = ring->getWriteVector().first;
|
|
- } while(evt_data.len == 0);
|
|
- }
|
|
- al::construct_at(reinterpret_cast<AsyncEvent*>(evt_data.buf), AsyncEvent::KillThread);
|
|
- ring->writeAdvance(1);
|
|
|
|
- ctx->mEventSem.post();
|
|
- if(ctx->mEventThread.joinable())
|
|
- ctx->mEventThread.join();
|
|
+
|
|
+
|
|
+
|
|
+
|
|
+
|
|
+
|
|
+
|
|
+
|
|
+
|
|
+
|
|
+
|
|
+
|
|
+
|
|
+
|
|
}
|
|
|
|
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>;
|