DOSBox Compilation Guides

General information and assistance with DOSBox.

DOSBox Compilation Guides

Postby DosFreak » 2017-8-30 @ 20:53

The intent of the attached guides is to update the documentation on the DOSBox WIKI:
https://www.dosbox.com/wiki/BuildingDOSBox


Credits:
gandhig (For reviewing the guide and providing corrections and testing)
Qbix
Neozeed
All the people that wrote the guides that I read to make this one.
Attachments
DOSBOXMingw64.txt
(14.74 KiB) Downloaded 10 times
DOSBOXMINGW.txt
(20.33 KiB) Downloaded 5 times
mingwrt-5.0.1-mingw32-dev-bug2357.zip
(943.84 KiB) Downloaded 2 times
dosboxsvn-10262017-mingw64710-NT351+.zip
(9.26 MiB) Downloaded 10 times
dosboxsvn-10262017-mingw630-NT351+.zip
(8.58 MiB) Downloaded 12 times
DXSDKFEBJune2010forSDL1.2.x.zip
(275.23 KiB) Downloaded 7 times
MINGW64-5.0.2-DXfiles-for-MINGW32.zip
(101.36 KiB) Downloaded 5 times
DOSBOXVisualStudioMultTarget.txt
(29.76 KiB) Downloaded 17 times
DOSBOXVisualStudioIndiv.txt
(38.36 KiB) Downloaded 28 times
vbempj.zip
(125.83 KiB) Downloaded 24 times
Q932590.zip
(206.91 KiB) Downloaded 27 times
SDL_net-1.2.8-NT351-95-NT4forGCC.zip
(587.46 KiB) Downloaded 34 times
dosboxsvn09182017-351tovista.zip
(6.29 MiB) Downloaded 28 times
vc6redistsetup_enu.zip
(1.71 MiB) Downloaded 35 times
User avatar
DosFreak
l33t++
 
Posts: 9493
Joined: 2002-6-30 @ 16:35
Location: Your Head

Re: DOSBox Compilation Guides

Postby DosFreak » 2017-9-21 @ 12:03

COMPILING DOSBOX
https://github.com/aqualung99/dosbox-0. ... 75GLES.txt
https://www.chocolate-doom.org/wiki/ind ... ing_Cygwin
https://github.com/msys2/msys2/wiki/MSYS2-installation
MAC: https://hexeract.wordpress.com/2016/09/ ... cos-sierra

MSVC
Look into compiling from CLI https://doc.libretro.com/compilation/wi ... c-cmdline/
Update VS guides with mingw-w64 guide updates.
Repositories vs zips. Test
Use vbempj.zip for NT3.51
Instructions for 64bit DOSBox (not recommended due to slow dynrec)
If dynamic then list redist as requirement
Updated MSVC guide with MINGW64 guide changes
diff against SDL and DOSBOX for changes? Mabye provide both methods.
Use Mingw with Visual Studio https://stackoverflow.com/questions/156 ... le-project
SDL_NET 1.2.7 vs 1.2.8
VS compiled DOSBox with /MT does not require msvcrt.dll
Command to gather all executables and dlls
Equivalent to "make clean"
Need to verify dependencies work in dosbox
Possible issue with SDL_Sound http://www.vogons.org/viewtopic.php?t=39101&p=354759
Add DOSBox files to package
Precompiled libraries
static link libraries or not?
viewtopic.php?t=3944
PNGLIB PATCH viewtopic.php?f=32&t=53116&p=573451#p573451
Verify SDL_SOUND and other sound libriaries and see if they work.
Comment vs removing issues in dependencies.
For pnflibconf.h bug look into putting in troubleshooting section.
Download free versions of Visual Studio Versions and Platform and Windows SDKs. https://en.wikipedia.org/wiki/Microsoft_Windows_SDK

NT3.51 requirements: MSVCRT
95 requirements: Winsock2, OpenGL, IE4 Active Desktop, MSVCRT
NT4 requirements: IE4 Active Desktop

GIT
GIT vs VisualSVN and TortoiseSVN
Visual Studio 2017 GIT support
https://git-for-windows.github.io/

Relative paths for projects:
If C:\BUILD\Dosbox
then should be able to point to $(ProjectDir)..\whatever or ..\whatever

STATIC LINK TO MSVCRT.dll like MS does for programs that come with Windows?
May have to use /MD with WDDK 2003 SP1 compiler or PSDK 2003 SP1
Windows Server 2003 SP1 Platform SDK https://www.microsoft.com/en-us/downloa ... x?id=12261
or mabye link with the 7600.16385.1 WDK
http://planet.jboss.org/post/fighting_t ... t_dll_hell

https://hero.handmade.network/forums/co ... on_windows
http://bearwindows.zcm.com.au/msvc.htm#c8

