All Projects → Netdex → twinject

Netdex / twinject

Licence: GPL-3.0 license
Automated player and hooking framework for bullet hell games from the Touhou Project

Programming Languages

C++
36643 projects - #6 most used programming language
c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to twinject

Universal-THCRAP-Launcher
Basic Universal Launcher for https://github.com/thpatch/thcrap
Stars: ✭ 32 (-38.46%)
Mutual labels:  touhou-project, touhou
DLL-Injector
Inject and detour DLLs and program functions both managed and unmanaged in other programs, written (almost) purely in C#. [Not maintained].
Stars: ✭ 29 (-44.23%)
Mutual labels:  dll-injection, detours
th18-nyasama
TH18东方虹龙洞喵玉汉化
Stars: ✭ 19 (-63.46%)
Mutual labels:  touhou-project, touhou
MapleClientEditTemplate
An increasingly generic and comprehensive MapleStory client editing framework. Written by Erik A (Minimum Delta). Intended to abstract away some of the MapleStory client editing learning curve.
Stars: ✭ 3 (-94.23%)
Mutual labels:  dll-injection, detours
thhyl
东方STG录像信息查看器 / Touhou STG replay file(*.rpy) info viewer
Stars: ✭ 35 (-32.69%)
Mutual labels:  touhou-project, touhou
TouhouRPC
TouhouRPC is a program that creates a Discord Rich Presence status for Touhou games.
Stars: ✭ 59 (+13.46%)
Mutual labels:  touhou-project, touhou
ReflectivePELoader
Reflective PE loader for DLL injection
Stars: ✭ 130 (+150%)
Mutual labels:  dll-injection
teki
Touhou-style shoot'em up
Stars: ✭ 60 (+15.38%)
Mutual labels:  touhou
inject
Yet another Windows DLL injector.
Stars: ✭ 23 (-55.77%)
Mutual labels:  dll-injection
Dll-Injector
simple C++ dll injector
Stars: ✭ 22 (-57.69%)
Mutual labels:  dll-injection
DLL-INJECTOR
I created a dll injector I am going to Open source its Code. But remember one thing that is any one can use it only for Educational purpose .I again say do not use it to damage anyone's Computer.But one thing if you are using it for some good purpose like to help someone who really need help then I permit you to use it.
Stars: ✭ 14 (-73.08%)
Mutual labels:  dll-injection
CodeInjection
Code Injection technique written in cpp language
Stars: ✭ 27 (-48.08%)
Mutual labels:  dll-injection
mauve
An eDSL for music composition and visualization
Stars: ✭ 16 (-69.23%)
Mutual labels:  touhou-project
SocketHook
Socket hook is an injector based on EasyHook (win only) which redirect the traffic to your local server.
Stars: ✭ 38 (-26.92%)
Mutual labels:  dll-injection
HAPIH-2
API for supporting C++14 external memory hacking. Complete redesign from HAPIH
Stars: ✭ 18 (-65.38%)
Mutual labels:  dll-injection
hooking-by-example
A series of increasingly complex programs demonstrating function hooking on 64 bit Windows. Culminating in a program that hooks mspaint to make it always paint orange.
Stars: ✭ 144 (+176.92%)
Mutual labels:  dll-injection
Invisiwind
An application that allows you to hide certain windows when sharing your full screen
Stars: ✭ 53 (+1.92%)
Mutual labels:  dll-injection
Indicium-Supra
DirectX API-hooking framework
Stars: ✭ 292 (+461.54%)
Mutual labels:  dll-injection
foo thbgm
⇩Download Page⇩ A foobar2000 plugin to directly play BGMs of Touhou series and some related doujin games
Stars: ✭ 36 (-30.77%)
Mutual labels:  touhou
ManagedInjector
A DLL injector to inject .NET assemblies into a foreign .NET process.
Stars: ✭ 73 (+40.38%)
Mutual labels:  dll-injection

twinject

Build status

Click here to visit Wiki (documentation)

This project is a work-in-progress.
If you have any questions, want to help, or are just having trouble getting 
something working, feel free to open a ticket or email me (my email address is on my GitHub profile). 

Demonstration Video

alt text?

What is this?

twinject (touhou windows injector) is an automated player for the bullet hell games from the Touhou Project. Instead of using computer vision techniques to extract data from the game, a DLL is injected and the relevant game data is directly extracted through trampolined functions. twinject's first goal is to expose game information and APIs to interact with the game.

