Save States - Proof of concept

Here you can discuss the development of patches.

Re: Save States - Proof of concept

Postby al3xmeister » 2010-7-12 @ 17:07

well you'll laugh. When playing volfied with beta 4 I've reached 10 levels and stopped to go for lunch, really happy about my discovery
with beta 5 problems started and they dont seem to go away
thank you very much for your help and trouble, if you could fix that particular bug (with static screen) thata would be more than awesome
al3xmeister
Newbie
 
Posts: 9
Joined: 2010-7-12 @ 12:56

Re: Save States - Proof of concept

Postby ZenJu » 2010-7-12 @ 18:03

The pc speaker sound is quite daunting in this game :) Actually you got me playing this game until level 16 where it said I should start all over again on medium difficulty. Which I rejected. But as a semi-end it told something about adam and eve on this planet...
About the video freeze: All in all saving and loading worked quite well (and I used it a LOT ;). There indeed was one time where the game stopped, but loading from the old savegame fixed this issue. This is good news because it shows the dosbox engine is still working. This was about level 8. Whatever it was it had no lasting influence on consistency of the VM.

PS: I'll add two more buttons like "next state" and "previous state" that allows for, let's say 10 save states in parallel.
User avatar
ZenJu
Newbie
 
Posts: 36
Joined: 2010-7-04 @ 12:05

Re: Save States - Proof of concept

Postby ZenJu » 2010-7-12 @ 19:20

Beta 6 supports up to 10 different save states; selectable via previous/next buttons.
User avatar
ZenJu
Newbie
 
Posts: 36
Joined: 2010-7-04 @ 12:05

Re: Save States - Proof of concept

Postby al3xmeister » 2010-7-12 @ 21:46

thank you very much for the good job, thumbs up!

everything woking fine so far, I'll let you know as I continue my dos-quests
al3xmeister
Newbie
 
Posts: 9
Joined: 2010-7-12 @ 12:56

Re: Save States - Proof of concept

Postby al3xmeister » 2010-7-13 @ 00:51

sorry for double post, I couldn't find the edit button. I can't say how thankful I am for dosbox save feature in human words. It's absolutely marveollous

Keep up the good job, releasing people free from their childhood frustrations :))
al3xmeister
Newbie
 
Posts: 9
Joined: 2010-7-12 @ 12:56

Re: Save States - Proof of concept

Postby ZenJu » 2010-7-14 @ 22:34

Beta7: 10 Save States are nice, but they consume a LOT of memory: My dosbox version usually requires about 100MB RAM. With all save states filled it rises to 525 MB! Beta 7 fixes this issue: It keeps all savestates, except for the active one, in a compressed state. This ensures maximum performance when saving and loading a single slot and only a minor performance drawback (about 100 - 150 ms) when switching slots, and even in this case the drawback happens only once per switch (not when toggling, only when actually using another slot). => Memory consumption is back to 130MB, that is the same as Beta 5 with a single filled slot: Dosbox internally initializes the RAM of the virtual machine with zeros which allows for even the fastest compression algorithm to still crunch the (unused) RAM to almost nothing.
PS: I also cleanup up the internal design of the save state code, as you wouldn't notice if I didn't mention it...
User avatar
ZenJu
Newbie
 
Posts: 36
Joined: 2010-7-04 @ 12:05

Re: Save States - Proof of concept

Postby al3xmeister » 2010-7-14 @ 22:54

I apologize for being the ultimate noob, but how do you switch between saves? I've tried left and right arrows, F1-F10, nothing seems to work :( Sorry again :d
al3xmeister
Newbie
 
Posts: 9
Joined: 2010-7-12 @ 12:56

Re: Save States - Proof of concept

Postby ZenJu » 2010-7-14 @ 23:13

You need to open the keymapper (CTRL + F1) and set them to something appropriate for you.
User avatar
ZenJu
Newbie
 
Posts: 36
Joined: 2010-7-04 @ 12:05

Re: Save States - Proof of concept

Postby al3xmeister » 2010-7-14 @ 23:59

thanks mate, one more time. much obliged
al3xmeister
Newbie
 
Posts: 9
Joined: 2010-7-12 @ 12:56

Re: Save States - Proof of concept

Postby isamu » 2010-7-21 @ 08:17

