Files
SourMesen e391fd8f9a Code: Add auto-formatting rules for C++ (clang-format) and enforce in CI via "clang-format" and "dotnet format" (#78)
* Code: Add auto-formatting rules for C++ projects (clang-format) and enforce code style via "clang-format" and "dotnet format"

* fix ui format warnings
2026-04-30 06:03:55 -07:00

36 lines
717 B
C++

#include "pch.h"
#include "Shared/EmulatorLock.h"
#include "Shared/Emulator.h"
#include "Shared/DebuggerRequest.h"
#include "Debugger/DebugBreakHelper.h"
EmulatorLock::EmulatorLock(Emulator* emu, bool allowDebuggerLock)
{
_emu = emu;
if(_emu->_runLock.IsLockedByCurrentThread()) {
_emu->Lock();
} else {
if(allowDebuggerLock) {
_debugger.reset(new DebuggerRequest(emu->GetDebugger(false)));
if(_debugger->GetDebugger()) {
_breakHelper.reset(new DebugBreakHelper(_debugger->GetDebugger(), true));
} else {
_debugger.reset();
_emu->Lock();
}
} else {
_emu->Lock();
}
}
}
EmulatorLock::~EmulatorLock()
{
if(_debugger) {
_breakHelper.reset();
} else {
_emu->Unlock();
}
}