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 / Custom resource dlls - (Help Needed)....

Author
Message
Acolyte
18
Years of Service
User Offline
Joined: 3rd Feb 2006
Location:
Posted: 27th Jun 2009 00:12
Hey guys.

I'll try to keep this short and sweet. What i'm basically trying to do is create a DLL for my new card game that stores all of my card JPEG images in it so that the player will never have to see them on their hard drive. I've already created this resource DLL in c++ and compiled it.

Now in my game project i've loaded the DLL using LoadResource and accessed my JPEG image and stored it in an HRSRC type object. I was wondering if there was a way you guys knew to convert the HRSRC data over to a DGDK readable format maybe using data transfer like memblocks or something?

I really need to be able to access these resources from the DLL. Since its really just data, there's got to be a way to do this, or maybe I can write something that will do it.

Any ideas?

Windows XP Home Ed. SP/2 ---> GeForce FX 5500 - 256MB
160 GB HD ---> 1 Gig RAM
chunks chunks
17
Years of Service
User Offline
Joined: 2nd Jan 2007
Location: ackworth uk
Posted: 27th Jun 2009 00:40 Edited at: 27th Jun 2009 00:44
there was an example somewhere on the forum where somebody used the microsoft card dll ,do a search for that and it prolly will give you some clues .

if you want i can have a go at making a dll which will alow you to call the data pretty easily cos i`m a little intrigued myself .

thanks chunks.


edit : the link -> http://forum.thegamecreators.com/?m=forum_view&t=108790&b=

nvidia geforce 9500gt + amd athlon 64
windows vista ultimate.
Acolyte
18
Years of Service
User Offline
Joined: 3rd Feb 2006
Location:
Posted: 27th Jun 2009 00:48
Hey chunks,

Thanks for the reply man. I'll check out that link, but I'd love it if you could work on an example. I already know how to do it for the .NET languages, but doing with C++ without using the Windows API drawing routines is a little trickier. I really am just looking for a way to store my assets for the game in the DLL and then to load them and use them in C++. Hopefully I can do it in such a way that I will still be able to use the GDK image handling routines.

Windows XP Home Ed. SP/2 ---> GeForce FX 5500 - 256MB
160 GB HD ---> 1 Gig RAM
Acolyte
18
Years of Service
User Offline
Joined: 3rd Feb 2006
Location:
Posted: 27th Jun 2009 09:33
Hey chunks,

I checked out the link, and while its intruiging, it's really not what i'm looking for. The code is in a hodgepodge of DBC and DBPro code not to mention that he also had another extended set of functionality that I don't have for DLL access.

Is there any way I can get you to help me figure out a way to store jpegs to a c++ dll and then read them back in using memblocks or something similar in c++? The key for me is to be able to use the GDK's image routines, because I really will be lost if I have to delve into the Windows API.

Windows XP Home Ed. SP/2 ---> GeForce FX 5500 - 256MB
160 GB HD ---> 1 Gig RAM
Acolyte
18
Years of Service
User Offline
Joined: 3rd Feb 2006
Location:
Posted: 27th Jun 2009 10:49
I think i've got the hang of actually compiling the DLL correctly. I think i'll even be able to figure out how to load my jpeg from the DLL using LoadLibrary and LoadBitmap functions; however, what I won't be able to do is figure out how to convert the windows handle HBITMAP to a Dark GDK readable format so I can use the image in the game. If Someone can help me learn how to manipulate the HBITMAP into a GDK format then that would be most appreciated!

Windows XP Home Ed. SP/2 ---> GeForce FX 5500 - 256MB
160 GB HD ---> 1 Gig RAM
Diggsey
17
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 27th Jun 2009 12:07
http://msdn.microsoft.com/en-us/library/dd144879(VS.85).aspx

Call it once with lpvBits set to NULL to get the bitmap header information, then call it again to get the raw data, passing in the header information you got before.
You should specify DIB_RGB_COLORS for the usage, and 24_BPP for the format. You can then make a memblock, write in the width, height, then 24, and then the raw data.

chunks chunks
17
Years of Service
User Offline
Joined: 2nd Jan 2007
Location: ackworth uk
Posted: 27th Jun 2009 12:24
sorry man i was getting confused i thought this was for a plugin , in this link is some code from ianm which loads a bitmap from resource and turns it into a gdk image , which will be very usefull for you .


good luck.

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

nvidia geforce 9500gt + amd athlon 64
windows vista ultimate.
chunks chunks
17
Years of Service
User Offline
Joined: 2nd Jan 2007
Location: ackworth uk
Posted: 27th Jun 2009 18:39 Edited at: 27th Jun 2009 18:44
You will be pleased to know its quite easy to do , attached is 2 projects 1 for the resource dll and the other how to load and display the bitmaps in gdk.

you might have to use bitmaps rather than jpgs , but anyways it`ll put you on the right track .


On a last note i was gonna ask whether you was putting resourses in a dll to hide them , beacause if so anyone can use resource hacker or similar prog to rip them out .

chunks

nvidia geforce 9500gt + amd athlon 64
windows vista ultimate.

Attachments

Login to view attachments
Acolyte
18
Years of Service
User Offline
Joined: 3rd Feb 2006
Location:
Posted: 27th Jun 2009 19:35
Hey guys, thanks for the replies.

@Diggsey:
I really appreciate the detailed reply, hopefully I will be able to figure it out.

@chunks:
Thanks so much man, and sorry for the confusion. I've been posting here and on other programming forums for about a year now trying to figure out how to do this. Thanks to you, I may have finally overcome one of my biggest programming hurdles.

