Dosbox SVN r4019 + savestates Build (Alpha)

Developer's Forum, for discussion of bugs, code, and other developmental aspects of DOSBox.

Dosbox SVN r4019 + savestates Build (Alpha)

Postby gandhig » 2017-3-26 @ 20:13

Read this First: DON'T pester the dosbox authors about the addition of 'savestate' feature in official/SVN dosbox. It is a humble request, to especially the newbies. THANKS.

Thanks to ZenJu, tikalat, ykhwong and of course, all the dosbox authors, here is an alpha version of Dosbox SVN r4019 with savestates(patches taken from this thread), built statically(with few shared dependencies) for debian 32 bit linux systems(tested on lubuntu only) as well as for windows.

Purists & old-timers(including myself) may please forgive.

Summary:
1) diff uploaded by tikalat against Dosbox SVN 3782(patch-005) was used as a base.
2) Added/removed certain data/data structs/POD's by comparing them between r3782 and r4007. Adapted to r4019 later without further changes.
3) Under Dos Files, "LPT1" was needed in addition to "CON", "PRN" & "AUX" checks. Probably it was fixed by tikalat in his later patches to daum build.
4) Save/Load to/from Disk code copied from latest Daum build.
5) Aim is to reach the savestates compatibility level of tikalat's 'savestate patch 005' to SVN r3782 build

Tested games (i.e. no regular crash :lol:):
a) Lure of the Temptress
b) XCOM UFO Defense
c) Turrican II
d) GP2 99 by Microprose
e) Wacky wheels (Thanks to bruenor41)
f) Dangerous dave 2 in the haunted mansion (Thanks to bruenor41)
g) Fallout 1 (Thanks to bruenor41)
h) Bio Menace (Thanks to bruenor41)
i) Might & Magic 1 (Thanks to bruenor41)

Issues/Fix needed/To Do:
Code: Select all
a) GP2 throws segmentation fault just after loading the saves. Issue was not observed in the buid of SVN 3782(with tikalat's savestate-005 patch applied). Got fixed automatically in SVN r4019.
b) May not work with Dune as 'opl3gold' mode not added yet. Not sure if it is required or that it will crash, as Dune is not available with me.
c) There maybe code regression due to certain new or replaced data/POD's in r4019 w.r.t r3782.
d) Compile win32 build - Completed.
e) Add MUNT support - Dropped
f) etc.

Note:
1) Intentionally no code was added :lol: to the main SVN source.
2) Dosbox SVN source/diff added in posts below
3) Those who download the build are requested to run it first in a virtual environment, if possible, to avoid hard crashes.

DOSBox_r4019_SAV_Linux_Static.rar
Static Linux build(alpha) of DOSBox SVN r4019 with savestates based on patches from ZenJu & tikalat with ykhwong's slot load/save code, with few shared dependencies
(2.28 MiB) Downloaded 25 times

DOSBox_r4019_SAV_Win32.7z
MinGW Win32 build(alpha) of DOSBox SVN r4019 with savestates based on patches from ZenJu & tikalat with ykhwong's slot load/save code
(4.63 MiB) Downloaded 102 times

dosbox_r4019_SAV_Linux_Static_bruenor.7z
Static Linux build(alpha) of DOSBox SVN r4019 with savestates based on patches from ZenJu & tikalat with ykhwong's slot load/save code and fixes by bruenor41, with few shared dependencies
(2.22 MiB) Downloaded 10 times

dosbox_r4019_SAV_Win32_bruenor.7z
MinGW Win32 build(alpha) of DOSBox SVN r4019 with savestates based on patches from ZenJu & tikalat with ykhwong's slot load/save code and fixes by bruenor41
(4.63 MiB) Downloaded 27 times

dosbox_r4019_SAV_Win32_bruenor_Alien_Carnage.7z
MinGW Win32 build(alpha) of DOSBox SVN r4019 with savestates based on patches from ZenJu & tikalat with ykhwong's slot load/save code and fixes by bruenor41(specifically Alien Carnage)
(1.66 MiB) Downloaded 3 times

