Skip to content

Architecture

Gordon Guan edited this page Aug 11, 2018 · 1 revision

Documentation of Functionality

Consists of two parts, twinhook and twinject.

twinhook

twinhook is a DLL, injected before runtime into a Touhou game. It uses MS Detours to trampoline functions.
This technical description is now a bit out of date, as radical changes were made to its functionality. I will update the documentation in the near future.

Technical Description of th08 binding

twinject

twinject loads twinhook into game with MS Detours. This documentation is up-to-date, since I haven't the injector part in years (don't fix it if it ain't broke).

Technical Description of Injection

Code Structure

Doxygen (mostly undocumented)

alt text?

Hooks for different parts of games are created. Some hooks can be reused across games (Direct3D, DirectInput), some are game specific (bullet processing hooks).

An algorithm is a methodology to process game data, and determine player movements. Multiple implementations of algorithms are/will be supported, including:

  • Method of Velocity Vector and Virtual Potential Field
  • Method of Constrained Velocity Obstacle
  • Method of Artificial Neural Network

The automated player is a game-specific wrapper for each game that twinject supports. It gathers information from hooks and delivers them to the algorithm. This is required since every game requires different hooks, and may have some game-specific quirk that needs to be handled.

Each game has a startup routine. This routine is responsible for intializing hooks at the correct time, setting up the chosen algorithm, and initializing the correct automated player for each game.

If you have any further questions about the code structure feel free to contact me.

Clone this wiki locally