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 / Accessing a 3d object in DBPro memory

Author
Message
Redmotion
21
Years of Service
User Offline
Joined: 16th Jan 2003
Location: Mmm mmm.. Marmite
Posted: 14th Mar 2008 14:59
Is there somewhere I can find out where and how the data for a 3d object sits inside a running DBPro program when its running? Where does it go once the LOAD OBJECT command is called? Would like to access this via a DLL.

Similar to a lot of other unanswered questions I know, but it would really help...

Check out The Grand Machines! & Black Mesa: Source <- vote @ www.moddb.com
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 14th Mar 2008 17:43
There's a function in the DBProBasic3DDebug.dll called ?GetObjectA@@YAPAUsObject@@H@Z
Get the address of this function by using GetProcAddress (the handle is available in the GlobStruct structure).

This function accepts an integer argument for the object id, and returns a pointer to an sObject structure which holds all of the object data. You can get the definitions for that and it's associated structures from the DarkGDK.

Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 14th Mar 2008 23:37
Also, if you open the DBP .dll for the particular section you want (in this case Compiler\Plugins\DBProBasic3DDebug.dll) with a utility called dllviewer, you can get a list of available functions. If you then see a function that you want to use, (and you have a version of Visual Studio) you can run a program called 'undname.exe' from the command line, with the function name (?GetObjectA@@YAPAUsObject@@H@Z) and it will tell you the parameters and return type, and everything else about the function You can find undname in VC\bin\undname.exe.

Here is a link to my thread where I asked the exact same question, not so long ago

IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 15th Mar 2008 01:23
Maybe I should have done a search

Anyway, the only thing I'd have to add to that would be that if you want to use a DBPro command from one of the DLLs, to use the resource string as a guide rather than the unmangled name (via undname), as that's a better guide of the parameters. For example, a lot of the plug-in functions use DWORD for strings and you are far better off replacing those with LPCSTR instead (same size parameter, and easier for you to use in your code).

jinzai
18
Years of Service
User Offline
Joined: 19th Aug 2006
Location: USA
Posted: 15th Mar 2008 02:16 Edited at: 15th Mar 2008 02:17
If you have VisualStudio, open the DLL itself, and go straight to the string table. You can order them by ordinal, or by name. DBPro does it the same way a user plug-in does. That is the easiest way I've found.

Just remember that floats are returned as DWORDs, and you cast the returned value using the address-of operator, and casting.

Redmotion
21
Years of Service
User Offline
Joined: 16th Jan 2003
Location: Mmm mmm.. Marmite
Posted: 16th Mar 2008 00:35 Edited at: 16th Mar 2008 00:42
Cheers for the info. I was hoping to replace the load object command and was looking for into that indicates how it loads a 3d object into a compiled .exe and where and how it registers/points/accesses the data.

Do you have a link to the dllviewer site?

War is terrorism with a bigger budget
Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 16th Mar 2008 13:53
@Redmotion,

In that case, take a look at the code Mike posted in the GDK forum

http://forum.thegamecreators.com/?m=forum_view&t=123392&b=22

The DBPro stuff works in exactly the same way - you just have to translate the GDK function calls to their equivalent functions in the Basic3D DLL.

Login to post a reply

Server time is: 2024-09-08 03:28:43
Your offset time is: 2024-09-08 03:28:43