HPM Hooking into a switch

GmOcean

Community Contributors
Messages
371
Points
0
Emulator
So, what I want to know how to do is, hook into certain parts of code where it does has a switch(case:).

How would I do that if it's even possible. Or do I have to just copy paste all of the code into a plugin, and add my custom code as well, so that it completely overrides it?

 
AFAIK, you can't hook onto an arbitrary point in a function, just pre or post hook it. I guess if you want to change an intermediate value you would have to posthook it, recheck for your case and, of necessary, redo all important code that use that result as an intermediate result.

 
I see. Well, that isn't too bad, guess it would make sense I can't just hook into a function like that.

 
Well it depends on how complex the the function you want to hook in..but there is other way you can do it..

temp_function(x);modified_function(x){ switch(x){   case myedit: break   default:      temp_function(x); }}temp_function = original_function;original_function = modified_function;

default_ani_meow.gif


 
Back
Top