OPERATING SYSTEM COMPATIBILITY

COMPILE DOSBOX WITH COMPILERS THAT DO NOT SUPPORT WINDOWS 95

Blackwingcat vcfix
http://blog.livedoor.jp/blackwingcat/ar ... 52362.html

To use:
-----------------------
add to dosbox.cpp
#define WINVER2 0x0400
#include "commonfix.h"

and add commonfix.h to the dosbox\src directory for now.
--------------------------------------------

VS2005 compiled DOSBox

Windows 95 missing:
InterlockedCompareExchange (Fixed with LegacyExtender)

VS2010 compiled DOSBox

Windows 95 missing:
EncodePointer (Fixed with LegacyExtender)
DecodePointer (Fixed with LegacyExtender)
FindFirstFileExA
HeapSetInformation (Fixed with LegacyExtender)

VS2012 compiled DOSBox

Windows 95 missing:
InitializeCriticalSectionEx
EncodePointer
DecodePointer
GetModuleHandleExW
FindFirstFileExW
InitOnceExecuteOnce
SetFilePointerEx
FlsAlloc
FlsGetValue
FlsSetValue
FlsFree
GetTickCount64
CompareStringEx
GetLocaleInfoEx
GetUserDefaultLocaleName
LCMapStringEx
IsValidLocaleName
EnumSystemLocalesEx

MINGW

LOW
Repositories vs zips. Test on mingw32 and mingw64
Use vbempj.zip for NT3.51
diff against SDL and DOSBOX for changes? Mabye provide both methods.
SDL_NET 1.2.7 vs 1.2.8 OS compatibility
Add DOSBox files to package
Precompiled libraries? Any point?
DOSBox Debug viewtopic.php?t=3944
QtCreator vs Codeblocks

Check sdl_net and verify if changes for NT 3.51 and 9x are needed.
Check gandhig PM for SSE executables for Windows 95.
Possible mouse issue with SDL 1.2.15 and 9x. Mouse cursor frozen on exiting DOSBox sometimes. Execute dosbox again to unfreeze.
https://sourceforge.net/p/scummvm/bugs/5859/
---------------
NT3.50
w32api
winbase.h
getsystemtimeasfiletime

To make a working VICE SDL binary for Windows NT 3.50 the following needs to be done:

- Compile SDL without DX, GL and joystick support:

SDL_config_win32.h

REMOVE:
#define SDL_AUDIO_DRIVER_DSOUND 1
#define SDL_VIDEO_DRIVER_DDRAW 1
#define SDL_VIDEO_OPENGL 1
#define SDL_VIDEO_OPENGL_WGL 1

SDL_config_win32.h
ADD
#define NO_CHANGEDISPLAYSETTINGS 1

SDL.DSP

REMOVE
Directx.h
SDL_dx5audio.c
SDL_dx5audio.h
SDL_dx5events.c
SDL_dx5events_c.h
SDL_dx5video.c
SDL_dx5video.h
SDL_dx5yuv.c
SDL_dx5yuv_c.h
SDL_joystick.c
SDL_joystick_c.h
SDL_mmjoystick.c
SDL_sysjoystick.h


C:\Mingw\msys\1.0\home\XXX\BUILD\DOSBOX\3.50\SDL-1.2.15\include\sdl_config_win32.h
#define SDL_JOYSTICK_DISABLED 1

------------------------
zips vs version control

SDL - online newer
SDL_net - online newer
sdlsound online newer


flac same
zlib same
libpng same
libogg same
libvorbis same

HIGH
Instructions for 64bit DOSBox (not recommended due to slow dynrec)
Verify dependencies work in dosbox
Possible issue with SDL_Sound http://www.vogons.org/viewtopic.php?t=39101&p=354759
Compile automake,gawk,libtool for mingw from here: https://ftp.gnu.org/gnu/
Compile pkg-config for mingw https://pkg-config.freedesktop.org/releases/?C=M;O=D

Procedures for testing:
screenshot CTRL+F5
video capture CTRL+ALT+F5
networking IPX and modem
bin/cue CD audio,flac,ogg,mp3

Remove MSVCRT dependency:
http://nullprogram.com/blog/2016/01/31/
https://stackoverflow.com/questions/730 ... pendencies





LINUX HOST
https://lists.gnu.org/archive/html/ming ... 00045.html
Cross compile Linux to Windows

