Save States - Proof of concept

Here you can discuss the development of patches.

Re: Save States - Proof of concept

Postby robertmo » 2012-5-14 @ 20:06

wouldn't it be easier to make one diff with all of them right now?
User avatar
robertmo
l33t
 
Posts: 4381
Joined: 2003-6-18 @ 10:35

Re: Save States - Proof of concept

Postby ykhwong » 2012-5-14 @ 21:03

The following steps are important for saving/loading procedure.
Run an app -> Save state to disk -> Exit DOSBox -> Run the app again -> Load state from disk
Just saving/loading without restarting DOSBox seems to be okay though.
ykhwong
Oldbie
 
Posts: 627
Joined: 2004-3-17 @ 15:35

Re: Save States - Proof of concept

Postby tikalat » 2012-5-14 @ 21:35

@robertmo
I have a good amount of debug + debugger + cheats + misc + experimental stuff in my modified build. Can't just simply 'diff'. :(


@ykhwong
Okay, I understand now. You're loading a loadstate at the CMOS screen (before the game fully boots up)?

That doesn't work yet. I normally wait until the game fully boots, then loadstate. That's worked okay for me to date.

I think it has to do with 'un-init' data that gets 'init'ed at usage run-time. May look into this.
tikalat
Member
 
Posts: 287
Joined: 2012-4-13 @ 16:39

Re: Save States - Proof of concept

Postby tikalat » 2012-5-15 @ 00:10

Archive of savestate diffs - each one is to be used with a clean svn 2012-02-20 build.

Added TheGreatCodeholio's GUS stereo patch also.
You do not have the required permissions to view the files attached to this post.
tikalat
Member
 
Posts: 287
Joined: 2012-4-13 @ 16:39

Re: Save States - Proof of concept

Postby tikalat » 2012-5-15 @ 16:32

Code: Select all
011

midi_mt32.h
- using sergm's syncthread file
+ added class MidiHandler_mt32 functions
  - GetSynth
  - Reset
+ added class RingBuffer function
  - reset

midi.cpp
+ Updated to MT-32 sergm class POD format

dosbox.cpp
- using sergm's new MT-32 config format



012

cpu.cpp
+ proper 'cpudecoder' POD

paging.cpp
- remove 'static' from PageFaultCore

iohandler.cpp
- remove 'static' from IOFaultCore


Applying patch 011 will install -all- updates from 001-011.
Applying patch 012 will install -all- updates from 001-012.


NOTES:
011 = uses sergm's new MT-32 code syncthread method
- faster than old multicore method
- doesn't lockup at boot (old code had a rare lockup bug)
- multicore handles buffers > 255 bytes (old bug too sometimes)


mt32.reverse.stereo=off
mt32.verbose=off
mt32.thread=off
mt32.dac=0
mt32.reverb.mode=auto
mt32.reverb.time=5
mt32.reverb.level=3


012 = proper cpudecoder POD support
- fixes loadstate lockups from CMOS
- fixes random loadstate lockups from HLT exceptions
You do not have the required permissions to view the files attached to this post.
tikalat
Member
 
Posts: 287
Joined: 2012-4-13 @ 16:39

Re: Save States - Proof of concept

Postby tikalat » 2012-5-15 @ 23:14

Code: Select all
013

mixer.cpp
+ Rework channel POD state (vars)
  + Add 'enabled'
  - Remove 'done', 'needed', 'last'
    (Reset mixer vars instead on loadstate)

void MixerChannel::SaveState( std::ostream& stream )
void MixerChannel::LoadState( std::istream& stream )



gus.cpp
+ Add mixer channel savestate POD

void POD_Save_GUS( std::ostream& stream )
void POD_Load_GUS( std::istream& stream )


NOTES:
Fixes missing mixer sounds on loadstate (from CMOS or pre-init sound device).

ex. Loadstate 'Another World' from CMOS prompt or title screen (fixes sblaster sounds)


GUS should be fully supported now.
ex. Blackthorne title 'shotgun' SE using GUS (edit: when loadstate from CMOS)
You do not have the required permissions to view the files attached to this post.
tikalat
Member
 
Posts: 287
Joined: 2012-4-13 @ 16:39

Re: Save States - Proof of concept

Postby ykhwong » 2012-5-16 @ 00:23

I applied your last patch (savestate_013_mixer_channel) and everything seems to work except midi which causes freezing even on runtime.

