Accessing every vars ram value and save file?

Blitz3D Forums/Blitz3D Programming/Accessing every vars ram value and save file?

aab(Posted 2004) [#1]
Am i Mad?


How would i go about doing this, that is: reading every part of my program in Ram, and saving it to file for reloading the program with the exact state it was at at a later date..... obviously in terms of a local starting point in Ram.....


Sunteam Software(Posted 2004) [#2]
That's a very old school technique your trying to do there. These days you should only need to store the contents of importants vars, and the program should be designed to reload these vars which tell it what state it should be in.


Strider Centaur(Posted 2004) [#3]
aab,

Sunteam is right, you shouldn't need to reload the entire program space, in fact it may not work since code run in Windows is effectivly relocatable at run time. So there is no garuntee you could get access to the same memory addresses in the future. The best way I have found to save a game is to use memory blocks to hold coppies of all variables that need to be saved. Then simply save that entire region of memory to a file. This makes loading it back in easy. Unfortianately not having access to type pointers means no C/C++ like structure dumps and loads, you will have to code a function to copy all the variables you want to save to the memory block and another to read them back. Yes, its a lot of typing, and is one of the biggest flaws with blitz basic( no direct pointer access), but its not hard to do, just takes time.


Graythe(Posted 2004) [#4]
You can use a memory bank to hold all of the values used by your program rather than vars (or you can use both!). Blitz has a command to save a bank to file.