Edit: Old r4007 based builds removed. bruenor41's fixed builds added on 14.09.17. Alien Carnage specific build (win32) of bruenor41 added on 11.10.17
Last edited by gandhig on 2017-10-11 @ 12:10, edited 19 times in total.
User avatar
gandhig
Member
 
Posts: 329
Joined: 2014-2-12 @ 08:35

Re: Dosbox SVN r4007 + savestates Build

Postby Ringding » 2017-3-27 @ 22:13

Can you please post the source code for this build?
Ringding
Newbie
 
Posts: 10
Joined: 2016-1-05 @ 21:02

Re: Dosbox SVN r4007 + savestates Build

Postby Dominus » 2017-3-28 @ 01:07

Yes, please give us the source/diff ;) (you know gpl etc... ;))
User avatar
Dominus
DOSBox Moderator
 
Posts: 7283
Joined: 2002-10-03 @ 09:54
Location: Vienna

Re: Dosbox SVN r4007 + savestates Build

Postby gandhig » 2017-3-28 @ 21:50

Ringding wrote:Can you please post the source code for this build?
Dominus wrote:Yes, please give us the source/diff ;) (you know gpl etc... ;))

Cornered :lol: .

Seriously, just wanted to be sure of the stability before uploading the source as it was mostly a copy-paste job with pattern recognition and a teensy bit of coding knowledge.

Just remember that you asked for it, so don't hold me responsible for anything :lol: that happens by downloading the thing that is attached below.

Futher a half-baked attempt on the win32 build using Visual Studio 2017(Windows SDK 10) resulted in a executable that threw a 'compression failure' error while the various components were getting saved (in the 'savestate.cpp' code of daum) when you hit Alt-F5. Weird that there was no problem with the linux build. Fortunately the ZenJu/tikalat 'savestate.cpp' code worked just fine, but the size of save files were in MB's 8-O whereas daum's save files were in KB's. You can't have everything. So this upload contains the latter savestate code only.

Win32 Build Summary:
Code: Select all
1) Platform Toolset : Visual Studio 2017 (v141)

2) Target Platform(SDK Version): Windows 10 (10.0.14393.0)

3) Dependencies compiled:
   a) SDL (1.2.15)
   b) libpng (1.6.29) & its dependency zlib( 1.2.8 )
   c) SDL_net (1.2.7), 1.2.8 version failed to cooperate

Above Win32 Build attached in first post. Visual C++ Redistributable for Visual Studio 2015 install required, if not done already.

Maybe later, it will be worth a try to compile the source with daum savestate code in MinGW environment.

dosbox_r4007_sav_source.rar
DOSBox SVN r4007 with savestates source (alpha) based on ZenJu/tikalat slot load/save code - VS2017
(1.21 MiB) Downloaded 30 times
Last edited by gandhig on 2017-3-29 @ 10:23, edited 1 time in total.
User avatar
gandhig
Member
 
Posts: 329
Joined: 2014-2-12 @ 08:35

Re: Dosbox SVN r4007 + savestates Build

Postby gandhig » 2017-3-29 @ 10:22

Compilation of daum savestate code was successful in MinGW environment. Modified Source attached below. Build attached in first post.

Win32 Build Summary:
Code: Select all
1) Followed Building DOSBox wiki

2) Works in both WinXP and Win7 unlike the previous VS2017 build(WinXP - not a valid win32 application error)

3) Dependencies compiled:
   a) SDL (1.2.15) - library directly added
   b) Direct Draw - libraries directly added
   c) libpng (1.6.29) & its dependency zlib( 1.2.8 )
   d) SDL_net (1.2.8)
   e) libogg (1.3.2)
   f) libvorbis (1.3.5)
   g) SDL_sound (1.0.3)

dosbox_r4007_sav_source_mingw.rar
DOSBox SVN r4007 with savestates source (alpha) based on ykhwong's slot load/save code - MinGW
(1.26 MiB) Downloaded 26 times
Last edited by gandhig on 2017-3-29 @ 15:35, edited 2 times in total.
User avatar
gandhig
Member
 
Posts: 329
Joined: 2014-2-12 @ 08:35

Re: Dosbox SVN r4007 + savestates Build

Postby Dominus » 2017-3-29 @ 11:59

