mirror of
https://github.com/isledecomp/isle.git
synced 2025-10-25 01:14:19 +00:00
Beta match MxAutoLock and MxCriticalSection (#1638)
Co-authored-by: jonschz <jonschz@users.noreply.github.com>
This commit is contained in:
@@ -2,8 +2,19 @@
|
||||
|
||||
#include "mxcriticalsection.h"
|
||||
|
||||
// FUNCTION: LEGO1 0x100b8ed0
|
||||
#ifdef BETA10
|
||||
// FUNCTION: BETA10 0x101386f0
|
||||
MxAutoLock::MxAutoLock(MxCriticalSection* p_criticalSection, const char* filename, int line)
|
||||
{
|
||||
m_criticalSection = p_criticalSection;
|
||||
m_currentThreadId = GetCurrentThreadId();
|
||||
|
||||
if (m_criticalSection != NULL) {
|
||||
m_criticalSection->Enter(m_currentThreadId, filename, line);
|
||||
}
|
||||
}
|
||||
#else
|
||||
// FUNCTION: LEGO1 0x100b8ed0
|
||||
MxAutoLock::MxAutoLock(MxCriticalSection* p_criticalSection)
|
||||
{
|
||||
m_criticalSection = p_criticalSection;
|
||||
@@ -12,6 +23,7 @@ MxAutoLock::MxAutoLock(MxCriticalSection* p_criticalSection)
|
||||
m_criticalSection->Enter();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// FUNCTION: LEGO1 0x100b8ef0
|
||||
// FUNCTION: BETA10 0x10138744
|
||||
|
||||
@@ -35,8 +35,35 @@ MxCriticalSection::~MxCriticalSection()
|
||||
}
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100b6d80
|
||||
#ifdef BETA10
|
||||
// FUNCTION: BETA10 0x1013c725
|
||||
void MxCriticalSection::Enter(unsigned long p_threadId, const char* filename, int line)
|
||||
{
|
||||
DWORD result;
|
||||
FILE* file;
|
||||
|
||||
if (m_mutex != NULL) {
|
||||
result = WaitForSingleObject(m_mutex, 5000);
|
||||
if (result == WAIT_FAILED) {
|
||||
file = fopen("C:\\DEADLOCK.TXT", "a");
|
||||
if (file != NULL) {
|
||||
fprintf(file, "mutex timeout occurred!\n");
|
||||
fprintf(file, "file: %s, line: %d\n", filename, line);
|
||||
fclose(file);
|
||||
}
|
||||
|
||||
abort();
|
||||
}
|
||||
}
|
||||
else {
|
||||
EnterCriticalSection(&m_criticalSection);
|
||||
}
|
||||
|
||||
// There is way more structure in here, and the MxCriticalSection class is much larger in BETA10.
|
||||
// The LEGO1 compilation is very unlikely to profit from a further decompilation here.
|
||||
}
|
||||
#else
|
||||
// FUNCTION: LEGO1 0x100b6d80
|
||||
void MxCriticalSection::Enter()
|
||||
{
|
||||
DWORD result;
|
||||
@@ -58,8 +85,10 @@ void MxCriticalSection::Enter()
|
||||
EnterCriticalSection(&m_criticalSection);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// FUNCTION: LEGO1 0x100b6de0
|
||||
// FUNCTION: BETA10 0x1013c7ef
|
||||
void MxCriticalSection::Leave()
|
||||
{
|
||||
if (m_mutex != NULL) {
|
||||
|
||||
Reference in New Issue
Block a user