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
Qbix
Neozeed
All the people that wrote the guides that I read to make this one.
Attachments
DOSBOXMingw64.txt
(14.05 KiB) Not downloaded yet
DOSBOXMINGW.txt
(10.4 KiB) Not downloaded yet
DOSBOXVisualStudioMultTarget.txt
(29.76 KiB) Not downloaded yet
DOSBOXVisualStudioIndiv.txt
(38.36 KiB) Not downloaded yet
vbempj.zip
(125.83 KiB) Downloaded 9 times
Q932590.zip
(206.91 KiB) Downloaded 8 times
dosboxsvn-1032017-mingw64710-NT351.zip
(1.47 MiB) Downloaded 8 times
dosboxsvn-1032017-mingw64710-95+.zip
(1.5 MiB) Downloaded 8 times
SDL_net-1.2.8-NT351-95-NT4forGCC.zip
(587.46 KiB) Downloaded 7 times
dosboxsvn09182017-351tovista.zip
(6.29 MiB) Downloaded 6 times
DXSDKFEBJune2010forSDL1.2.x.zip
(275.23 KiB) Downloaded 7 times
vc6redistsetup_enu.zip
(1.71 MiB) Downloaded 14 times
dosboxsvn09092017-MINGW64-vista+..zip
(1.66 MiB) Downloaded 13 times
User avatar
DosFreak
l33t++
 
Posts: 9465
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://hero.handmade.network/forums/co ... on_windows
https://www.chocolate-doom.org/wiki/ind ... ing_Cygwin
https://github.com/msys2/msys2/wiki/MSYS2-installation
http://bearwindows.zcm.com.au/msvc.htm#c8
MAC: https://hexeract.wordpress.com/2016/09/ ... cos-sierra

