From ef91193a708a8b4c4e609f0a75586ee44033f700 Mon Sep 17 00:00:00 2001 From: JeBobs Date: Thu, 27 Jul 2023 14:56:56 -0400 Subject: [PATCH] updated disclaimer, archive detection, clean up flags No more beeps, no more persistent warnings, no more insults, just a single silent disclaimer that also helps the user get started using games from their console. Updated the archived format detection to add tar/gz, and updated the box to state that xenia does not support running archived games. --- src/xenia/app/emulator_window.cc | 6 +---- src/xenia/emulator.cc | 44 +++++++++++++++++++------------- src/xenia/emulator.h | 5 +--- 3 files changed, 28 insertions(+), 27 deletions(-) diff --git a/src/xenia/app/emulator_window.cc b/src/xenia/app/emulator_window.cc index 74f85078e..0cadca940 100644 --- a/src/xenia/app/emulator_window.cc +++ b/src/xenia/app/emulator_window.cc @@ -850,11 +850,7 @@ void EmulatorWindow::OnKeyDown(ui::KeyEvent& e) { } break; case ui::VirtualKey::kF2: { - if (e.is_ctrl_pressed()) { - emulator()->ClearStickyPersistentFlags(); - } else { - ShowBuildCommit(); - } + ShowBuildCommit(); } break; case ui::VirtualKey::kF9: { diff --git a/src/xenia/emulator.cc b/src/xenia/emulator.cc index f4b3ff794..5308eaad1 100644 --- a/src/xenia/emulator.cc +++ b/src/xenia/emulator.cc @@ -111,19 +111,28 @@ Emulator::Emulator(const std::filesystem::path& command_line, paused_(false), restoring_(false), restore_fence_() { - // show the quickstart guide the first time they ever open the emulator +#if XE_PLATFORM_WIN32 == 1 + // Show a disclaimer that links to the quickstart + // guide the first time they ever open the emulator uint64_t persistent_flags = GetPersistentEmulatorFlags(); - if (!(persistent_flags & EmulatorFlagQuickstartShown)) { -#if XE_PLATFORM_WIN32 == 1 - if (MessageBoxW(nullptr, L"Xenia does not support or condone piracy in anyway shape or form\nDo you want to open the quickstart guide?", L"Xenia", MB_YESNO | MB_ICONQUESTION) == IDYES) { -#endif - LaunchWebBrowser( - "https://github.com/xenia-canary/xenia-canary/wiki/Quickstart#how-to-rip-games"); - SetPersistentEmulatorFlags(persistent_flags | EmulatorFlagQuickstartShown); -#if XE_PLATFORM_WIN32 == 1 + if (!(persistent_flags & EmulatorFlagDisclaimerAcknowledged)) { + if ((MessageBoxW( + nullptr, + L"DISCLAIMER: Xenia is not for enabling illegal activity, and " + "support is unavailable for illegally obtained software.\n\n" + "Please respect this policy as no further reminders will be " + "given.\n\nThe quickstart guide explains how to use digital or " + "physical games from your Xbox 360 console.\n\nWould you like " + "to open it?", + L"Xenia", MB_YESNO | MB_ICONQUESTION) == IDYES)) { + LaunchWebBrowser( + "https://github.com/xenia-project/xenia/wiki/" + "Quickstart#how-to-rip-games"); } -#endif + SetPersistentEmulatorFlags(persistent_flags | + EmulatorFlagDisclaimerAcknowledged); } +#endif } Emulator::~Emulator() { @@ -310,8 +319,12 @@ const std::unique_ptr Emulator::CreateVfsDeviceBasedOnPath( auto parent_path = path.parent_path(); return std::make_unique( mount_path, parent_path, !cvars::allow_game_relative_writes); - } else if (extension == ".7z" || extension == ".zip" || extension == ".rar") { - xe::FatalError(fmt::format("Xenia does not support running {} files.", extension)); + } else if (extension == ".7z" || extension == ".zip" || extension == ".rar" || + extension == ".tar" || extension == ".gz") { + xe::ShowSimpleMessageBox( + xe::SimpleMessageBoxType::Error, + fmt::format("Unsupported format!" + "Xenia does not support running software in an archived format.")); } return std::make_unique(mount_path, path); } @@ -337,7 +350,7 @@ uint64_t Emulator::GetPersistentEmulatorFlags() { } return value; #else - return EmulatorFlagQuickstartShown | EmulatorFlagIsoWarningAcknowledged; + return EmulatorFlagDisclaimerAcknowledged; #endif } void Emulator::SetPersistentEmulatorFlags(uint64_t new_flags) { @@ -358,11 +371,6 @@ void Emulator::SetPersistentEmulatorFlags(uint64_t new_flags) { #endif } -void Emulator::ClearStickyPersistentFlags() { - SetPersistentEmulatorFlags(GetPersistentEmulatorFlags() & - ~EmulatorFlagIsoWarningSticky); -} - X_STATUS Emulator::MountPath(const std::filesystem::path& path, const std::string_view mount_path) { auto device = CreateVfsDeviceBasedOnPath(path, mount_path); diff --git a/src/xenia/emulator.h b/src/xenia/emulator.h index b6a7b2ea4..64a7f09f1 100644 --- a/src/xenia/emulator.h +++ b/src/xenia/emulator.h @@ -202,7 +202,6 @@ class Emulator { void Pause(); void Resume(); bool is_paused() const { return paused_; } - void ClearStickyPersistentFlags(); bool SaveToFile(const std::filesystem::path& path); bool RestoreFromFile(const std::filesystem::path& path); @@ -222,9 +221,7 @@ class Emulator { private: enum : uint64_t { - EmulatorFlagQuickstartShown = 1ULL << 0, - EmulatorFlagIsoWarningAcknowledged = 1ULL << 1, - EmulatorFlagIsoWarningSticky = 1ULL<<2, + EmulatorFlagDisclaimerAcknowledged = 1ULL << 0 }; static uint64_t GetPersistentEmulatorFlags(); static void SetPersistentEmulatorFlags(uint64_t new_flags);