More Debugger related work.
Signed-off-by: Andrea Odetti <mariofutire@gmail.com>
This commit is contained in:
parent
c36cbe5a31
commit
9d4f293a3c
7 changed files with 74 additions and 23 deletions
|
@ -81,7 +81,6 @@ set(SOURCE_FILES
|
||||||
linux/network/tfe2.cpp
|
linux/network/tfe2.cpp
|
||||||
linux/network/slirp2.cpp
|
linux/network/slirp2.cpp
|
||||||
|
|
||||||
linux/duplicates/AppleWin.cpp
|
|
||||||
linux/duplicates/Debugger_Display.cpp
|
linux/duplicates/Debugger_Display.cpp
|
||||||
linux/duplicates/Debugger_Win32.cpp
|
linux/duplicates/Debugger_Win32.cpp
|
||||||
linux/duplicates/Joystick.cpp
|
linux/duplicates/Joystick.cpp
|
||||||
|
|
|
@ -366,3 +366,8 @@ namespace na2
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SingleStep(bool /* bReinit */)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -142,3 +142,8 @@ BYTE* QtFrame::GetResource(WORD id, LPCSTR lpType, DWORD expectedSize)
|
||||||
|
|
||||||
return reinterpret_cast<BYTE *>(myResource.data());
|
return reinterpret_cast<BYTE *>(myResource.data());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SingleStep(bool /* bReinit */)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
#include "Utilities.h"
|
#include "Utilities.h"
|
||||||
#include "Memory.h"
|
#include "Memory.h"
|
||||||
|
|
||||||
#include "Debugger/Debug.h"
|
|
||||||
#include "Debugger/DebugDefs.h"
|
#include "Debugger/DebugDefs.h"
|
||||||
|
|
||||||
#include "Tfe/tfe.h"
|
#include "Tfe/tfe.h"
|
||||||
|
@ -854,20 +853,15 @@ namespace sa2
|
||||||
const ImGuiTableFlags flags = ImGuiTableFlags_BordersV | ImGuiTableFlags_BordersOuter | ImGuiTableFlags_ScrollY;
|
const ImGuiTableFlags flags = ImGuiTableFlags_BordersV | ImGuiTableFlags_BordersOuter | ImGuiTableFlags_ScrollY;
|
||||||
if (ImGui::BeginTable("Console", 1, flags))
|
if (ImGui::BeginTable("Console", 1, flags))
|
||||||
{
|
{
|
||||||
for (int i = 0; i < CONSOLE_HEIGHT; ++i)
|
for (int i = g_nConsoleDisplayTotal; i >= CONSOLE_FIRST_LINE; --i)
|
||||||
{
|
{
|
||||||
const conchar_t * src = g_aConsoleDisplay[CONSOLE_HEIGHT - i - 1];
|
const conchar_t * src = g_aConsoleDisplay[i];
|
||||||
char line[CONSOLE_WIDTH + 1];
|
char line[CONSOLE_WIDTH + 1];
|
||||||
COLORREF currentColor = ConsoleColor_GetColor(src[0]);
|
size_t length = 0;
|
||||||
line[0] = ConsoleChar_GetChar(src[0]);
|
|
||||||
size_t length = 1;
|
|
||||||
if (!line[0])
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui::TableNextRow();
|
ImGui::TableNextRow();
|
||||||
ImGui::TableNextColumn();
|
ImGui::TableNextColumn();
|
||||||
|
COLORREF currentColor = DebuggerGetColor( FG_CONSOLE_OUTPUT );
|
||||||
|
|
||||||
const auto textAndReset = [&line, &length, & currentColor] () {
|
const auto textAndReset = [&line, &length, & currentColor] () {
|
||||||
line[length] = 0;
|
line[length] = 0;
|
||||||
|
@ -876,7 +870,7 @@ namespace sa2
|
||||||
ImGui::TextColored(color, "%s", line);
|
ImGui::TextColored(color, "%s", line);
|
||||||
};
|
};
|
||||||
|
|
||||||
for (size_t j = length; j < CONSOLE_WIDTH; ++j)
|
for (size_t j = 0; j < CONSOLE_WIDTH; ++j)
|
||||||
{
|
{
|
||||||
const conchar_t g = src[j];
|
const conchar_t g = src[j];
|
||||||
if (ConsoleColor_IsColorOrMouse(g))
|
if (ConsoleColor_IsColorOrMouse(g))
|
||||||
|
@ -888,10 +882,26 @@ namespace sa2
|
||||||
currentColor = ConsoleColor_GetColor(g);
|
currentColor = ConsoleColor_GetColor(g);
|
||||||
}
|
}
|
||||||
line[length] = ConsoleChar_GetChar(g);
|
line[length] = ConsoleChar_GetChar(g);
|
||||||
++length;
|
if (line[length])
|
||||||
|
{
|
||||||
|
++length;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
textAndReset();
|
textAndReset();
|
||||||
}
|
}
|
||||||
|
ImGui::TableNextRow();
|
||||||
|
ImGui::TableNextColumn();
|
||||||
|
ImGui::TextUnformatted(g_aConsoleInput);
|
||||||
|
|
||||||
|
if (myScrollConsole)
|
||||||
|
{
|
||||||
|
ImGui::SetScrollHereY(1.0f);
|
||||||
|
myScrollConsole = false;
|
||||||
|
}
|
||||||
ImGui::EndTable();
|
ImGui::EndTable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -900,7 +910,8 @@ namespace sa2
|
||||||
{
|
{
|
||||||
if (ImGui::Begin("Debugger", &myShowDebugger))
|
if (ImGui::Begin("Debugger", &myShowDebugger))
|
||||||
{
|
{
|
||||||
if (ImGui::BeginTabBar("Settings"))
|
ImGui::BeginChild("Console", ImVec2(0, -ImGui::GetFrameHeightWithSpacing()));
|
||||||
|
if (ImGui::BeginTabBar("Tabs"))
|
||||||
{
|
{
|
||||||
if (ImGui::BeginTabItem("CPU"))
|
if (ImGui::BeginTabItem("CPU"))
|
||||||
{
|
{
|
||||||
|
@ -931,6 +942,10 @@ namespace sa2
|
||||||
{
|
{
|
||||||
frame->ChangeMode(MODE_PAUSED);
|
frame->ChangeMode(MODE_PAUSED);
|
||||||
}
|
}
|
||||||
|
if ((ImGui::SameLine(), ImGui::Button("Debug")))
|
||||||
|
{
|
||||||
|
frame->ChangeMode(MODE_DEBUG);
|
||||||
|
}
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::Text("%016llu - %04X", g_nCumulativeCycles, regs.pc);
|
ImGui::Text("%016llu - %04X", g_nCumulativeCycles, regs.pc);
|
||||||
|
|
||||||
|
@ -961,9 +976,20 @@ namespace sa2
|
||||||
}
|
}
|
||||||
ImGui::EndTabBar();
|
ImGui::EndTabBar();
|
||||||
}
|
}
|
||||||
|
ImGui::EndChild();
|
||||||
|
if (ImGui::InputText("Prompt", myInputBuffer, IM_ARRAYSIZE(myInputBuffer), ImGuiInputTextFlags_EnterReturnsTrue))
|
||||||
|
{
|
||||||
|
for (const char *ch = myInputBuffer; *ch; ++ch)
|
||||||
|
{
|
||||||
|
DebuggerInputConsoleChar(*ch);
|
||||||
|
}
|
||||||
|
DebuggerProcessKey(VK_RETURN);
|
||||||
|
myScrollConsole = true;
|
||||||
|
myInputBuffer[0] = 0;
|
||||||
|
ImGui::SetKeyboardFocusHere(-1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
#include "frontends/sdl/imgui/gles.h"
|
#include "frontends/sdl/imgui/gles.h"
|
||||||
#include "frontends/sdl/sdirectsound.h"
|
#include "frontends/sdl/sdirectsound.h"
|
||||||
|
#include "Debugger/Debug.h"
|
||||||
|
#include "Debugger/Debugger_Console.h"
|
||||||
|
|
||||||
namespace sa2
|
namespace sa2
|
||||||
{
|
{
|
||||||
|
@ -24,6 +26,9 @@ namespace sa2
|
||||||
bool mySyncCPU = true;
|
bool mySyncCPU = true;
|
||||||
bool myShowAbout = false;
|
bool myShowAbout = false;
|
||||||
|
|
||||||
|
bool myScrollConsole = true;
|
||||||
|
char myInputBuffer[CONSOLE_WIDTH] = "";
|
||||||
|
|
||||||
int myStepCycles = 0;
|
int myStepCycles = 0;
|
||||||
int mySpeakerVolume;
|
int mySpeakerVolume;
|
||||||
int myMockingboardVolume;
|
int myMockingboardVolume;
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
#include "Mockingboard.h"
|
#include "Mockingboard.h"
|
||||||
#include "MouseInterface.h"
|
#include "MouseInterface.h"
|
||||||
#include "Log.h"
|
#include "Log.h"
|
||||||
|
#include "Debugger/Debug.h"
|
||||||
|
|
||||||
#include "linux/paddle.h"
|
#include "linux/paddle.h"
|
||||||
#include "linux/keyboard.h"
|
#include "linux/keyboard.h"
|
||||||
|
@ -532,12 +533,20 @@ namespace sa2
|
||||||
{
|
{
|
||||||
// when running in adaptive speed
|
// when running in adaptive speed
|
||||||
// the value msNextFrame is only a hint for when the next frame will arrive
|
// the value msNextFrame is only a hint for when the next frame will arrive
|
||||||
if (g_nAppMode == MODE_RUNNING)
|
switch (g_nAppMode)
|
||||||
{
|
{
|
||||||
const size_t cyclesToExecute = mySpeed.getCyclesTillNext(msNextFrame * 1000);
|
case MODE_RUNNING:
|
||||||
Execute(cyclesToExecute);
|
{
|
||||||
}
|
const size_t cyclesToExecute = mySpeed.getCyclesTillNext(msNextFrame * 1000);
|
||||||
// else do nothing, it is either paused, debugged or stepped
|
Execute(cyclesToExecute);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case MODE_STEPPING:
|
||||||
|
{
|
||||||
|
DebugContinueStepping();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
void SDLFrame::ChangeMode(const AppMode_e mode)
|
void SDLFrame::ChangeMode(const AppMode_e mode)
|
||||||
|
@ -572,3 +581,8 @@ namespace sa2
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SingleStep(bool /* bReinit */)
|
||||||
|
{
|
||||||
|
dynamic_cast<sa2::SDLFrame &>(GetFrame()).Execute(0);
|
||||||
|
}
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
void SingleStep(bool /* bReinit */)
|
|
||||||
{
|
|
||||||
}
|
|
Loading…
Add table
Reference in a new issue