Hello everyone. I am a brand new dosbox user and I just registered to this forum seconds ago. DosBox is fantastic program and I want to thank first the authors of the emulator, and also to Zenju for this remarkable dosbox "plugin".

This ability to save state at anytime has allowed me to enjoy Dungeon Master for Dos more than I ever did before. The ability to save anytime is a huge benefit to this particular game. I haven't had any problems using it so far either.

Thanks so much Zenju. This rocks. I can't wait til you are able to figure out how to write the saves states to disk. That's going to be even more awesome! :happyhappy:
isamu
Newbie
 
Posts: 11
Joined: 2010-7-21 @ 06:54

Re: Save States - Proof of concept

Postby jal » 2010-7-22 @ 08:03

isamu wrote:I can't wait til you are able to figure out how to write the saves states to disk.


As I understand it, ZenJu is perfectly capable of writing the states to disk, but since he does not save the entire state of DOSBox (especially hardware, whose state is usually rather static while a game is running, but definitely not while, say, another game is), saving to disk would not allow restoring the game again (at least not without first starting the game again).


JAL
User avatar
jal
Member
 
Posts: 495
Joined: 2004-1-02 @ 15:30
Location: Amersfoort, Netherlands

Re: Save States - Proof of concept

Postby ZenJu » 2010-7-22 @ 17:40

The biggest obstacle are function pointer variables. These are quite frequently used to register callbacks, mainly at program startup. The function pointer addresses are subject to change in between dosbox sessions. But there are other types of "per-session-constant" data as well. Therefore a solution for this problem entails a redesign of some significant parts of code. This is something I could do, but it doesn't make much sense, as all the work I'd put into this would be lost when the next dosbox version comes out. Therefore this would have to be done by a dosbox developer, if at all. Currently my design is non-intrusive, this means I can add save state functionality to a dosbox version by simply adding more code instead of extensively modifying exiting. Implementing major dosbox design changes would compromise my implementation strategy.
So dosbox in its current design easily supports save states within one session, but not across sessions.
User avatar
ZenJu
Newbie
 
Posts: 36
Joined: 2010-7-04 @ 12:05

Re: Save States - Proof of concept

Postby ykhwong » 2010-7-22 @ 18:12

Thanks, ZenJu. Keep up the good job. It should be useful to release a patch file rather than releasing the entire source code, as it is handy. For maintenance, I have created a patch-file and uploaded it here. Some fixes have been done for the compilation on MinGW/MSYS.
You do not have the required permissions to view the files attached to this post.
ykhwong
Oldbie
 
Posts: 627
Joined: 2004-3-17 @ 15:35

Re: Save States - Proof of concept

Postby ZenJu » 2010-7-22 @ 22:19

Beta 8: Yet another maintenance release:
- Some more code review
- cleared keyboard buffer after loading a state.

Some fixes have been done for the compilation on MinGW/MSYS.

Which fixes did MinGW require?
User avatar
ZenJu
Newbie
 
Posts: 36
Joined: 2010-7-04 @ 12:05

Re: Save States - Proof of concept

Postby ripa » 2010-7-24 @ 17:51

FYI: in Beta 8 adlib audio no longer works (tested with Blake Stone shareware).
ripa
Oldbie
 
Posts: 548
Joined: 2005-4-18 @ 00:53
Location: Finland

Re: Save States - Proof of concept

Postby ZenJu » 2010-7-24 @ 23:29

@ripa: Thanks for notifying! Fixed with Beta9.

Cause was a bug in Dosbox, an unitialized variable. It's been there all the time, but my unrelated code changes made it appear. A classic. Insanely hard to debug... I'm hereby reminded again what "undefined behavior" really means.

@some dosbox dev: Init the "MixerChannel" struct before using it. This is done only partially.
User avatar
ZenJu
Newbie
 
Posts: 36
Joined: 2010-7-04 @ 12:05

Re: Save States - Proof of concept

Postby Serious Callers Only » 2010-7-25 @ 07:43

I'm getting errors compiling in ubuntu x86-64


...

