feat(launcher): install offline copies and back up stock files

The launcher's main process can now install the game copy, driven over
IPC by the install wizard to come:

- install:checkPatches builds the copy in memory in a utility process
  (workers/patch-check-worker.ts, a second main entry) and reports the
  patches that do not fit, each marked essential or not. Nothing is
  written.
- install:start checks first, on the stock files the copy would get, so
  a game whose essential patches do not fit is refused before tens of
  gigabytes are copied; other missing patches need the player's
  acceptance. Then, for the copy method, it measures, checks the target
  drive's free space (plus 1 GB) and copies; it keeps the four stock
  files in <copy>/wtoffline/stock, never replacing a file already there;
  and it writes <user data>/install.json. Patched files are written by
  the build at every launch with that launch's port, not here.
- The copy leaves out the top-level folders that hold what the game
  produced while played online (.game_logs, cache, Replays, Screenshots,
  UserMissions). It copies in chunks through streams, so progress moves
  within a large data pack and install:cancel stops at once; it never
  overwrites a file, and after a failure or a cancel it removes what it
  copied, which is safe because the target was new or empty. One failing
  parallel copy stops the others before the cleanup starts.
- Progress goes to the window as event:install-progress, at most every
  250 ms. install:getRecord returns the record and the default data
  folder (<user data>/data).
- New error codes, translated in both languages: not_a_game_folder,
  target_not_usable, steam_library_not_confirmed, not_enough_space,
  essential_patches_unavailable, missing_features_not_accepted,
  patch_check_failed, copy_failed, install_cancelled, install_busy.

Checked with the launcher typecheck and build, and the calls made from a
running launcher window on a 2 GB test game folder holding the real
stock files: the check (12 exe and 35 GUI patches ready), a copy
install (player data folders left out, stock files backed up, record
written, 51 progress events), a second install into the same folder
(not_empty), a cancel 36 MB into a copy (install_cancelled, the copy
removed), an in-place install of the copy (its backup used) and a
folder that is not a game.
This commit is contained in:
N0VAN0M4LY committed 2026-11-29 05:03:40 +08:00
1 parent ab0d3b1f30
commit 3dcf7bb062
14 files changed
+629 -3

No files matched your search

@@ -16,6 +16,16 @@
"internal_error": "Something went wrong inside the launcher.",
"settings_write_failed": "Could not save the settings.",
"folder_unreadable": "Cannot read the folder: {{path}}",
"not_a_game_folder": "This is not a War Thunder game folder: {{path}}",
"target_not_usable": "This folder cannot be used for the installation.",
"steam_library_not_confirmed": "The folder is in a Steam library. Confirm the warning first.",
"not_enough_space": "Not enough disk space: {{neededGb}} GB needed, {{freeGb}} GB free.",
"essential_patches_unavailable": "Your game version lacks changes the offline version cannot run without: {{patches}}",
"missing_features_not_accepted": "Some changes do not fit. Confirm whether to go on without those features first.",
"patch_check_failed": "Checking the game files failed.",
"copy_failed": "Copying the game failed. What was copied has been removed.",
"install_cancelled": "Installation cancelled. What was copied has been removed.",
"install_busy": "An installation is already running.",
"unknown": "Something went wrong."
}
}
@@ -16,6 +16,16 @@
"internal_error": "启动器内部出错了。",
"settings_write_failed": "设置保存失败。",
"folder_unreadable": "无法读取文件夹:{{path}}",
"not_a_game_folder": "这不是战争雷霆的游戏文件夹:{{path}}",
"target_not_usable": "这个文件夹不能用来安装。",
"steam_library_not_confirmed": "安装位置在 Steam 游戏库里,需要先确认风险提示。",
"not_enough_space": "磁盘空间不够:需要 {{neededGb}} GB,只剩 {{freeGb}} GB。",
"essential_patches_unavailable": "你的游戏版本缺少离线版必需的改动,无法安装:{{patches}}",
"missing_features_not_accepted": "有些改动用不上,需要先确认是否在缺少这些功能的情况下继续。",
"patch_check_failed": "检查游戏文件时出错了。",
"copy_failed": "复制游戏失败,已复制的部分已删除。",
"install_cancelled": "安装已取消,已复制的部分已删除。",
"install_busy": "已经有一个安装在进行。",
"unknown": "出错了。"
}
}