It is also possible to cross compile from Linux to windows using the MinGW cross tools and even to run the test suite under Wine, the Linux/*nix windows emulator.

On Debian and Ubuntu systems, these cross compiler tools can be installed by doing:

sudo apt-get mingw32 mingw32-binutils mingw32-runtime wine
Once these tools are installed its possible to compile and test by executing the following commands, or something similar depending on your system:

./configure --host=i586-mingw32msvc --target=i586-mingw32msvc --build=i586-linux
make
make check


DOSBOX COMPILED WITH VS2008 (Runs on NT3.51)

Windows NT 3.5 SP0

KERNEL32.DLL
GetSystemTimeAsFileTime

USER32.DLL (Need to remove fullscreen support in SDL)
ChangeDisplaySettingsA
EnumDisplaySettingsA

WINMM.DLL (Need to remove joystick support from SDL)
joyGetPosEx

Missing APIs in Windows NT 3.10:

KERNEL32.DLL:
CompareStringA (only CompareStringW exists)
EnumSystemLocalesA (only EnumSystemLocalesW exists)
GetLocaleInfoA (only GetLocaleInfoW exists)
GetStringTypeA (only GetStringTypeW exists)
GetSystemTimeAsFileTime
GetVersionExA (only non-Ex version GetVersion available)
LCMapStringA (only LCMapStringW exists)

USER32.DLL
ChangeDisplaySettingsA
CreateIconFromResourceEx (only non-Ex version CreateIconFromResource available)
EnumDisplaySettingsA
GetKeyboardLayout
LoadImageA (only LoadBitmapA exists)
MapVirtualKeyExA (only non-Ex version MapVirtualKeyA available)
ToAsciiEx (only non-Ex version ToAscii available)

WINMM.DLL
joyGetPosEx (only non-Ex version joyGetPos available)

GDI32.DLL
CreateDIBSection
GetDeviceGammaRamp
SetDIBColorTable
SetDeviceGammaRamp

OLE32.DLL (whole file is missing in NT 3.10 retail and SP3)
CoInitialize


BUILDBOT


Need to look into either a #define to remove ActiveDesktop or a fallback if no Active Desktop found.


THIRD PARTY PATCHES
viewtopic.php?f=32&t=35256&p=301919#p301814
https://blogs.msdn.microsoft.com/chuckw ... rtain-age/
Pixel Perfect Patch
https://roadtoalm.com/2013/10/22/use-vi ... cal-files/
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\vsdiffmerge.exe
http://gnuwin32.sourceforge.net/packages/patch.htm

SDL2 on Windows 2000
https://www.tapatalk.com/groups/win2kga ... t1073.html
viewtopic.php?f=32&t=34770&start=60#p537272

MIDI
https://www.dosbox.com/wiki/MIDI_software_devices
viewtopic.php?f=33&t=55993

MUNT Windows 98

A multi-platform software synthesiser emulating (somewhat inaccurately) pre-GM MIDI devices such as the Roland MT-32, CM-32L, CM-64 and LAPC-I. In no way endorsed by or affiliated with Roland Corp.

viewtopic.php?f=40&t=55981

OPL3
https://sourceforge.net/p/dosbox/patches/270/
viewtopic.php?f=41&t=49327

XBRZ
viewtopic.php?f=41&t=34125

NE2000
https://sourceforge.net/p/dosbox/patches/238/

VSYNC
viewtopic.php?f=41&t=35535
viewtopic.php?t=37148

Check
https://sourceforge.net/p/dosbox/patches/125/


Need to categorize third party patches:
What are the "necessary" third party patches?
cross-platform
Never will be crossplatform
Already in DOSBox
Never will be in DOSBox
etc

PIXELPERFECT
viewtopic.php?f=41&t=49160&hilit=pixel+perfect&start=420
https://git-scm.com/download/win
Install
Add C:\Program Files (x86)\Git\usr\bin to path variable

Put "diff" in dosbox folder

Run patch -p0 < patchfile

http://gnuwin32.sourceforge.net/packages/rpl.htm


VS2008 does not like "round" identifier. VS2010 should work.
Patch should work with Mingw which works on less than XP.

viewtopic.php?f=41&t=36342



WINDOWS ONLY
http://www.si-gamer.net/gulikoza/

Need to find latest software ver of xbrz (Non-GL)


Shader support for DOSBox Mac,Windows,Lunux. Which patch?
viewtopic.php?f=41&t=36342
https://www.gamingonlinux.com/wiki/Buil ... rom_source
https://lists.freedesktop.org/archives/ ... 00497.html
https://mesamatrix.net/
viewtopic.php?f=32&t=49999&start=20
https://www.dosbox.com/wiki/Cuesheet
viewtopic.php?f=31&t=41610
https://www.dosbox.com/wiki/connectivity
http://gadgets.itwriting.com/2158-getti ... ourse.html
https://web.archive.org/web/20160131005 ... index.html
https://sourceforge.net/p/dosbox/patches/270/
https://sourceforge.net/p/dosbox/patches/260/
https://sourceforge.net/p/dosbox/patches/238/

-----------------------------
OLD

VISUAL STUDIO
Link-time Code Generation
Whole Program Optimization

COMPILERS

VISUAL STUDIO

OFFICIAL
Visual Studio 2003 95-98-NT4-2000
Visual Studio 2005 NT4-98-2000 (NT4 if /MT set)
Visual Studio 2008 NOSP 2000+
Visual Studio 2008 SP1 XP+ (Possibly Windows 2000 with KB816542 and PE header modified)


LIBRARIES

COMPRESSED AUDIO SUPPORT
viewtopic.php?f=32&t=50077
https://www.dosbox.com/wiki/Building_DOSBox_with_MinGW
Game Acronym List
DosBox CVS Builds
DosBox Feature Request Thread
DosBox FAQ
PC Game Compatibility List
"Who's got time to read all the way down to the bottom of an email?"
User avatar
DosFreak
l33t++
 
Posts: 9493
Joined: 2002-6-30 @ 16:35
Location: Your Head

Re: DOSBox Compilation Guides

Postby DosFreak » 2017-9-22 @ 13:03

Got Mesa 7.5.1 to work on Windows 95.

7.10.3 is the last ver to support Visual Studio. 6-13-2011 OpenGL 2.1

Download: https://mesa.freedesktop.org/archive/ol ... 7.x/7.5.1/
Compile with VS2008 and LegacyExtender
EDITVERSION from LegacyExtender should work if not then use VS2005 EDITBIN
EDITBIN from VS2005 C++ Command prompt "editbin /subsystem:windows,4.00 /osversion:4.0 opengl32.dll"
https://www.gamingonlinux.com/wiki/Buil ... rom_source

Copy opengl32.dll to quake 2 directory to test.

https://mesa.freedesktop.org/archive/ol ... .x/7.10.3/
https://wiki.qt.io/Cross_compiling_Mesa_for_Windows
https://wiki.qt.io/MesaLlvmpipe
https://github.com/florianlink/MesaOnWindows


OTHER

EXEVersion may work: http://louis.steelbytes.com/vs2008_vs_win40.html

https://fdossena.com/?p=mesa/build.frag
https://stackoverflow.com/questions/178 ... 7-mesa-9-1


MESA
https://sourceforge.net/projects/msys2/ ... INGW/i686/
https://sourceforge.net/p/mingw-w64/bugs/599/
https://github.com/Alexpux/MINGW-packages/issues/2282
https://github.com/pal1000/mesa-dist-win
http://forums.thedarkmod.com/topic/1786 ... ntry391478

Possible issue with MSYS2 and GCC. Works fine with MSVC
https://github.com/Alexpux/MINGW-packages/issues/2089
mingw-w64-i686 standalone with dwarf exceptions and posix threading
Possibily fixed in GCC 7.2.0
Attachments
95Quake2Mesa7.5.1.PNG
Game Acronym List
DosBox CVS Builds
DosBox Feature Request Thread
DosBox FAQ
PC Game Compatibility List
"Who's got time to read all the way down to the bottom of an email?"
User avatar
DosFreak
l33t++
 
Posts: 9493
Joined: 2002-6-30 @ 16:35
Location: Your Head

Re: DOSBox Compilation Guides

Postby DosFreak » 2017-10-06 @ 18:37

HXRT & HXGUI

PREREQUISITES

MEMORY
If you want to use Dynamic core or use higher than 16mb of memory in DOSBox then you'll need more than 64mb of memory on your host system.
If you have 64mb or less then only normal core and 16mb of memory can be used in DOSBox.

DOSBOX
Download my 3.51 or 95 builds of DOSBox

HXRT & HXGUI
https://sourceforge.net/projects/hx-dos/
https://web.archive.org/web/20140904175 ... de/HX.html
http://sound-dos.ucoz.ru/load/new_hxdos ... 17/1-1-0-8
hxrt217.zip
hxgui217.zip

HIMEMX
*If OS is less than Windows 95 then use HIMEMX or mabye you can use HIMEM.SYS from Windows 95+.

MSVCRT
Download from this thread or Windows 2000 SP4

INSTALL

HXRT & HXGUI
Unzip both into the same folder c:\HX
Add "C:\HX" to your PATH

DOSBOX
Extract DOSBox to C:\DOSBOX

MSVCRT
Copy MSVCRT.DLL to C:\DOSBOX

Copy the following files from Windows 95 C:\Windows\System to C:\DOSBOX
CRTDLL.DLL
GLU32.DLL
OPENGL32.DLL






DOSBOX CONFIGURATION SETTING FOR MAXIMUM PERFORMANCE

fullscreen=true
fullresolution=original
output=surface
Core=dynamic
cpu=pentium_slow
cycles=max
scaler=none
memory=63
machine=svga_s3

TROUBLESHOOTING

VIDEO
If you only get a black screen when loading DOSBox then verify that you have not exited Windows and then tried to start DOSBox. Boot straight to DOS instead.

INPUT
DOSBox with HXRT & HXGUI seems to have issues with the mouse

BENCHMARKS

DOSBox running quake on the host
210 320x200
70 800x600

QUAKE running in DOS under vmware
*fps numbers vary significantly
377 320x200
233 800x600
167 1024x768

DOSBox running quake under hxrt in DOS under vmware
180 320x200
60 800x600
40.7 1024x768

Between DOSBox in DOS (VMWARE) vs DOSBox on the host there isn't much of a difference in speed.
Between Quake in DOS (VMWARE) vs Quake in DOSBOX using HXRT in DOS (VMWARE) there is a big difference.
Attachments
Capture.PNG
Game Acronym List
DosBox CVS Builds
DosBox Feature Request Thread
DosBox FAQ
PC Game Compatibility List
"Who's got time to read all the way down to the bottom of an email?"
User avatar
DosFreak
l33t++
 
Posts: 9493
Joined: 2002-6-30 @ 16:35
Location: Your Head

Re: DOSBox Compilation Guides

Postby DosFreak » 2017-10-30 @ 23:38

Non-DOSBox. CMOV theory with Mingw 4.6+ versions and libraries. True or false? Is objdump accurate? Not relevant for DOSBox but possibly for other projects.

Consolidation of Ryzen posts

NOT RELEVANT TO COMPILING DOSBOX BUT USEFUL FOR CMOV RESEARCH

MANUAL COMPILE OF GCC

Source code for gcc 464:
https://ftp.gnu.org/gnu/gcc/gcc-4.6.4/

1. tar xzf gcc-4.6.4.tar.gz
2. rename gcc-4.6.4 to gcc
2b. Originally ran 3-step bootstrap process for native build, but instead save time and do 1-step for testing
3. cd gcc
4. This was the original configure line, but I don't know yet whether PPro instructions are emitted from this build. Best to specify architecture explicitly in this line and also verify in code that no CMOV code is enabled.
./configure --prefix=$HOME/gcc --enable-languages=c,c++ --disable-sjlj-exceptions --with-dwarf2 --disable-win32-registry --enable-version-specific-runtime-libs --build=mingw32 --prefix=/mingw --disable-libquadmath --disable-libgomp --disable-nls
5. make
6. make install

Source code:
ftp://gcc.gnu.org/pub/gcc/infrastructure/
gmp-6.1.2.tar.bz2
mpfr-3.1.5.tar.gz
mpc-1.0.3.tar.gz

Built the above three libraries using mingw32/gcc462/binutils222.
1. configure shared libraries of gmp/mpc/mpfr for /mingw
./configure --enable-shared --disable-static --prefix=/mingw
3. make; make install


MANUAL COMPILE OF MINGW GCC
https://sourceforge.net/projects/mingw/ ... c-4.8.1-4/
https://sourceforge.net/projects/mingw/ ... tils-2.28/
https://sourceforge.net/projects/mingw/ ... rt-3.21.1/

gcc-c++-4.8.1-4-mingw32-dev.tar.lzma
gcc-c++-4.8.1-4-mingw32-bin.tar.lzma
gcc-core-4.8.1-4-mingw32-bin.tar.lzma
gcc-core-4.8.1-4-mingw32-dev.tar.lzma
binutils-2.28-1-mingw32-bin.tar.xz
libiberty-2.28-1-mingw32-dev.tar.xz
binutils-2.28-1-mingw32-dev.tar.xz
mingwrt-3.21.1-mingw32-dev.tar.xz

gcc-c++-4.8.1-4-mingw32-dll.tar.lzma (C++ runtimes)
gcc-core-4.8.1-4-mingw32-dll.tar.lzma (C runtimes)

The C/C++ runtime files (*.dll) contain PPro instructions but linked staticly then Pentium Pro instructions not included

C++ 11 threading https://github.com/meganz/mingw-std-threads

GCC 4.62 and libraries may not have PPro instructions

MANUAL COMPILE OF MINGW GCC DEPENDENCIES

These are the dependencies in the case of a manual installation of them:
GMP 6.1.2
https://sourceforge.net/projects/mingw/ ... gmp-6.1.2/

gmp-6.1.2-2-mingw32-dev.tar.xz
libgmp-6.1.2-2-mingw32-dll-10.tar.xz

MPFR 3.1.5
https://sourceforge.net/projects/mingw/ ... pfr-3.1.5/

mpfr-3.1.5-1-mingw32-dev.tar.xz
libmpfr-3.1.5-1-mingw32-dll-4.tar.xz

MPC 1.0.3
https://sourceforge.net/projects/mingw/ ... mpc-1.0.3/

libmpc-1.0.3-1-mingw32-dll-3.tar.xz
mpc-1.0.3-1-mingw32-dev.tar.xz

Testing with gcc v493 from here;
https://sourceforge.net/projects/mingw/ ... c-4.9.3-1/

gcc-4.9.3-1-mingw32-src.tar.xz

I recall that the earlier gcc versions have a ready-made configure system, but v493 doesn't. Here is a potential configure line for gcc v493 (--prefix= should be changed accordingly):
./configure --prefix=$HOME/gcc --enable-languages=c,c++ --disable-sjlj-exceptions --with-dwarf2 --disable-win32-registry --enable-version-specific-runtime-libs --build=mingw32 --prefix=/mingw --disable-libquadmath --disable-libgomp --disable-nls --disable-bootstrap --host=mingw32 --with-tune=i386 --with-arch=i386
make install


OLD

The bug report for gcc 4.7 branch shows at least some of the problem in i386.h:
X86_ARCH_CMOV
#define TARGET_CMOV
#define TARGET_CMOVE

This is one section of code which refers to activation of the PPro instruction set. I haven't searched for other examples nor in other branches yet. If the PPro issue is difficult to solve, then these targets may be defined away in the code for testing.

Edit: one possibility is that the GMP library is the cause along the gcc 4.6 branch. Found this in the configure log for it: march=pentium4. In the source code of gcc 4.6.4, couldn't find any examples of *CMOV*, but the GMP library had many references to it.

Perhaps defining "HAVE_HOST_CPU_pentium" in GMP configure.ac will at least fix the issue in GMP?

Edit 2: it is probably necessary to confirm that objdump is producing the correct output by trying another tool and compare the results.

For example, a Quake 2 binary from 1998 shows a single fcmovu instruction from the PPro set. It was presumably built by Visual C++ 5.0 which does have the capability to emit the PPro set.

Edit 3: verified that the gcc 464 custom build had PPro instructions in libgmp while the official gcc 46 version did not. However, the CMOV patch discussed in the previously posted gcc bug report was applied to gcc 464. Also, verified that i386.c/h are the main parts of gcc 464 which have references to the PPro instructions.

Edit 4: tried to verify the PPro instructions predicted by objdump against those generated by gcc itself (gcc -S option). The result was that PPro instructions were already in "libdxguid.a", a third-party available mingw32 library. That probably explains a previous finding of PPro instructions when building with the default gcc 4.6 of mingw32. Requires more testing.

Edit 5: the gcc 3.4 finding was probably a result of false detection of cmovs by a djgpp version of objdump. This version of objdump also detected cmovs in software compiled by gcc versions before the PPro was supported.
Game Acronym List
DosBox CVS Builds
DosBox Feature Request Thread
DosBox FAQ
PC Game Compatibility List
"Who's got time to read all the way down to the bottom of an email?"
User avatar
DosFreak
l33t++
 
Posts: 9493
Joined: 2002-6-30 @ 16:35
Location: Your Head

Re: DOSBox Compilation Guides

Postby DosFreak » 2017-11-21 @ 21:02

ISSUE

When DOSBox (using Directx) is executed on a 9x system then if you try to move the mouse over the DOSBox window then it will either freeze or move erraticly (not captured yet). If captured the mouse works fine in DOSBox.
Also if the mouse is captured by DOSBox and you exit then the mouse will be frozen, you must uncapture the mouse before exiting DO


SDL_dx5events.c and SDL_sysevents.c handle the mouse movements.

SDL_dx5events.c MIGHT be the cause of the mouse issue
SDL_sysevents.c MIGHT be for mouse usage inside DOSBox.

Really both work together so if one is modified the other must be too....if you know what you're doing.

If using DOSBox with WINDIB then no issue.

Issue occurs with SDL 1.2.14 and SDL 1.2.15.


Replacing
C:\Mingw\msys\1.0\home\XXX\BUILD\DOSBOX\95-NT4\SDL-1.2.15\src\video\windx5
SDL_dx5events.c in SDL 1.2.15 with the SDL_dx5events.c from SDL 1.2.13

"fixes" the issue where the mouse doesn't work on the host.


or you can just add the following to SDL_dx5events.c instead:

Replace Lines #373-377 with the following from SDL 1.2.13:

#301 /* If we are in windowed mode, Windows is taking care of the mouse */

