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.

Programming Talk / ASP / ASP.Net - Accessing internal DBPro data structures from a plugin?

Author
Message
Diggsey
19
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 12th Apr 2007 15:18 Edited at: 12th Apr 2007 15:20
I can already write basic plugins for DBPro, but I need to know how to get at things like images, bitmaps and memblocks from a dll without just calling the DBPro commands from the dll.

Most importantly, I need to be able to get at images and bitmaps.

edit:
Oops, forgot to set the language, and now I can't change it (Its supposed to be c++)

IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 12th Apr 2007 15:58
There are various functions in the DLLs that you can use to get a small amount of internal data.

This one is in the Basic3D plug-in and returns a pointer to 3D object data:
sObject* GetObject(int ObjectNumber)

You can get the definitions of the sObject structure and associated structures from the extras pack, as the ODE plug-in source code needs it.

From the images plug-in, you have two functions:

LPDIRECT3DTEXTURE9 GetPointer(int ImageNumber)
LPDIRECT3DTEXTURE9 Make(int ImageNumber, int Width, int Height)

Once you get the pointer back, just treat it as a standard DirectX texture.

Bitmaps are an area that I haven't looked into so far. There are some functions there that may help you (Make, MakeFormat, 2 versions of MakeSurface, Get, GetBitmapData) - you'll need to investigate those yourself.

Diggsey
19
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 12th Apr 2007 16:34
Thanks

I'll look into those

Diggsey
19
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 12th Apr 2007 17:40
I just can't get it to compile
It uses the GetObject function in the ODE source, but I can't get it to then work in mine

IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 12th Apr 2007 21:53
Without code I can only guess ...

You need 3 pieces to complete this puzzle. First, you need to define a function-pointer-type. You don't have to do it this way, but it's far easier.


Now that we've defined a type called pfnGetObject, we need a variable to hold the value in:


I use 0 instead of NULL - personal preference.

Finally, the last stage is to populate that variable with the address of the function itself:


The first two pieces go at the top of your source code outside of any function, making them global within the file. The last piece will probably best fit into either your ReceiveCoreDataPtr or Constructor functions.

From that point on, you just use the variable as if it were a function:


Don't forget to ensure that the Basic3D DLL is included in your executable, either the easy way by using a 3D command, or the harder way using code like the following:


Diggsey
19
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 10th May 2007 20:10
Thanks for the info
How do I get at a sprite's data, from a sprite number?

IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 11th May 2007 00:55
There's no equivalent to the sObject structure for sprites - it all has to be done via function calls to the sprite DLL. Most of the functions in that DLL have an int as the first parameter that you can pass the sprite number in.

Login to post a reply

Server time is: 2025-08-08 17:33:20
Your offset time is: 2025-08-08 17:33:20