MSVC
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.
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
Use same DX files between Mingw,Mingw-w64,VA? MS DX files not recognized in Mingw

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.

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

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
diff against SDL and DOSBOX for changes? Mabye provide both methods.
Why do I have to edit aclocal 1.11, what's using that ver? Should be 1.15
SDL_NET 1.2.7 vs 1.2.8
Command to gather all executables and dlls
Post NT3.51+ builds
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? Any point?
DOSBox Debug viewtopic.php?t=3944
QtCreator vs Codeblocks
Use same DX files between Mingw,Mingw-w64,VA? MS DX files not recognized in Mingw
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 (Possibly GCC doesn't rely on this)

USER32.DLL (Mabye SDL trying to use missing GDI features? Someone would need to code a replacement or mabye remove fullscreen support?)
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

Visual Studio 2005+ do not support setting /subsystem and /osversion less than 4.00 in the linker. EDITBIN has same limitation

STATIC LINK VS NON-STATIC CRT USING VISUAL STUDIO
Sticking with Static Linking the CRT.
Only see downsides to not static linking. Potentially mabye might be a good idea for Windows Operating systems currently in support and that receive all Windows updates not just security updates.
If don't static link CRT then for XP need to install Visual Studio 2015 VCRedist.
For Vista+ the Universal CRT should be pushed through Windows Update but unknown if EOL OS will receive this update or not. (If only security updates pushed to box then will not receive the Universal CRT)
https://blogs.msdn.microsoft.com/vcblog ... ersal-crt/


COMPILERS

MINGW
http://gnutoolchains.com/building/
http://www.mingw.org/wiki/InstallationHOWTOforMinGW
https://kb.hilscher.com/display/TOOLCHAIN/MinGW
https://sourceforge.net/projects/orwell ... ers/MinGW/
http://gnutoolchains.com/mingw32/
https://sourceforge.net/projects/mingw/ ... /Version4/
https://sourceforge.net/projects/tdm-gc ... /1.1006.0/

MINGW
MINGW 4.7.2 and below NT3.51+ (i586)
MINGW 4.8.x+ NT3.51+ (i686)
MINGW 5.3.0+ 98+ (i686)

TDM-GCC
TDM-GCC 4.7.2-2 and below NT3.51+ (i586)
TDM-GCC 4.8.1 NT3.51+ w/ MSVCRT 6.10.8293.0 (for missing export fstat64) Possibly mingw 4.8.1-4 may work fine. (i686)
TDM-GCC 4.9.2+ 98+ Requires interlockedexchangeadd (TDM ver probably using mingw-w64 not mingw) (i686)

DEV-CPP
Dev-Cpp 5.5.2 MinGW 4.7.2 NT3.51+ (i586)

OLD
ILLEGAL INSTRUCTION ERROR RESEARCH

https://sourceforge.net/p/mingwbuilds/m ... /31157308/
https://sourceforge.net/p/mingw/mailman ... e/4899231/
viewtopic.php?t=46693&p=475702#p476760
https://stackoverflow.com/questions/351 ... -for-i586#
https://sourceforge.net/p/mingw/bugs/2146/

Looks like past Mingw 4.7.2 i686 (might be earlier) CMOV instruction is required. I have no idea how to compile mingw gcc without this instruction but at least I know what the minimum CPU required (i686 pentium pro) for builds past 4.7.2 is. If anyone has a clue on how to remove this instruction then I'd appreciate it.
http://mingw-users.1079350.n2.nabble.co ... 82248.html

VISUAL STUDIO

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

VISUAL STUDIO WITH MINGW
Looks like VS2017 requires remote access to a Linux system. To use it on the local filesystem requires using the App Store. Tried to use the Ubunto distro without the App Store but no luck. Ridiculous.

OPTIMIZATION

NOT NEEDED

/OPT:WIN98 WAS REMOVED IN VS2008
Switch supposedly improved loading times and decreased size of file

98/ME
/OPT:WIN98

NT
/OPT:NOWIN98


OLD OS SUPPORT
https://www.msfn.org/board/topic/154868 ... -problems/


LIBRARIES

COMPRESSED AUDIO SUPPORT
viewtopic.php?f=32&t=50077
https://www.dosbox.com/wiki/Building_DOSBox_with_MinGW
Any point in disabling unused items in config.h?

MSVCRT
ReactOS msvcrt not compatible with Windows 95

DOSBOX AND SDL
Keeping this out until someone complains:
The surface changes in SDL are needed in 1.2.15.
Check src/platform/sdl-win32.diff for DOSBOX SDL modifications.

MS DX:
https://stackoverflow.com/questions/951 ... -via-mingw
viewtopic.php?t=14655&p=103534
Remove sal.h
Look into dinput version errors
Supposedly no diff between DX and SDL DX headers

DIRECTX LIB and INCLUDE

You can use the Windows 10 SDK 10.0.15063.468 for XP and below for SDL
https://developer.microsoft.com/en-us/w ... ows-10-sdk

INCLUDE: C:\Program Files (x86)\Windows Kits\10\Include\10.0.15063.0\um
LIB: C:\Program Files (x86)\Windows Kits\10\Lib\10.0.15063.0\um\x86

BUT you'll need to modify the include files to remove the winapi modifications and there really aren't any changes to these files anyway.

OLD
C:\Program Files (x86)\Microsoft SDKs\Windows
C:\Program Files\Microsoft SDKs\Windows
C:\Program Files (X86)\Microsoft Visual Studio 8\VC\PlatformSDK\Include
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: 9465
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: 9465
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: 9465
Joined: 2002-6-30 @ 16:35
Location: Your Head

Re: DOSBox Compilation Guides

Postby DosFreak » 2017-10-16 @ 18:41

TODO:

LOW EFFORT
Check if 32bit gcc can be used with 64bit MSYS2.
Look into removing DX in SDL and DOSBox for NT4 or just keep as is and use the 95 build which will default to windib on NT4. Need to at least --disable-ddraw for NT4
Update Mingw and VS guides with mingw-w64 guide updates.
Use vbempj.zip for NT3.51
libpng 1.6.34

HIGH EFFORT
http://matpack.de/cygwin/
https://chocolatey.org/packages/mingw
See if can recompile latest Mingw GCC to support Pentium (i586). Mingw 4.7.2 is the latest for now.
Download free versions of Visual Studio Versions and Platform and Windows SDKs. https://en.wikipedia.org/wiki/Microsoft_Windows_SDK
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: 9465
Joined: 2002-6-30 @ 16:35
Location: Your Head

Re: DOSBox Compilation Guides

Postby DosFreak » 2017-10-19 @ 16:45

MSYS

LIBPNG
autoreconf -f -i
Only have libtool 2.4 need Libtool version 2.4.2
Change line 73 in configure.ac from 2.4.2 to 2.4
72 LT_INIT([win32-dll])
73 LT_PREREQ([2.4])

Only have automake 1.11.1 need Automake 1.13
Change line 37 in configure.ac from 1.13 to 1.11.1
36 # 1.13 is required for parallel tests
37 AM_INIT_AUTOMAKE([1.11.1 foreign dist-xz color-tests silent-rules subdir-objects])

mingw-get install msys-autoconf msys-autogen msys-automake

OGG
mingw-get install libtool

FLAC
Missing pkg-config

Download:
http://ftp.gnome.org/pub/gnome/binaries ... _win32.zip
http://ftp.gnome.org/pub/gnome/binaries ... _win32.zip
Go to C:/MinGW/bin
Copy libintl-8.dll to intl.dll
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: 9465
Joined: 2002-6-30 @ 16:35
Location: Your Head


Re: DOSBox Compilation Guides

Postby hail-to-the-ryzen » 2017-10-22 @ 06:00

This may help where <filename> is the name of the executable to parse:
objdump.exe -M intel -d <filename> | cut -c 33-39 | cut -d ' ' -f1 | sort | uniq > <filename>.opcodes

Objdump is available for mingw32 package (either by default or by selection during setup).

The output of opcodes may be parsed with a simple text editor.

Objdump doesn't work on all possible binaries, but should for the builds of dosbox. Here is a similar line for a verbose output of opcodes, especially where the above parsing script fails:
objdump.exe -M intel -d <filename> > <filename>.opcodes
hail-to-the-ryzen
Newbie
 
Posts: 70
Joined: 2017-3-09 @ 01:34


Return to DOSBox General

Who is online

Users browsing this forum: No registered users and 2 guests