8000 Zdxsv: limit upstream features: save state on shutdown, game properties by inada-s · Pull Request #557 · inada-s/pcsx2 · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/zdxsv/features.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ skips does not run on that path.
| Qt setup wizard (`QtHooks.h`) | `pcsx2-qt/Zdxsv/QtSetupWizard` | first-run wizard texts, zdxsv sign-in page |
| Qt fonts | `pcsx2-qt/Zdxsv/QtFonts` | Noto Sans JP download before the OSD fonts load |
| Qt game window wheel (`QtHooks.h`, `DisplayWidget`) | `pcsx2-qt/Zdxsv/QtWheelVolume` | mouse wheel volume |
| VMManager shutdown, shutdown dialog, Big Picture menus, settings dialogs, game list menus, debugger (`UiHooks.h`) | `FeatureLimits` | no save state on shutdown, no game properties |
| VMManager, GS, MTGS, hotkeys, Qt main window (`UiHooks.h`, `QtHooks.h`) | `OnlineLimits`, `pcsx2-qt/Zdxsv/QtOnlineLimits`, `ReplayControls` | operations refused while online or during a replay, debugger window closed |
| Qt host start and exit (`CrashReportHooks.h`), log output (`Log::SetTapOutputLevel` in `common/Console`) | `pcsx2-qt/Zdxsv/CrashReports` | crash reports, the last log lines they carry |
| Qt host start (`AuthHooks.h`) | `Zdxsv/AuthSignIn` | sign-in test trigger (`ZDXSV_AUTH_SIGNIN_TEST`) |
Expand Down Expand Up @@ -174,6 +175,8 @@ Keys (`net=1`, `lobby=1`, `port=`, `delay=`, ...) are parts of `ZDXSV_GGPO`.

## Game window

- **No save state on shutdown** (changed default): closing the game saves no resume state and offers none; `ZdxsvFeatureLimits`.
- **No game properties** (changed default): the per-game settings dialog is not offered, in the Qt menus, the game list and Big Picture, and settings already saved for a game are not read; `ZdxsvFeatureLimits`.
- **Mouse wheel volume**: the wheel over the game screen changes the volume in 5% steps, OSD with the new volume; not while a menu takes the mouse or the wheel is bound to an input; `ZdxsvWheelVolume`.
- **Keyboard and hotkeys**: the host keyboard is a USB keyboard on USB port 1 (in-game chat; Settings > Controllers > USB Port 1, None turns it off); on Windows it sends the physical key, so a Japanese keyboard types its own symbols (@ : ^ and the shifted ones) as a Japanese keyboard; no upstream PCSX2 hotkeys are bound by default, the zdxsv replay ones stay (bind any under Settings > Hotkeys). Settings files from before get both once on start (`[Zdxsv] InputDefaultsVersion`).

Expand Down
1 change: 1 addition & 0 deletions docs/zdxsv/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ page greys it out and its tooltip names the variable.
| `[EmuCore/GS] VsyncEnable` | `true` | feature | Upstream VSync, on by default in this build (upstream: off); Settings → Emulation. |
| `[DEV9/Eth] ZdxsvLiveAutoNext` | `false` | feature | Live spectating: when a stream ends, watch the lobby's next live battle. `ZDXSV_LIVE_NEXT` overrides it. |
| `[DEV9/Eth] ZdxsvUPnP` | `true` | feature | When the connectivity test finds the GGPO port not open, map it on the router with UPnP and test again (`lobby.md`). |
| `[DEV9/Eth] ZdxsvFeatureLimits` | `true` | feature | On: the upstream features zdxsv limits are off (`docs/zdxsv/features.md`, `FeatureLimits`). Off: as upstream. Ini only. |
| `[DEV9/Eth] ZdxsvNetOsd` | `true` | feature | Network status OSD in GGPO battles. Read when the game starts. `osd=` overrides it. Off: shown only while an opponent is interrupted or disconnected. |
| `[DEV9/Eth] ZdxsvFrameOsd` | `false` | feature | Frame time OSD in GGPO battles and replays (docs/zdxsv/rollback.md). Read when the game starts. `ZDXSV_FRAME_OSD` overrides it. |
| `[DEV9/Eth] ZdxsvAllyHp` | `true` | feature | In battle, the own HP display shows the teammate's HP in place of the own max HP. Applied when settings change. `ZDXSV_ALLY_HP` overrides it. |
Expand Down
3 changes: 3 additions & 0 deletions pcsx2-qt/Debugger/DebuggerWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "DebugTools/MipsStackWalk.h"
#include "DebugTools/SymbolImporter.h"
#include "QtHost.h"
#include "pcsx2/Zdxsv/UiHooks.h"
#include "MainWindow.h"
#include "AnalysisOptionsDialog.h"

