mirror of
https://github.com/nzeemin/ukncbtl-qt.git
synced 2025-04-18 06:04:01 +03:00
Save/restore debugger breakpoints.
This commit is contained in:
parent
ae5021f81d
commit
7f49f77836
@ -101,9 +101,9 @@ void DebugLog(const char* message)
|
||||
#ifndef Q_OS_WIN32
|
||||
QString dirname = QDir::homePath() + "/.QtUkncBtl/";
|
||||
QDir tracedir(dirname);
|
||||
if(!tracedir.exists())
|
||||
if (!tracedir.exists())
|
||||
{
|
||||
if(!tracedir.mkdir(dirname))
|
||||
if (!tracedir.mkdir(dirname))
|
||||
{
|
||||
::perror("Operation failed");
|
||||
return;
|
||||
@ -113,7 +113,7 @@ void DebugLog(const char* message)
|
||||
#endif
|
||||
#endif
|
||||
Common_LogFile = ::fopen(fullpathfile.c_str(), "a+b");
|
||||
if(!Common_LogFile)
|
||||
if (!Common_LogFile)
|
||||
{
|
||||
::perror("Tracefile opening failed");
|
||||
return;
|
||||
|
@ -71,8 +71,12 @@ bool Emulator_Init()
|
||||
m_wEmulatorCPUBpsCount = m_wEmulatorPPUBpsCount = 0;
|
||||
for (int i = 0; i <= MAX_BREAKPOINTCOUNT; i++)
|
||||
{
|
||||
m_EmulatorCPUBps[i] = 0177777;
|
||||
m_EmulatorPPUBps[i] = 0177777;
|
||||
uint16_t address = Settings_GetDebugBreakpoint(i, true);
|
||||
m_EmulatorCPUBps[i] = address;
|
||||
if (address != 0177777) m_wEmulatorCPUBpsCount = i + 1;
|
||||
address = Settings_GetDebugBreakpoint(i, false);
|
||||
m_EmulatorPPUBps[i] = address;
|
||||
if (address != 0177777) m_wEmulatorPPUBpsCount = i + 1;
|
||||
}
|
||||
|
||||
g_pBoard = new CMotherboard();
|
||||
@ -126,6 +130,12 @@ void Emulator_Done()
|
||||
{
|
||||
ASSERT(g_pBoard != nullptr);
|
||||
|
||||
// Save breakpoints
|
||||
for (int i = 0; i < MAX_BREAKPOINTCOUNT; i++)
|
||||
Settings_SetDebugBreakpoint(i, true, i < m_wEmulatorCPUBpsCount ? m_EmulatorCPUBps[i] : 0177777);
|
||||
for (int i = 0; i < MAX_BREAKPOINTCOUNT; i++)
|
||||
Settings_SetDebugBreakpoint(i, false, i < m_wEmulatorPPUBpsCount ? m_EmulatorPPUBps[i] : 0177777);
|
||||
|
||||
CProcessor::Done();
|
||||
|
||||
g_pBoard->SetSoundGenCallback(nullptr);
|
||||
|
@ -105,6 +105,25 @@ quint16 Settings_GetDebugMemoryMode()
|
||||
return (quint16)value.toUInt();
|
||||
}
|
||||
|
||||
void Settings_SetDebugBreakpoint(int bpno, bool okCpuPpu, quint16 address)
|
||||
{
|
||||
char bufValueName[] = "DebugBreakptCpu0";
|
||||
bufValueName[12] = okCpuPpu ? 'C' : 'P';
|
||||
bufValueName[15] = bpno < 10 ? '0' + (char)bpno : 'A' + (char)(bpno - 10);
|
||||
if (address == 0177777)
|
||||
Global_getSettings()->remove(bufValueName);
|
||||
else
|
||||
Global_getSettings()->setValue(bufValueName, address);
|
||||
}
|
||||
quint16 Settings_GetDebugBreakpoint(int bpno, bool okCpuPpu)
|
||||
{
|
||||
char bufValueName[] = "DebugBreakptCpu0";
|
||||
bufValueName[12] = okCpuPpu ? 'C' : 'P';
|
||||
bufValueName[15] = bpno < 10 ? '0' + (char)bpno : 'A' + (char)(bpno - 10);
|
||||
QVariant value = Global_getSettings()->value(bufValueName, 0177777);
|
||||
return (quint16)value.toUInt();
|
||||
}
|
||||
|
||||
void Settings_SetDebugMemoryAddress(quint16 mode)
|
||||
{
|
||||
Global_getSettings()->setValue("DebugMemoryAddress", mode);
|
||||
|
@ -41,6 +41,8 @@ void Settings_SetSoundAY(bool flag);
|
||||
bool Settings_GetSoundAY();
|
||||
bool Settings_GetDebugCpuPpu();
|
||||
void Settings_SetDebugCpuPpu(bool flag);
|
||||
void Settings_SetDebugBreakpoint(int bpno, bool okCpuPpu, quint16 address);
|
||||
quint16 Settings_GetDebugBreakpoint(int bpno, bool okCpuPpu);
|
||||
void Settings_SetDebugMemoryMode(quint16 mode);
|
||||
quint16 Settings_GetDebugMemoryMode();
|
||||
void Settings_SetDebugMemoryAddress(quint16 address);
|
||||
|
Loading…
x
Reference in New Issue
Block a user