[SoundFix]: Disable as this seems fixed (#1007)

This commit is contained in:
Edo 2023-05-03 22:44:11 +01:00 committed by GitHub
parent 35141b1106
commit 42110d586d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 0 additions and 57 deletions

View File

@ -49,7 +49,6 @@
#include "Modules/ServerList.hpp" #include "Modules/ServerList.hpp"
#include "Modules/Session.hpp" #include "Modules/Session.hpp"
#include "Modules/SlowMotion.hpp" #include "Modules/SlowMotion.hpp"
#include "Modules/SoundMutexFix.hpp"
#include "Modules/StartupMessages.hpp" #include "Modules/StartupMessages.hpp"
#include "Modules/Stats.hpp" #include "Modules/Stats.hpp"
#include "Modules/StringTable.hpp" #include "Modules/StringTable.hpp"
@ -163,7 +162,6 @@ namespace Components
Register(new ServerList()); Register(new ServerList());
Register(new Session()); Register(new Session());
Register(new SlowMotion()); Register(new SlowMotion());
Register(new SoundMutexFix());
Register(new StartupMessages()); Register(new StartupMessages());
Register(new Stats()); Register(new Stats());
Register(new StringTable()); Register(new StringTable());

View File

@ -1,40 +0,0 @@
#include <STDInclude.hpp>
#include "SoundMutexFix.hpp"
namespace Components
{
// This component is a workaround for issue https://github.com/XLabsProject/iw4x-client/issues/80
// In case the link goes down, this is a "game hangs randomly" issue:
//
// Investigations on the issue pointed out it comes from a situation on Intel processors where
// WaitForSingleObjectA is ignored by a thread, for some (?) reason.
//
// This locks up the game randomly, mostly at the end of rounds or when too many things happen at
// once, due to trying to stop sounds (AIL_Stop_sounds) and playing streams at the same time,
// rushing for the same resource via AIL_lock_mutex.
//
// This bug has been reproduced on mp_terminal, mp_overgrown, mp_rust, with and without bots,
// and so far this has been the only way to circumvent it afaik. This component wraps
// miles' mutex into another mutex, created below, and for some reason (?) that mutex is
// respected when miles' is not.
//
// As soon as a real fix is found, please discard this fix. In the meantime, it should not
// have side effects too bad - worst case it might cause a slight performance drop during
// team switch and intermission.
//
std::mutex SoundMutexFix::CloseStreamMutex;
void WINAPI SoundMutexFix::AIL_close_stream_Stub(int h_stream)
{
std::lock_guard lock(CloseStreamMutex);
const auto ptr = *reinterpret_cast<DWORD*>(0x6D7554); // AIL_close_stream
Utils::Hook::Call<void WINAPI(int)>(ptr)(h_stream);
}
SoundMutexFix::SoundMutexFix()
{
Utils::Hook(0x689EFE, &AIL_close_stream_Stub, HOOK_JUMP).install()->quick();
}
}

View File

@ -1,15 +0,0 @@
#pragma once
#include <mutex>
namespace Components
{
class SoundMutexFix : public Component
{
public:
SoundMutexFix();
private:
static std::mutex CloseStreamMutex;
static void WINAPI AIL_close_stream_Stub(int h_stream);
};
}