Jump to content
Setting up an AI agent? ReverseEngineering.wiki skill (works from the command line, no configuration): https://reverseengineering.wiki/skill/rewiki/SKILL.md · setup for every client, including MCP: https://reverseengineering.wiki/llms.txt · REWiki:Connect

Tool:EDFModLoader

From ReverseEngineering.wiki
Tool
Developer BlueAmulet
Uses Technique:DLL proxy loading
Platforms Windows x64
License MIT
Website https://github.com/BlueAmulet/EDFModLoader
On this wiki Facts · Code · Notes · Topics

Open-source (MIT) mod loader for Earth Defense Force 4.1, 5 and 6 on PC by BlueAmulet. It is a winmm.dll proxy that loads plugin DLLs and ASI files, redirects CRI file-system reads to a loose Mods folder, and can write the game's internal debug log.

Overview

EDFModLoader is installed by extracting winmm.dll next to EDF41.exe, EDF5.exe or EDF6.exe. It is written in C++ with MinHook (hooks), plog (logging) and LightningScanner (signature scans). It identifies the game from the executable name; for EDF6 it scans EDF.dll, which holds the game code, instead of the executable.

Loading sequence

  1. DllMain loads the real %WINDIR%\\System32\\winmm.dll and fills the forwarders (Technique:DLL proxy loading).
  2. It reads ModLoader.ini (section [ModLoader], booleans LoadPlugins, LoadASI, Redirect, GameLog) and creates Mods and Mods\\Plugins.
  3. It hooks a late-start function and loads plugins from that hook, outside the loader lock: _initterm of ucrtbase.dll (EDF5) or MSVCR120.dll (EDF4.1), and the CPP_OnBoot export of EDF.dll (EDF6).
  4. Plugins: every Mods\\Plugins\\*.dll; with LoadASI also Mods\\Plugins\\*.asi and *.asi in the game folder (ASI files get InitializeASI() called if they export it).

Logs go to ModLoader.log; with GameLog=True the game's own printf-style debug output goes to game.log.

Plugin API

A plugin exports bool __fastcall EML4_Load(PluginInfo*), EML5_Load or EML6_Load (one name per game). Returning false unloads it. PluginInfo (24 bytes, PluginAPI.h): uint32 infoVersion (must be 1), const char* name (required), uint64 version (union of four uint16: build, patch, minor, major; macro PLUG_VER(major, minor, patch, build)). The loader itself registers as version 1.0.10.0.

File redirection

The game opens its data through the CRI File System with paths that start with /cri_bind/ (files inside the bound .cpk archives). The loader hooks that open routine; if ./Mods/<rest of path> exists on disk it rewrites the path (a 32-byte MSVC std::wstring, assigned through the game's own std::wstring::assign) so the loose file is read instead. Mods therefore mirror the archive layout, e.g. Mods\\MISSION\\M003\\MISSION.bvm replaces mission M003's script in EDF5.

Patcher plugin

The bundled Patcher plugin applies runtime patches from Mods\\Patches\\*.txt and logs to Patcher.log. Line format: Offset: hex bytes ; comment or Offset: Type! value, where Offset is hexadecimal and relative to the module base (the executable, or EDF.dll for EDF6). Types: u8-u64, s#, p#, n#, float/f32, double/f64, rel32 (writes a rel32 displacement to a label). Commands: aob <label> <pattern> (signature scan, label = module offset), alloc <label> <size> [near] (executable memory near an address, for code caves), label <name> (name the current offset). Addresses can be label+hex or label-hex. Default EDF5 patches: IncreaseChatLimit (32 to 128 characters), RemoveChatCensor, InvalidMissionIDFix (online lobby crash on out-of-range modded mission IDs) and MouseJitterFix; extra patches: BorderlessWindow, ChangeFOV (default 45 degrees vertical), ChangePickupLimits, NoAmbientOcclusion.

Known plugins

  • EDF5 Damage Number Display (Eiton): EDF6-style damage numbers, see Software:Earth Defense Force 5#Modding.
  • EarthDefenseForce-8PlayerMod (BurguerJohn): raises online co-op above 4 players in EDF5.

See also

Code & repositories

  • https://github.com/BlueAmulet/EDFModLoader @ c686e8fb48121e0a6b3f6b7f42d6df0d5249678b · license: MIT
    Mod loader for EDF 4.1/5/6: winmm.dll proxy, plugin DLL/ASI loading, CRI /cri_bind/ to Mods folder redirection, game debug log hook, Patcher plugin with runtime patch files.
    Tested on: Source read only (not built or run in this session) · checked 2026-10-17; last activity 2025-10-11; Note: the latest release ships binaries; the wiki links only the source, never the binaries
  • https://github.com/Eiton/EDF5-Damage-Number-Display @ 17bb4d60d4c1a5a1e8bf89e95338e15b55131777 · license: MIT
    EDFModLoader plugin drawing EDF6-style damage numbers in EDF5 with Dear ImGui; hooks the damage-to-health addss by signature and IDXGISwapChain Present/ResizeBuffers with Detours.
    Tested on: Source read only (not built or run in this session) · checked 2026-10-17; last activity 2026-02-16; Note: the latest release ships binaries; the wiki links only the source, never the binaries