#302 if ( (SDL_PublicSurface->flags & SDL_OPENGL) ||

#303 !(SDL_PublicSurface->flags & SDL_FULLSCREEN) ) {

#304 return;

#304 }

Remove Line 551 extra bracket:

#547 if ( xrel || yrel ) {

#548 post_mouse_motion(1, xrel, yrel);
}

#549 }

#550
#551 }


This then causes the mouse to not work inside DOSBox

To fix that then modify:

SDL-1.2.15\src\video\wincommon\sdl_sysevents.c
(See file)

So the SDL 1.2.15 9x minimal package I put together is still the latest I've got. Still looking at it today and it seems like there's not too much more I can do to minimize the changes.

What I'd like to do is fix the bug but I don't think I understand the code enough to do that.

Windows 95-98 with sdl_videodriver=directx
SDL 1.2.15 - When mouse is uncaptured and dragged over the dosbox windown then the mouse may not move or will move all over the screen. When mouse is captured the mouse works fine in dosbox in both window and fullscreen. If you quit DOSBox while the mouse is captured then the mouse will be frozen.

SDL 1.2.15 9x minimal - Same behavior as 1.2.13. Mouse works fine in windowed or full screen in dosbox. Mouse works fine uncaptured.

To my uneducated eyes it looks like mabye SDL is confused about the mouse focus or capture so when the mouse is on the screen then it's captured but mabye it doesn't think that it is? When you quit dosbox then SDL never releases it back to Windows? Mabye the reason it works fine in Windows 2000+ is due to a security feature in the OS that overrides the bug in SDL?

