A DLL extension for Star Wars Battlefront II (2005) that exposes new modding capabilities by hooking into the game engine at runtime. Injects into BF2_modtools.exe and adds custom Lua functions, ODF properties, loading screen parameters, bug fixes, and engine limit extensions.
Fully reverse-engineer Star Wars Battlefront II (2005) and produce a complete Ghidra decompilation of the game engine - then use that knowledge to push the boundaries of what's possible in SWBF2 modding. Re-enable cut features, fix long-standing engine bugs, and add entirely new capabilities through the game's existing Lua and ODF systems.
Aspyr's Classic Collection, outsourced to Dragons Lake Entertainment, failed to deliver even basic fixes the community had been requesting for years, while simultaneously taking from modders without credit. Every feature listed below was achieved by patching raw assembly in a 20-year-old binary without source code access. Consider what a studio with the actual source code could have accomplished in a single afternoon and then ask why they didn't.
- Features
- Supported Executables
- Installation
- Configuration
- Building from Source
- Project Structure
- Contributors
Automatic binary patches applied on load:
- Heap Memory Extension - Increases RedMemory heap from 64MB to 256MB, drastically reducing out-of-memory crashes
- DLC Mission Limit - Increases from 500 to 4096, allowing more mods installed simultaneously
- Sound Layer Limit - Prevents crashes on maps with many flyers/entities using EngineSound
- GC Visual Limits - Raises Galactic Conquest per-frame rendering limits: pathway beams from 64 to 256, particle icons from 128 to 512. Fixes pathways and fleet/planet icons silently disappearing on modded GC maps with many planets
The vanilla game reads a loading screen configuration from a munged load.cfg, but it cannot be overridden without replacing the base game file. BF2GameExt hooks into the LoadDisplay config parser and renderer to add new parameters that work alongside vanilla ones. Modders can also redirect the entire loading screen to a custom load.cfg via SetLoadDisplayLevel(path) in Lua.
| Parameter | Syntax | Description |
|---|---|---|
EnableBF1 |
EnableBF1(1/0) |
Master switch for the BF1-style zoom animation sequence |
PlanetLevel |
PlanetLevel(index, texName, x, y, w, h) |
Per-level planet texture at a normalized screen rect. Place inside PC() or Map() |
AnimatedTextures |
AnimatedTextures(baseName, count, fps [, x, y, w, h]) |
Frame-sequence animation overlay. Frames named baseName0..baseName(count-1) |
ScanLineTexture |
ScanLineTexture(texName [, f1, f2, f3]) |
Full-screen scanline overlay drawn on top of everything |
ZoomSelectorTextures |
ZoomSelectorTextures(horz, vert, corner) |
Texture strips for the 16-quad crosshair frame around the zoom target |
ZoomSelectorTileSize |
ZoomSelectorTileSize(halfW [, halfH]) |
Half-dimensions of each crosshair tile in normalized screen space |
XTrackingSound |
XTrackingSound(soundName) |
Looping sound during horizontal band convergence |
YTrackingSound |
YTrackingSound(soundName) |
Looping sound during vertical band convergence |
ZoomSound |
ZoomSound(soundName) |
One-shot sound on zoom-in phase |
TransitionSound |
TransitionSound(soundName) |
One-shot sound on planet transition |
BarSound |
BarSound(soundName) |
Periodic sound when no planet animation is active |
BarSoundInterval |
BarSoundInterval(seconds) |
Seconds between BarSound replays |
LoadSoundLVL |
LoadSoundLVL(lvlPath) |
Path to an .lvl containing sound definitions for the above |
RemoveToolTips |
RemoveToolTips(1/0) |
Hides the tips box and text. Works independently of EnableBF1 |
RemoveLoadingBar |
RemoveLoadingBar(1/0) |
Hides the progress bar. Works independently of EnableBF1 |
| Function | Description |
|---|---|
SetLoadDisplayLevel(path) |
Redirects to a custom load.cfg (call from script root or ScriptPreInit) |
- Prone Stance - Re-enables, fixes, and adapts the cut prone posture system. Double-tap crouch to go prone, any crouch press to stand back up. Includes a terrain rotation fix that prevented prone from working on slopes. Lua:
EnableProne(enable) - Multiple First-Person Animation Banks - Allows each soldier class to use its own first-person animation bank instead of sharing one global set. Supports partial banks where missing animations fall through to defaults. ODF:
FirstPersonAnimationBank = bankname - Unit Class Removal - Dynamically remove classes from a team's spawn menu at runtime. Lua:
RemoveUnitClass(team, class)
- Barrel Fire Origin Fix - Fixes ordnances spawning from
bone_headinstead ofhp_fireon WeaponCannon. Forces projectiles to originate from the actual barrel hardpoint. Lua:SetBarrelFireOrigin(enable) - Disguise Model Override - Allows WeaponDisguise to swap the soldier's visual model to a specific GameModel instead of cloning the first enemy soldier. ODF:
DisguiseModel = modelname - Grappling Hook (experimental) - Re-enables the cut grappling hook weapon with custom pull physics, slingshot mechanic (jump mid-pull to launch), and rope cable rendering. ODF properties:
PullSpeed,MaxRange
- Flyer Boost Animation - If a flyer's AnimationName bank contains an animation named
boost, it will automatically play when boosting with a smooth blend transition. Frame 0 should be the normal flying pose and the final frame the full boost pose. - Carrier Fixes - Originally an unused class, the Carrier Fixes address landing state oscillation, cargo attachment, LOD rendering, and animation override for EntityCarrier, making it viable for modders to use as a VehiclePad.
- OnCharacterExitVehicle - Register Lua callbacks that fire when soldiers dismount vehicles, with filtering by name, team, or class. Lua:
OnCEV(fn),OnCEVName(name, fn),OnCEVTeam(team, fn),OnCEVClass(class, fn),ReleaseCEV(handle)
Make HTTP requests directly from Lua scripts - enables integration with external APIs, telemetry, live configuration, and more. All from within singleplayer or multiplayer missions.
HttpGet(url)/HttpPut(url, body)/HttpPost(url, body)- Synchronous requests, return response bodyHttpGetAsync(url)/HttpPutAsync(url, body)/HttpPostAsync(url, body)- Fire-and-forget on background threads
Extra commands for the in-game console in the ModTools (~):
RenderHoverSprings- Visualize hover vehicle spring compression with colored wireframe spheresShowWeaponRanges- Draw weapon AI range circles (MinRange, OptimalRange, MaxRange) around soldiers
- BF2_modtools - Full support (modding executable from the official mod tools)
- GoG - Binary patches only
- Steam - Binary patches only
Lua extensions and hooks currently target BF2_modtools only. GoG/Steam support for the full feature set is planned.
- Build
BF2GameExt.dll(PatcherDLL project) andBF2GameExt.exe(BF2GameExt project) - Place both in your
Star Wars Battlefront II Classicfolder (outside ofGameData) - Run
BF2GameExt.exeand patch a copy of BF2_modtools.exe - The patcher places the DLL into
GameDataautomatically - Done! Run the game through the patched executable and have fun :)
Features are configured through load.cfg parameters, ODF properties, and Lua functions. See the Examples folder for ready-to-use configurations with inline documentation.
Requirements:
- Visual Studio 2022 (v143 toolset)
- Windows 10 SDK
- C++20
git clone https://github.com/S1thK3nny/BF2GameExt.git
Open BF2GameExt.sln and build the PatcherDLL project. Output goes to bin\Debug\ or bin\Release\.
PatcherDLL/src/
core/ Entry point, patching, address registry, resolve helpers
entity/ EntitySoldier, EntityFlyer, cloth collision fixes
weapon/ Grappling hook, disguise model override
lua/ Lua API hooks and custom function registration
loading_screen/ Loading screen system (config, renderer, lifecycle)
shell/ Galactic Conquest visual limit extensions
debug_commands/ Console debug visualization commands
util/ File helpers, slim_vector, class limit patch
- PrismaticFlower - Author of the original project this was forked from. Creator of numerous essential tools for the BF2 modding community.
- phantom567459 - BF1 engine research and decompilation. His work on the BF1 binary made the loading screen system possible.
- Ryan Hank - Reverse engineering, decompilation, implementation.
- S1thK3nny - Reverse engineering, decompilation, implementation.