Thread: Store high scores in exe file

  1. #1
    Registered User Nutshell's Avatar
    Join Date
    Jan 2002
    Posts
    1,020

    Store high scores in exe file

    I once heard that it's possible to store high scores (or other information) in the game .exe file. Do any of you know how to do that in windows?

  2. #2
    Me -=SoKrA=-'s Avatar
    Join Date
    Oct 2002
    Location
    Europe
    Posts
    448
    If your program is running, Windows doesn't allow you to modify it. What you could do is create another .exe file so that it modifys your app. Of course you'd have to change it in binary (or hex maybe) which could mess up your app and it wouldn't work. I wouldn't recomend modifying an .exe after it's been compiled. Why don't you just store it in a txt file? It's easier.
    SoKrA-BTS "Judge not the program I made, but the one I've yet to code"
    I say what I say, I mean what I mean.
    IDE: emacs + make + gcc and proud of it.

  3. #3
    Registered User Nutshell's Avatar
    Join Date
    Jan 2002
    Posts
    1,020
    Nah i think it's possible, coz i saw someone done it before. I just want to know how to do it, even though txt file is an alternative.

    Besides it's more portable, in terms of distributing the exe from person to person.

  4. #4
    Used Registerer jdinger's Avatar
    Join Date
    Feb 2002
    Posts
    1,065

    Re: Store high scores in exe file

    Originally posted by Nutshell
    I once heard that it's possible to store high scores (or other information) in the game .exe file. Do any of you know how to do that in windows?
    I've never heard of that nor would I even want to try. If you want to store the high score, but not use a txt (so people can't easily change it and cheat), and you're using Windows then just store the score in the System Registry.

  5. #5
    Registered User Frobozz's Avatar
    Join Date
    Dec 2002
    Posts
    546
    Originally posted by Nutshell
    Nah i think it's possible, coz i saw someone done it before. I just want to know how to do it, even though txt file is an alternative.
    It's quite possible and has been done a good deal, but not by me (yet).

    http://community.borland.com/article...,27979,00.html

    It involves the fact that executables can have data added to the end of the file and it will not mess up anything. Both Windows and Linux function in this matter, but Windows prevents self-modification while Linux allows it.

  6. #6
    Pursuing knowledge confuted's Avatar
    Join Date
    Jun 2002
    Posts
    1,916
    lol, I thought I forgot how to program until I realized that it really wasn't C++ code :P Anyway, that's really cool...and has an amazing potential for misuse by "naughty" people.
    Away.

  7. #7
    Registered User Frobozz's Avatar
    Join Date
    Dec 2002
    Posts
    546
    Not quite naughty... you could use the techniques to build a compiler.

    Adventure Maker's compiler uses this technique...

  8. #8
    Registered User Nutshell's Avatar
    Join Date
    Jan 2002
    Posts
    1,020
    Right thnx, exactly what i wanted, although im still not if that code is kylix or delphi
    Last edited by Nutshell; 04-26-2003 at 08:19 PM.

  9. #9
    Registered User cMADsc's Avatar
    Join Date
    Jun 2002
    Posts
    18

    Talking

    Instead of using a txt file use an XML file!
    There are those who say they can, and there are those who acutally do.

    ...you can not learn programming in a class, you have to learn it on your own

  10. #10
    Crazy Fool Perspective's Avatar
    Join Date
    Jan 2003
    Location
    Canada
    Posts
    2,640
    Originally posted by cMADsc
    Instead of using a txt file use an XML file!
    i dont think that really solves the problem as xml files can be opened in almost any text editor...

  11. #11
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    Save the highscore in a binary file. That way it can't be easily modified through notepad.
    If you're really paranoid, use encryption .
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  12. #12
    Registered User cMADsc's Avatar
    Join Date
    Jun 2002
    Posts
    18
    yes, you can open xml files with text editors but xml can make data organization easier. Just write yourself a nice parser.
    Code:
    <player>
    <name>Mario</name>
    <score>1500></score>
    <lives>999</lives>
    </player>

  13. #13
    Pursuing knowledge confuted's Avatar
    Join Date
    Jun 2002
    Posts
    1,916
    Yes, but that doesn't change the fact that we're talking about storing it in the .exe file, so everything is together in one file...
    Away.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Formatting the contents of a text file
    By dagorsul in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2008, 12:36 PM
  2. Totally confused on assigment using linked lists
    By Uchihanokonoha in forum C++ Programming
    Replies: 8
    Last Post: 01-05-2008, 04:49 PM
  3. Replies: 3
    Last Post: 03-04-2005, 02:46 PM
  4. Possible circular definition with singleton objects
    By techrolla in forum C++ Programming
    Replies: 3
    Last Post: 12-26-2004, 10:46 AM