Replace occurrences of "Fallout 4 Together" with "Commonwealth Online" across docs and testing guidance. Add Interface assets and tooling: MainMenu/Pipboy SWFs, translation/fonts, exported scripts (Interface/exported/scripts/MainMenu.as) and a PATCH_MainMenu_Multiplayer.md describing how to add a Multiplayer menu entry that calls root.f4se.plugins.commonwealthOnline.openManager(). Also add build/run batch scripts and apply assorted updates to README, plugin, server and protocol documentation/source to align with the rename and UI changes.
4.6 KiB
MainMenu.swf — Multiplayer button patch guide
Reference export: scripts/MainMenu.as
Edit the script inside FFDec on the SWF (or paste changes back into FFDec after editing the export). Saving only the .as file does not update MainMenu.swf.
Why texts/sprites only showed CONTINUE
The main menu is a dynamic list (MainPanel_mc.List_mc). Items like $NEW, $LOAD, $SETTINGS are pushed in InitList(), not stored as static text tags.
Three edits in MainMenu class
1. Add index constant (~line 214)
After INSTALLED_CONTENT_INDEX:
private const MULTIPLAYER_INDEX:Number = 15;
Index 15 is unused in vanilla (highest defined is INSTALLED_CONTENT_INDEX = 14).
2. Add list entry in InitList() (~line 589)
Insert after the $LOAD push and before the PS5 transfer / DLC block — only on the title screen (!PauseMode):
this.MainPanel_mc.List_mc.entryList.push({
"text":"$LOAD",
"disabled":!this.HasRecentSave || !param6,
"index":this.LOAD_INDEX
});
// --- ADD BELOW ---
if(!this.PauseMode)
{
this.MainPanel_mc.List_mc.entryList.push({
"text":"Multiplayer",
"index":this.MULTIPLAYER_INDEX
});
}
// --- ADD ABOVE ---
if(param8 == true)
Using literal "MULTIPLAYER" avoids needing a .strings entry for the PoC. Later switch to "$COSYNC_MULTIPLAYER" + Interface/Translate_en.txt if you want localization.
Label text: For the PoC use a literal label (no $ prefix):
"text":"Multiplayer",
Strings starting with $ are looked up in Interface/Translate_en.txt (from Fallout4 - Interface.ba2). A lone Interface/Translations/MainMenu_en.txt is not how vanilla resolves main-menu keys, so $MULTIPLAYER shows as-is until you merge the key into Translate_en.txt (extract from BA2, append $MULTIPLAYER Multiplayer, redeploy loose file).
Regenerate optional translation stub: python tools/write_mainmenu_translation.py (for future i18n / Translate_en merge only).
Fallout 4 must load loose Interface files
Loose Data/Interface/*.swf overrides are ignored unless archive invalidation is on. Add to %USERPROFILE%/Documents/My Games/Fallout4/Fallout4Custom.ini:
[Archive]
bInvalidateOlderFiles=1
(MO2 enables this automatically; manual Data/ copies need it.)
Without invalidation, the game keeps using Fallout4 - Interface.ba2 — your patched SWF never loads even though the file is on disk.
Suggested placement: between Load and Add-ons so it reads naturally on the main menu.
3. Handle selection in onMainListItemPress() switch (~line 864)
Add before case this.HELP_INDEX: (or anywhere in the switch):
case this.MULTIPLAYER_INDEX:
this.BGSCodeObj.PlayOKSound();
if(root.f4se != null && root.f4se.plugins != null && root.f4se.plugins.commonwealthOnline != null)
{
root.f4se.plugins.commonwealthOnline.openManager();
}
break;
Requires the C++ plugin to register commonwealthOnline.openManager() via F4SE Scaleform (not done yet). Until then, the button will play the OK sound and do nothing else — safe for SWF-only testing.
FFDec workflow
- Open
Interface/MainMenu.swfin FFDec. - scripts → MainMenu → right-click → Replace / Edit (or open script, paste from
scripts/MainMenu.as). - File → Save (overwrites SWF).
- Deploy to
Fallout 4/Data/Interface/MainMenu.swfor your mod folder. - Launch via F4SE and test.
Re-import from edited export: In FFDec, select the MainMenu script under scripts, use Edit ActionScript and paste the full contents of Interface/exported/scripts/MainMenu.as, then save the SWF. FFDec may also offer Import script / Replace script from file depending on version.
Keep MainMenu.swf.vanilla.bak unchanged.
Related functions (no edit needed for PoC)
| Function | Role |
|---|---|
InitList() |
Builds entryList with $CONTINUE, $NEW, $LOAD, … |
onMainListItemPress() |
switch on selectedEntry.index |
onListItemPress() |
Routes list press events to onMainListItemPress() |
| Index constants (~184–212) | CONTINUE_INDEX … INSTALLED_CONTENT_INDEX |
Next step (code)
Implement commonwealthOnline.openManager() in CommonwealthOnline.dll and CoSyncServerBrowser.swf per docs/custom-swf-ui.md.