For the unaware, bullet hells are a category of Shoot 'em Up video games where the player controls a ship, which must dodge large numbers of obstacles and destroy large numbers of enemies. In the demonstration videos, the fast moving projectiles are the obstacles which must be dodged - if the player hits any of these projectiles they die immediately. The player itself also fires projectiles, which damage enemies. Props to ZUN for making games that people still play 20 years later.

Documentation is currently incomplete/outdated, and is currently on my list of things to do. At the moment, I am prioritizing features and demonstrations.

So far, I plan to implement bindings for this bot for every mainline game. As of now, I have completed basic bindings for games listed in the table below. Some binding implementations or reverse engineering knowledge have been borrowed from other sources and are cited at the bottom. Thank you!

Demonstrations

As of now, I have implemented two player algorithms with varying degrees of success.

Constrained Velocity Obstacle Algorithm

The constrained velocity obstacle algorithm uses a linear velocity obstacle predictor based approach with an infinite horizon but constrained bounds, and picks the best possible move at the current instant in a greedy fashion.
Note that when these demonstrations were recorded, the bot was incapable of dodging lasers. Watch as it struggles to deathbomb through every laser it sees.

MoF 1CC Normal

MoF Stage 3 Lunatic

1CC LoLK Normal

LoLK Stage 6

More demonstrations are available in the wiki.

Support

Bindings th07 th08 th10 th11 th15
Bullet Hook ✔️ ✔️ ✔️ ✔️ ✔️
Enemy Hook ✔️
Powerup Hook ✔️ ✔️
Laser Hook ✔️ ✔️
Stage Info Hook ✔️ ✔️ ✔️ ✔️ ✔️
Direct3D Hook ✔️ ✔️ ✔️ ✔️ ✔️
DirectInput Hook ✔️ ✔️ ✔️ ✔️* ✔️
Feature th07 th08 th10 th11 th15
Dodge Bullet ✔️ ✔️ ✔️ ✔️ ✔️
Dodge Enemy ✔️ ✔️
Dodge Laser ✔️ ✔️
Collect Powerups ✔️ ✔️
Target Enemies

... and some other undocumented features. Keep in mind that this table probably isn't kept up to date.

Building

The dependencies are included in the repository, and are referenced by relative path.

Build Instructions

1. git clone --recurse-submodules https://github.com/netdex/twinject.git
2. Build in Visual Studio 2017 with Release (x86) target.
The following components are required:
- VC++ 2017 version 15.8 v14.5 latest v141 tools (other verisons should be okay, you will need to retarget)
- Windows 10 SDK (10.0.17134.0) (other versions should be okay, you will need to retarget)
- Visual C++ ATL for x86 and x64 (technically this isn't required, but I used CString for convenience)

Place the following files into the game directory:
twinject.exe
twinhook.dll
twinject.toml (there is a sample included under twinhook/)

Obtain dx8->dx9 converter patch (included in releases in this repo as dxd8.dll and enbconvertor.ini),
and place into game directory if the game requires it.

If you don't want to build it, there are stable Releases in this repository. The tagged commits represent stable points, since sometimes I break the build and it doesn't work. If you want to test the latest features (since the Releases take effort to create, so I don't do them often), you can download the build artifacts from Appveyor. If you are having trouble getting it to build, feel free to open a ticket or contact me.

Usage

Refer to deploy/INSTRUCTIONS.TXT

You can click the IMGUI windows to control twinject as well.  
(note: key controls have been temporarily replaced with IMGUI while I sort stuff out.)

To close the bot, close the debug console window and the game will close after.
Closing the game first may cause cleanup to not occur.

If you are using the th_vo_algo (the default), make sure you only enable the bot after the stage loads and the player is able to move, 
since the th_vo_algo needs to calibrate the player by moving it around. You should see a log message after successful calibration.

Make sure DirectInput is not disabled, it is required for movement.

If you have any other problems, please read the troubleshooting section below. 
If you still have any other problems, feel free to contact me. 
You can either make an issue or email me (my email is on my GitHub profile).

Architecture

Troubleshooting

Ethics

Replays

Note that this bot generates valid replays. Do not submit replays generated by this bot to replay aggregators such as royalflare, as they are prohibited. You may only submit to a tool-assisted category if they exist.

3rd Party

This code is licensed under the specified terms here.

Libraries and their licenses are documented under dependencies/.

Information regarding Touhou game internals to assist in reverse engineering have been used from the following sources:
TH10_DataReversing by binvec
thinput by Drake
Nice cheat.
Ethan Silver's Junkpile

Thank you.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].