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;
case ui::VirtualKey::kF2: {
if (e.is_ctrl_pressed()) {
emulator()->ClearStickyPersistentFlags();
} else {
ShowBuildCommit();
}
ShowBuildCommit();
} break;
case ui::VirtualKey::kF9: {

View File

@ -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<vfs::Device> Emulator::CreateVfsDeviceBasedOnPath(
auto parent_path = path.parent_path();
return std::make_unique<vfs::HostPathDevice>(
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<vfs::DiscImageDevice>(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);

View File

@ -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);