Skip to content

oldgrev/proxy-dll-for-loading-ITR2-mod

Repository files navigation

First up, I'm sorry but this is wholly AI generated readme. It looks correct and it seems.....fine. It probably waffles a lot less that it would if I wrote it though.

Ideally I'd make this also load sdk stuff and do function hooking on behalf of a mods, but I'm not there yet. This is mostly just a nicer way to break out the proxy dll from the stuff I'm tinkering with.

The only mod this works with is https://github.com/oldgrev/a-battle-arena-mod-for-itr2/

Since this mod is technically proxying a windows dll which can be considered a scary behaviour by AV scanners, it's possible it may be detected as a virus or trojan. If you ever get a virus warning, definitely quarantine the dll and don't use it if you're not comfortable. If you don't trust random dll's downloaded from the internet, but still want to try it, then clone the repo and use the github actions to build it yourself and compare. Or download it and compile it with visual studio community 2022. The code is fully readable and pretty simple, run it through an ai for a second opinion even! But then you'll have your own version of the mod loader that you know exactly what it was built with.

Anyway... on to the slop!

ITR2ModLoader

A mod loader DLL for ITR2 that enables modding support by dynamically loading compatible mods from a mods directory.

Overview

ITR2ModLoader is a DLL that acts as a mod loader for ITR2. When loaded by the game, it:

  1. Checks for a mods subfolder in the game directory
  2. Creates the mods directory if it doesn't exist
  3. Scans for any .dll files in the mods directory
  4. Validates each mod by checking its SDK version compatibility
  5. Keeps only compatible mods loaded and unloads incompatible ones

How It Works

Mod Loading Process

Game Starts
    │
    ▼
ITR2ModLoader (version.dll) Loaded
    │
    ├── Create mods/ directory if needed
    │
    ├── Scan mods/ directory for .dll files
    │
    └── For each .dll found:
        ├── Load the DLL
        ├── Call GetModSDKVersion() function
        │
        ├── If version matches "1.0.0":
        │   └── Keep mod loaded ✓
        │
        └── If version doesn't match or function missing:
            └── Unload mod ✗

Version.dll Proxy

The compiled DLL is named version.dll (a DLL that many Windows applications depend on). This clever workaround allows the mod loader to be loaded by the game without requiring any special launchers or modifications to the game executable.

The DLL proxies all exported functions from the real Windows version.dll located in System32, ensuring the game continues to function normally while the mod loader runs in the background.

SDK Version

  • Current SDK Version: 1.0.0
  • Mods must export a function GetModSDKVersion() that returns this exact string to be considered compatible

Building from Source

Prerequisites

  • Windows 10/11
  • Visual Studio 2022 (or newer)
  • C++20 support

Build Instructions

  1. Open ITR2ModLoader.sln in Visual Studio
  2. Select the desired configuration:
    • Debug - For development and testing
    • Release - For production builds
  3. Select the desired platform:
    • x64 - 64-bit (recommended)
    • Win32 - 32-bit
  4. Build the solution (Ctrl+Shift+B)

Output

The compiled DLL will be located:

 atx64/Release/version.dll

Creating Mods

To create a mod compatible with ITR2ModLoader:

  1. Create a new DLL project
  2. Export a function called GetModSDKVersion that returns "1.0.0"
  3. Compile your mod as a .dll file
  4. Place your mod in the mods folder next to the game executable

Example Mod SDK Function

extern "C" __declspec(dllexport) const char* GetModSDKVersion()
{
    return "1.0.0";
}

Project Structure

ITR2ModLoader/
├── dllmain.cpp           # Main DLL entry point and mod loading logic
├── framework.h           # Windows framework headers
├── pch.h                 # Precompiled header
├── pch.cpp               # Precompiled header source
├── Source.def            # Module definition file (exports)
├── ITR2ModLoader.sln     # Visual Studio solution
├── ITR2ModLoader.vcxproj # Visual Studio project file
└── README.md             # This file

Exported Functions

The DLL proxies all standard version.dll functions:

Function Description
GetFileVersionInfoA/W Retrieves version information for a file
GetFileVersionInfoExA/W Retrieves extended version information
GetFileVersionInfoSizeA/W Gets size of version info
GetFileVersionInfoSizeExA/W Gets size of extended version info
VerFindFileA/W Finds a file
VerInstallFileA/W Installs a file
VerLanguageNameA/W Gets language name from language ID
VerQueryValueA/W Queries version information value

License

This project is provided as-is for modding purposes.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors