Comments (6)
Definitely, as long as the game uses DirectX 9.0. th_d3d9_hook
, which is the sub-component of twinject that handles DirectX hooking, should work in theory with any DirectX 9 game. It can hook the entry point regardless of whether the DirectX is loaded statically (link-time) or dynamically (LoadLibrary).
th_d3d9_hook
hooks BeginScene, EndScene, and CreateDevice, so custom code can be run in each of these methods while exposing the underlying IDirect3D9Device.
If the game does not use DirectX 9.0, then adaptations must be made to the wrapper methods (such as Direct3DCreate9) to the appropriate methods in the other version.
Also note that the code containing th_d3d9_hook
must be injected into the target game.
from twinject.
Good. As I was looking at twinject 1.2.86 release version and testing with Touhou 10, I could see it works perfectly. I've done a good job man.
So I'd like to integrate a simpler twinject version to my project, so that:
- Neither all that initial UI windows overlaying the game will be needed nor all that render targets
- The my own 'bot' will need to start feeding fake input when the game start playing.
from twinject.
Thanks, I'm glad it worked the way it's supposed to (I've never tested twinject on another system).
If you need to fake input too, that is a separate component (th_di8_hook
). It only supports DirectInput8, supporting any other versions of DirectInput would require similar changes as I mentioned above with other versions of DirectX. If the game uses the Windows Event Loop to handle input, you can probably adapt the Windows Event Hook code used for the IMGUI integration.
If you want to integrate twinject functionality into your project there are a few major components you will need to consider:
Injection
This is the job done by the injector portion using Microsoft Detours to create the game process and inject the hook DLL, this code should be easy to abstract for your case since it is very generic.
Hooking
You also need to initialize the hooks so that the code trampolines are created and the detours are set, this should be done in the injected DLL right after injection (DllMain).
Frame processing
The code that the hook calls is in this file, and can be modified (you said you didn't need the IMGUI functionality or rendering, which is in d3d9EndHook
). you will probably need to modify this code to suit your needs.
The input hooking is very generic, and probably doesn't need to be modified, you can check the method names should be fairly self explanatory.
You should be able to figure out how most of the components work by inspecting how they are used for Touhou games.
from twinject.
Such a great information!
Really thanks.
from twinject.
from twinject.
Sorry for the late reply (I didn't see the issue because it was closed).
I am netdex#9804
on Discord, and you can contact me there for support (I should respond more quickly there than emails).
Anyone else who sees this ticket can also contact me via Discord.
from twinject.
Related Issues (20)
- Command processor does not suppress enter key HOT 1
- th11: DirectInputDevice8 handles are invalid and cannot be used HOT 1
- Move IMGUI renderer to separate window
- Implement virtual collision testing system
- Overhaul collision testing system
- AI is not working HOT 3
- TH15 EXCEPTION_ACCESS_VIOLATION HOT 1
- Replace all usages of Win32 API with WIL
- Modify documentation to reflect configuration changes to TOML
- Modify documentation to require recursive clone of submodules
- Implement universal loader and TOML configuration
- Move hardcoded dimensions in twinhook to TOML configuration
- Replace macro logging framework with spdlog
- Huge lag during lasers. HOT 9
- Feature to hide overlay / extra windows? HOT 1
- Does not work on Windows 7 due to XINPUT_1.4.DLL dependency HOT 1
- Using `twinject` to tweak bullet and player movement speed? HOT 6
- support for th16,17,18
- Keys do not work; Z, X and C are all active in the GUI HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from twinject.