Expand All @@ -35,6 +36,8 @@ DebuggerWindow::DebuggerWindow(QWidget* parent)
connect(m_ui.actionAnalyse, &QAction::triggered, this, &DebuggerWindow::onAnalyse);
connect(m_ui.actionSettings, &QAction::triggered, this, &DebuggerWindow::onSettings);
connect(m_ui.actionGameSettings, &QAction::triggered, this, &DebuggerWindow::onGameSettings);
if (Zdxsv::FeaturesLimited())
m_ui.actionGameSettings->setVisible(false);
connect(m_ui.actionClose, &QAction::triggered, this, &DebuggerWindow::close);

connect(m_ui.actionOnTop, &QAction::triggered, this, [this](bool checked) {
Expand Down
5 changes: 5 additions & 0 deletions pcsx2-qt/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,8 @@ void MainWindow::connectSignals()
connect(m_ui.actionViewGameGrid, &QAction::triggered, this, &MainWindow::onViewGameGridActionTriggered);
connect(m_ui.actionViewSystemDisplay, &QAction::triggered, this, &MainWindow::onViewSystemDisplayTriggered);
connect(m_ui.actionViewGameProperties, &QAction::triggered, this, &MainWindow::onViewGamePropertiesActionTriggered);
if (Zdxsv::FeaturesLimited())
m_ui.actionViewGameProperties->setVisible(false);
connect(m_ui.actionGitHubRepository, &QAction::triggered, this, &MainWindow::onGitHubRepositoryActionTriggered);
connect(m_ui.actionSupportForums, &QAction::triggered, this, &MainWindow::onSupportForumsActionTriggered);
connect(m_ui.actionWiki, &QAction::triggered, this, &MainWindow::onWikiActionTriggered);
Expand Down Expand Up @@ -1713,6 +1715,8 @@ bool MainWindow::requestShutdown(bool allow_confirm, bool allow_save_to_state, b
save_cb->setChecked(save_state);
save_cb->setEnabled(allow_save_to_state);
msgbox.setCheckBox(save_cb);
if (Zdxsv::FeaturesLimited())
save_cb->hide();
msgbox.addButton(QMessageBox::Yes);
msgbox.addButton(QMessageBox::No);
msgbox.setDefaultButton(QMessageBox::Yes);
Expand Down Expand Up @@ -1849,6 +1853,7 @@ void MainWindow::onGameListEntryContextMenuRequested(const QPoint& point)
if (entry.has_value())
{
QAction* action = menu.addAction(tr("Properties..."));
action->setVisible(!Zdxsv::FeaturesLimited());
action->setEnabled(!entry->serial.empty() || entry->type == GameList::EntryType::ELF);
if (action->isEnabled())
{
Expand Down
3 changes: 3 additions & 0 deletions pcsx2-qt/Settings/AdvancedSettingsWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "QtUtils.h"
#include "SettingWidgetBinder.h"
#include "SettingsWindow.h"
#include "pcsx2/Zdxsv/UiHooks.h"

AdvancedSettingsWidget::AdvancedSettingsWidget(SettingsWindow* settings_dialog, QWidget* parent)
: SettingsWidget(settings_dialog, parent)
Expand Down Expand Up @@ -62,6 +63,8 @@ AdvancedSettingsWidget::AdvancedSettingsWidget(SettingsWindow* settings_dialog,

SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.backupSaveStates, "EmuCore", "BackupSavestate", true);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.saveStateOnShutdown, "EmuCore", "SaveStateOnShutdown", false);
if (Zdxsv::FeaturesLimited())
m_ui.saveStateOnShutdown->hide();

SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.pineEnable, "EmuCore", "EnablePINE", false);
SettingWidgetBinder::BindWidgetToIntSetting(sif, m_ui.pineSlot, "EmuCore", "PINESlot", 28011);
Expand Down
4 changes: 4 additions & 0 deletions pcsx2-qt/Settings/SettingsWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "Settings/BIOSSettingsWidget.h"
#include "Settings/DEV9SettingsWidget.h"
#include "Settings/ZdxsvSettingsWidget.h"
#include "pcsx2/Zdxsv/UiHooks.h"
#include "Settings/EmulationSettingsWidget.h"
#include "Settings/FolderSettingsWidget.h"
#include "Settings/GameCheatSettingsWidget.h"
Expand Down Expand Up @@ -669,6 +670,9 @@ void SettingsWindow::saveAndReloadGameSettings()

void SettingsWindow::openGamePropertiesDialog(const GameList::Entry* game, const std::string_view title, std::string serial, u32 disc_crc, bool is_elf, const char* category)
{
if (Zdxsv::FeaturesLimited())
return;

std::string filename = VMManager::GetGameSettingsPath(!is_elf ? serial : std::string_view(), disc_crc);

// check for an existing dialog with this filename
Expand Down
1 change: 1 addition & 0 deletions pcsx2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,7 @@ set(pcsx2DEV9Sources
Zdxsv/LobbyPing.cpp
Zdxsv/Upnp.cpp
Zdxsv/ServerHosts.cpp
Zdxsv/FeatureLimits.cpp
Zdxsv/FastBoot.cpp
Zdxsv/AuthSignIn.cpp
Zdxsv/AuthTest.cpp
Expand Down
8 changes: 6 additions & 2 deletions pcsx2/ImGui/FullscreenUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1757,7 +1757,7 @@ void FullscreenUI::DrawPauseMenu(MainWindowType type)
s_current_main_window = MainWindowType::None;
}

if (ActiveButton(FSUI_ICONSTR(ICON_FA_WRENCH, "Game Properties"), false, can_save_state))
if (!Zdxsv::FeaturesLimited() && ActiveButton(FSUI_ICONSTR(ICON_FA_WRENCH, "Game Properties"), false, can_save_state))
{
SwitchToGameSettings();
}
Expand Down Expand Up @@ -1820,7 +1820,7 @@ void FullscreenUI::DrawPauseMenu(MainWindowType type)
RequestReset();
}

if (ActiveButton(FSUI_ICONSTR(ICON_FA_FLOPPY_DISK, "Exit And Save State"), false))
if (!Zdxsv::FeaturesLimited() && ActiveButton(FSUI_ICONSTR(ICON_FA_FLOPPY_DISK, "Exit And Save State"), false))
RequestShutdown(true);

if (ActiveButton(FSUI_ICONSTR(ICON_FA_POWER_OFF, "Exit Without Saving"), false))
Expand Down Expand Up @@ -3036,6 +3036,8 @@ void FullscreenUI::HandleGameListOptions(const GameList::Entry* entry)
{FSUI_ICONSTR(ICON_FA_FORWARD_FAST, "Fast Boot"), false},
{FSUI_ICONSTR(ICON_FA_COMPACT_DISC, "Full Boot"), false},
};
if (Zdxsv::FeaturesLimited())
options.erase(options.begin());

const time_t entry_played_time = GameList::GetCachedPlayedTimeForSerial(entry->serial);
if (entry_played_time)
Expand All @@ -3046,6 +3048,8 @@ void FullscreenUI::HandleGameListOptions(const GameList::Entry* entry)
OpenChoiceDialog(entry->GetTitle(s_prefer_english_titles).c_str(), false, std::move(options),
[has_resume_state, entry_path = entry->path, entry_serial = entry->serial, entry_title = entry->title, entry_played_time]
(s32 index, const std::string& title, bool checked) {
if (index >= 0 && Zdxsv::FeaturesLimited())
index++; // the removed first option
switch (index)
{
case 0: // Open Game Properties
Expand Down
5 changes: 5 additions & 0 deletions pcsx2/ImGui/FullscreenUI_Settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "INISettingsInterface.h"
#include "ImGui/FullscreenUI_Internal.h"
#include "Zdxsv/DefaultsHooks.h"
#include "Zdxsv/UiHooks.h"
#include "ImGui/ImGuiFullscreen.h"
#include "ImGui/ImGuiManager.h"
#include "Input/InputManager.h"
Expand Down Expand Up @@ -1662,6 +1663,9 @@ void FullscreenUI::SwitchToSettings()

void FullscreenUI::SwitchToGameSettings(const std::string_view serial, u32 crc)
{
if (Zdxsv::FeaturesLimited())
return;

s_game_settings_entry.reset();
s_game_settings_interface = std::make_unique<INISettingsInterface>(VMManager::GetGameSettingsPath(serial, crc));
s_game_settings_interface->Load();
Expand Down Expand Up @@ -2284,6 +2288,7 @@ void FullscreenUI::DrawInterfaceSettingsPage()
DrawToggleSetting(bsi, FSUI_ICONSTR(ICON_FA_POWER_OFF, "Confirm Shutdown"),
FSUI_CSTR("Determines whether a prompt will be displayed to confirm shutting down the emulator/game when the hotkey is pressed."),
"UI", "ConfirmShutdown", true);
if (!Zdxsv::FeaturesLimited())
DrawToggleSetting(bsi, FSUI_ICONSTR(ICON_FA_FLOPPY_DISK, "Save State On Shutdown"),
FSUI_CSTR("Automatically saves the emulator state when powering down or exiting. You can then resume directly from where you left "
"off next time."),
Expand Down
4 changes: 2 additions & 2 deletions pcsx2/VMManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -984,7 +984,7 @@ std::string VMManager::GetSerialForGameSettings()
bool VMManager::UpdateGameSettingsLayer()
{
std::unique_ptr<INISettingsInterface> new_interface;
if (s_disc_crc != 0)
if (s_disc_crc != 0 && !Zdxsv::FeaturesLimited())
{
std::string filename(GetGameSettingsPath(GetSerialForGameSettings(), s_disc_crc));
if (!FileSystem::FileExists(filename.c_str()))
Expand Down Expand Up @@ -1679,7 +1679,7 @@ void VMManager::Shutdown(bool save_resume_state)
MTGS::WaitGS();
Zdxsv::GgpoOnVmShutdown("vm shutdown");

if (!GSDumpReplayer::IsReplayingDump() && save_resume_state)
if (!GSDumpReplayer::IsReplayingDump() && save_resume_state && !Zdxsv::FeaturesLimited())
{
std::string resume_file_name(GetCurrentSaveStateFileName(-1));
if (!resume_file_name.empty())
Expand Down
14 changes: 14 additions & 0 deletions pcsx2/Zdxsv/FeatureLimits.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// SPDX-FileCopyrightText: 2026 zdxsv contributors
// SPDX-License-Identifier: GPL-3.0+

#include "Zdxsv/UiHooks.h"

#include "Host.h"

namespace Zdxsv
{
bool FeaturesLimited()
{
return Host::GetBoolSettingValue("DEV9/Eth", "ZdxsvFeatureLimits", true);
}
} // namespace Zdxsv
1 change: 1 addition & 0 deletions pcsx2/Zdxsv/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ options: `docs/zdxsv/`.
| `HttpsLatency.cpp` | HTTPS latency test to the cloud regions, sent in the platform info |
| `SpectateSync.cpp`, `SpectateSync.h` | Four-screen replay: one PCSX2 per position, kept on the same frame through shared memory |
| `ServerHosts.cpp`, `ServerHosts.h` | Addresses the game's server hosts resolved to; whether that was the built-in server (public server) |
| `FeatureLimits.cpp` | The setting that limits upstream features in zdxsv |
| `FastBoot.cpp` | Boot at unlimited speed to the lobby user_id selection, pressing through the menus on the fixed network route; optionally on through ID 1 into the lobby |
| `AuthSignIn.cpp`, `AuthSignIn.h` | Sign-in through the server in the browser (127.0.0.1 callback, PKCE), the token file, sign-out |
| `AuthTest.cpp` | Sign-in and sign-out at app start for the rigs (`ZDXSV_AUTH_SIGNIN_TEST`) |
Expand Down
3 changes: 3 additions & 0 deletions pcsx2/Zdxsv/UiHooks.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ namespace Zdxsv
// a net battle or while the game is connected to the zdxsv lobby, where the menu opens by accident.
bool OnlinePauseMenuRefuses();

// True: the upstream features zdxsv limits are off ([DEV9/Eth] ZdxsvFeatureLimits).
bool FeaturesLimited();

extern bool g_online_limits;
// The reason goes to `error`, else to the OSD.
bool OnlineRefuses(Error* error = nullptr);
Expand Down
1 change: 1 addition & 0 deletions pcsx2/pcsx2.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@
<ClCompile Include="Zdxsv\LobbyPing.cpp" />
<ClCompile Include="Zdxsv\Upnp.cpp" />
<ClCompile Include="Zdxsv\ServerHosts.cpp" />
<ClCompile Include="Zdxsv\FeatureLimits.cpp" />
<ClCompile Include="Zdxsv\FastBoot.cpp" />
<ClCompile Include="Zdxsv\AuthSignIn.cpp" />
<ClCompile Include="Zdxsv\AuthTest.cpp" />
Expand Down
2 changes: 2 additions & 0 deletions tests/zdxsv/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,8 @@ Scripts are in `tests/zdxsv/` except `run.py` (repository root) and

| Feature | Test | Control |
|---|---|---|
| No save state on shutdown | no test. By hand: close the window during a game: the dialog has no `Save State For Resume`, and no resume state is written to the save state folder; `ZdxsvFeatureLimits = false`: as upstream | none |
| No game properties | no test. By hand: the System menu, the game list context menu and Big Picture have no game properties entry and a saved game settings ini is not loaded (emulog has no `Loading game settings from`); `ZdxsvFeatureLimits = false`: as upstream | none |
| Mouse wheel volume | no test. By hand: wheel over the game screen, OSD `Volume: N%` steps by 5 and the status bar volume follows; setting off or the wheel bound: no change | none |

### ARM64 builds
Expand Down
0