Hooking virtual template functions
Hello! I'm new to the forum, so I don't know anyone here; I'll briefly introduce myself. My name is Rao, and I am a hobbyist gamer and self-taught programmer like many of us here. I don't actually play games; I find coding things for games much more interesting. I am actually a med student who has wandered off into programming. Nice to meet you all.
There's a ton of documentation on hooking/detouring virtual functions. I've looked at lots of examples that used empty classes and vtable offsets to hook functions. Now, would the same principle apply if I wanted to hook a function like:
Code:
Action<SomeClass>::SomeFunction(SomeClass*, AnotherClass*)
... given that I have the base address and offsets, how would one hook something like the above?
Templates only exist in the source, once it is instantiated it "becomes" a normal function. Hook it as you would any other virtual function (replace the typenames with the associated class for your prototype).