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.

Dark GDK / Using custom resource DLLs...

Author
Message
Acolyte
18
Years of Service
User Offline
Joined: 3rd Feb 2006
Location:
Posted: 26th Jun 2009 02:19
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
Acolyte
18
Years of Service
User Offline
Joined: 3rd Feb 2006
Location:
Posted: 26th Jun 2009 18:31
bump

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: 26th Jun 2009 22:30
So no one has any ideas? I know it's pretty advanced, but it's a pretty common thing for game programmers to store assets in DLLs. Hope its just a slow day.

Windows XP Home Ed. SP/2 ---> GeForce FX 5500 - 256MB
160 GB HD ---> 1 Gig RAM
XtwiggyX
17
Years of Service
User Offline
Joined: 17th Nov 2006
Location: Lincoln, UK
Posted: 5th Aug 2009 00:48
Can you even do this in Visual C++ 2008 Express?

AMD Athhon 64 1.99 GHz Prosessor, 1GB Ram, ATI Radeon X300 256MB Graphics, Windows XP Home SP2
Caleb1994
15
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 5th Aug 2009 07:07 Edited at: 5th Aug 2009 07:09
Well i don't know anything about HRSRC type, but if you can access the pixel colors and image dimentions then you can make a memblock of the coorasponding size and then assign the values. here is the memblock image structure



if you get a DWORD of the pixel it will just be the color.

Wait sorry i think it's this:



it's backward i think

New Site! Check it out \/
Amnzero
15
Years of Service
User Offline
Joined: 1st Aug 2009
Location:
Posted: 5th Aug 2009 18:48
Quote: "
LoadImage Function
Loads an icon, cursor, animated cursor, or bitmap.

Syntax


HANDLE LoadImage( HINSTANCE hinst,
LPCTSTR lpszName,
UINT uType,
int cxDesired,
int cyDesired,
UINT fuLoad
);
Parameters

hinst
[in] Handle to the module of either a DLL or executable (.exe) that contains the image to be loaded. For more information, see GetModuleHandle. Note that as of 32-bit Microsoft Windows, an instance handle (HINSTANCE), such as the application instance handle exposed by system function call of WinMain, and a module handle (HMODULE) are the same thing.

To load an OEM image, set this parameter to NULL.

To load a stand-alone resource (icon, cursor, or bitmap file)—for example, c:\myimage.bmp—set this parameter to NULL.

lpszName
[in] Specifies the image to load. If the hinst parameter is non-NULL and the fuLoad parameter omits LR_LOADFROMFILE, lpszName specifies the image resource in the hinst module. If the image resource is to be loaded by name from the module, the lpszName parameter is a pointer to a null-terminated string that contains the name of the image resource. If the image resource is to be loaded by ordinal from the module, use the MAKEINTRESOURCE macro to convert the image ordinal into a form that can be passed to the LoadImage function.
If the hinst parameter is NULL and the fuLoad parameter omits the LR_LOADFROMFILE value, the lpszName specifies the OEM image to load. The OEM image identifiers are defined in Winuser.h and have the following prefixes.

OBM_ OEM bitmaps
OIC_ OEM icons
OCR_ OEM cursors

To pass these constants to the LoadImage function, use the MAKEINTRESOURCE macro. For example, to load the OCR_NORMAL cursor, pass MAKEINTRESOURCE(OCR_NORMAL) as the lpszName parameter, NULL as the hinst parameter, and LR_SHARED as one of the flags to the fuLoad parameter.

If the fuLoad parameter includes the LR_LOADFROMFILE value, lpszName is the name of the file that contains the stand-alone resource (icon, cursor, or bitmap file). Therefore, set hinst to NULL.

uType
[in] Specifies the type of image to be loaded. This parameter can be one of the following values.
IMAGE_BITMAP
Loads a bitmap.
IMAGE_CURSOR
Loads a cursor.
IMAGE_ICON
Loads an icon.
cxDesired
[in] Specifies the width, in pixels, of the icon or cursor. If this parameter is zero and the fuLoad parameter is LR_DEFAULTSIZE, the function uses the SM_CXICON or SM_CXCURSOR system metric value to set the width. If this parameter is zero and LR_DEFAULTSIZE is not used, the function uses the actual resource width.
cyDesired
[in] Specifies the height, in pixels, of the icon or cursor. If this parameter is zero and the fuLoad parameter is LR_DEFAULTSIZE, the function uses the SM_CYICON or SM_CYCURSOR system metric value to set the height. If this parameter is zero and LR_DEFAULTSIZE is not used, the function uses the actual resource height.
fuLoad
[in] This parameter can be one or more of the following values.
LR_DEFAULTCOLOR
The default flag; it does nothing. All it means is "not LR_MONOCHROME".
LR_CREATEDIBSECTION
When the uType parameter specifies IMAGE_BITMAP, causes the function to return a DIB section bitmap rather than a compatible bitmap. This flag is useful for loading a bitmap without mapping it to the colors of the display device.
LR_DEFAULTSIZE
Uses the width or height specified by the system metric values for cursors or icons, if the cxDesired or cyDesired values are set to zero. If this flag is not specified and cxDesired and cyDesired are set to zero, the function uses the actual resource size. If the resource contains multiple images, the function uses the size of the first image.
LR_LOADFROMFILE
Loads the stand-alone image from the file specified by lpszName (icon, cursor, or bitmap file).
LR_LOADMAP3DCOLORS
Searches the color table for the image and replaces the following shades of gray with the corresponding 3-D color. Color Replaced with
Dk Gray, RGB(128,128,128) COLOR_3DSHADOW
Gray, RGB(192,192,192) COLOR_3DFACE
Lt Gray, RGB(223,223,223) COLOR_3DLIGHT
Do not use this option if you are loading a bitmap with a color depth greater than 8bpp.
LR_LOADTRANSPARENT
Retrieves the color value of the first pixel in the image and replaces the corresponding entry in the color table with the default window color (COLOR_WINDOW). All pixels in the image that use that entry become the default window color. This value applies only to images that have corresponding color tables.
Do not use this option if you are loading a bitmap with a color depth greater than 8bpp.

If fuLoad includes both the LR_LOADTRANSPARENT and LR_LOADMAP3DCOLORS values, LRLOADTRANSPARENT takes precedence. However, the color table entry is replaced with COLOR_3DFACE rather than COLOR_WINDOW.

LR_MONOCHROME
Loads the image in black and white.
LR_SHARED
Shares the image handle if the image is loaded multiple times. If LR_SHARED is not set, a second call to LoadImage for the same resource will load the image again and return a different handle.
When you use this flag, the system will destroy the resource when it is no longer needed.

Do not use LR_SHARED for images that have non-standard sizes, that may change after loading, or that are loaded from a file.

When loading a system icon or cursor, you must use LR_SHARED or the function will fail to load the resource.

This function finds the first image in the cache with the requested resource name, regardless of the size requested.

LR_VGACOLOR
Uses true VGA colors.
Return Value

If the function succeeds, the return value is the handle of the newly loaded image.

If the function fails, the return value is NULL. To get extended error information, call GetLastError.

"


[ Amnzero ]

Login to post a reply

Server time is: 2024-10-01 10:35:55
Your offset time is: 2024-10-01 10:35:55