Edit: I removed this code in setbytes.
Code: Select all
MIDI_State_LoadMessage();
ykhwong
Oldbie
 
Posts: 627
Joined: 2004-3-17 @ 15:35

Re: Save States - Proof of concept

Postby tikalat » 2012-5-16 @ 01:40

That's an interesting place for a bug. But it doesn't happen for me. :(


(Roland virtual SC-55 map = Betrayal at Krondor)
mpu401=intelligent
mididevice=win32
midiconfig=2
mt32.reverse.stereo=off
mt32.verbose=off
mt32.thread=on
mt32.dac=1
mt32.reverb.mode=auto
mt32.reverb.time=5
mt32.reverb.level=1


(MUNT MT-32 = Space Quest 3)
mpu401=intelligent
mididevice=mt32
midiconfig=2
mt32.reverse.stereo=off
mt32.verbose=off
mt32.thread=on
mt32.dac=1
mt32.reverb.mode=auto
mt32.reverb.time=5
mt32.reverb.level=1


Haven't had any crashes with either. Hmm. Wonder what's wrong.
tikalat
Member
 
Posts: 287
Joined: 2012-4-13 @ 16:39

Re: Save States - Proof of concept

Postby tikalat » 2012-5-16 @ 01:50

Code: Select all
014

midi.cpp
+ Add real-time MIDI savestate feature
MIDI_State_SaveMessage


NOTES:
This should fix the MIDI crashes. Wasn't there before. Which is probably why LoadState would crash (tries to send -all- junk data on all channels).


And I've noticed a CMOS load problem with Krondor (mouse). Will look at probably.
You do not have the required permissions to view the files attached to this post.
tikalat
Member
 
Posts: 287
Joined: 2012-4-13 @ 16:39

Re: Save States - Proof of concept

Postby ykhwong » 2012-5-16 @ 01:59

I forgot to say that I also found a crash with setting machine=cga, pcjr, hercules, tandy.
ykhwong
Oldbie
 
Posts: 627
Joined: 2004-3-17 @ 15:35

Re: Save States - Proof of concept

Postby tikalat » 2012-5-16 @ 02:07

Quite late for me. I've got the original SQ3 (cga, ega, tandy, pcjr) floppy disk so I'll try them out with Dosbox later this week.

I wouldn't be surprised if CMOS loadstate crashes them though (MMIO handler not done).
tikalat
Member
 
Posts: 287
Joined: 2012-4-13 @ 16:39

Re: Save States - Proof of concept

Postby tikalat » 2012-5-16 @ 13:08

Code: Select all
015

dma.cpp
+ Add POD save/load DMA_controller NULL checks

void DmaController::SaveState( std::ostream& stream )
void DmaController::LoadState( std::istream& stream )


NOTES:
Should fix savestate crashes with tandy / cga modes. And likely pcjr.
You do not have the required permissions to view the files attached to this post.
tikalat
Member
 
Posts: 287
Joined: 2012-4-13 @ 16:39

Re: Save States - Proof of concept

Postby ykhwong » 2012-5-16 @ 17:29

Yes, that fix works as expected for those machines. :)
The midi does not cause crash. However, MIDI_RawOutByte() is still stucked while loading states. I am looking into this.
ykhwong
Oldbie
 
Posts: 627
Joined: 2004-3-17 @ 15:35

Re: Save States - Proof of concept

Postby tikalat » 2012-5-16 @ 18:08

Ugh. Guess I'll try a very clean build and see how it goes on my end.


Code: Select all
016

mouse.cpp
+ Add full POD support

dosbox.cpp
+ Add Sdlmain POD support

sdlmain.cpp
+ Add mouse autolock POD support


NOTES:
Fixes Krondor mouse loadstates from CMOS.


Now I notice that CMOS Krondor loading doesn't detect my in-game saves. o_o
You do not have the required permissions to view the files attached to this post.
tikalat
Member
 
Posts: 287
Joined: 2012-4-13 @ 16:39

Re: Save States - Proof of concept

Postby tikalat » 2012-5-16 @ 23:39

Code: Select all
017


dma.cpp
+ Compile error: Add missing sstream header
+ Add class DMAChannel functions
(avoid raw class POD saving)


dma.h
+ Compile error: Add missing DMAController prototypes
+ Add class DMAChannel functions


