diff --git a/source/frontends/sdl/imgui/sdlsettings.cpp b/source/frontends/sdl/imgui/sdlsettings.cpp index e683f842..341421da 100644 --- a/source/frontends/sdl/imgui/sdlsettings.cpp +++ b/source/frontends/sdl/imgui/sdlsettings.cpp @@ -235,10 +235,19 @@ namespace sa2 ImGui::Separator(); + if (frame->HardwareChanged()) + { + ImGui::PushStyleColor(ImGuiCol_Button, (ImVec4)ImColor(180, 0, 0)); + } + else + { + ImGui::PushStyleColor(ImGuiCol_Button, (ImVec4)ImColor(0, 180, 0)); + } if (ImGui::Button("Restart")) { frame->Restart(); } + ImGui::PopStyleColor(1); ImGui::SameLine(); if (ImGui::Button("ResetMachineState")) diff --git a/source/frontends/sdl/processfile.cpp b/source/frontends/sdl/processfile.cpp index abc279a4..50d8e595 100644 --- a/source/frontends/sdl/processfile.cpp +++ b/source/frontends/sdl/processfile.cpp @@ -89,6 +89,7 @@ namespace sa2 if (strlen(filename) > strlen(yaml) && !strcmp(filename + strlen(filename) - strlen(yaml), yaml)) { common2::setSnapshotFilename(filename, true); + frame->ResetHardware(); } else if (strlen(filename) > strlen(wav) && !strcmp(filename + strlen(filename) - strlen(wav), wav)) { diff --git a/source/frontends/sdl/sdlframe.cpp b/source/frontends/sdl/sdlframe.cpp index 0c5f7795..3083d6f0 100644 --- a/source/frontends/sdl/sdlframe.cpp +++ b/source/frontends/sdl/sdlframe.cpp @@ -152,6 +152,7 @@ namespace sa2 CommonFrame::Initialize(); mySpeed.reset(); setGLSwapInterval(myTargetGLSwap); + ResetHardware(); } void SDLFrame::FrameRefreshStatus(int drawflags) @@ -388,6 +389,7 @@ namespace sa2 { Snapshot_LoadState(); mySpeed.reset(); + ResetHardware(); break; } case SDLK_F11: @@ -698,6 +700,17 @@ namespace sa2 Execute(0); } + void SDLFrame::ResetHardware() + { + myHardwareConfig = CConfigNeedingRestart(GetPropertySheet().GetTheFreezesF8Rom()); + } + + bool SDLFrame::HardwareChanged() const + { + const CConfigNeedingRestart currentConfig(GetPropertySheet().GetTheFreezesF8Rom()); + return myHardwareConfig != currentConfig; + } + } void SingleStep(bool /* bReinit */) diff --git a/source/frontends/sdl/sdlframe.h b/source/frontends/sdl/sdlframe.h index 57281df7..33ef3ea6 100644 --- a/source/frontends/sdl/sdlframe.h +++ b/source/frontends/sdl/sdlframe.h @@ -1,6 +1,7 @@ #pragma once #include "Common.h" +#include "Configuration/Config.h" #include "frontends/common2/commonframe.h" #include "frontends/common2/speed.h" #include @@ -29,6 +30,8 @@ namespace sa2 void ExecuteOneFrame(const size_t msNextFrame); void ChangeMode(const AppMode_e mode); void SingleStep(); + void ResetHardware(); + bool HardwareChanged() const; virtual void ResetSpeed(); const std::shared_ptr & GetWindow() const; @@ -73,6 +76,8 @@ namespace sa2 common2::Speed mySpeed; std::shared_ptr myWindow; + + CConfigNeedingRestart myHardwareConfig; }; }