Putting the resources in the DLL is sort of a two-fold purpose in my case. I want to hide them, but you make a good point about people being able to just open it up and look at them; however, isn't there a way to just encrypt the info and decrypt it when you load it from the DLL? I'm also storing the images in the DLL because this game I'm making is a trading card game with 3 sets of cards. Making the grand total somewhere around 500 to 600 images for all the cards, so I don't want to have to install all those images into a separate directory when someone installs the game, I want them not to have to look at all those separate files, plus I think this method is just much more professional than simply storing all your resources in a directory for everyone to see.

Thanks again guys! I'll try it out again and be back with how it went!

Windows XP Home Ed. SP/2 ---> GeForce FX 5500 - 256MB
160 GB HD ---> 1 Gig RAM
Diggsey
17
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 27th Jun 2009 19:57
If all you want to do is encrypt them, there is a far easier way!
Make a program in DGDK which loads in all the images normally, then use the 'dbMakeMemblockFromImage' command. Once you have the memblock, you can apply any encryption you need, and then save it to a file. (You could save all the data in one big file to make it harder for anybody to use)

To load it in, just do the exact reverse. Load the data from the file into memblocks, decrypt it, then use dbMakeImageFromMemblock.

Acolyte
18
Years of Service
User Offline
Joined: 3rd Feb 2006
Location:
Posted: 27th Jun 2009 21:37
Hey guys, I keep getting errors when I try to load my bitmap from my DLL using LoadBitmap. It can't find it in my DLL. I've copied the DLL into my debug directory for the project and i've also included a copy of the resource.h file from the DLL project inside my game directory so that the MAKEINTRESOURCE can understand my reference to the bitmap. Can someone walk me through the method for putting the bitmap into a dll and compiling so that the code here will work?

Windows XP Home Ed. SP/2 ---> GeForce FX 5500 - 256MB
160 GB HD ---> 1 Gig RAM
Acolyte
18
Years of Service
User Offline
Joined: 3rd Feb 2006
Location:
Posted: 27th Jun 2009 22:00
Well now it's loading the image after some work, but I still can't see my card. Below is my source code, anything wrong with it?



Windows XP Home Ed. SP/2 ---> GeForce FX 5500 - 256MB
160 GB HD ---> 1 Gig RAM
Acolyte
18
Years of Service
User Offline
Joined: 3rd Feb 2006
Location:
Posted: 27th Jun 2009 22:03
Ok I just noticed towards the bottom I was using dbMakeMemblockFromImage instead of dbMakeImageFromMemblock. It works, thanks so much for all of your help guys, you are amazing and I am very grateful for your quick responses!

Windows XP Home Ed. SP/2 ---> GeForce FX 5500 - 256MB
160 GB HD ---> 1 Gig RAM
Acolyte
18
Years of Service
User Offline
Joined: 3rd Feb 2006
Location:
Posted: 27th Jun 2009 22:44
Hey, one last quick question. Is there any way to store jpegs in the DLL instead of bitmaps to save space?

Windows XP Home Ed. SP/2 ---> GeForce FX 5500 - 256MB
160 GB HD ---> 1 Gig RAM
chunks chunks
17
Years of Service
User Offline
Joined: 2nd Jan 2007
Location: ackworth uk
Posted: 27th Jun 2009 23:02 Edited at: 28th Jun 2009 01:11
you can store custom files in resources ,but you would have to have to load it differently you wouldn`t be able to use load bitmap , on the other hand in directx you can load textures of almost any format.

give me tonight and i will look into it for you , get back to you in the morning .

chunks


EDIT: sorry man i have tried allsorts to load a jpeg from a rsource its just not working , couldn`t you add the cards into couple of images and cut them up when they are loaded in gdk ?

nvidia geforce 9500gt + amd athlon 64
windows vista ultimate.
Acolyte
18
Years of Service
User Offline
Joined: 3rd Feb 2006
Location:
Posted: 28th Jun 2009 02:02
That's actually a pretty good idea. I'm mainly concerned about the disk space usage and the fact that i'm loading these libraries during runtime. For my VB.NET app I packaged all the cards up in a .NET DLL and it was about 50mb; however, it was JPEG. After saving about 300 cards to the c++ DLL it was over 150mb!!! That can't be good for load times. I'll try what you said and update when I get the chance, thanks!

Windows XP Home Ed. SP/2 ---> GeForce FX 5500 - 256MB
160 GB HD ---> 1 Gig RAM
Acolyte
18
Years of Service
User Offline
Joined: 3rd Feb 2006
Location:
Posted: 28th Jun 2009 22:14
Hey chunks, I was testing out your idea about cutting the large card images into chunks, and it doesn't really save me any room. The only reason I wanted to switch to jpeg usage in the first place is because my cards are in that native format and it really saves space and loading time. You sure there's no way to load the jpegs in and convert them to memblocks like the other post you showed me?

Windows XP Home Ed. SP/2 ---> GeForce FX 5500 - 256MB
160 GB HD ---> 1 Gig RAM
Diggsey
17
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 29th Jun 2009 00:51
@Acolyte
He meant combining them into one large image, not cutting them up into smaller images.

Acolyte
18
Years of Service
User Offline
Joined: 3rd Feb 2006
Location:
Posted: 29th Jun 2009 01:16
I know what he meant. I tried it and it doesn't save any space, so it defeats the purpose and is redundant.

Windows XP Home Ed. SP/2 ---> GeForce FX 5500 - 256MB
160 GB HD ---> 1 Gig RAM

Login to post a reply

Server time is: 2024-04-19 17:34:30
Your offset time is: 2024-04-19 17:34:30