So through much trial and error I've gathered together some tricks for getting plugins to work with PureGDK. Now I've only tried these to extend the base DarkNet commands and to add in two more Matrix1Utils not already supported in PureGDK.
Things you will need
1. PureGDK installation. Duh I know but just covering my bases.
2. Dependency Walker http://www.dependencywalker.com/
This is to find the plugin commands undecorated names.
3. Plugin documentation. This is really essential since as far as I know you can't extract the variable/return types from a dll.
Adding a user (non-liscensed) plugin
1) Add a new template for the plugin or append to an existing plugin. (for instance for adding the matrix1utils I simply appended to the existing Matrix1Util template)
To add a new template navigate to your PureGDK installation usually at C:\Program Files (x86)\PureGDK
-Open the libraries folder
-Open the plugins-user folder
-Create a new text document and save it as "[Some name].gdt"(remove quotes and insert your plugin name in place of [Some name])
Or to append to an existing template file simply open the file of choice and scroll to the bottom of the template.
Continue once you have the template file open you will be using.
2)Create the template commands.
This is the hardest part. For this you'll need to use both Dependency walker and your plugin documentation.
; - this denotes a comment in the template file. Anything written on the line after ; is completely ignored by the puregdk compiler
basic layout of a command is:
All of the above parts are required for every command except the [ after YourCommandName. The [ is only there for commands that return a value.
-pluginName.dll should be pretty self explanatory it's the name of the dll
-YourCommandName is whatever you want to call the command. Since all this is is a wrapper for the dll, this name doesn't matter except so you know what it's referencing.
-[ as said before this is there if the command returns a value. Knowing if this should be there is totally dependent on the documentation of the plugin you have. If the documentation says it returns a value you put the [ there. If the documentation says it does not return a value then do not put the [ there as it will mess up the compiler.
-VariableTypes This is also dependent on the documentation in order to know what variables the return type, and parameters are. This will simply be a list of the types of the parameters with the return type of the function at the beginning if the function returns a variable. See Variable Types
to learn more about the various options I've discovered.
-UndecoratedDllName You'll need to use dependency walker to get this as this is how PureGDK references the function within the plugin. Scroll down to Using Dependency Walker
to see how to get this name.
-VariableList This is a comma delimited list of the Parameters required for the command. I believe the name of the Parameters don't matter, but the types have to match the types in the VariableTypes list and what the documentation says. See Variable Types
to see the tags needed to match data types.
Matrix1Util_31.dll%M1U_Lookup[%SLSS%GetLookupValueDefault%LookupID, Key.s, Default.s
Matrix1Util_31.dll%M1U_SetLookup%LSS%SetLookupValue%LookupID, Key.s, Value.s
Here is the code I appended to the Matrix1Util.gdt template to add support for the 31st Matrix1Util. Extracting two to take a look at:
You can see how this is done.
-Matrix1Util_31.dll as the plugin that I'm refencing
-M1U_DeleteLookup and M1U_Lookup are the names I chose to use as it follows the standard Mistrel was already following though I could have easily called them anything else
-now here is where you see the difference between a command that returns a value and one that does not. This first command I listed does not have the [ as it does not return a value, though the second one does.
-LS and SLS for the first one this means that the function takes two parameters a 32bit integer(L), and a string(S) and for the second one this means that it returns a string(s), and requires two other parameters a 32bit integer(L), and a string(S).
-DeleteLookupValue and GetLookupValue as you can see here the Undecorated names do not always follow the convention written in the documentation so you have to be careful when using Dependency Walker to make sure you are referencing the correct function.
-LookupID, Key.s(="") though both similar, the second is different as it adds a default value to the variable. So if it's not set it will default to "". Also note the .s after the Key parameter. This signifies that it is a string parameter.
Continue once all commands have been converted. You can run the "Compile Headers And Libraries" .bat file in the root directory to see if any errors arise. Save and close the template file.
3)Verify your dll is in the right spot.
Navigate to your root PureGDK install location again.
From there open engine
Verify your plugin is here if not, copy it to this directory.
4)Add it to the compiler list
Navigate to yoru root PureGDK install location again.
Open the libraries file in Notepad or text Editor of your choice
Append your plugin to the end of the User plugins list in the form pluginName.dll%Unique reference name. where the Unique reference name can be whatever you want.
Save and close this file.
5)Finally compile engine with plugins and enjoy!
Finally run the "compile engine with plugins" .bat file in the root install and everything should compile correctly and your plugin is ready to use.
Everything is exactly the same as user plugins except you just change folders from plugins-user to plugins-licensed. And you have to make sure all the appropriate certificates are available to the compiler
1) To make sure all the certificates are available:
Navigate to your root Dark Basic Install
Select all files and copy them to [%PureGDKRoot]/engine/certificates
If after this the plugin still doesn't work try running TGCOnline.exe in the PureGDK/engine folder to verify the certificates.
L - 32bit Integer also used in place of a boolean return type (0 = false, 1 = true) parametertag: (none)
R - 64bit variable(DWORD) parametertag: .r
S - string variable parametertag: .s
F - float variable parametertag: .f
O - double variable parametertag: .d
P - void pointer parametertag: * this goes at the beginning of the parameterName however
0 - this is only used if the function does not have a return or any parameters
Using Dependency Walker
1) Open Dependency Walker
2) Click the folder icon
3) Navigate to your dll and open it
4) The view will be split into multiple windows, the one you care about is the top rightish one. It should show a list of Functions.
5) Right click on this list and make sure the Undecorate C++ functions is checked. This is the list you'll use to find the UndecoratedDllName.