Saved games

Laurent.DESNOGUES at Laurent.DESNOGUES at
Wed Jan 9 05:17:34 EST 2002

I have taken a quick look at how games are saved and why they failed to
be reloaded.  Some function pointers are written to the file and so any
new will fail to reload a saved games.

   There are two workarounds for this:

     1. instead of saving the address, save a string providing the
        function name instead of its address;  when reloading, use
        dlsym;  there are two ways to implement that:

          a. when you update the field, on top of storing in game
             structures the pointer to the function, store also a
             pointer to a string which will be saved;  problem:
             this needs to be done everywhere, so it's a no-no!
          b. when saving, translate the function address to a
             string;  problem:  we need to have the value returned
             by dlopen when loading

     2. write a utility which given a saved game, the
        which saved it and the new, will translate the
        pointers;  problems:  saved game need to be translated with
        an external tool;  there will be an offset due to dynamic
        linking (not so sure about that).

I tend to favor 1.b.

   Any comments welcome, especially since I only spent half an hour
looking at the problem and I surely missed something...


More information about the quake2 mailing list