[General]: Small cleanup (#963)

This commit is contained in:
Edo 2023-04-22 18:56:29 +02:00 committed by GitHub
parent 42e5132c5e
commit a43b95cbaa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 38 additions and 21 deletions

View File

@ -4,6 +4,23 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog v0.3.0](http://keepachangelog.com/en/0.3.0/).
## r4208 - 2023-04-22
### Changed
- `Noclip` GSC method does not require `sv_cheats` to be set to "1" for it to work (#962)
- `Ufo` GSC method does not require `sv_cheats` to be set to "1" for it to work (#962)
### Fixed
- Fix `InfoString` output (#961)
- Fix parsing of the server info (client-side) (#953)
- Fix bug in the /info TCP endpoint (#955)
### Known issues
- Sound issue fix is experimental as the bug is not fully understood.
## r4193 - 2023-04-19
### Added
@ -20,6 +37,7 @@ The format is based on [Keep a Changelog v0.3.0](http://keepachangelog.com/en/0.
### Fixed
- `sv_privatePassword` will work as intended (#908)
- Fix crash when loading bots.txt file (#927)
### Known issues

View File

@ -317,7 +317,7 @@ namespace Components
void Debug::Com_BugNameInc_f()
{
char buf[260]{};
char buf[512]{};
if (std::strlen(BugName->current.string) < 4)
{

View File

@ -23,18 +23,18 @@ namespace Components
// team switch and intermission.
//
std::mutex SoundMutexFix::SNDMutex;
std::mutex SoundMutexFix::CloseStreamMutex;
void __stdcall SoundMutexFix::LockSoundMutex(int unk)
void WINAPI SoundMutexFix::AIL_close_stream_Stub(int h_stream)
{
std::lock_guard lock(SNDMutex);
std::lock_guard lock(CloseStreamMutex);
DWORD funcPtr = *reinterpret_cast<DWORD*>(0x6D7554); // AIL_close_stream
Utils::Hook::Call<void __stdcall(int)>(funcPtr)(unk);
const auto ptr = *reinterpret_cast<DWORD*>(0x6D7554); // AIL_close_stream
Utils::Hook::Call<void WINAPI(int)>(ptr)(h_stream);
}
SoundMutexFix::SoundMutexFix()
{
Utils::Hook(0x689EFE, &LockSoundMutex, HOOK_JUMP).install()->quick();
Utils::Hook(0x689EFE, &AIL_close_stream_Stub, HOOK_JUMP).install()->quick();
}
}
}

View File

@ -9,7 +9,7 @@ namespace Components
SoundMutexFix();
private:
static std::mutex SNDMutex;
static void _stdcall LockSoundMutex(int unk);
static std::mutex CloseStreamMutex;
static void WINAPI AIL_close_stream_Stub(int h_stream);
};
}

View File

@ -10,23 +10,22 @@ namespace Game::Engine
{
Sys_EnterCriticalSection(this->s_);
this->hasOwnership_ = true;
return;
}
if (type == SCOPED_CRITSECT_TRY)
{
this->hasOwnership_ = Sys_TryEnterCriticalSection(this->s_);
}
else
{
if (type == SCOPED_CRITSECT_TRY)
if (type == SCOPED_CRITSECT_RELEASE)
{
this->hasOwnership_ = Sys_TryEnterCriticalSection(this->s_);
Sys_LeaveCriticalSection(this->s_);
this->isScopedRelease_ = true;
}
else
{
if (type == SCOPED_CRITSECT_RELEASE)
{
Sys_LeaveCriticalSection(this->s_);
this->isScopedRelease_ = true;
}
this->hasOwnership_ = false;
}
this->hasOwnership_ = false;
}
}