VOGONS

Common searches


Save States - Proof of concept

Topic actions

Reply 40 of 227, by al3xmeister

User metadata
Rank Newbie
Rank
Newbie

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

Reply 41 of 227, by ZenJu

User metadata
Rank Newbie
Rank
Newbie

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.

https://sourceforge.net/projects/xbrz
https://freefilesync.org

Reply 44 of 227, by al3xmeister

User metadata
Rank Newbie
Rank
Newbie

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 😀)

Reply 45 of 227, by ZenJu

User metadata
Rank Newbie
Rank
Newbie

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...

https://sourceforge.net/projects/xbrz
https://freefilesync.org

Reply 49 of 227, by isamu

User metadata
Rank Newbie
Rank
Newbie

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! 😁

Reply 50 of 227, by jal

User metadata
Rank Oldbie
Rank
Oldbie
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

Reply 51 of 227, by ZenJu

User metadata
Rank Newbie
Rank
Newbie

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.

https://sourceforge.net/projects/xbrz
https://freefilesync.org

Reply 52 of 227, by ykhwong

User metadata
Rank Oldbie
Rank
Oldbie

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.

Attachments

  • Filename
    savestates.7z
    File size
    9.59 KiB
    Downloads
    304 downloads
    File license
    Fair use/fair dealing exception

Reply 53 of 227, by ZenJu

User metadata
Rank Newbie
Rank
Newbie

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?

https://sourceforge.net/projects/xbrz
https://freefilesync.org

Reply 55 of 227, by ZenJu

User metadata
Rank Newbie
Rank
Newbie

@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.

https://sourceforge.net/projects/xbrz
https://freefilesync.org

Reply 56 of 227, by Serious Callers Only

User metadata
Rank Member
Rank
Member

I'm getting errors compiling in ubuntu x86-64

... […]
Show full quote

...

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.

Reply 57 of 227, by ZenJu

User metadata
Rank Newbie
Rank
Newbie
In file included from cpu.cpp:33: ../save_state.h: In function ‘void writePODContainer(std::ostream&, const T&)’: ../save_stat […]
Show full quote

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.

https://sourceforge.net/projects/xbrz
https://freefilesync.org

Reply 58 of 227, by Serious Callers Only

User metadata
Rank Member
Rank
Member

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

Reply 59 of 227, by ZenJu

User metadata
Rank Newbie
Rank
Newbie

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);

https://sourceforge.net/projects/xbrz
https://freefilesync.org