Godot RE Tools Documentation

repository·master·Indexed 26 days ago

https://github.com/gdretools/gdsdecomp

A suite of tools for Godot engine reverse engineering, featuring full project recovery, PCK extraction and creation, GDScript decompilation, and resource format conversion. Includes a GUI and a headless CLI for automating recovery, patching PCKs, and converting binary scene/resource files to text.

Tokens
5.2K
Snippets
11
Records
25
Agent score
88%

What's inside Godot RE Tools

  1. Use Glob Patterns for Include/Exclude

    master

    When using --include or --exclude, follow these rules:

    • Recursive patterns: Use ** (e.g., res://**/*.gdc matches all .gdc files in all subdirectories).
    • Rooting: Globs should be rooted to res:// or user://. If not rooted, they default to res://.
    • Wildcard shorthand: If a glob has a wildcard but no directory, it is treated as recursive (e.g., *.gdc is equivalent to res://**/*.gdc).
    • Matching: Globs only match files actually present in the project PCK/directory. For example, if res://main.gdc exists in the PCK, using the glob res://main.gd will not match anything, but res://main.gdc will match and allow recovery of the source res://main.gd.
  2. Build the Godot Mono Decompiler AOT Test

    master

    To build the C++ test program used to verify the AOT (Ahead-of-Time) build of the Godot Mono Decompiler with dynamic linking, follow these steps:

    Prerequisites

    • CMake: version 3.16 or higher.
    • Compiler: C++17 compatible compiler (GCC, Clang, or MSVC).
    • AOT Library: The library must be built and located at ../GodotMonoDecompNativeAOT/bin/Release/net9.0/osx-arm64/publish/GodotMonoDecompNativeAOT.{dylib,dll,so}.

    Build Steps

    1. Create and enter a build directory:
      mkdir build
      cd build
    2. Configure the project with CMake:
      cmake ..
    3. Build the program:
      make
    mkdir build
    cd build
    cmake ..
    make
  3. Compile Godot RE Tools from Source

    master

    To build the module as part of the Godot engine:

    1. Clone this repository into the Godot modules subfolder as gdsdecomp.
    2. Ensure you have rustup and dotnet 10 sdk installed.
    3. Rebuild the Godot engine. Note that the module automatically applies patches to Godot core files (e.g., main/main.cpp) during SCons configuration.
    4. Important: Build the editor build first, and launch the editor in the standalone directory at least once so that resources are imported before running.

    Requirements:

    Standalone Execution Example: If you compiled with scons platform=linuxbsd target=template_debug:

    bin/godot.linuxbsd.template_debug.x86_64.llvm --headless --path=modules/gdsdecomp/standalone --recover=<pck/apk/exe
    bin/godot.linuxbsd.template_debug.x86_64.llvm --headless --path=modules/gdsdecomp/standalone --recover=<pck/apk/exe
  4. Install Godot RE Tools

    master

    You can install Godot RE Tools by downloading the latest release from the GitHub releases page or by using Scoop on Windows.

    Windows (via Scoop):

    scoop bucket add games
    scoop install gdsdecomp
    scoop bucket add games
    scoop install gdsdecomp
  5. Write a custom decryptor script

    master

    If a game uses a custom encryption scheme instead of the standard Godot AES-256-CFB, you must write a custom decryptor script using Godot 4.5+ GDScript.

    Your script must:

    1. Extend the CustomDecryptor class.
    2. Implement the _parse_and_decrypt() method.

    Warning: Do not include secrets (encryption keys, XOR keys, etc.) directly in the script if you intend to distribute it, as this may violate legal restrictions like the DMCA.

  6. Perform Full Project Recovery via GUI

    master

    To recover a full Godot project (including decompiling GDScript, recovering original project files, and converting resources) using the graphical interface:

    1. Open the application.
    2. Select "Recover project..." from the "RE Tools" menu.
    3. Alternatively, drag and drop the PCK, APK, or EXE file directly onto the application window.
  7. Troubleshoot Godot Mono Decompiler AOT Test

    master

    If you encounter issues while running or building the AOT test, check the following:

    • Linker errors: Verify that the AOT library is built and that the path specified in CMakeLists.txt is correct.
    • Missing symbols: Ensure the GodotMonoDecomp_DecompileProject function is properly exported from the AOT library.
    • Runtime errors: Ensure all dependencies are available in the RPATH.
  8. Run the Godot Mono Decompiler AOT Test

    master

    The aot-test program verifies the decompilation process by calling the GodotMonoDecomp_DecompileProject function directly via dynamic linking. It requires a path to a .NET assembly and an output directory.

    Arguments

    1. Assembly Path: Path to the .dll file to decompile.
    2. Output Directory: Directory where the decompiled project will be saved.
    3. Reference Paths (Optional): Additional paths used for assembly resolution.

    Usage Examples

    Basic usage:

    ./aot-test /path/to/your/assembly.dll ./output

    Usage with reference paths:

    ./aot-test /path/to/your/assembly.dll ./output ./reference1 ./reference2