Debating using current fix or just compiling 9x builds with WINDIB only. Don't think there is a downside.



Links:
https://icculus.org/pipermail/quake3-co ... 01365.html
http://diehardwolfers.areyep.com/viewtopic.php?p=89401

https://github.com/spurious/SDL-mirror/tree/SDL12


SDL 1.2.14


Most promising
https://github.com/spurious/SDL-mirror/ ... 266ca8ab3a
https://github.com/spurious/SDL-mirror/ ... 266ca8ab3a

PRIOR COMMIT
https://github.com/spurious/SDL-mirror/ ... 27ee36aec4
https://github.com/spurious/SDL-mirror/ ... 27ee36aec4

git clone https://github.com/spurious/SDL-mirror.git SDL12
cd SDL12
git checkout 140163c34e

OLD

Sept 27, 2009
https://github.com/spurious/SDL-mirror/ ... 157b87e330
https://github.com/spurious/SDL-mirror/ ... 157b87e330

https://github.com/spurious/SDL-mirror/ ... e1c1435608
https://github.com/spurious/SDL-mirror/ ... e1c1435608


https://github.com/spurious/SDL-mirror/ ... 62b82512e3
https://github.com/spurious/SDL-mirror/ ... 62b82512e3


https://github.com/spurious/SDL-mirror/ ... d778e2b937
https://github.com/spurious/SDL-mirror/ ... d778e2b937
Attachments
SDL-1.2.15 9x-Minimal.zip
(16.76 MiB) Downloaded 3 times
SDL-1.2.15 for 9x-toomanymods.zip
(16.71 MiB) Downloaded 3 times
Game Acronym List
DosBox CVS Builds
DosBox Feature Request Thread
DosBox FAQ
PC Game Compatibility List
"Who's got time to read all the way down to the bottom of an email?"
User avatar
DosFreak
l33t++
 
