Jump to content
  • Advertisement
Sign in to follow this  
angry

Store data inside the exe?

This topic is 4864 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I've made a very small and simple game and I need a place where I can store my highscore data, however creating a file for keeping just a number seems like a waiste of space and unneccessary complicated. So is it possible to store the highscore directly in the exe file? Perhaps in the resource section of the file?

Share this post


Link to post
Share on other sites
Advertisement
Assumption: Windows
You cannot write to the EXE whilst it is running. Even if you could, it would STILL require you to work with files.

If you dont want to use a file, think about using the registry. Although a file would be simpler

Share this post


Link to post
Share on other sites
Bah, that's what I thought.

Using the registry would have been a nice approach, though that would require me to write an uninstaller of the game, since I guess no players would like my game to waiste space in their registry, even though it might just be 1 key.

I guess I'll just have to write a file, thanks anyways.

Share this post


Link to post
Share on other sites
There is a secret thing on Windows NT file system that let's you store data on a file ... I forget the name at the moment, it was a big scare sometime ago as it could also be used by trojans, etc. Google for it or maybe somebody remebers the name.. something like streams or something.

But it only works on NTFS.

Now, you can still write to the EXE but it is a bit crazy to do it. What you do is run it from a batch file, it returns the score on exit, the batch file execs a prog to append the score on the EXE in someway the executable can locate it. It is a crappy way to do it...

or what you can do is to make a copy of the EXE before executing it, use the dummy EXE to write the score to it, and than delete the old one and rename it when done.

or you can create a remote thread, and when the EXE finishes (it waits on the event) it than writes the score to the EXE.

All of these will trigger virus scanners and firewalls very very likely.

OR you can just make a .INI text file and just write the stupid score to it and be done with it all.

Your choice.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!