CSCs, Detours, Lazylink, builtins and event functions #9
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Like I told you by message for #8, if we call one of the function about the game stack or the VM_OP we have a game crash (unlike using the project-bo4 dll), but I added some other options.
I made the same tests as the ones in #8 so to avoid a duplicated PR I don't mention them there.
I didn't took the time to look at it so I've put a config to enable these options instead.
The new options with their default values are:
We can put them in the gsc.conf or using the option
-Ckey=valuewhen calling the compiler.The dll and dll.lazylink options aren't crashing the game and can be used with the base game, but maybe it's better to not inject a dll by default.
Event functions
It seems that your assertion that the 2nd namespace in the export is a namespace was false (at least from this code), it seems to be the event name for the event functions. (I added some events in my find.txt file)
You can see the the event linking in Scr_GscObjLink, which is calling ScrEvent_AddCallbackEventHandler
To keep the syntax simple I used something like with the detours. The prefix
event_can be used to use hashed event name.event<eventname> func_name(eventstruct) { // ... }To test, I've used this example, which was working and was printing my username.
event<player_connect> codecallback_player_co(eventstruct) { am_log("player connect " + self.name); }Advanced builtins
I wanted to quickly dump some script information so I added 2 builtins:
Due to the obvious hazard that can be created using these functions, I added the symbol T8CINTERNAL_ADVANCED to avoid them during compilation. (The config Release_Advanced adds this symbol)
GCSC
The CSC files added, I think it's better to have a way to write common CSC/GSC files, I used the extension
.gcscwhich is compiled on both the csc and gsc sides.Symbols
To have a better compilation, I added a symbol for each feature
I hope I didn't make it too long, sorry.