VOGONS


Quake2 + Acebot for DOSBox (128mb)

Topic actions

Reply 300 of 862, by ggorts_

User metadata
Rank Newbie
Rank
Newbie

The directory /wattcp/bin/ has wattcp.cfg. Placed this "watt" configuration file in the directory along with q2.exe and modified settings. There is even a setting: pkt.near_ptr = 1 ; optional (djgpp only). It also has settings for logging to a file.

Reply 301 of 862, by Maraakate

User metadata
Rank Oldbie
Rank
Oldbie

I don't know how to say it without being an ass... but I really don't care about this whole nearptr bullshit trying to run in windows dos boxes. It's a mess and I already discussed this recently with Taniwha who used to be a fairly prolific DJGPP developer back in it's hey-day. He said the biggest issues I'm going to run into is that the conventional_base shifts around even between malloc and friends in Windows so you would have to wrap around all of it and years ago we tried this with QDOS and it was too much to do and we ended up leaving it be.

You're probably never going to get it to work properly in NTVDM or Win9x DOS BOX because of the real2ptr address constantly moving around. A large overhaul of the code and all it's libraries is probably necessary to convert everything to work properly. Another option might be Watcom, but again everything has to be converted over for this. I'm 100% not interested and I'm not interested in seeing snippets of code unless it's something that works and is ready to merge for such a project like this.

