Skip to content

Deploy GeneralsOnline data patch to user data directory with backup tracking and hotswap guard #372

Description

@undead2146

Problem

Generals Online requires data patch BIG files (such as 500_900_CommunityPatch_CoreINI.big, or patch archives distributed for the client / launcher updates like patch3.zip) to reside in the user's Documents data directory:
%USERPROFILE%\Documents\Command and Conquer Generals Zero Hour Data\GeneralsOnlineGameData\

To support this:

  1. User Data Deployment: GenHub must deploy and link files with ContentInstallTarget.UserDataDirectory preserving the GeneralsOnlineGameData/... subdirectory hierarchy.
  2. Conflict & Backup Management: Overwriting existing user data files or updating/replacing executables (e.g. original GeneralsOnlineZH_60.exe or custom user data) requires automated backup to %APPDATA%\UserData\backups so uninstallation or profile switching restores previous states cleanly without data loss.
  3. Hotswapping & Runtime Safety (Allow live content hotswapping on running game profiles for non-binary content types #370 Alignment): While Map content in User Data can be hot-swapped dynamically during an active game session, .big archives in GeneralsOnlineGameData are opened and locked by the engine on boot. Modifying or replacing data patches while the game process is running risks file lock collisions and engine crashes.

Proposed Approach

1. User Data Directory Materialisation

  • Ensure UserDataTrackerService.ResolveUserDataTargetPath correctly maps files targeted to ContentInstallTarget.UserDataDirectory preserving relative subdirectories (such as GeneralsOnlineGameData\500_900_CommunityPatch_CoreINI.big).
  • Support hard-linking from CAS (with fallback to copy) for .big files in user data.

2. Backup & Lifecycle Tracking

  • Leverage UserDataTrackerService backup mechanism (BackupExistingFileAsync) before overwriting any existing files in Documents\Command and Conquer Generals Zero Hour Data\GeneralsOnlineGameData\.
  • Ensure UninstallUserDataAsync and SwitchProfileUserDataAsync cleanly remove deployed patch files and restore original backed-up files.
  • If launcher/patch deployment involves replacing client executables (e.g. GeneralsOnlineZH_60.exe), ensure original executables are backed up and restorable.

3. Runtime Guard & Hotswap Classification (#370 Compatibility)

  • Clarify ContentHotswapClassification: ContentType.Patch (even when deployed to UserDataDirectory) is classified as Locked during active profile sessions (ILaunchRegistry.IsRunning == true).
  • In GameProfileSettingsViewModel, disable toggling of Data Patch items when in Hotswap Mode.

Acceptance Criteria

  • Data patch files targeting ContentInstallTarget.UserDataDirectory are materialized to %USERPROFILE%\Documents\Command and Conquer Generals Zero Hour Data\GeneralsOnlineGameData\.
  • Pre-existing user data files in GeneralsOnlineGameData are safely backed up before overwrite and restored upon uninstallation.
  • Profile switching cleanly deactivates/unlinks old profile data patches and activates new profile data patches.
  • Data Patch (ContentType.Patch) remains locked and non-modifiable in the profile editor while the target game profile is running.
  • Unit tests cover path resolution for UserDataDirectory, backup creation and restoration on uninstall, and hotswap locking behavior.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions