Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
sh95014 committed Dec 22, 2023
2 parents 9615f47 + b8ad971 commit e52e1e5
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 8 deletions.
13 changes: 13 additions & 0 deletions source/frontends/sdl/imgui/sdldebugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,9 +287,22 @@ namespace sa2
}
}
}

if (!showDebugger)
{
// this happes when the window is closed
syncDebuggerState(frame);
}

ImGui::End();
}

void ImGuiDebugger::syncDebuggerState(SDLFrame * frame)
{
const AppMode_e mode = showDebugger ? MODE_DEBUG : MODE_RUNNING;
frame->ChangeMode(mode);
}

void ImGuiDebugger::debuggerCommand(SDLFrame * frame, const char * s)
{
for (; *s; ++s)
Expand Down
3 changes: 3 additions & 0 deletions source/frontends/sdl/imgui/sdldebugger.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ namespace sa2

void drawDebugger(SDLFrame* frame);
void resetDebuggerCycles();

void syncDebuggerState(SDLFrame* frame);

private:
bool mySyncCPU = true;

Expand Down
29 changes: 21 additions & 8 deletions source/frontends/sdl/imgui/sdlsettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,14 @@ namespace
}
}

void setSpeedMultiplier(sa2::SDLFrame* frame, const DWORD speedMultiplier)
{
g_dwSpeed = speedMultiplier;
SetCurrentCLK6502();
REGSAVE(TEXT(REGVALUE_EMULATION_SPEED), g_dwSpeed);
frame->ResetSpeed();
}

}

namespace sa2
Expand All @@ -69,9 +77,9 @@ namespace sa2
ImGui::Checkbox("Memory", &myShowMemory);
ImGui::SameLine(); HelpMarker("Show Apple memory.");

if (ImGui::Checkbox("Debugger", &myDebugger.showDebugger) && myDebugger.showDebugger)
if (ImGui::Checkbox("Debugger", &myDebugger.showDebugger))
{
frame->ChangeMode(MODE_DEBUG);
myDebugger.syncDebuggerState(frame);
}
ImGui::SameLine(); HelpMarker("Show Apple CPU.");

Expand Down Expand Up @@ -125,12 +133,17 @@ namespace sa2
int speedMultiplier = g_dwSpeed;
if (ImGui::SliderInt("Speed", &speedMultiplier, SPEED_MIN, SPEED_MAX))
{
g_dwSpeed = speedMultiplier;
SetCurrentCLK6502();
REGSAVE(TEXT(REGVALUE_EMULATION_SPEED), g_dwSpeed);
frame->ResetSpeed();
setSpeedMultiplier(frame, speedMultiplier);
}

/* */ if (ImGui::Button("0.5 MHz")) setSpeedMultiplier(frame, SPEED_MIN);
ImGui::SameLine(); if (ImGui::Button("1 MHz")) setSpeedMultiplier(frame, SPEED_NORMAL);
ImGui::SameLine(); if (ImGui::Button("2 MHz")) setSpeedMultiplier(frame, SPEED_NORMAL * 2);
ImGui::SameLine(); if (ImGui::Button("3 MHz")) setSpeedMultiplier(frame, SPEED_NORMAL * 3);
ImGui::SameLine(); if (ImGui::Button("MAX")) setSpeedMultiplier(frame, SPEED_MAX);

ImGui::Separator();

const common2::Speed::Stats stats = frame->getSpeed().getSpeedStats();
ImGui::LabelText("Clock", "%15.2f Hz", stats.nominal);
ImGui::LabelText("Audio adjusted", "%12.0f Hz", stats.audio);
Expand Down Expand Up @@ -725,9 +738,9 @@ namespace sa2
{
ImGui::MenuItem("Settings", nullptr, &myShowSettings);
ImGui::MenuItem("Memory", nullptr, &myShowMemory);
if (ImGui::MenuItem("Debugger", nullptr, &myDebugger.showDebugger) && myDebugger.showDebugger)
if (ImGui::MenuItem("Debugger", nullptr, &myDebugger.showDebugger))
{
frame->ChangeMode(MODE_DEBUG);
myDebugger.syncDebuggerState(frame);
}
ImGui::EndMenu();
}
Expand Down

0 comments on commit e52e1e5

Please sign in to comment.