VOGONS


First post, by tcostin

User metadata
Rank Newbie
Rank
Newbie

Hello:

long story short, I wished to run an old DOS TSR called Game Wizard. I downloaded a (shareware) copy from this site: http://www.dosmuseum.com/pages/view.php?ref=5 … 24&archive=0&k=

Note that this is GW 2.50; an older version (2.20) caused DosBox to go into an infinite loop right upon startup.

Anyway, v2.50 of the program seemed to work. It's a TSR that you break into as your game is running in order to make edits to memory realtime. Breaking into GW worked, I could use its functionality alright, but whenever I tried to return to what was running before (even command prompt), DosBox would crash.....

I think I have tracked down the issue; GW seems to pause/resume sound coming from the SB (which is a good idea if you're breaking in the middle of sound effects), but doesn't check very carefully the state of the SB (or is buggy or interacts poorly with emulated SB). When returning from GW, one of the last things it does is issue a resume command which is responsible for the crash.

After getting the DosBox code to compile on Windows, I traced down the crash and made the following patch:

DosBox 0.74 --- sblaster.cpp

function DSP_DoCommand(), line 920:

===ORIGINAL===
case 0xd4: /* Continue DMA 8-bit*/
if (sb.mode==MODE_DMA_PAUSE) {
sb.mode=MODE_DMA_MASKED;
sb.dma.chan->Register_Callback(DSP_DMA_CallBack);
}
break;

===PATCHED===
case 0xd4: /* Continue DMA 8-bit*/
if (sb.mode==MODE_DMA_PAUSE) {
sb.mode=MODE_DMA_MASKED;
if (sb.dma.chan != NULL) sb.dma.chan->Register_Callback(DSP_DMA_CallBack);
}
break;

Hope this is useful...
-TC

Reply 2 of 18, by tcostin

User metadata
Rank Newbie
Rank
Newbie

I'm no expert on SB emulation (in fact I know next to nothing about SB emulation), but I'm inclined to assume you're right. I've made and tested another patch, which also works for this particular program:

v0.74, sblaster.cpp
function DSP_DoCommand(), line 900:

===ORIGINAL===
case 0xd0: /* Halt 8-bit DMA */
// DSP_ChangeMode(MODE_NONE);
// Games sometimes already program a new dma before stopping, gives noise
sb.mode=MODE_DMA_PAUSE;
PIC_RemoveEvents(END_DMA_Event);
break;

===PATCHED===
case 0xd0: /* Halt 8-bit DMA */
// DSP_ChangeMode(MODE_NONE);
// Games sometimes already program a new dma before stopping, gives noise
if (sb.mode == MODE_DMA || sb.mode == MODE_DMA_MASKED) {
sb.mode=MODE_DMA_PAUSE;
PIC_RemoveEvents(END_DMA_Event);
}
break;

It's possible that only one, or neither, of the modes I'm testing for is the 'correct' one from which one could go to the PAUSE state. I don't know enough about the SB core to make an informed call; this is just what seemed reasonable to me though I'm sure someone on the dev team knows the right setup.

Still... I'm willing to bet there is at least one buggy SB script out there that relies on being able to switch from <random> to paused?

Reply 3 of 18, by wd

User metadata
Rank DOSBox Author
Rank
DOSBox Author

I'd use sb.mode!=MODE_NONE for that, but not sure in what state the soundblaster
or the emulation should be if there's a "pause" then "continue" call when there's been
no previous playing. Maybe this was/can be used as sort of initialization, though in the
current code it would definitely be broken. Harekiet may know.

Thanks for the details on this.

Reply 4 of 18, by jomalin

User metadata
Rank Newbie
Rank
Newbie

Hi! Few months ago I tried to run a newer version of DOS Game Wizard (2.80 I think, can't remember exactly, I got the last GW version) and it crashed to me too. So, I'm very interested in this fix, will this be incorporated to the next version of Dosbox 0.75?

Reply 8 of 18, by HunterZ

User metadata
Rank l33t++
Rank
l33t++

You also might try contacting one of the enhanced SVN build maintainers and seeing if they might be interested in incorporating this patch into their build(s).

Reply 11 of 18, by Dominus

User metadata
Rank DOSBox Moderator
Rank
DOSBox Moderator

jomalin, you really need to learn patience. And you really need to learn to read.
wd already responded that it is likely that this patch makes it into the next version of DOSBox. Everything said about it.
Bumping threads in this way is not welcomed...

Windows 3.1x guide for DOSBox
60 seconds guide to DOSBox
DOSBox SVN snapshot for macOS (10.4-11.x ppc/intel 32/64bit) notarized for gatekeeper

Reply 13 of 18, by jomalin

User metadata
Rank Newbie
Rank
Newbie

As we can see in DosBox changelog:
http://source.dosbox.com/dosboxsvn.txt

Now it seems that this fix will be integrated into the next DosBox version:

2011-04-19 19:46 c2woody

* [r3696] src/hardware/sblaster.cpp: fix sb halt/continue sequence
when no transfer in progress (thanks to tcostin, fixes some
GameWizard crash)

Thanks tcostin and c2woody

Reply 14 of 18, by HunterZ

User metadata
Rank l33t++
Rank
l33t++

Looks like both the EmuCR vanilla and Ykhwong enhanced SVN builds should have that fix already included now too, as the latest builds of each at the time of this post are based on SVN r3706 and r3704 respectively.

Reply 15 of 18, by peterferrie

User metadata
Rank Oldbie
Rank
Oldbie

and the reason why GW 2.20 hangs in DOSBox is because of a bug in GW. It has a protection layer but someone forgot to encrypt a section of the file, so when it gets "decrypted", it actually gets encrypted and can't run.

Reply 18 of 18, by wd

User metadata
Rank DOSBox Author
Rank
DOSBox Author

I don't know what zip you have and where this is from, but the regular version
comes with a full installer that cross-crypts parts according to bios data and thus
only runs on the respective PC/dosbox installation.