Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DLL Talk / Integrating Commands

Author
Message
Lucas Tiridath
AGK Developer
16
Years of Service
User Offline
Joined: 28th Sep 2008
Location: Kings Langley, UK
Posted: 11th Jan 2011 23:37
Hi. I'm sorry if this has been asked before but as someone whose quite new to making plugins, I had a couple of questions about making new commands.

I've already built a few basic mathematical commands for my own use. I did this from the technical documentation but I've encountered a couple of problems in developing my commands further.

1. Can you use DarkGDK in your plugins? I get the following error when I've try.

LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library
C:\Users\Laurie\Documents\C++\DarkTezPlugin\Debug\DarkTezPlugin.dll : fatal error LNK1169: one or more multiply defined symbols found

2. How do you interact with other DBP commands. For example, say I wanted to create a command SET TEXT FORMAT which allowed me to set the text size, font and colour in one command. How would I be able to get my command to save these settings in the same way that DBPs commands such as SET TEXT FONT etc do so that when I use the existing TEXT command, it will using the settings set in my command. This applies to all aspects of DBP. Another example would be how can I manipulate sprites created with DBP commands.

Thanks very much for your help with this.
Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 12th Jan 2011 01:01 Edited at: 12th Jan 2011 01:18
1. You can't use DarkGDK from a plugin, but you can use DBPro commands. Download this program: http://www.nirsoft.net/utils/dll_export_viewer.html

Open the dlls in the "dbpro/Compiler/plugins/" folder with it, and it will list all the commands you can use from each dll. Make sure the program is showing the decorated function names (the names should have seemingly random symbols on the end, and may begin with a ? symbol)

Once you've found the command you want to use, look at which dll it is from.

To get a handle to the dll:


Now for each function in the dll, use a variation of this code:


The typedef makes the code easier to read, but this is equivalent:


You should change the typedef or equivalent code to use the same return value and parameter types as the command you want to call. After this code you can call the function simply by doing:


Remember that all the rules you follow when making a plugin (ie. hidden first parameter when returning a string, casting floats to dwords, etc.) are all followed by the built in commands as well, so make sure you take them into account.

For the hidden first parameter it should be safe to pass in NULL every time. To cast dword results back into floats, use something like this:


Also, remember that if you use a command from (for example) the Basic2D dll, that dll must be included in the final DBPro exe. The user can do this by using a command from that dll, or you can tell the compiler to do it using two functions:



You can use this code directly and just add any dependencies to the array initialiser.

2. Some data is stored in the globstruct (include the header file found at "dbpro\Help\documents\Files\DBO Loader\globstruct.h") A pointer to this struct is passed to a function with the prototype "__declspec ( dllexport ) void ReceiveCoreDataPtr(void* ptr)" if one exists in your plugin.

Other data can be accessed by using functions in the dbpro dlls as shown for part 1, many of which are not accessible as dbpro commands.

The sprite dll doesn't give much access to its internals though.

[b]
Lucas Tiridath
AGK Developer
16
Years of Service
User Offline
Joined: 28th Sep 2008
Location: Kings Langley, UK
Posted: 12th Jan 2011 17:52
Tyvm. That is extremely useful. I'll have a play around with that and see what I can make

Login to post a reply

Server time is: 2024-11-21 15:27:20
Your offset time is: 2024-11-21 15:27:20