poly.h
+ Compile error: constuctor


sdlmain.cpp
+ Add sergm MT-32 changes (GUI options)


memory.cpp
+ Add full POD support



018

int10_char.cpp, int10_putpixel.cpp
+ Use h-a-l-9000's pcjr patch


NOTES:

017 = fixes compile errors, add -missing- memory POD
(fixes more loadstate crashes / hangs)

018 = adds h-a-l-9000's pcjr patch


I've changed dma.cpp to -not- write out a -class- as a raw POD. Heard this can cause unexpected problems.


When I mention CMOS, I've disabled the loadstate program check (my private build only). So I'm at a pure CMOS prompt when doing loadstate testing.


If external midi still locks up your emulator, only the non-sysex flushing would cause a pure problem. Are you hooking up a real mt-32?
You do not have the required permissions to view the files attached to this post.
tikalat
Member
 
Posts: 287
Joined: 2012-4-13 @ 16:39

Re: Save States - Proof of concept

Postby ykhwong » 2012-5-17 @ 03:31

tikalat wrote:If external midi still locks up your emulator, only the non-sysex flushing would cause a pure problem. Are you hooking up a real mt-32?

No, I am using default Windows midi device.

Edit: I had to remove "while( midi.cmd_pos != 1 )" in MIDI_State_LoadMessage() to make it work.
ykhwong
Oldbie
 
Posts: 627
Joined: 2004-3-17 @ 15:35

Re: Save States - Proof of concept

Postby tikalat » 2012-5-17 @ 15:56

Code: Select all
019

midi.cpp
+ Add midi msg reset (loadstate)
+ New midi cmd flushing method (loadstate)


midi_mt32.h
+ Using 'pure' dac = set 1/2 reverb output gain
(per readme)


NOTES:
New MIDI loadstate handler - throws invalid messages to cut current transfers. Also fixes a MIDI loadstate bug caused by random results of interrupting a MIDI transfer.

And forcing MUNT 'pure dac' to set reverb gain to 1/2 of 'normal dac' (readme). Doesn't seem to normally do this from what I can see in MUNT.



I kinda see where the DOS file loading problem is (CMOS loadstate). Still need to what to do about this.
You do not have the required permissions to view the files attached to this post.
tikalat
Member
 
Posts: 287
Joined: 2012-4-13 @ 16:39

Re: Save States - Proof of concept

Postby tikalat » 2012-5-18 @ 15:18

Code: Select all
020

dos_files.cpp
= Change to class POD support (Files)
= save state rewrite (class POD support)


dos_system.h
+ Add POD support (DOS_Drive)
= Change to class POD support (DOS_File)
= Enforce virtual use (DOS_Drive)


drives.cpp
+ Add POD functions (DOS_Drive)


part.h
= Enforce virtual use (Part)


cpu.h
= Enforce virtual use (Descriptor)


(misc cleanup)


NOTES:
Big thing is DOS drive POD - saves current directory. Fixes missing file errors (ex. loading Krondor from CMOS)

Reworked DOS files POD to be cleaner - relies on classes to do work.

Added in virtuals to enforce that the right POD structure is saved (fixes possible errors with MUNT rhythm + CPU descriptors)


POD support should be functioning at a high stable level. Minus Adlib or Paging. Or some rarer stuff like xms/ems callbacks. Or glide.

Haven't had any MIDI hangs yet.
You do not have the required permissions to view the files attached to this post.
tikalat
Member
 
Posts: 287
Joined: 2012-4-13 @ 16:39

Re: Save States - Proof of concept

Postby tikalat » 2012-5-19 @ 14:04

Code: Select all
021

midi.cpp
+ Fix MIDI polyphony (+ aftertouch poly) (loadstate)
You do not have the required permissions to view the files attached to this post.
tikalat
Member
 
Posts: 287
Joined: 2012-4-13 @ 16:39

Re: Save States - Proof of concept

Postby tikalat » 2012-5-19 @ 16:37

Code: Select all
022

midi.cpp
+ Fixes a big logging mistake in setting note-off polyphony


NOTES:
Can re-use old savestates from 021.
You do not have the required permissions to view the files attached to this post.
tikalat
Member
 
Posts: 287
Joined: 2012-4-13 @ 16:39

PreviousNext

Return to DOSBox Patches

Who is online

Users browsing this forum: No registered users and 1 guest