Posts: 9493
Joined: 2002-6-30 @ 16:35
Location: Your Head

Re: DOSBox Compilation Guides

Postby DosFreak » 2017-11-30 @ 23:56

TODO:
Decide on SDL 1.2.15 for 9x or WINDIB only for 9x (Would still leave a TODO: High for fixing SDL on the list tho)
Update guide and mingwrt package with latest patch by Keith from using diff file https://sourceforge.net/p/mingw/bugs/2357/
Check SDL_Sound and dependencies
Recompile dosbox for mingw and mingw-w64 and post builds

No luck from ioquake3 person that submitted dinput patch in SDL. We're on our own.

GCC3.4.5(MinGW 5.1.6) works on Windows 95
gdb 6.3-2 Works on Windows 95
Game Acronym List
DosBox CVS Builds
DosBox Feature Request Thread
DosBox FAQ
PC Game Compatibility List
"Who's got time to read all the way down to the bottom of an email?"
User avatar
DosFreak
l33t++
 
Posts: 9493
Joined: 2002-6-30 @ 16:35
Location: Your Head

Re: DOSBox Compilation Guides

Postby DosFreak » 2017-12-06 @ 18:35

I've been sick since coming back from Thanksgiving. Feel alot better now but haven't felt up to working on the guide, hopefully thursday or friday I can get back to it.
Game Acronym List
DosBox CVS Builds
DosBox Feature Request Thread
DosBox FAQ
PC Game Compatibility List
"Who's got time to read all the way down to the bottom of an email?"
User avatar
DosFreak
l33t++
 