I'd always recommend the Mingw environment, at least with autotool projects. Most of the time, it seems these built much better than with abandoned Visual Project files...
User avatar
Dominus
DOSBox Moderator
 
Posts: 7283
Joined: 2002-10-03 @ 09:54
Location: Vienna

Re: Dosbox SVN r4007 + savestates Build

Postby gandhig » 2017-3-29 @ 17:51

Started with MinGW only, but got stuck up at compiling libpng 1.6.29. Then switched to Visual Studio, which seemed easy initially, but ended up in a partially botched build. Had to learn it the hard way, my personal preference really, so that it gets properly latched as a first-hand memory. Later got libpng to compile under MinGW, after googling as usual, culprit being 'tabbed spaces/new line between certain 'define' parameters and its values'.

Dominus wrote:abandoned Visual Project files...
Didn't know that, being new to the environment and all that.

Doing this as more of a time-pass only, so everyone please overlook, if any target is not set or met. A lack of confidence too, on my part, in fixing any bugs that might have resulted in the migration of the savestate patch from r3782 to r4007. Doesn't mean any lack of effort, however.

Now, leisurely, trying to zero in on the random segmentation fault on GP2 savestate loads in r4007 which is not there in r3782.
User avatar
gandhig
Member
 
Posts: 329
Joined: 2014-2-12 @ 08:35

Re: Dosbox SVN r4007 + savestates Build

Postby Yesterplay80 » 2017-3-30 @ 06:58

gandhig wrote:culprit being 'tabbed spaces/new line between certain 'define' parameters and its values'.

The infamous pnglibconf.h error. :) I don't know why they didn't fix that already, this bug was already in the last 3 version, iirc.

I made myself a patch especially for this bug, so I can fix it quickly everytime a new version of libpng is released:

Code: Select all
--- pnglibconf.h
+++ pnglibconf.h
@@ -196,17 +196,17 @@
 #define PNG_QUANTIZE_BLUE_BITS 5
 #define PNG_QUANTIZE_GREEN_BITS 5
 #define PNG_QUANTIZE_RED_BITS 5
-#define PNG_TEXT_Z_DEFAULT_COMPRESSION
                                                    (-1)
-#define PNG_TEXT_Z_DEFAULT_STRATEGY
                                                 0
+#define PNG_TEXT_Z_DEFAULT_COMPRESSION (-1)
+#define PNG_TEXT_Z_DEFAULT_STRATEGY 0
 #define PNG_USER_CHUNK_CACHE_MAX 1000
 #define PNG_USER_CHUNK_MALLOC_MAX 8000000
 #define PNG_USER_HEIGHT_MAX 1000000
 #define PNG_USER_WIDTH_MAX 1000000
 #define PNG_ZBUF_SIZE 8192
-#define PNG_ZLIB_VERNUM
                                     0x1280
-#define PNG_Z_DEFAULT_COMPRESSION
                                               (-1)
-#define PNG_Z_DEFAULT_NOFILTER_STRATEGY
                                                     0
-#define PNG_Z_DEFAULT_STRATEGY
                                            1
+#define PNG_ZLIB_VERNUM 0x1280
+#define PNG_Z_DEFAULT_COMPRESSION (-1)
+#define PNG_Z_DEFAULT_NOFILTER_STRATEGY 0
+#define PNG_Z_DEFAULT_STRATEGY 1
 #define PNG_sCAL_PRECISION 5
 #define PNG_sRGB_PROFILE_CHECKS 2
 /* end of settings */


If you need any help compiling DOSBox in MinGW, I'll gladly help wherever I can. I'm no pro or coder neither, but so far I had very few problems (except building it statically with Fluidsynth) using MinGW for my DOSBox ECE.
My full-featured DOSBox SVN builds (without debugger) for Windows: Vanilla DOSBox and DOSBox ECE (Enhanced Community Edition)
User avatar
Yesterplay80
Member
 
Posts: 252
Joined: 2016-2-23 @ 11:02
Location: Germany

Re: Dosbox SVN r4007 + savestates Build

Postby gandhig » 2017-3-30 @ 08:26

Yesterplay80 wrote:If you need any help compiling DOSBox in MinGW, I'll gladly help wherever I can. I'm no pro or coder neither, but so far I had very few problems (except building it statically with Fluidsynth) using MinGW for my DOSBox ECE.