In file included from cpu.cpp:33:
../save_state.h: In function ‘void writePODContainer(std::ostream&, const T&)’:
../save_state.h:183: error: expected ‘;’ before ‘i’
../save_state.h:183: error: ‘i’ was not declared in this scope
cpu.cpp: In function ‘bool CPU_SwitchTask(Bitu, TSwitchType, Bitu)’:
cpu.cpp:443: warning: format ‘%x’ expects type ‘unsigned int’, but argument 2 has type ‘Bitu’
cpu.cpp:637: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘Bitu’
cpu.cpp: In function ‘void CPU_Interrupt(Bitu, Bitu, Bitu)’:
cpu.cpp:899: warning: format ‘%x’ expects type ‘unsigned int’, but argument 2 has type ‘Bitu’
cpu.cpp:931: warning: format ‘%X’ expects type ‘unsigned int’, but argument 2 has type ‘Bitu’
cpu.cpp:931: warning: format ‘%X’ expects type ‘unsigned int’, but argument 3 has type ‘Bitu’
cpu.cpp: In function ‘void CPU_IRET(bool, Bitu)’:
cpu.cpp:1103: warning: format ‘%X’ expects type ‘unsigned int’, but argument 2 has type ‘Bitu’
cpu.cpp: In function ‘void CPU_JMP(bool, Bitu, Bitu, Bitu)’:
cpu.cpp:1285: warning: format ‘%X’ expects type ‘unsigned int’, but argument 2 has type ‘Bitu’
cpu.cpp: In function ‘void CPU_CALL(bool, Bitu, Bitu, Bitu)’:
cpu.cpp:1560: warning: format ‘%x’ expects type ‘unsigned int’, but argument 2 has type ‘Bitu’
cpu.cpp: In function ‘void CPU_RET(bool, Bitu, Bitu)’:
cpu.cpp:1632: warning: format ‘%X’ expects type ‘unsigned int’, but argument 2 has type ‘Bitu’
cpu.cpp:1691: warning: format ‘%X’ expects type ‘unsigned int’, but argument 2 has type ‘Bitu’
cpu.cpp: In function ‘bool CPU_LTR(Bitu)’:
cpu.cpp:1820: warning: format ‘%X’ expects type ‘unsigned int’, but argument 2 has type ‘Bitu’
make[4]: *** [cpu.o] Error 1
make[4]: Leaving directory `/home/paulo/Desktop/dosbox/dosbox-0.74/src/cpu'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/home/paulo/Desktop/dosbox/dosbox-0.74/src/cpu'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/paulo/Desktop/dosbox/dosbox-0.74/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/paulo/Desktop/dosbox/dosbox-0.74'
make: *** [all] Error 2


The mt-32 patch, also, should have been included long ago.
Serious Callers Only
Member
 
Posts: 370
Joined: 2003-4-26 @ 21:34

Re: Save States - Proof of concept

Postby ZenJu » 2010-7-25 @ 09:32

In file included from cpu.cpp:33:
../save_state.h: In function ‘void writePODContainer(std::ostream&, const T&)’:
../save_state.h:183: error: expected ‘;’ before ‘i’
../save_state.h:183: error: ‘i’ was not declared in this scope


There is a "typename" missing:

for (typename T::const_iterator i = data.begin(); i != data.end(); ++i)

MSVC isn't very strict about this.
User avatar
ZenJu
Newbie
 
Posts: 36
Joined: 2010-7-04 @ 12:05

Re: Save States - Proof of concept

Postby Serious Callers Only » 2010-7-25 @ 11:05

paging.cpp: In constructor ‘<unnamed>::SerializePaging::SerializePaging()’:
paging.cpp:1070: error: no matching function for call to ‘<unnamed>::SerializePaging::registerPOD(<anonymous struct>&)’
make[4]: *** [paging.o] Error 1
Serious Callers Only
Member
 
Posts: 370
Joined: 2003-4-26 @ 21:34

Re: Save States - Proof of concept

Postby ZenJu » 2010-7-25 @ 11:24

error: no matching function for call to ‘<unnamed>::SerializePaging::registerPOD(<anonymous struct>&)’

I have no idea why it's complaining in this case. The method is clearly visible in the upper class
SerializeGlobalPOD::registerPOD(pf_queue);
User avatar
ZenJu
Newbie
 
Posts: 36
Joined: 2010-7-04 @ 12:05

PreviousNext

Return to DOSBox Patches

Who is online

Users browsing this forum: No registered users and 2 guests