Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions MarathonRecomp/kernel/imports.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -765,15 +765,15 @@ void RtlLeaveCriticalSection(XRTL_CRITICAL_SECTION* cs)

void RtlEnterCriticalSection(XRTL_CRITICAL_SECTION* cs)
{
uint32_t thisThread = g_ppcContext->r13.u32;
be<uint32_t> thisThread = g_ppcContext->r13.u32;
// printf("RtlEnterCriticalSection %x %x %x %x\n", thisThread, cs->OwningThread, cs->LockCount, cs->RecursionCount);
assert(thisThread != NULL);

std::atomic_ref owningThread(cs->OwningThread);

while (true)
{
uint32_t previousOwner = 0;
be<uint32_t> previousOwner = 0;

if (owningThread.compare_exchange_weak(previousOwner, thisThread) || previousOwner == thisThread)
{
Expand Down Expand Up @@ -1282,12 +1282,12 @@ void XexGetModuleHandle()
bool RtlTryEnterCriticalSection(XRTL_CRITICAL_SECTION* cs)
{
// printf("RtlTryEnterCriticalSection\n");
uint32_t thisThread = g_ppcContext->r13.u32;
be<uint32_t> thisThread = g_ppcContext->r13.u32;
assert(thisThread != NULL);

std::atomic_ref owningThread(cs->OwningThread);

uint32_t previousOwner = 0;
be<uint32_t> previousOwner = 0;

if (owningThread.compare_exchange_weak(previousOwner, thisThread) || previousOwner == thisThread)
{
Expand Down
Loading