I know you're pretty hell-bent on trying to get this to work, but this entire project is intended for people with actual DOS computers with Sound Blasters and Gravis UltraSounds (GUS preferred 😉). Being able to play it properly in DOSBox, QEMU, (insert favourite VM/Emulator here) is just a nice side-effect. If you want to play the game with all it's extra enhacements (and I've personally spent wayyyy too much time on adding them all in and sezero has spent a massive amount of time auditing all of my changes to catch any potential creeper bugs) then compile it in Visual Studio 6. It can probably be upgraded to compile on modern Visual Studio considering the code compiles just fine in GCC 4.84 if this is an issue for you.

Not only will you get to experience it in Windows, properly, but on modern computers it actually runs faster in Windows than it does in DOS. On my older DOS computers it is the other way around.

...That being said. I can give you potential clues if you really must keep playing with it. That endtime change is a good catch and may be why s_mixahead actually works properly in Q2 (in Quake 1 it basically doesn't work at values past 0.4 and this can be a semi-hacky way to play 44100 on a slow computer at the expense of the sounds obviously being delayed by half a second). The crash is happening at the memset after the real2ptr for grabbing the DMA address. You can also try building a null video build and see if it still crashes at the memset. You're going to have to eliminate things one by one until you can actually get sound working in a Windows dos box. This is how I would do it. A good utility in Windows for comparing Q1 to Q2 files is BeyondCompare. There's a freeware alternative out there but I forget it's name.

Other side notes is that I have already tried compiling with DJ 2.03 with GCC 2.95 with OGG removed and all those friends (except WATT32) and still had the problem.

Inlining the vector math functions is probably worth it, but I haven't gotten around to it yet.

If you ever make it work, then I'll be glad to see the entire code project (no DIFFs, please). But please, no more discussion of it. To me it is senseless and everyone working on the project feels the same way.

Reply 302 of 862, by ggorts_

User metadata
Rank Newbie
Rank
Newbie

Thank you for the helpful information. I will read it more carefully today, but I have news. Q2Dos is working in a 95 dos box. Here is the necessary code change:

--- snd_sb-ORIG.c	2015-07-22 21:21:22 +0000
+++ snd_sb.c 2015-07-23 00:32:32 +0000
@@ -452,13 +452,13 @@ qboolean BLASTER_Init(void)
dma_buffer = (short *) real2ptr(realaddr);
dma_size = size;

- memset(dma_buffer, 0, dma_size);
+ //memset(dma_buffer, 0, dma_size);

dma.samples = size/(dma.samplebits/8);
dma.samplepos = 0;
dma.submission_chunk = 1;
dma.buffer = (unsigned char *) dma_buffer;
- dma.samples = size/(dma.samplebits/8);
+ // dma.samples = size/(dma.samplebits/8);

StartDMA();
StartSB();

I also temporarily attached a q2.exe binary until the result is verified.

There was a wattcp.cfg file in the q2dos directory and this parameter was set:
pkt.near_ptr = 1 ; optional (djgpp only)
However, I don't think that was necessary to find the above result.

Edit: removed attached binary for testing, "Q2Dos binary for 95 dos box".

Last edited by ggorts_ on 2015-07-23, 10:09. Edited 1 time in total.

Reply 303 of 862, by Maraakate

User metadata
Rank Oldbie
Rank
Oldbie

I never noticed dma.samples is being set twice. I have to test with the memset. GUS still crashes but I haven't seen if that's also in there twice, though I'm unsure why that would cause an issue. But thanks for this.

Reply 306 of 862, by ggorts_

User metadata
Rank Newbie
Rank
Newbie

The only change should be disabling extra functions in makefile (but for cd audio). I will run a difference file between the entire source from your branch and the modified one, although I don't recall other changes.

Edit: just realized I changed settings in the ms dos box in 95 (such as fast paste off).

Reply 307 of 862, by ggorts_

User metadata
Rank Newbie
Rank
Newbie

The full set of changes...

diff -rupN q2-ORIG//dos/snd_sb.c q2//dos/snd_sb.c
--- q2-ORIG//dos/snd_sb.c 2015-07-22 21:21:21 -0400
+++ q2//dos/snd_sb.c 2015-07-23 00:32:31 -0400
@@ -452,13 +452,13 @@ qboolean BLASTER_Init(void)
dma_buffer = (short *) real2ptr(realaddr);
dma_size = size;

- memset(dma_buffer, 0, dma_size);
+ //memset(dma_buffer, 0, dma_size);

dma.samples = size/(dma.samplebits/8);
dma.samplepos = 0;
dma.submission_chunk = 1;
dma.buffer = (unsigned char *) dma_buffer;
- dma.samples = size/(dma.samplebits/8);
+ // dma.samples = size/(dma.samplebits/8);

StartDMA();
StartSB();
diff -rupN q2-ORIG//dos/sys_dos.c q2//dos/sys_dos.c
--- q2-ORIG//dos/sys_dos.c 2015-07-22 21:21:21 -0400
+++ q2//dos/sys_dos.c 2015-07-22 23:56:47 -0400
@@ -20,7 +20,7 @@
#include <sys/nearptr.h>
#include <conio.h>

-int _crt0_startup_flags = _CRT0_FLAG_UNIX_SBRK; // FS: Fake Mem Fix (QIP)
+// int _crt0_startup_flags = _CRT0_FLAG_UNIX_SBRK; // FS: Fake Mem Fix (QIP)

#include "dosisms.h"
#include "../qcommon/qcommon.h"
diff -rupN q2-ORIG//makedxe3.frank q2//makedxe3.frank
--- q2-ORIG//makedxe3.frank 2015-07-22 21:21:21 -0400
+++ q2//makedxe3.frank 2015-07-22 23:21:22 -0400
@@ -1,24 +1,24 @@
# features selection :
#
# gamespy/server browser:
-USE_GAMESPY=1
+USE_GAMESPY=0
# dynamically linked gamespy:
-GAMESPY_DXE=1
+GAMESPY_DXE=0
# libcurl/http downloads:
-USE_CURL=1
+USE_CURL=0
# ogg/vorbis music:
-USE_OGG=1
+USE_OGG=0
# use tremor library for ogg/vorbis:
-USE_TREMOR=1
+USE_TREMOR=0
# pci sound card support:
-USE_SNDPCI=1
+USE_SNDPCI=0
# cd audio support:
USE_CDAUDIO=1
# abrash's asm optimizations:
USE_ASM=1

Show last 5 lines
 CC = gcc
-CFLAGS = -g -Wall -O2 -fno-strict-aliasing -fomit-frame-pointer
+CFLAGS = -g -O2 -fno-strict-aliasing -fomit-frame-pointer
CPPFLAGS = -DREF_HARD_LINKED -DCLIENT_SPLIT_NETFRAME
LDFLAGS =

Also, ran strip.exe on q2 binary.

Reply 308 of 862, by Maraakate

User metadata
Rank Oldbie
Rank
Oldbie

The most interesting is the removal of the CRT0 flag.

DJGPP says this about it:

_CRT0_FLAG_UNIX_SBRK

If set, the sbrk algorithm resizes memory blocks so that the layout of memory is set up to be the most compatible with Unix sbrk expectations. This mode should not be used with hardware interrupts, near pointers, and may cause problems with QDPMI virtual memory.

A long time ago QIP posted this as a fix for incorrect memory sizes being reported to Q1 (which was an issue because of it's weird zone/scache manager). I wonder if that's all the problem was all along.

Reply 310 of 862, by Maraakate

User metadata
Rank Oldbie
Rank
Oldbie

The most interesting aspect is all that flag is necessary to get the crashing to stop. However, LFB modes still crash, but banked is OK. I have to test if LFB is OK in real DOS.

Reply 311 of 862, by ggorts_

User metadata
Rank Newbie
Rank
Newbie

I didn't mention earlier, but opencp doesn't work (so far for me) in XP ntvdm. I went over a dozen code samples using auto-init dma and some of the corresponding binaries show the same issue as q2dos, even though the code is short. I think ntvdm dpmi is not made for sound compatibility. 😀

Reply 313 of 862, by Maraakate

User metadata
Rank Oldbie
Rank
Oldbie

Also recompiling with this flag instead works just as well and sounds more appropriate to use:

_CRT0_FLAG_NONMOVE_SBRK

If set, the sbrk algorithm uses multiple DPMI memory blocks which makes sure the base of CS/DS/SS does not change. This may cause problems with sbrk(0) values and programs with other assumptions about sbrk behavior. This flag is useful with near pointers, since a constant pointer to DOS/Video memory can be computed without needing to reload it after any routine which might call sbrk.

Reply 315 of 862, by Maraakate

User metadata
Rank Oldbie
Rank
Oldbie

Well the CS/DS/SS is shifting around in Windows which is the cause of the crashes from real2ptr with nearptr so that flag sounds like you would still get SBRK (which apparently was needed for the fake memory issue but maybe DJGPP has since resolved this in 2.04+) but not have to chase every nearptr everywhere and wrap it around to verify its value, which was the exact problem we had in QDOS a long time ago and I always wondered how ID was even able to get it all to work since the code was basically all the same.

Reply 316 of 862, by Maraakate

User metadata
Rank Oldbie
Rank
Oldbie

Also, works perfect in real DOS. I noticed in Windows... memstats shows only using virtual memory (which I guess windows takes over and does what it needs) but in DOS memory usage is still working properly. The one machine has 1GB RAM and reports the proper amount (previously original Q1 would show negative values before using SBRK!). It looks like that oneliner you found was the biggest issues of all!

Reply 317 of 862, by neozeed

User metadata
Rank Newbie
Rank
Newbie
Maraakate wrote:

Also, works perfect in real DOS. I noticed in Windows... memstats shows only using virtual memory (which I guess windows takes over and does what it needs) but in DOS memory usage is still working properly. The one machine has 1GB RAM and reports the proper amount (previously original Q1 would show negative values before using SBRK!). It looks like that oneliner you found was the biggest issues of all!

Un-freaking real. What a nightmare this has been.

Good job for everyone finding this, it's going to make those additional Quake2 MS-DOS users happy!!!! 😎

Without a doubt the MS-DOS version will be the best Q2, ever!

Reply 318 of 862, by Maraakate

User metadata
Rank Oldbie
Rank
Oldbie

That one liner also fixed QDOS to work now as well. LFB (or at least I assume it is LFB writes because the one resolution only is reported by VBE) works there so there's a way we are using the writes to LFB address being wrong in windows, but it's stil lquite amazing to see it working now.