From 07e760612e1fae800f2cb32397863693b757c493 Mon Sep 17 00:00:00 2001 From: SirQuartz Date: Mon, 10 Oct 2022 15:06:01 -0400 Subject: [PATCH 1/3] Add message box when emulator fails to load invalid or corrupted file formats. --- src/xenia/app/emulator_window.cc | 12 ++++++++++-- src/xenia/emulator.cc | 4 ++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/xenia/app/emulator_window.cc b/src/xenia/app/emulator_window.cc index cab817a10..5aec2c71b 100644 --- a/src/xenia/app/emulator_window.cc +++ b/src/xenia/app/emulator_window.cc @@ -806,7 +806,11 @@ void EmulatorWindow::FileDrop(const std::filesystem::path& filename) { } auto result = emulator_->LaunchPath(filename); if (XFAILED(result)) { - // TODO: Display a message box. + xe::ui::ImGuiDialog::ShowMessageBox( + imgui_drawer_.get(), "Error: Failed to Launch", + fmt::format("Failed to launch target {}", + filename.filename().string() + + "; file format is unrecognized or corrupted.")); XELOGE("Failed to launch target: {:08X}", result); } } @@ -838,7 +842,11 @@ void EmulatorWindow::FileOpen() { auto abs_path = std::filesystem::absolute(path); auto result = emulator_->LaunchPath(abs_path); if (XFAILED(result)) { - // TODO: Display a message box. + xe::ui::ImGuiDialog::ShowMessageBox( + imgui_drawer_.get(), "Error: Failed to Launch", + fmt::format("Failed to launch target {}", + abs_path.filename().string() + + "; file format is unrecognized or corrupted.")); XELOGE("Failed to launch target: {:08X}", result); } } diff --git a/src/xenia/emulator.cc b/src/xenia/emulator.cc index 38a2bb09c..6ad9808a6 100644 --- a/src/xenia/emulator.cc +++ b/src/xenia/emulator.cc @@ -330,11 +330,11 @@ X_STATUS Emulator::LaunchDiscImage(const std::filesystem::path& path) { // Register the disc image in the virtual filesystem. auto device = std::make_unique(mount_path, path); if (!device->Initialize()) { - xe::FatalError("Unable to mount disc image; file not found or corrupt."); + XELOGE("Unable to mount disc image; file not found or corrupt."); return X_STATUS_NO_SUCH_FILE; } if (!file_system_->RegisterDevice(std::move(device))) { - xe::FatalError("Unable to register disc image."); + XELOGE("Unable to register disc image."); return X_STATUS_NO_SUCH_FILE; } From c09b9e7fbfd4d78dd80045e4b8b7d04be3b6f45b Mon Sep 17 00:00:00 2001 From: Nicholas Huelin <62965063+SirQuartz@users.noreply.github.com> Date: Thu, 13 Oct 2022 15:02:11 -0400 Subject: [PATCH 2/3] Update src/xenia/app/emulator_window.cc Co-authored-by: Silent --- src/xenia/app/emulator_window.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/xenia/app/emulator_window.cc b/src/xenia/app/emulator_window.cc index 5aec2c71b..f020d2db2 100644 --- a/src/xenia/app/emulator_window.cc +++ b/src/xenia/app/emulator_window.cc @@ -809,7 +809,7 @@ void EmulatorWindow::FileDrop(const std::filesystem::path& filename) { xe::ui::ImGuiDialog::ShowMessageBox( imgui_drawer_.get(), "Error: Failed to Launch", fmt::format("Failed to launch target {}", - filename.filename().string() + + xe::path_to_utf8(filename.filename()) + "; file format is unrecognized or corrupted.")); XELOGE("Failed to launch target: {:08X}", result); } From e5d5f7387506d67f9754b60d357685874fbe8b20 Mon Sep 17 00:00:00 2001 From: Nicholas Huelin <62965063+SirQuartz@users.noreply.github.com> Date: Thu, 13 Oct 2022 15:02:19 -0400 Subject: [PATCH 3/3] Update src/xenia/app/emulator_window.cc Co-authored-by: Silent --- src/xenia/app/emulator_window.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/xenia/app/emulator_window.cc b/src/xenia/app/emulator_window.cc index f020d2db2..f73b84a3d 100644 --- a/src/xenia/app/emulator_window.cc +++ b/src/xenia/app/emulator_window.cc @@ -845,7 +845,7 @@ void EmulatorWindow::FileOpen() { xe::ui::ImGuiDialog::ShowMessageBox( imgui_drawer_.get(), "Error: Failed to Launch", fmt::format("Failed to launch target {}", - abs_path.filename().string() + + xe::path_to_utf8(abs_path.filename()) + "; file format is unrecognized or corrupted.")); XELOGE("Failed to launch target: {:08X}", result); }