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.
This commit is contained in:
JeBobs 2023-07-27 14:56:56 -04:00 committed by Radosław Gliński
parent 2ab2a65ae1
commit ef91193a70
3 changed files with 28 additions and 27 deletions

View File

@ -850,11 +850,7 @@ void EmulatorWindow::OnKeyDown(ui::KeyEvent& e) {
} break; } break;
case ui::VirtualKey::kF2: { case ui::VirtualKey::kF2: {
if (e.is_ctrl_pressed()) { ShowBuildCommit();
emulator()->ClearStickyPersistentFlags();
} else {
ShowBuildCommit();
}
} break; } break;
case ui::VirtualKey::kF9: { case ui::VirtualKey::kF9: {

View File

@ -111,19 +111,28 @@ Emulator::Emulator(const std::filesystem::path& command_line,
paused_(false), paused_(false),
restoring_(false), restoring_(false),
restore_fence_() { 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(); uint64_t persistent_flags = GetPersistentEmulatorFlags();
if (!(persistent_flags & EmulatorFlagQuickstartShown)) { if (!(persistent_flags & EmulatorFlagDisclaimerAcknowledged)) {
#if XE_PLATFORM_WIN32 == 1 if ((MessageBoxW(
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) { nullptr,
#endif L"DISCLAIMER: Xenia is not for enabling illegal activity, and "
LaunchWebBrowser( "support is unavailable for illegally obtained software.\n\n"
"https://github.com/xenia-canary/xenia-canary/wiki/Quickstart#how-to-rip-games"); "Please respect this policy as no further reminders will be "
SetPersistentEmulatorFlags(persistent_flags | EmulatorFlagQuickstartShown); "given.\n\nThe quickstart guide explains how to use digital or "
#if XE_PLATFORM_WIN32 == 1 "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() { Emulator::~Emulator() {
@ -310,8 +319,12 @@ const std::unique_ptr<vfs::Device> Emulator::CreateVfsDeviceBasedOnPath(
auto parent_path = path.parent_path(); auto parent_path = path.parent_path();
return std::make_unique<vfs::HostPathDevice>( return std::make_unique<vfs::HostPathDevice>(
mount_path, parent_path, !cvars::allow_game_relative_writes); mount_path, parent_path, !cvars::allow_game_relative_writes);
} else if (extension == ".7z" || extension == ".zip" || extension == ".rar") { } else if (extension == ".7z" || extension == ".zip" || extension == ".rar" ||
xe::FatalError(fmt::format("Xenia does not support running {} files.", extension)); 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<vfs::DiscImageDevice>(mount_path, path); return std::make_unique<vfs::DiscImageDevice>(mount_path, path);
} }
@ -337,7 +350,7 @@ uint64_t Emulator::GetPersistentEmulatorFlags() {
} }
return value; return value;
#else #else
return EmulatorFlagQuickstartShown | EmulatorFlagIsoWarningAcknowledged; return EmulatorFlagDisclaimerAcknowledged;
#endif #endif
} }
void Emulator::SetPersistentEmulatorFlags(uint64_t new_flags) { void Emulator::SetPersistentEmulatorFlags(uint64_t new_flags) {
@ -358,11 +371,6 @@ void Emulator::SetPersistentEmulatorFlags(uint64_t new_flags) {
#endif #endif
} }
void Emulator::ClearStickyPersistentFlags() {
SetPersistentEmulatorFlags(GetPersistentEmulatorFlags() &
~EmulatorFlagIsoWarningSticky);
}
X_STATUS Emulator::MountPath(const std::filesystem::path& path, X_STATUS Emulator::MountPath(const std::filesystem::path& path,
const std::string_view mount_path) { const std::string_view mount_path) {
auto device = CreateVfsDeviceBasedOnPath(path, mount_path); auto device = CreateVfsDeviceBasedOnPath(path, mount_path);

View File

@ -202,7 +202,6 @@ class Emulator {
void Pause(); void Pause();
void Resume(); void Resume();
bool is_paused() const { return paused_; } bool is_paused() const { return paused_; }
void ClearStickyPersistentFlags();
bool SaveToFile(const std::filesystem::path& path); bool SaveToFile(const std::filesystem::path& path);
bool RestoreFromFile(const std::filesystem::path& path); bool RestoreFromFile(const std::filesystem::path& path);
@ -222,9 +221,7 @@ class Emulator {
private: private:
enum : uint64_t { enum : uint64_t {
EmulatorFlagQuickstartShown = 1ULL << 0, EmulatorFlagDisclaimerAcknowledged = 1ULL << 0
EmulatorFlagIsoWarningAcknowledged = 1ULL << 1,
EmulatorFlagIsoWarningSticky = 1ULL<<2,
}; };
static uint64_t GetPersistentEmulatorFlags(); static uint64_t GetPersistentEmulatorFlags();
static void SetPersistentEmulatorFlags(uint64_t new_flags); static void SetPersistentEmulatorFlags(uint64_t new_flags);