Thread dedicated to issues and problems related to code injection (hook\detour)s

Started by RawCode, December 11, 2016, 09:26:55 AM

Previous topic - Next topic


Well, issue cannot be ignored anymore, major modding tool remain mystery for community two years later.

Reasons, well, reasons are simple, people do not like thing they do not understand, can't use properly things they do not understand and unable to contribute and improve things they do not understand.

I will try to change situation.
Sadly, trying to keep my own rule "no spoonfeeding" and "refer proper documentation please" resulted in, well, bad things.

Please ask your questions related to code injection, i will do my best do explain usage and internals.

Few "mini articles" are already panned and will be posted in upcoming days.


I think it would be reasonable to have a tutorial on detouring a public/private method and how to access private members. The basics of reflection, because lots of C# coders aren't familiar with it. How to detour a method that can have different number of arguments. All this info can be found on the forum/Google but it's a bit of a wild goose chase.


I will provide such information, actually i already did it here:
and here

but, both threads simply ignored for "reasons", i will think how to provide that information in "a bit more friendly" manner, without causing "wtf" effect.


PART 1: Mark your goal

In most cases individuals just want something, "I want ironmain suit" or "I want doctor who colonist".
Sadly "I want to read documentation" and "I want to work hard" are not included, writing this I have perfect understanding, only 3.5 visitors will read this tutorial, everyone else will ignore it and just post suggestion\question.
Such individuals will FAIL, there are no exceptions, no exclusions, individuals who do not actually know what they want doomed to failure.
You may lack skill, lack time or both, but if you know what your goal, you will eventually reach it.
You must describe your goal fully and clearly, best if you write down it with physical pen on physical paper. This is not waste of time, this is academic technique used worldwide that exploit functions of human brain.
Let's begin with something very simple:
"I WANT IRONMEAN!!!!!!11111"
Well, probably sarcastic, but this is exactly how most mod requests and mod suggestions looks like. And you probably already understood that individual is trolling or already failed at modding.
As stated above, you must describe goal fully and clearly, without any references and without holding any information at side channels. Do not expect that everyone aware about your favorite Jedi and how his spells works, everything must be described directly:
Wrong: «I want ironman armor"
Still wrong: "I want armor that allows to fly"
Acceptable: "I want armor that allows bypassing obstacles like stones without slowdown"

Ever if you are not going to post mod suggestion and want to implement modification self, describe everything using common words and common terms, focus on final effects.
This especially valuable if you going to develop modification as part of team.
If goal described properly, you already have keywords and possible implementation vectors right in your plan.
If your task is complicated, do not try to plan everything ahead, focus on single step.

PART 2: Gather required information