Files
Commonwealth-Online-Public/tools/restore-vanilla-mainmenu.ps1
T
andrew d4d3268b12 Add runtime MainMenu injection and docs
Introduce a C++ runtime injection that adds a Multiplayer row to the Fallout 4 main menu instead of patching MainMenu.swf. Adds F4TMainMenuInject.h/cpp implementing injection, ITEM_PRESS handling, accept/button hooks, resync tasks and logging; integrates installation by calling MainMenuInject::Install() from PrismaUI init. Update PrismaUI to use the new helper and remove a duplicate IsMainMenuOnMainPanel implementation. Documentation updated to deprecate FFDec SWF patching (new docs/MainMenu_Injection.md, note in FFDEC guide, and setup.md) and restore-vanilla-mainmenu.ps1 messaging updated to instruct using the runtime injection.
2026-06-09 14:52:27 +12:00

32 lines
1.2 KiB
PowerShell

# Restore vanilla MainMenu.swf from the game BA2 archive.
# The patched SWF must NOT be rebuilt via full FFDec script re-import — that breaks settings.
param(
[string]$GameData = "D:\SteamLibrary\steamapps\common\Fallout 4\Data"
)
$ErrorActionPreference = "Stop"
$repoRoot = Split-Path $PSScriptRoot -Parent
$ba2 = Join-Path $GameData "Fallout4 - Interface.ba2"
$extractor = Join-Path $repoRoot "tools\extract_ba2.py"
$vanillaOut = Join-Path $repoRoot "Interface\MainMenu.swf.vanilla.bak"
$repoSwf = Join-Path $repoRoot "Interface\MainMenu.swf"
$deploySwf = Join-Path $GameData "Interface\MainMenu.swf"
if (-not (Test-Path $ba2)) {
Write-Error "Interface BA2 not found: $ba2"
}
python $extractor $ba2 "Interface\MainMenu.swf" $vanillaOut
Copy-Item -Force $vanillaOut $repoSwf
New-Item -ItemType Directory -Force -Path (Split-Path $deploySwf -Parent) | Out-Null
Copy-Item -Force $vanillaOut $deploySwf
Write-Host "Restored vanilla MainMenu.swf to:"
Write-Host " $repoSwf"
Write-Host " $deploySwf"
Write-Host ""
Write-Host "Settings -> Gameplay/Display/Audio should work again."
Write-Host "Do not deploy a patched MainMenu.swf. Multiplayer is injected at runtime by CommonwealthOnline.dll."
Write-Host "See docs/MainMenu_Injection.md for setup and testing."