tehomod 1.3BETA2(MEGA)
- Some fixes and improvements
- Dynamic scripts system was fixed and rewritten:
Now there is a section
LoadCustomScripts for loading scripts without
#include
Execute section was replaced by
Events
Alias sections was replaced by
Detours
Now almost everything could be modified without modifying the whole files(except functions in LoadSegment and repeated function detouring)
It can look like this:
tehomod_dynamictest.ini file:
;tehomod_dynamictest.ini
[Mod]
Enabled=1
Binds=1
Advanced=1 ; Enable LoadCustomScripts, Events, Detours sections
[Binds]
DynamicTest.0x72=Log_Info("Message")
[LoadCustomScripts]
Scripts=dynamictest.c
[Events]
Log_Info=Log_SetStringToLog("Log_Info event")
[Detours]
Log_Info=Log_Info2
dynamictest.c:
void Log_Info2(string _str)
{
Log_SetStringToLog("Log_Info called");
Log_SetStringToLog(_str);
}
Now dynamictest.c will be loaded into the gamestate, but will unload before saving data
When Log_Info is being executed(F3) it will trigger event Log_Info (print "Log_Info event"), then detour original Log_Info to Log_Info2 from dynamictest.c and print "Log_Info called" before printing "Message"
Generally,
Events can be used to write preceding code for functions, when you don't need to replace any code on it, and
Detours are for replacing the whole functions without modifying the whole files.
This version fixes the bug with incorrect unloading of custom scripts,
but it's still in BETA, use it at your own risk and always make saves!
UPD:
beta2: version checking fix and code cleanup