need to figure out why n64-systemtest loops indefinitely at some address that appears to be valid (i think it's me not invalidating the cache properly)
This commit is contained in:
@@ -160,24 +160,6 @@ void KaizenGui::HandleInput(const SDL_Event &event) {
|
||||
}
|
||||
}
|
||||
|
||||
std::pair<std::optional<s64>, std::optional<Util::Error::MemoryAccess>> RenderErrorMessageDetails() {
|
||||
auto lastPC = Util::Error::GetLastPC();
|
||||
if (lastPC.has_value()) {
|
||||
ImGui::Text("%s", std::format("Occurred @ PC = {:016X}", Util::Error::GetLastPC().value()).c_str());
|
||||
}
|
||||
|
||||
auto memoryAccess = Util::Error::GetMemoryAccess();
|
||||
if (memoryAccess.has_value()) {
|
||||
const auto [is_write, size, address, written_val] = memoryAccess.value();
|
||||
ImGui::Text("%s",
|
||||
std::format("{} {}-bit value @ {:08X}{}", is_write ? "Writing" : "Reading", static_cast<u8>(size),
|
||||
address, is_write ? std::format(" (value = 0x{:X})", written_val) : "")
|
||||
.c_str());
|
||||
}
|
||||
|
||||
return {lastPC, memoryAccess};
|
||||
}
|
||||
|
||||
void KaizenGui::RenderUI() {
|
||||
n64::Core &core = n64::Core::GetInstance();
|
||||
gui::StartFrame();
|
||||
@@ -234,10 +216,6 @@ void KaizenGui::RenderUI() {
|
||||
ImGui::EndMainMenuBar();
|
||||
}
|
||||
|
||||
if (!Util::Error::IsHandled()) {
|
||||
ImGui::OpenPopup(Util::Error::GetSeverity().as_c_str());
|
||||
}
|
||||
|
||||
if (settingsWindow.isOpen) {
|
||||
ImGui::OpenPopup("Settings", ImGuiPopupFlags_None);
|
||||
}
|
||||
@@ -270,114 +248,6 @@ void KaizenGui::RenderUI() {
|
||||
|
||||
ImGui::SetNextWindowPos(center, ImGuiCond_Appearing, ImVec2(0.5f, 0.5f));
|
||||
|
||||
if (ImGui::BeginPopupModal(Util::Error::GetSeverity().as_c_str(), nullptr, ImGuiWindowFlags_AlwaysAutoResize)) {
|
||||
emuThread.TogglePause();
|
||||
switch (Util::Error::GetSeverity().as_enum) {
|
||||
case Util::Error::Severity::WARN:
|
||||
{
|
||||
ImGui::PushStyleColor(ImGuiCol_TitleBg, 0x8054eae5);
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, 0xff7be4e1);
|
||||
ImGui::Text("Warning of type: %s", Util::Error::GetType().as_c_str());
|
||||
ImGui::PopStyleColor();
|
||||
ImGui::PopStyleColor();
|
||||
ImGui::Text(R"(Warning message: "%s")", Util::Error::GetError().c_str());
|
||||
RenderErrorMessageDetails();
|
||||
|
||||
if (n64::Core::GetInstance().romLoaded && !n64::Core::GetInstance().pause) {
|
||||
const bool ignore = ImGui::Button("Try continuing");
|
||||
ImGui::SameLine();
|
||||
const bool stop = ImGui::Button("Stop emulation");
|
||||
ImGui::SameLine();
|
||||
const bool chooseAnother = ImGui::Button("Choose another ROM");
|
||||
if (ignore || stop || chooseAnother) {
|
||||
Util::Error::SetHandled();
|
||||
ImGui::CloseCurrentPopup();
|
||||
}
|
||||
|
||||
if (ignore) {
|
||||
emuThread.TogglePause();
|
||||
}
|
||||
|
||||
if (stop || chooseAnother) {
|
||||
emuThread.Stop();
|
||||
}
|
||||
|
||||
if (chooseAnother) {
|
||||
fileDialogOpen = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (ImGui::Button("OK"))
|
||||
ImGui::CloseCurrentPopup();
|
||||
}
|
||||
break;
|
||||
case Util::Error::Severity::UNRECOVERABLE:
|
||||
{
|
||||
emuThread.Stop();
|
||||
ImGui::PushStyleColor(ImGuiCol_TitleBg, 0x800000ff);
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, 0xff3b3bbf);
|
||||
ImGui::Text("An unrecoverable error has occurred! Emulation has been stopped...");
|
||||
ImGui::Text("Error of type: %s", Util::Error::GetType().as_c_str());
|
||||
ImGui::PopStyleColor();
|
||||
ImGui::PopStyleColor();
|
||||
ImGui::Text(R"(Error message: "%s")", Util::Error::GetError().c_str());
|
||||
RenderErrorMessageDetails();
|
||||
if (ImGui::Button("OK"))
|
||||
ImGui::CloseCurrentPopup();
|
||||
}
|
||||
break;
|
||||
case Util::Error::Severity::NON_FATAL:
|
||||
{
|
||||
ImGui::PushStyleColor(ImGuiCol_TitleBg, 0x800000ff);
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, 0xff3b3bbf);
|
||||
ImGui::Text("An error has occurred!");
|
||||
ImGui::Text("Error of type: %s", Util::Error::GetType().as_c_str());
|
||||
ImGui::PopStyleColor();
|
||||
ImGui::PopStyleColor();
|
||||
ImGui::Text(R"(Error message: "%s")", Util::Error::GetError().c_str());
|
||||
auto [lastPC, memoryAccess] = RenderErrorMessageDetails();
|
||||
|
||||
const bool ignore = ImGui::Button("Try continuing");
|
||||
ImGui::SameLine();
|
||||
const bool stop = ImGui::Button("Stop emulation");
|
||||
ImGui::SameLine();
|
||||
const bool chooseAnother = ImGui::Button("Choose another ROM");
|
||||
const bool openInDebugger =
|
||||
lastPC.has_value() ? ImGui::Button("Add breakpoint at this PC and open the debugger") : false;
|
||||
if (ignore || stop || chooseAnother || openInDebugger) {
|
||||
Util::Error::SetHandled();
|
||||
ImGui::CloseCurrentPopup();
|
||||
}
|
||||
|
||||
if (ignore) {
|
||||
emuThread.TogglePause();
|
||||
}
|
||||
|
||||
if (stop || chooseAnother) {
|
||||
emuThread.Stop();
|
||||
}
|
||||
|
||||
if (chooseAnother) {
|
||||
fileDialogOpen = true;
|
||||
}
|
||||
|
||||
if (openInDebugger) {
|
||||
if (!n64::Core::GetInstance().breakpoints.contains(lastPC.value()))
|
||||
n64::Core::GetInstance().ToggleBreakpoint(lastPC.value());
|
||||
|
||||
debugger.Open();
|
||||
emuThread.Reset();
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
|
||||
if (ImGui::BeginMainStatusBar()) {
|
||||
ImGui::Text("FPS: %.2f", ImGui::GetIO().Framerate);
|
||||
ImGui::EndMainStatusBar();
|
||||
|
||||
Reference in New Issue
Block a user