Posts: 9493
Joined: 2002-6-30 @ 16:35
Location: Your Head

Re: DOSBox Compilation Guides

Postby gandhig » 2017-12-10 @ 20:11

DosFreak wrote:No luck from ioquake3 person that submitted dinput patch in SDL. We're on our own.
For some reason unknown to me, the Windows' "ClipCursor" function called by the SDL's "post_mouse_motion" function has no effect on the cursor movement inside the dosbox main text window(directx driver, windowed mode) in Win95.

The issue is not there with SDL 1.2.13, probably due to the handling of the mouse by Windows itself(when the SDL application is in windowed mode) rather than by SDL, as is the case with ver 1.2.15.

Trying still to identify the issue.
Last edited by gandhig on 2017-12-11 @ 17:53, edited 2 times in total.
User avatar
gandhig
Member
 
Posts: 332
Joined: 2014-2-12 @ 08:35

Re: DOSBox Compilation Guides

Postby DosFreak » 2017-12-10 @ 22:23

You were able to state the issue alot more eloquently than I could. heh

According to:
https://msdn.microsoft.com/en-us/library/ee418864.aspx
http://xboxforums.create.msdn.com/forums/t/108722.aspx
https://code.msdn.microsoft.com/windows ... iscussions
https://s547.neocities.org/mouse.html

