Save a program's state

For everything that's not in any way related to PureBasic. General chat etc...
Bonne_den_kule
Addict
Addict
Posts: 841
Joined: Mon Jun 07, 2004 7:10 pm

Save a program's state

Post by Bonne_den_kule »

Is it possible to save a programs current state/the programs memory?
Which program can do that?
The_CodeMaster
User
User
Posts: 41
Joined: Wed Dec 29, 2004 11:39 am
Location: Belgium

Post by The_CodeMaster »

That's verry difficult, since your program (and all your variables) are somehow randomly (where there is space available) allocated.

I mean if you were capable to capture a programs state, you'll have to put it back in the same memory-adress, else your pointers to variables wil be invalid. Now what if that particullar adress is not available because another program is using it....


A much safer way is to use preference files.
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post by PB »

> A much safer way is to use preference files

From what I can tell, I don't think Bonne_den_kule means in a PureBasic app,
but in apps in general. I'm guessing he's looking for an "Action Replay" type
of app, but I don't think these exist (or are possible) for Windows.
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
The_CodeMaster
User
User
Posts: 41
Joined: Wed Dec 29, 2004 11:39 am
Location: Belgium

Post by The_CodeMaster »

WinXP can save it's entire state so when you reboot you'll get your desktop back as you left it. The problem is that this is only possible directly before windows starts.
But saving and restoring just a part of the memory :? ...
From what I can tell, I don't think Bonne_den_kule means in a PureBasic app,
but in apps in general. I'm guessing he's looking for an "Action Replay" type
of app, but I don't think these exist (or are possible) for Windows.
I know, that's why I suggested the use of preference files :wink:
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

Post by thefool »

Action replay
hmm well you could use a macro to get it back to the state you want it in.
Program one in AutoIt [http://www.hiddensoft.com/autoit3/]
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post by PB »

>> I'm guessing he's looking for an "Action Replay" type of app
>
> I know, that's why I suggested the use of preference files

Do you mean he should code an app that grabs the memory space of an app,
and then save every byte of that memory as a prefs (binary) file?
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
Bonne_den_kule
Addict
Addict
Posts: 841
Joined: Mon Jun 07, 2004 7:10 pm

Post by Bonne_den_kule »

I was thinking about to use it on other programs.
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

Post by thefool »

well its not easy to make a snapshot of a programs state.. but listen to my advice about the AutoIt..
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post by PB »

> its not easy to make a snapshot of a programs state

Hmm, I was just thinking about your trainer lib... what would happen if you
just queried and saved every byte of the app's memory, and then restored
it later? Crash? I would expect it would because the running app wouldn't
be loaded into the same memory space (as the CodeMaster already said).
But wouldn't there be some way around that? I don't know. :)

Actually (just thought about it some more) does it really matter where the
app is loaded? I regularly play Quake 2 and the address for health, ammo,
etc never changes... I just poke the same address every time. So what's
the reason behind that?
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
Post Reply