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 / Unloading things

Author
Message
Chicknstu
18
Years of Service
User Offline
Joined: 10th Oct 2006
Location:
Posted: 9th Sep 2007 20:23
OK, so I can load images, and give them a specific index number. Presumably they sit in memory somewhere.

How do you 'unload' things. Say, for example, you want to free up all the memory your frontend is taking up once you're into the game, so you can then re-use the index's, and obviously free up the memory.

Or, what happens when I load another file over the same index? Does the old one get deleted from memory, or get moved somewhere else? Is there any danger in doign this?

Cheers,

Stu xxx

www.Retrodev.co.uk
Grunge Game Developers
APEXnow
Retired Moderator
21
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 9th Sep 2007 20:31
Whether you're using DGDK (C++) or DGDK.NET, loading images into memory are maintained in texture memory until either one of two things happen.

1. Either you free existing images up by calling the dbDeleteImage or oDGDKImage.DeleteImage function

2. You physically change screen modes by using the SetDisplayMode function. Doing this causes DirectX to free up all of the used texture memory making image and bitmap indexes invalid.

Although there isn't any particular type of error checking going on, you can always test to see if an image exists first before attempting to delete it. Trying to load images into indexes that are already being used results in nothing happening. You should free up an image index before reloading it.

Paul.

Chicknstu
18
Years of Service
User Offline
Joined: 10th Oct 2006
Location:
Posted: 9th Sep 2007 23:00
Cheers Paul, that helps loads..

Although you're second point,

"Trying to load images into indexes that are already being used results in nothing happening."

I tried this, and the old image actually gets overwritten with the new one if you try and load it into the same index. Does this mean that the old one has been removed from memory?

www.Retrodev.co.uk
Grunge Game Developers
APEXnow
Retired Moderator
21
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 9th Sep 2007 23:41
Ahh, if that's the case, then yes, you are correct. The image has to be freed since it's no longer referenced.

Not the best of advice but I hope it helped.

Paul.

jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 11th Sep 2007 02:12
I wouldn't bet that its "removed" from memory. If its anyting like how classes work - It could be that they are all in there taking up space. You load an Image, you TELL DarkGDK/DBPro/DBC WHAT that number is - it LIKELY loads the "thing" (object, image etc) and at one point or another allocates memory for it and associates that pointer to the mem location with the ID you said. I suspect loading another just changes the memory address of the "list item" that makes "Image Exists" work associated with that ID.

But truth be known - I know not. Unless The Game Creators give us their source code so we can find out for sure - you'd be better served calling delete yourself to be CERTAIN its gone.

Login to post a reply

Server time is: 2024-11-16 20:36:30
Your offset time is: 2024-11-16 20:36:30