it's not recommended to use dinput for mouse and keyboard...

DirectInput is a set of API calls that abstracts input devices on the system. Internally, DirectInput creates a second thread to read WM_INPUT data, and using the DirectInput APIs will add more overhead than simply reading WM_INPUT directly. DirectInput is only useful for reading data from DirectInput joysticks; however, if you only need to support the Xbox 360 controller for Windows, use XInput instead. Overall, using DirectInput offers no advantages when reading data from mouse or keyboard devices, and the use of DirectInput in these scenarios is discouraged


Wonder if the ioquake3 commit only benefited ioquake3.
Game Acronym List
DosBox CVS Builds
DosBox Feature Request Thread
DosBox FAQ
PC Game Compatibility List
"Who's got time to read all the way down to the bottom of an email?"
User avatar
DosFreak
l33t++
 
Posts: 9493
Joined: 2002-6-30 @ 16:35
Location: Your Head

Re: DOSBox Compilation Guides

Postby DosFreak » 2017-12-11 @ 00:58

https://github.com/spurious/SDL-mirror/ ... diff=split
https://hg.libsdl.org/SDL/rev/a6f635e5eaa6
https://hg.libsdl.org/SDL/log/4171

sdl_dx5events.c
/* Construct a 1 pixel square RECT that is used to confine the cursor
+ * pointer to a specific pixel using ClipCursor. This is used in
+ * preference to SetCursorPos as it avoids the cursor jumping around as
+ * both the OS and SDL attempt to move it simultaneously. */


hmmm so mabye it's not tracking the coordinates when using the DX driver on 9x when in non relative mode. I'm assuming relative is when the mouse is captured since it works fine inside dosbox. (Mouse cursor hidden and stuck in center of screen).

sdl_sysmouse.c
sys_sysevents.c
Game Acronym List
DosBox CVS Builds
DosBox Feature Request Thread
DosBox FAQ
PC Game Compatibility List
"Who's got time to read all the way down to the bottom of an email?"
User avatar
DosFreak
l33t++
 
Posts: 9493
Joined: 2002-6-30 @ 16:35
Location: Your Head

Re: DOSBox Compilation Guides

Postby gandhig » 2017-12-11 @ 19:01

DosFreak wrote:hmmm so mabye it's not tracking the coordinates when using the DX driver on 9x when in non relative mode. I'm assuming relative is when the mouse is captured since it works fine inside dosbox. (Mouse cursor hidden and stuck in center of screen).
Yes, the non-relative mode seems so, but needs to be re-verified at my end('mouse_relative' variable). I'm assuming that you didn't refer to the 'relative' variable used inside the SDL_PrivateMouseMotion function.

That aside, observations(subject to edit, later) as per my current understanding are,
Code: Select all
a) In dosbox 'windowed' as well as 'fullscreen' mode (Win95), the mouse cursor movement inside the SDL Window(i.e. dosbox Z prompt) is taken care of by the SDL's post_mouse_motion function, which in turn utilizes Windows' ClipCursor function to supposedly move the Cursor to the calculated position inside the dosbox window, based on the inputs received from the actual hardware & reported through the Direct Input interface/mouse device object. But ClipCursor doesn't seem to be working. However the cursor position as per the actual movement is properly getting updated in the SDL mouse structure internally with the correct screen/client coordinates. The above is obviously with 'no grab'.

b) Under Win7, the ClipCursor function works properly inside the SDL window with each mouse movement.

c) Under Win7, the mouse motion events generated are also somewhat different compared to Win95. In case of Win7, 'handle_mouse' function is not called when the cursor movement is outside the window and the dosbox window isn't 'in focus' or 'active'. However under Win95, the function gets called even when the dosbox window is not active and the mouse is moved outside the window.
User avatar
gandhig
Member
 
Posts: 332
Joined: 2014-2-12 @ 08:35


Return to DOSBox General

Who is online

Users browsing this forum: No registered users and 2 guests