mirror of
https://github.com/mitch030504/Wiicompiled_VR_Frame.git
synced 2026-10-06 02:00:14 +02:00
--update reuses the options an install was made with (saved to install.conf in the work dir) and builds nothing when the Frame already has the newest release and Retro Rewind pack; --check only reports. The installed release is stamped as .release-tag beside the game on the Frame. An install built on the Frame itself (--frame local) also gets a systemd user service the game's new Updates tab starts: the update runs in the background at low priority, writes each step and the build percentage to a status file the tab shows, and reopens the game at the end if it was closed. Progress does not go through Steam notifications: on the Frame, Steam receives them from steam_notif_daemon but does not display them. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UyuWx5hNrMpf9R78FZFcbA
62 lines
2.6 KiB
C++
62 lines
2.6 KiB
C++
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
#pragma once
|
|
|
|
#include <string>
|
|
|
|
// Settings > Updates: whether a newer release of the game exists, and, on a Frame that holds its own
|
|
// build, updating to it without leaving the headset.
|
|
//
|
|
// Both answers come from Launcher/steam-frame-install.sh, which already knows how to compare
|
|
// versions and how to build: `--check` reports, `--update` installs. The update reports its progress
|
|
// through a status file rather than Steam notifications, which the Frame's Steam does not show.
|
|
// The install writes update.conf beside the player's configuration when it put a build on this
|
|
// machine, so the Update button appears only where it can actually work; installed from a PC, the
|
|
// tab says to update there.
|
|
namespace update_check {
|
|
|
|
enum class State {
|
|
// This install cannot update itself: it was built on a PC, which is where updates are run.
|
|
PcInstall,
|
|
// It can, and nothing has been asked of it yet this session.
|
|
Idle,
|
|
Checking,
|
|
UpToDate,
|
|
Available,
|
|
// An update is running beside the game, as a service of its own: it carries on if the game is
|
|
// closed, and then opens it again when it is done.
|
|
Updating,
|
|
Failed,
|
|
};
|
|
|
|
struct Status {
|
|
State state = State::PcInstall;
|
|
// The release this build came from, or empty when it was built from a source tree.
|
|
std::string installedRelease;
|
|
// One line under the state: which release is available, what failed, or what step is running.
|
|
std::string detail;
|
|
// An update has installed a different build since this one started: it takes effect when the
|
|
// game is started again.
|
|
bool restartNeeded = false;
|
|
};
|
|
|
|
// What the Updates tab draws. Cheap enough to call every frame: a check or update in flight is
|
|
// answered from memory, and otherwise the files behind it are re-read at most once a second.
|
|
Status Current();
|
|
|
|
// Whether there is an Updates tab to show at all: this install can update itself, or it at least
|
|
// knows which release it is running. Neither is true of a build that came from somewhere else.
|
|
inline bool Relevant(const Status& status) {
|
|
return status.state != State::PcInstall || !status.installedRelease.empty();
|
|
}
|
|
|
|
// Asks the install script whether a newer release exists, in the background. Returns at once.
|
|
void StartCheck();
|
|
|
|
// Starts the update in the background: its own systemd user service runs the install script, which
|
|
// reports each step to the file Current() reads, so the game can stay open and show the progress.
|
|
// On false, `error` says why, for display.
|
|
bool StartUpdate(std::string& error);
|
|
|
|
} // namespace update_check
|