Thanks for the kind words and offered help, will remember that. Just started the first lap in this and judging by DOSBox ECE, you would be way ahead in the curve, pro definitely.

Maybe if you permit, once the savestate patch is stable enough(possible???), it can be merged with DOSBox ECE to benefit the community if there is any demand for it.

Join forces :lol: and you are welcome to take the lead.
User avatar
gandhig
Member
 
Posts: 329
Joined: 2014-2-12 @ 08:35

Re: Dosbox SVN r4007 + savestates Build

Postby Yesterplay80 » 2017-3-30 @ 09:10

gandhig wrote:Maybe if you permit, once the savestate patch is stable enough(possible???), it can be merged with DOSBox ECE to benefit the community if there is any demand for it.

You can, of course, download the source code of DOSBox ECE and try to apply the patch there as well. You'd have to expand it for Fluidsynth, MT32, OPL3 and whatever else I added to it.
My full-featured DOSBox SVN builds (without debugger) for Windows: Vanilla DOSBox and DOSBox ECE (Enhanced Community Edition)
User avatar
Yesterplay80
Member
 
Posts: 252
Joined: 2016-2-23 @ 11:02
Location: Germany

Re: Dosbox SVN r4007 + savestates Build

Postby Firtasik » 2017-3-30 @ 10:10

Nice job. :happy:

Old bug: save states don't work with Alien Carnage (Halloween Harry is fine, though).
11 1 111 11 1 1 1 1 1 11 1 1 111 1 111 1 1 1 1 111
User avatar
Firtasik
Member
 
Posts: 378
Joined: 2013-7-21 @ 19:07

Re: Dosbox SVN r4007 + savestates Build

Postby gandhig » 2017-3-30 @ 17:06

Yesterplay80 wrote:You can, of course, download the source code of DOSBox ECE and try to apply the patch there as well. You'd have to expand it for Fluidsynth, MT32, OPL3 and whatever else I added to it.

On a lighter note, during my school days, our English teacher used to quote an incident for registering the difference between the use of 'can' and 'may' in a sentence. Point is, 'may' being more of an approval than 'can' can ever be, i.e. it may or may not be an approval. Native English speakers may please correct, if wrong. So, is there a permission lurking in that sentence :lol: ? Either way is fine really, as the patch has to be stable first, before it can be put to good use in addition to adding support for the patches included in your ECE build.

Firtasik wrote:Nice job. :happy:

Old bug: save states don't work with Alien Carnage (Halloween Harry is fine, though).

Thank you as well for reporting the bug.

Sorry but the save command is also failing in the tikalat's savestate patch applied r3782 build. Suppose my knowledge levels up to that level in the future, definitely will look into it. Maybe the authors can throw some light as some of this forum's posts and readme of Alien Carnage mentioned the bug fixes by those authors.
User avatar
gandhig
Member
 
Posts: 329
Joined: 2014-2-12 @ 08:35

Re: Dosbox SVN r4007 + savestates Build

Postby gandhig » 2017-3-30 @ 20:25

Firtasik wrote:Old bug: save states don't work with Alien Carnage (Halloween Harry is fine, though).
Can you please try the attached build? Just a temporary fix for this game only. Not 100% sure, however. As a safety precaution just use the save/load feature within the same level and please use the game's save feature for saves between levels. Also please don't try to save in the menu or loading screen or anything else.

BTW, which OS? Both win and linux builds attached. Permanent fix may need getting to the bottom of the issue(now isolated only), can't say now if it is possible.
Attachments
DOSBox_Win_AC.rar
Win32 bit build for Alien Carnage only (Temporary Fix)
(1.42 MiB) Downloaded 21 times
DOSBox_Lin_AC.rar
Static Linux 32 bit build for Alien Carnage only (Temporary Fix)
(2.28 MiB) Downloaded 18 times
User avatar
gandhig
Member
 
Posts: 329
Joined: 2014-2-12 @ 08:35

Re: Dosbox SVN r4007 + savestates Build

Postby Firtasik » 2017-3-30 @ 21:30

