Skip to content

Technical Details

Sören Zapp edited this page May 11, 2024 · 2 revisions

Ninja is wrapped into a Windows dynamic link library (DLL). When loaded (and the parent process has been confirmed to be a supported version of Gothic, Gothic Sequel, Gothic 2 or Gothic 2 NotR), Ninja injects itself to the executable.

The reason for this compartmentalization is to separate core and wrapper and to avoid slow absolute (eax) jumps within the executed code by injecting it into the executable at fixed addresses to make use of relative jumps to addresses known at time of assembling.

This address space spans multiple methods of the deprecated class zCNetEventManager starting with zCNetEventManager::HandleNetMessage. After a long testing period any safety checks for ensuring that the overwritten methods are indeed never called are now omitted. This address space corresponds to 0x452640 - 0x454DF0 (Gothic 1.08k_mod) and 0x457470 - 0x459E60 (Gothic 2 NotR 2.6fix). Note: this ranges might be outdated.

Ninja is written entirely in assembly.

Introduction
    Virtual Disk File System
    Formats
        Single File Formats
        Collected File Formats
    Limitations to Overcome
        Scripts
        Animations
        Output Units

Solution
    Implementation
    Patch Structure
        VDF File Tree
        VDF Header
    Patch Template
    Patch Validator
    Inter-Game Compatibility

Inject Changes
    Daedalus Scripts
        Overwriting Symbols
            Naming Conventions
            Preserved Symbols
        Initialization Functions
            Init_Global
            Menu Creation
        Ikarus and LeGo
            Initializing LeGo
            Modifications to LeGo
            PermMem and Handles
        Daedalus Hooks
        Inserting NPC
        Disallow Saving
        Helper Symbols
            NINJA_VERSION
            NINJA_MODNAME
            NINJA_PATCHES
            NINJA_ID_PATCHNAME
            NINJA_SYMBOLS_START
            NINJA_SYMBOLS…PATCHNAME
        Common Symbols
        Localization
    Animations and Armor
    Output Units

Other Mechanics
    Remove Invalid NPC
    Safety Checks in Externals
    Preserve Integer Variables
    Detect zSpy
    Incompatibility List for Mods

Technical Details

Applications and Examples
    Add New NPC
    Set AI Variables
    Add New Dialogs
    Add New Spells
    Add New World
    Translation Patch

Debugging
    Console
    Logging

Installation
    Requirements
    Instructions

Troubleshooting
    Is Ninja Active
    Is Patch Loaded
    Error Messages

Download

Checksums
    Setup
    In-Game

Changelog

Support this project  

Acknowledgements

Contact and Discussion

Clone this wiki locally