GithubHelp home page GithubHelp logo

herrnamenlos123 / g3sdk Goto Github PK

View Code? Open in Web Editor NEW
2.0 4.0 0.0 417.76 MB

An experimental Gothic 3 SDK, trying to get into the Genome Engine with the intention of fixing bugs.

CMake 0.86% Batchfile 0.02% C++ 13.88% C 43.19% Python 1.44% SCSS 0.12% HTML 3.17% CSS 0.46% JavaScript 0.60% Objective-C 1.83% Shell 0.01% AGS Script 34.42%

g3sdk's Introduction

G3SDK

This is an experimental project for tinkering with the Genome Engine by Piranha Bytes, used in Gothic 3. The goal was to hook into the Gothic 3 Engine with the intention of fixing bugs and allowing more modifications.

This repository contains some of my attempts, with some successes and failures. It is not meant to do something specific, but you can use it as a starter if you want to get into it.

Some important links:

I copied all the files into this repository, so many paths in batch scripts will be wrong and you will have to adjust them.

The C++ project

The C++ project builds a DLL that is loaded into Gothic by attaching the G3Loader DLL to Engine.dll. Engine.dll, because Gothic.exe was already hooked by some other system patches and it conflicted. See G3Dll.bat, G3DllUndo.bat. A console will pop up when you start Gothic now.

Then, a second C++ DLL is compiled, which is dynamically loaded by the first when you press F2. This means you can hot-reload your C++ DLL while Gothic is running. Be aware that many function calls are detoured and routed through the DLL, and the DLL will hook and unhook these functions. If by chance you unload the DLL using F3, while the engine is inside a detoured function, Gothic will crash. Depending on which functions you hook into and how much time is spent in your detours, it is more likely or less likely to crash. This is simply meant to speed up development time.

Microsoft Detours library is used to redirect any function call between DLL boundaries into a user defined function, and then you can either redirect it back into the original function (which means you do the default plus something additional), or you simply return in your detour, which means you essentially completely skip or disable an engine function. Every function that has an exported function signature can be detoured.

Extra-resources

extra-resources contains disassembled versions of the Gothic DLLs, there you see all function signatures of all DLLs that are imported and exported. A python program was used to demangle them using visual studio tools.

You will need these function signatures in order to hook into these functions in C++.

Ghidra

Here is also a ghidra subfolder, which contains a Ghidra project. I put in a lot of effort to decompile the original Gothic 3 DLLs. My main target were classes such as PS_Animation and anything animation related, as well as a bit of the entity component system and general data types such as BCString.

xmot file format

One of many goals was to reverse engineer the .xmot file format. All other file formats of Gothic have already been reverse engineered. Just .xmot not, which prevents modders from changing animations, which prevents a whole bunch of bug fixes.

This attempt is also here, so make sure to look into the xmot folder. There is a python file which is a file converter, and it can half-way decode a .xmot file, and then re-encode it back. This means it might be possible to change values. However, only parts of the file are decoded yet and many parts of the file format are still black boxes.

https://web.archive.org/web/20230513172524/https://forum.xentax.com/viewtopic.php?t=9369 is very valuable. It is saved locally at Animation researching - XenTaX.

You need help?

As said, I copied all files into this repository and did not do any more work afterwards. If you need any help getting the project to compile, feel free to contact me at [email protected] or in an issue.

I really wanted to get into the engine in order to make Gothic what it should have been, but sadly my time was prioritized differently at some point. But if you ask me I will gladly try to get the project to work, for now it is just a silent reference.

g3sdk's People

Contributors

herrnamenlos123 avatar

Stargazers

 avatar  avatar

Watchers

James Cloos avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.