Thanks! It's working. I'm using Windows. :happy:
11 1 111 11 1 1 1 1 1 11 1 1 111 1 111 1 1 1 1 111
User avatar
Firtasik
Member
 
Posts: 378
Joined: 2013-7-21 @ 19:07

Re: Dosbox SVN r4007 + savestates Build

Postby PumpkinPaladin » 2017-4-23 @ 00:34

Hey Gandhig,
Great job on the savestate build. I just wanted to report a minor idiosyncrasy to you. In Turrican II, using the VS 2017 build, savestates do not work, giving me the, "Decompression Failed" error. However, strangely enough, the MinGW seems to work just fine, loading and saving every state I created. I am using Windows 10 64 bit. Just figured you'd want to know.
PumpkinPaladin
Newbie
 
Posts: 7
Joined: 2017-4-06 @ 01:24

Re: Dosbox SVN r4007 + savestates Build

Postby gandhig » 2017-4-23 @ 10:43

PumpkinPaladin wrote:Hey Gandhig,
Great job on the savestate build.

Full credit goes to the patch authors and dosbox authors. My contribution is very minimal, really.

PumpkinPaladin wrote:I just wanted to report a minor idiosyncrasy to you. In Turrican II, using the VS 2017 build, savestates do not work, giving me the, "Decompression Failed" error. However, strangely enough, the MinGW seems to work just fine, loading and saving every state I created. I am using Windows 10 64 bit. Just figured you'd want to know.

Seems to be some issue pertaining to the update of the dosbox solution from VS2015 to VS2017(Please see 4th post from the top). If you can scroll down further, it can be seen that MinGW being the better option for building the dosbox. Sorry, can't help much with the botched VS2017 build.
User avatar
gandhig
Member
 
Posts: 329
Joined: 2014-2-12 @ 08:35

Re: Dosbox SVN r4007 + savestates Build

Postby SedrynTyros » 2017-5-16 @ 03:21

Hey, any chance for a diff file that would cleanly apply to SVN r4019?
User avatar
SedrynTyros
Member
 
Posts: 103
Joined: 2012-7-24 @ 21:44

Re: Dosbox SVN r4007 + savestates Build

Postby gandhig » 2017-5-16 @ 04:44

Gimme a day or two. Let me first check whether the rewritten mixer code automagically fixes the crash during the loading of savestate in GP2.

Edit: Yep it fixed it.
User avatar
gandhig
Member
 
Posts: 329
Joined: 2014-2-12 @ 08:35

Re: Dosbox SVN r4007 + savestates Build

Postby gandhig » 2017-5-16 @ 21:01

SedrynTyros wrote:Hey, any chance for a diff file that would cleanly apply to SVN r4019?

Diff againt plain SVN r4019 is attached. And the usual disclaimer, 'USE IT AT YOUR OWN RISK'.

Win32 build compiled under MinGW is also attached. Again, 'USE IT AT YOUR OWN RISK'.

Once the other builds are ready, the original post shall be updated to reflect the new ones, probably in a day or two.

Edit: Win 32 Build moved to first post and updated. Diff files for both Linux and Windows attached.

savestate_r4019_linux.patch
Diff against DOSBox SVN r4019 for savestate patch (Linux(Lubuntu 32 bit)) based on patches from ZenJu & tikalat with ykhwong's slot load/save code
(392.17 KiB) Downloaded 16 times

savestate_r4019_win32_mingw.patch
Diff against DOSBox SVN r4019 for savestate patch (Win32 MinGW) based on patches from ZenJu & tikalat with ykhwong's slot load/save code
(405.64 KiB) Downloaded 33 times
Last edited by gandhig on 2017-5-17 @ 11:45, edited 1 time in total.
User avatar
gandhig
Member
 
Posts: 329
Joined: 2014-2-12 @ 08:35

Re: Dosbox SVN r4007 + savestates Build

Postby SedrynTyros » 2017-5-16 @ 21:22

Awesome! Thank you very much. :)

EDIT:

Patch seems to work for me in the few tests I ran. This is great! I've been hoping for this for a long time.
User avatar
SedrynTyros
Member
 
Posts: 103
Joined: 2012-7-24 @ 21:44

Next

Return to DOSBox Development

Who is online

Users browsing this forum: No registered users and 1 guest