DOSBox Compilation Guides

General information and assistance with DOSBox.

DOSBox Compilation Guides

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

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

Google Drive
Contains all Mingw environments and all files required to compile DOSBox.
Now includes DOSBox binaries for NT 3.51, 95, 98+ and XP+ 64bit compiled with Mingw and Mingw-W64 w/ gcc 7.x.0
https://drive.google.com/open?id=1G13rk ... 3aMO8U9mvV

Everything is on Google Drive now except for the attached and the posts in this thread awaiting review.

Recommendations for compiling:
*CLANG not recommended due to issues with ogg and flac. If you don't need those then use it.
*Posix builds require XP+ (Possibly 2000 can work with unofficial updates)

Linux builds

i386
?

i686
1st Ubuntu VM w/ GCC
2nd Windows 10 WSL w/ Ubuntu w/ GCC

Windows builds

i386
1st MSYS w/ Mingw w/gcc 6.3 for NT3.50+
2nd Visual Studio 2005 or 2008 for NT3.50+

i686
1st Ubuntu VM w/mingw-w64 win32 GCC for 3.50+
2nd Windows 10 WSL w/Ubuntu w/mingw-w64 win32 GCC for 3.50+ or Visual Studio 2005,2008 or 2017 (XP+)
3rd MSYS2 w/ Mingw-w64 win32 GCC for NT3.50+ or posix for XP+

ISSUES
DOSBox in DOS requires SDL_Videodriver=Windib for functional mouse. (Removing 9x if statement in SDL would probably fix it but would there be any point?)
64bit DOSBox requires normal core
Need to recompile mingw-w64 to i386 to compile DOSBox for < i686 support. (Would potentially eliminate MSYS\mingw)
For Mingw and Mingw-64 can't use /c/ for prefix have to use /mingwxx. If so then need to seperate 32 and 64bit and clang vs gcc
Clang v5 doesn't support static for libstdc++ and having issues with -Bdynamic and -Bstatic switches. Clang instructions use shared for everything.
https://github.com/tpoechtrager/wclang/issues/32
When compiling vorbis with clang march= causes failure to compile.
Need to compile MacOS build
Need to cross-compile from Linux for MacOS
Compile mingw for linux
Finish WSL and linux guide and upload linux vm

Credits:
gandhig (For reviewing the guide,providing corrections and testing)
Qbix
Neozeed (Blog posts and tips via email)
All the people that wrote the guides that I read to make this one.
Attachments
DOSBOXVisualStudioMultTarget.txt
(29.76 KiB) Downloaded 246 times
DOSBOXVisualStudioIndiv.txt
(38.36 KiB) Downloaded 265 times
User avatar
DosFreak
l33t++
 
Posts: 9783
Joined: 2002-6-30 @ 16:35
Location: Your Head

Re: DOSBox Compilation Guides

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

COMPILING DOSBOX
PKG_CONFIG

export PKG_CONFIG_DIR=
export PKG_CONFIG_LIBDIR=${SYSROOT}/usr/lib/pkgconfig:${SYSROOT}/usr/share/pkgconfig
export PKG_CONFIG_SYSROOT_DIR=${SYSROOT}

http://www.mingw.org/wiki/LinuxCrossMinGW

MAC:
https://hexeract.wordpress.com/2016/09/ ... cos-sierra
viewtopic.php?f=32&t=59655
https://github.com/emendelson/OneStopDOSBoxOSX
viewtopic.php?f=32&t=57494

VISUAL STUDIO
Look into compiling from CLI https://doc.libretro.com/compilation/wi ... c-cmdline/
Update VS guides with mingw-w64 guide updates.
Use repositories instead of zips
Instructions for 64bit DOSBox (not recommended due to slow dynrec)
If dynamic then list redist as requirement
Use Mingw with Visual Studio https://stackoverflow.com/questions/156 ... le-project
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
Comment vs removing issues in dependencies.
For pnglibconf.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, Mercurial, SVN
Visual Studio 2017 GIT support

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

---------------
NEED TO TEST THE FOLLOWING WITH VISUAL STUDIO. REF MINGW instructions.

- 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

------------------------

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 works with LegacyExtender. Fixes InterlockedCompareExchange

VS2010 compiled DOSBox
*Windows 95 will not work even with LegacyExtender. Missing "FindFirstFileExA"
*Need to check 98+ If 98 then try KernelEX

VS2012 compiled DOSBox
*Windows 95 will not work
*Need to check 98+ If 98 then try KernelEX

DOSBOX COMPILED WITH VS2008 (Runs on NT3.51)

Windows NT 3.50
DOSBox should work as long as correct msvcrt.dll is used and modifications to SDL to display fullscreen are made. Need to test.
Also copy winmm.dll from NT3.51

Windows NT 3.10:
DOSBox will not work. SDL 1.2.15 not supported on NT 3.10

MINGW

LOW
Codeblocks instructions
http://wiki.codeblocks.org/index.php/Us ... de::Blocks

Check gandhig PM for SSE executables for Windows 95.

HIGH
Possible issue with SDL_Sound http://www.vogons.org/viewtopic.php?t=39101&p=354759

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

BUILDBOT


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

Pixelperfect doesn't compile with VS2008. VS2013+ should work. Need to try mingw.

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
User avatar
DosFreak
l33t++
 
Posts: 9783
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
User avatar
DosFreak
l33t++
 
Posts: 9783
Joined: 2002-6-30 @ 16:35
Location: Your Head

Re: DOSBox Compilation Guides

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

DOSBox in DOS using HX-DOS

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 Google Drive

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 in vmware.....so don't use vmware use pcem v14.

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.

So did some testing with HXRT and DOSBox and found out that vmware was causing the issues with the mouse.

Using PCEM v14 (not 12!!), HXRT and DOSBox AND with SDL_Videodriver=windib then no mouse issues!

If recompile sdl 1.2.15 and allow new code to apply to all OS instead of just 9x then would probably work but there isn't much point.

If PCEM v12 set then DOSBox displays no video
If SDL_Videodriver not set then mouse issues.

Need to look into setting dosbox.cfg or dosbox.ini in dosbox code although dosbox still reads "dosbox.conf" as "dosbox.con" in DOS anyway.
https://github.com/joncampbell123/dosbox-x/issues/582

http://freedos.10956.n7.nabble.com/HX-D ... 24534.html
http://www.bttr-software.de/forum/forum ... p?id=14645
Attachments
Capture.PNG
User avatar
DosFreak
l33t++
 
Posts: 9783
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.
User avatar
DosFreak
l33t++
 
Posts: 9783
Joined: 2002-6-30 @ 16:35
Location: Your Head

Re: DOSBox Compilation Guides

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

SDL 1.2 MOUSE ISSUE

When DOSBox (or any program that uses SDL) is executed and NOT using WIBDIB on a 9x systems then when the mouse cursor is non-relative and inside the DOSBox window then the cursor will freeze or move erraticaly. When the cursor is in relative mode then the mouse works fine.

Also if the mouse is in relative mode and DOSBox is quit then the mouse cursor will be frozen until DOSBox is executed with the mouse NOT captured and then DOSBox is quit again to release it.

SDL 1.2.13 - works fine
SDL 1.2.14 - mouse issue
SDL 1.2.15 and current branch - mouse issue

Bug #611 is where issue starts but there are commits after that modify this code:
https://hg.libsdl.org/SDL/rev/a6f635e5eaa6
https://hg.libsdl.org/SDL/rev/27c0db0fbfad

Affected files for mouse issue:

video\wincommon
SDL_sysevents.c
SDL_sysmouse.c
SDL_lowvideo.h

video\windibb
SDL_dibevents.c

video\windx5
SDL_dx5events.c
directx.h

BUT THESE ARE THE MAIN ONES:
SDL_dx5events.c
SDL_sysevents.c

FIXES:

Removing the following from SDL_dx5events.c "fixes" the first issue but breaks the mouse when DOSBox is relative
This was removed to allow directinput to work with OpenGL previously when opengl was used then windib was used:

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 }

To fix the above then SDL_sysevents.c needs to be modified with the SDL 1.2.13 mouse code.

SDL_dx5events.c

This was removed to allow directinput to work with OpenGL previously when opengl was used then windib was used:

6.101 - /* If we are in windowed mode, Windows is taking care of the mouse */
6.102 - if ( (SDL_PublicSurface->flags & SDL_OPENGL) ||
6.103 - !(SDL_PublicSurface->flags & SDL_FULLSCREEN) ) {
6.104 - return;
6.105 - }

INFO

Look into trackmouse storing coordinates outside of dosbox window for 9x vs 0,1 for non-9x.

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



Links
https://github.com/spurious/SDL-mirror/ ... d778e2b937
https://icculus.org/pipermail/quake3-co ... 01365.html
https://github.com/spurious/SDL-mirror/ ... 266ca8ab3a
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
https://bugzilla.libsdl.org/show_bug.cgi?id=265

https://discourse.libsdl.org/t/win10-fa ... g/23526/19
https://bugzilla-attachments.libsdl.org ... gi?id=3112
https://bugs.chromium.org/p/chromium/is ... 781182#c15

To download certain commit:
git clone "https address" SDL12
cd SDL12
git checkout "commit"

-----------------------------------
gandhig posts:

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.

Edit(12.12.17):
If I just replace the ClipCursor(&trap) with SetCursorPos(cursor.x, cursor.y) in line 344 of SDL_dx5events.c, mouse does move inside the dosbox window and also doesn't get stuck on exit(not captured). However, as warned in the comments, the mouse movement sort of resembles a tug of war. I will try till this weekend and then throw the towel.

Ok, I give up.

Contrary to my earlier statement, the ClipCursor function does work as I'm getting proper return values when checked in gdb.

The return value of ClipCursor in Win7 is different w.r.t Win95 in that under Win7 it returns only '1' (EAX value) on success, whereas in Win95 the return value observed in EAX register is the X coordinate of mouse. If I manually change the 'trap' rectangle which is fed as the argument to the ClipCursor function, the cursor does get restricted to the changed rectangle. But it doesn't happen during the normal run of the SDL test program (threadwin.exe) with directx driver. My incomplete understanding leads to the following possibilities(not in any particular order) & observations:

a)_TrackMouseEvent points to SDL's WIN_TrackMouseEvent in Win95, but Win7 has its own TrackMouseEvent(takes care of mouse leaving the SDL window). Incompatibility with new mouse handling code in SDL-1.2.14/15??? Should not matter as it is responsible for only tracking as to when the mouse leaves the window???

b) Direct Input implementation in Win95??? As per the links you referred, the direct input's mouse and keyboard interfaces are wrappers around WM_MOUSEMOVE messages under later OS versions (since WinXP), so there is no issue there.

c) Too many WM_TIMER messages(due to TrackMouseEvent???) observed during the handling of Window messages at the start of DX5_CheckInput function under Win95 (timer resolution ???)

d) Under Win95, once the mouse enters the client area of the SDL window, say, from the top (i.e client coordinate SDL_MouseY=0, at_edge is true, cursor changes to black...), further mouse movement(left/right) in the X-axis is fine as the OS is taking care of the motion. Just moving the mouse one step down(i.e. client coordinate SDL_MouseY=1, at_edge is false..), something happens that makes the cursor get stuck, though this initial one step movement does happen(again courtesy of OS probably). After that, no movement. However if we keep on moving the mouse,say, towards the bottom, it does get released once enough movements in the Y-axis get accumulated such that the mouse cursor warps out of the bottom of the SDL window/DOSBox Z prompt window. Similarly if we make small upwards movement of the mouse(w.r.t SDL_MouseY=1) towards the top, it immediately gets released outside the SDL window, off the top.

Would it be better to leave a note in the guide with all the possible options and let the users decide as per their requirements? I'm not sure about the best option, that's why.

The closest I got to a workaround to the erratic mouse movement issue with 'directx' driver is by modding the code from line nos. 324 to 327 of SDL_dx5events.c(just expanding the 'trap' rectangle slightly):

Code: Select all
    Line No:324:      trap.left = cursor.x - 1;
    Line No:325:      trap.top = cursor.y - 1;
    Line No:326:      trap.right = cursor.x + 2;
    Line No:327:      trap.bottom = cursor.y + 2;

'Mouse stuck on exit' issue resolved by adding 'ClipCursor(NULL)' in DX5_DestroyWindow function after line no. 990 of SDL_dx5events.c
Code: Select all
    Line No:990:      DX5_DInputQuit(this);
    Line No:991:      ClipCursor(NULL); /* free the stuck cursor while exiting in Win9X(windowed & grab mode = off) */
    Line No:992:      /* Destroy our window */

Not pretty, but this is the best I can do presently.
------------------------------
User avatar
DosFreak
l33t++
 
Posts: 9783
Joined: 2002-6-30 @ 16:35
Location: Your Head

Re: DOSBox Compilation Guides

Postby DosFreak » 2018-5-10 @ 17:01

Need to see about getting the following added to upstream:

SDL

Soooo.....even though the SDL 1.2.13 mouse code works in SDL 1.2.15 (Actually current branch of SDL 1.2) I've been unsuccessful with adding the subsequent changes back to those files that don't have anything to do with the issue. Issue is adding that code back doesn't allow a proper patch to be created so I've scratched that project and modified ghandig's code to only apply for 9x. (Is that necessary? Probably not but it only affects 9x)

See attached for a replacement sdl-win32.diff

This means that DOSBox can now be used with SDL 1.2.15 and supports the same Windows operating systems that SDL 1.2.13 does. (95+) (SDL also works in NT 3.51 but DOSBox file cross.cpp needs a few changes..see below)

With this change it now means DirectInput can be used in a window and in OpenGL fullscreen whereas with SDL 1.2.13 WINDIB was used in a Window and OpenGL fullscreen.

This also means that high DPI mice are supported now in DOSBox in those configurations for those games that need it.

This also bumps the DX requirement to DX7

https://discourse.libsdl.org/t/sdl-1-2- ... h-9x/24342




SDL_NET

Getlocaladdresses breaks programs for NT3.51, 95 and NT4 that use SDL_NET 1.2.8+ if IPHLPAPI is missing.
*3.51 - IPHLPAPI not supported.
*95 - IE4 comes with the .dll
*NT4 - Possibly comes with IE4 or elsewhere

"If you don’t need to know your local IP address, just comment out the entire SDLNet_GetLocalAddresses function. This only reports the LAN address, which for most users is going to be behind a NAT and not actually be their public IP address."


To fix:
https://hg.libsdl.org/SDL_net/log?rev=showinterfaces

Remove this commit:
https://hg.libsdl.org/SDL_net/rev/22ec5ac13f65


Cannot create a diff since too many changes so here is the attached.
This does not break functionality in DOSBox since DOSBox does not use this function.

Alternative is to use SDL_NET 1.2.7 to support the above
or use SDL_net 1.2.8+ with IE4 on 95 and NT4.

*This fixes the issue with compiling SDL_NET 1.2.8+ with mingwrt 5.0.2




DOSBOX

NT 3.51 SUPPORT
*See if I can create a diff. Using full file for now.

SDL_NET introduces WS2_32 or WSOCK32 requirement but NT 3.51 (or 95 if you want to use WSOCK) doesn't support WS2_32. To support need to replace WS2_32 in configure with WSOCK32. Need to figure out how to offer both options or mabye just add a note to DOSBox INSTALL

DISABLING PROFILE
*See if I can create a diff. Using full file for now.

This enables a --disable-profile switch in configure which allows all supported operating systems to save the profile in the current directory.

Another benefit is that this disables the Active Desktop requirement for IE4 on 95 and NT4 and also allows DOSBox to run on NT 3.51.


OLD

SDL

SDL-1.2.13filesfor SDL-1.2.15 for mouse issue.zip

These are SDL 1.2.13 files modified with the minimum amount of changes to get them to compile on SDL 1.2.15. Keeping just in case. Use sdl-win32.diff instead which modifies SDL-1.2.15 to only apply what's needed to get the mouse to work on 9x.


OLDERSDL-1.2.15 9x-Minimal.zip
OLDERSDL-1.2.15 for 9x-toomanymods

These two were earlier attempts to fix the mouse issues.
Attachments
OLDERSDL-1.2.15 for 9x-toomanymods.zip
(16.71 MiB) Downloaded 120 times
OLDERSDL-1.2.15 9x-Minimal.zip
(16.76 MiB) Downloaded 119 times
OLDSDL-1.2.13filesfor SDL-1.2.15 for mouse issue.zip
(27.45 KiB) Downloaded 117 times
dosbox - no profile 3.51.zip
(9.66 KiB) Downloaded 120 times
dosbox - no profile.zip
(9.58 KiB) Downloaded 118 times
sdl-win32.diff
(2.25 KiB) Downloaded 119 times
SDL_net_1.2.9-Removed rev 191.zip
(2.62 MiB) Downloaded 118 times
User avatar
DosFreak
l33t++
 
Posts: 9783
Joined: 2002-6-30 @ 16:35
Location: Your Head

Re: DOSBox Compilation Guides

Postby DosFreak » 2018-5-11 @ 19:57

Finally got DOSBox working in NT 3.50. Wasn't that difficult but did take all day since I don't know what I'm doing.

Windows NT 3.50 was released September 21, 1994 making this the oldest version of Windows that can run DOSBox.

Use the attached with the previously posted msvcrt.dll.

Also keyboard doesn't work for some reason. Likely due to the changes I had to make to DOSBox. Need to figure out how to disable the mapper or rather the joystick part of the mapper without butchering the code. Same behavior on Windows 10.

For DOSBox to work in NT 3.50 SDL has to be modified to remove changedisplaysettingsa which means that SDL can't use fullscreen in NT 3.50. Also joystick support has to be removed from SDL which also means it has to be disabled in DOSBox.

Next:
Simplify SDL modification
Ask about configure switch to disable mapper or disable joystick part of mapper or see if I can figure it out.


*Need to test with VS

NEED TO IDENTIFY WHY DISABLING THE JOYSTICK IN DOSBOX DISABLES KEYBOARD INPUT. NOT A SDL ISSUE

DOSBOX
*If joystick disabled in SDL then receive the below when compiling DOSBox.

mv -f .deps/dosbox.Tpo .deps/dosbox.Po
g++ -O3 -march=i386 -mtune=i386 -mno-ms-bitfields --static -s -o dosbox.exe dosbox.o winres.o cpu/libcpu.a debug/li
ebug.a dos/libdos.a fpu/libfpu.a hardware/libhardware.a gui/libgui.a ints/libints.a misc/libmisc.a shell/libshell.a h
dware/mame/libmame.a hardware/serialport/libserial.a libs/gui_tk/libgui_tk.a -lSDL_sound -lsdl_net -lwsock32 -L/mingw/
b -lmingw32 -lSDLmain -lSDL -mwindows -liconv -lm -luser32 -lgdi32 -lwinmm -lpng -lz -lSDL_net -lwinmm -lwsock32
gui/libgui.a(sdlmain.o):sdlmain.cpp:(.text+0x35d5): undefined reference to `SDL_JoystickUpdate'
gui/libgui.a(sdlmain.o):sdlmain.cpp:(.text+0x4e55): undefined reference to `SDL_NumJoysticks'
gui/libgui.a(sdl_mapper.o):sdl_mapper.cpp:(.text+0x14d5): undefined reference to `SDL_JoystickEventState'
gui/libgui.a(sdl_mapper.o):sdl_mapper.cpp:(.text+0x1588): undefined reference to `SDL_JoystickEventState'
gui/libgui.a(sdl_mapper.o):sdl_mapper.cpp:(.text+0x40c9): undefined reference to `SDL_JoystickName'
gui/libgui.a(sdl_mapper.o):sdl_mapper.cpp:(.text+0x460f): undefined reference to `SDL_NumJoysticks'
gui/libgui.a(sdl_mapper.o):sdl_mapper.cpp:(.text+0x4648): undefined reference to `SDL_JoystickOpen'
gui/libgui.a(sdl_mapper.o):sdl_mapper.cpp:(.text+0x465a): undefined reference to `SDL_JoystickNumAxes'
gui/libgui.a(sdl_mapper.o):sdl_mapper.cpp:(.text+0x4693): undefined reference to `SDL_JoystickEventState'
gui/libgui.a(sdl_mapper.o):sdl_mapper.cpp:(.text+0x48fd): undefined reference to `SDL_JoystickOpen'
gui/libgui.a(sdl_mapper.o):sdl_mapper.cpp:(.text+0x4910): undefined reference to `SDL_JoystickNumAxes'
gui/libgui.a(sdl_mapper.o):sdl_mapper.cpp:(.text+0x491e): undefined reference to `SDL_JoystickNumButtons'
gui/libgui.a(sdl_mapper.o):sdl_mapper.cpp:(.text+0x492c): undefined reference to `SDL_JoystickNumHats'
gui/libgui.a(sdl_mapper.o):sdl_mapper.cpp:(.text+0x498e): undefined reference to `SDL_JoystickName'
gui/libgui.a(sdl_mapper.o):sdl_mapper.cpp:(.text+0x4cbd): undefined reference to `SDL_JoystickOpen'
gui/libgui.a(sdl_mapper.o):sdl_mapper.cpp:(.text+0x4cd0): undefined reference to `SDL_JoystickNumAxes'
gui/libgui.a(sdl_mapper.o):sdl_mapper.cpp:(.text+0x4cde): undefined reference to `SDL_JoystickNumButtons'
gui/libgui.a(sdl_mapper.o):sdl_mapper.cpp:(.text+0x4cec): undefined reference to `SDL_JoystickNumHats'
gui/libgui.a(sdl_mapper.o):sdl_mapper.cpp:(.text+0x4d4e): undefined reference to `SDL_JoystickName'
gui/libgui.a(sdl_mapper.o):sdl_mapper.cpp:(.text+0x50ad): undefined reference to `SDL_JoystickOpen'
gui/libgui.a(sdl_mapper.o):sdl_mapper.cpp:(.text+0x50c0): undefined reference to `SDL_JoystickNumAxes'
gui/libgui.a(sdl_mapper.o):sdl_mapper.cpp:(.text+0x50ce): undefined reference to `SDL_JoystickNumButtons'
gui/libgui.a(sdl_mapper.o):sdl_mapper.cpp:(.text+0x50dc): undefined reference to `SDL_JoystickNumHats'
gui/libgui.a(sdl_mapper.o):sdl_mapper.cpp:(.text+0x513e): undefined reference to `SDL_JoystickName'
gui/libgui.a(sdl_mapper.o):sdl_mapper.cpp:(.text+0x5481): undefined reference to `SDL_JoystickOpen'
gui/libgui.a(sdl_mapper.o):sdl_mapper.cpp:(.text+0x5494): undefined reference to `SDL_JoystickNumAxes'
gui/libgui.a(sdl_mapper.o):sdl_mapper.cpp:(.text+0x54a2): undefined reference to `SDL_JoystickNumButtons'
gui/libgui.a(sdl_mapper.o):sdl_mapper.cpp:(.text+0x54b0): undefined reference to `SDL_JoystickNumHats'
gui/libgui.a(sdl_mapper.o):sdl_mapper.cpp:(.text+0x5749): undefined reference to `SDL_JoystickOpen'
gui/libgui.a(sdl_mapper.o):sdl_mapper.cpp:(.text+0x575c): undefined reference to `SDL_JoystickNumAxes'
gui/libgui.a(sdl_mapper.o):sdl_mapper.cpp:(.text+0x576a): undefined reference to `SDL_JoystickNumButtons'
gui/libgui.a(sdl_mapper.o):sdl_mapper.cpp:(.text+0x5778): undefined reference to `SDL_JoystickNumHats'
gui/libgui.a(sdl_mapper.o):sdl_mapper.cpp:(.text+0x57da): undefined reference to `SDL_JoystickName'
gui/libgui.a(sdl_mapper.o):sdl_mapper.cpp:(.text+0x5a7d): undefined reference to `SDL_JoystickOpen'
gui/libgui.a(sdl_mapper.o):sdl_mapper.cpp:(.text+0x5a90): undefined reference to `SDL_JoystickNumAxes'
gui/libgui.a(sdl_mapper.o):sdl_mapper.cpp:(.text+0x5a9e): undefined reference to `SDL_JoystickNumButtons'
gui/libgui.a(sdl_mapper.o):sdl_mapper.cpp:(.text+0x5aac): undefined reference to `SDL_JoystickNumHats'
gui/libgui.a(sdl_mapper.o):sdl_mapper.cpp:(.text+0x5b01): undefined reference to `SDL_JoystickName'
gui/libgui.a(sdl_mapper.o):sdl_mapper.cpp:(.text+0x5b46): undefined reference to `SDL_JoystickOpen'
gui/libgui.a(sdl_mapper.o):sdl_mapper.cpp:(.text+0x5b58): undefined reference to `SDL_JoystickNumAxes'
gui/libgui.a(sdl_mapper.o):sdl_mapper.cpp:(.text+0x5b6c): undefined reference to `SDL_JoystickClose'
gui/libgui.a(sdl_mapper.o):sdl_mapper.cpp:(.text+0x5b78): undefined reference to `SDL_JoystickOpen'
gui/libgui.a(sdl_mapper.o):sdl_mapper.cpp:(.text+0x5b8a): undefined reference to `SDL_JoystickNumAxes'
gui/libgui.a(sdl_mapper.o):sdl_mapper.cpp:(.text+0x5b99): undefined reference to `SDL_JoystickClose'
gui/libgui.a(sdl_mapper.o):sdl_mapper.cpp:(.text+0x5c7c): undefined reference to `SDL_JoystickNumButtons'
gui/libgui.a(sdl_mapper.o):sdl_mapper.cpp:(.text+0x5c86): undefined reference to `SDL_JoystickClose'
gui/libgui.a(sdl_mapper.o):sdl_mapper.cpp:(.text+0x5d14): undefined reference to `SDL_JoystickOpen'
gui/libgui.a(sdl_mapper.o):sdl_mapper.cpp:(.text+0x5d26): undefined reference to `SDL_JoystickNumAxes'
gui/libgui.a(sdl_mapper.o):sdl_mapper.cpp:(.text+0x5d35): undefined reference to `SDL_JoystickClose'
gui/libgui.a(sdl_mapper.o):sdl_mapper.cpp:(.text+0x5df2): undefined reference to `SDL_JoystickNumButtons'
gui/libgui.a(sdl_mapper.o):sdl_mapper.cpp:(.text+0x5e6a): undefined reference to `SDL_JoystickNumButtons'
gui/libgui.a(sdl_mapper.o):sdl_mapper.cpp:(.text$_ZN15CStickBindGroup9BindStartEv[__ZN15CStickBindGroup9BindStartEv]+0
1): undefined reference to `SDL_JoystickName'
gui/libgui.a(sdl_mapper.o):sdl_mapper.cpp:(.text$_ZN15CStickBindGroupD1Ev[__ZN15CStickBindGroupD1Ev]+0x16): undefined
ference to `SDL_JoystickClose'
gui/libgui.a(sdl_mapper.o):sdl_mapper.cpp:(.text$_ZN15C4AxisBindGroupD1Ev[__ZN15C4AxisBindGroupD1Ev]+0x16): undefined
ference to `SDL_JoystickClose'
gui/libgui.a(sdl_mapper.o):sdl_mapper.cpp:(.text$_ZN13CFCSBindGroupD1Ev[__ZN13CFCSBindGroupD1Ev]+0x16): undefined refe
nce to `SDL_JoystickClose'
gui/libgui.a(sdl_mapper.o):sdl_mapper.cpp:(.text$_ZN12CCHBindGroupD1Ev[__ZN12CCHBindGroupD1Ev]+0x16): undefined refere
e to `SDL_JoystickClose'
gui/libgui.a(sdl_mapper.o):sdl_mapper.cpp:(.text$_ZN15CStickBindGroupD0Ev[__ZN15CStickBindGroupD0Ev]+0x16): undefined
ference to `SDL_JoystickClose'
gui/libgui.a(sdl_mapper.o):sdl_mapper.cpp:(.text$_ZN13CFCSBindGroupD0Ev[__ZN13CFCSBindGroupD0Ev]+0x16): more undefined
eferences to `SDL_JoystickClose' follow
gui/libgui.a(sdl_mapper.o):sdl_mapper.cpp:(.text$_ZN15CStickBindGroup27ActivateJoystickBoundEventsEv[__ZN15CStickBindG
up27ActivateJoystickBoundEventsEv]+0x3b): undefined reference to `SDL_JoystickGetButton'
gui/libgui.a(sdl_mapper.o):sdl_mapper.cpp:(.text$_ZN15CStickBindGroup27ActivateJoystickBoundEventsEv[__ZN15CStickBindG
up27ActivateJoystickBoundEventsEv]+0x1e3): undefined reference to `SDL_JoystickGetAxis'
gui/libgui.a(sdl_mapper.o):sdl_mapper.cpp:(.text$_ZN15CStickBindGroup27ActivateJoystickBoundEventsEv[__ZN15CStickBindG
up27ActivateJoystickBoundEventsEv]+0x403): undefined reference to `SDL_JoystickGetHat'
collect2.exe: error: ld returned 1 exit status
make[2]: *** [dosbox.exe] Error 1
make[2]: Leaving directory `/mingw/codeprojects/dosbox/32/vanilla/dosbox351/src'
make[1]: *** [install-recursive] Error 1
make[1]: Leaving directory `/mingw/codeprojects/dosbox/32/vanilla/dosbox351/src'
make: *** [install-recursive] Error 1


-----------------------------------

C:\MinGW\codeprojects\dosbox\32\vanilla\SDL-1.2.15351\include\SDL_config_win32.h

Add the following to line 183:

#if (_WIN32_WINNT >= 0x0333)
#define NO_CHANGEDISPLAYSETTINGS 1
#define SDL_JOYSTICK_DISABLED 1
#endif



OLD


ADD TO SDL_CONFIG_WIN32.H
#define NO_CHANGEDISPLAYSETTINGS 1
#define SDL_JOYSTICK_DISABLED 1

dibvideo.c

For
#define NO_GETDIBITS
#define NO_GAMMA_SUPPORT
#if _WIN32_WCE < 420
#define NO_CHANGEDISPLAYSETTINGS
#else
#define ChangeDisplaySettings(lpDevMode, dwFlags) ChangeDisplaySettingsEx(NULL, (lpDevMode), 0, (dwFlags), 0)

Delete:
#define ChangeDisplaySettings(lpDevMode, dwFlags) ChangeDisplaySettingsEx(NULL, (lpDevMode), 0, (dwFlags), 0)
#else
#define ChangeDisplaySettings(lpDevMode, dwFlags) ChangeDisplaySettingsEx(NULL, (lpDevMode), 0, (dwFlags), 0)
#endif


sdl_sysevents.c

For
#ifdef _WIN32_WCE
#define IsZoomed(HWND) 1
#define NO_GETKEYBOARDSTATE
#if _WIN32_WCE < 420
#define NO_CHANGEDISPLAYSETTINGS

Delete:
#ifdef _WIN32_WCE
#define IsZoomed(HWND) 1
#define NO_GETKEYBOARDSTATE
#if _WIN32_WCE < 420
#endif

#endif


-----------------------
The following use changedisplaysettings

sdl_dibvideo.c
#define NO_GAMMA_SUPPORT
#if _WIN32_WCE < 420 || _WIN32_WINNT < 0x0333
#define NO_CHANGEDISPLAYSETTINGS

sdl_sysevents.c
#ifdef _WIN32_WCE || _WIN32_WINNT < 0x0333
#define IsZoomed(HWND) 1
#define NO_GETKEYBOARDSTATE
if _WIN32_WCE < 420 || _WIN32_WINNT < 0x0333

#ifndef NO_CHANGEDISPLAYSETTINGS
#ifndef _WIN32_WCE || _WIN32_WINNT < 0x0333
ChangeDisplaySettings(&SDL_fullscreen_mode, CDS_FULLSCREEN);
#endif
#endif /* NO_CHANGEDISPLAYSETTINGS */

#ifndef NO_CHANGEDISPLAYSETTINGS
#ifndef _WIN32_WCE || _WIN32_WINNT < 0x0333
ChangeDisplaySettings(NULL, 0);
#endif
#endif /* NO_CHANGEDISPLAYSETTINGS */

SDL_dx5video.c
#ifdef _WIN32_WCE || _WIN32_WINNT < 0x0333
#define NO_CHANGEDISPLAYSETTINGS
#endif
Attachments
DOSbox350.PNG
User avatar
DosFreak
l33t++
 
Posts: 9783
Joined: 2002-6-30 @ 16:35
Location: Your Head

Re: DOSBox Compilation Guides

Postby DosFreak » 2018-5-12 @ 10:46

DOSBox on NT 3.50

Okay figured it out with a workaround until/if I can figure out how to disable the joystick in DOSBox:

Note that below joystick support has not been disabled in either SDL or DOSBox so the executable will error out on NT3.50 with joygetposex error in winmm.dll.
Simply copy winmm.dll from NT3.51 to the DOSBox directory on NT3.50 and execute

SDL

"./configure --disable-shared --disable-directx --disable-video-opengl CFLAGS="-O3 -march=i386 -mtune=i386" --prefix=/mingw"

C:\MinGW\codeprojects\dosbox\32\vanilla\SDL-1.2.15351\include\SDL_config.h
Add
#define NO_CHANGEDISPLAYSETTINGS 1



DOSBOX

./configure --enable-core-inline LDFLAGS="--static -s" LIBS="-lsdl_net -lwsock32" CXXFLAGS="-O3 -march=i386 -mtune=i386" CPPFLAGS="-I/mingw/include/libpng16" --disable-opengl --disable-ddraw --disable-profile --bindir=/mingw/bin --libdir=/mingw/lib --includedir=/mingw/include --prefix=/mingw



Also it turns out fullscreen does work in NT3.50 but it's a fullscreen window versus true fullscreen. The more things change the more they stay the same.....

Need to see if can turn into a configure switch for SDL

Also likely that joystick doesn't work, this just satisfied the dependency.

Getsystemtimeasfiletime not caused by MINGW but by msvcrt.dll

To bypass this error then need to use a msvcrt.dll that does not include getsystemtimeasfiletime.
See attached.

OLD

SDL
--disable-joystick

SDL_config.h
#define SDL_JOYSTICK_DISABLED 1


VS ONLY?
C:\MinGW\codeprojects\dosbox\32\vanilla\SDL-1.2.15351\include\SDL_config_win32.h
Add
#define NO_CHANGEDISPLAYSETTINGS 1


NOT NEEDED


C:\mingw\codeprojects\dosbox\32\vanilla\SDL-1.2.15351\src\video\windib\SDL_dibvideo.c
Add
#define NO_CHANGEDISPLAYSETTINGS

C:\mingw\codeprojects\dosbox\32\vanilla\SDL-1.2.15351\src\video\wincommon\SDL_sysevents.c
Add
#define NO_CHANGEDISPLAYSETTINGS
Attachments
MSVCRT-4.20.0.6164.zip
(127.38 KiB) Downloaded 120 times
winmm.zip
(49.84 KiB) Downloaded 118 times
dosbox350.zip
(1.68 MiB) Downloaded 120 times
User avatar
DosFreak
l33t++
 
Posts: 9783
Joined: 2002-6-30 @ 16:35
Location: Your Head

Re: DOSBox Compilation Guides

Postby DosFreak » 2018-5-16 @ 08:53

INFO
mingw faster than mingw-w64 x32
x32 builds faster than x64 builds
Mingw svn faster than 0.74 by a significant amount

TO DO

VISUAL STUDIO
Update Visual Studio Guide with MINGW guide changes
Add gulikoza d3d patch to unofficial build http://www.si-gamer.net/gulikoza/
Ask bearwindows about VS2010 and findfirstfileex (does not work in 9x but does for NT4+) (msfn)
See if it's worth doing PGO
Cleanup junk at the bottom of each guide
http://bearwindows.zcm.com.au/msvc.htm#c9

/MT
/nodefaultlib crtdll.lib

minicrt
http://www.bttr-software.de/forum/mix_e ... p?id=10855
http://www.ltr-data.se/opencode.html/
http://www.mdgx.com/wnt4.htm
http://www.acc.umu.se/~bosse/
https://www.benshoof.org/blog/small-programs/
http://www.malsmith.net/minicrt/#overview

VS2012 defaults to SSE2. Specify /arch:IA32 to disable

libpng
*Need to see if this is an issue in Visual Studio. It's not with mingw or mingw-w64
viewtopic.php?f=32&t=40800

MINGW
Setup Linux VM and create Linux guide
Add gulikoza d3d patch to unofficial build http://www.si-gamer.net/gulikoza/
Cleanup junk at the bottom of each guide

Test only making some things dynamic
If need some things static and some things dynamic:
-static-libstdc++ -static-libgcc -Wl,-Bstatic -lstdc++ -lpthread -Wl,-Bdynamic
Everything after “-Wl,-Bstatic” will be linked statically, everything after “-Wl,-Bdynamic” will be linked dynamically

If recompile mingw-w64 for i386 then verify does not have same bug as old ver of mingwrt v5
Check *MINGWRT 5.0.1 with 2357 fix https://sourceforge.net/p/mingw/bugs/2357/ against mingw-w64. See if same issue

See if it's worth using PGO:
Need to try -fprofile-generate, then recompiling with -fprofile-use,
"If you have the patience, add -fprofile-generate to the switches, compile, run dosbox with a few different games, using different video modes, cpu instructions, scalers and sound cards. (I'd love to hear which ones you take. I tried Settlers for protected mode+svga+gus and MOM for hq2x+sblaster. Didn't have other ideas yet, no useful real mode program yet). After running the sample programs, reconfigure, replace -fprofile-generate with -fprofile-use, make clean, make"
https://stackoverflow.com/questions/436 ... le_rich_qa

CURSES
The debugger is mainly for developers of DOSBox, so they can find out why a game isn't working.
https://github.com/joncampbell123/dosbox-x/issues/515

Download the PDCurses source files from http://sourceforge.net/projects/pdcurse ... 3.4.tar.gz
Copy the downloaded file to your MSYS home folder
Switch to the MSYS command prompt
Extract the file
tar xvf PDCurses-3.4.tar.gz
Compile the library
cd PDCurses-3.4/win32
make -f gccwin32.mak DLL=N
And now copy the files to your /mingw folders
cp pdcurses.a /mingw/lib/libpdcurses.a
cd ..
cp curses.h panel.h /mingw/include/
cd ..

DOSBOX
./configure --enable-debug

COMPILE MINGW-W64 FOR i386

Might be able to compile for < i686 using mingw-w64 after all, although why there isn't a package available for this already is beyond me:
Use Mingw-W64 how to build document and use target i386-w64-mingw32
https://sourceforge.net/p/mingw-w64/wik ... wto-build/
https://github.com/niXman/mingw-builds
https://www.reactos.org/wiki/Building_MINGW-w64
http://ascend4.org/Setting_up_a_MinGW-w ... nvironment
https://github.com/Alexpux/mingw-w64/bl ... -build.txt
http://powdertoy.co.uk/Wiki/W/Compiling ... Linux.html


ALL
Create MacOS guide
Setup Windows OS VMs for testing. vbempj for NT3.51 in pcem works
Clang and DOSBox


ADD TO GUIDE

DOSBOX
Do not enable mmx or sse or avx. Already set by march.
fomit-frame pointer already set by -Ox . This inhibits proper debugging though.


findstr /s /n /i /p changedisplaysettings * | more

GCC 7.3 - Spectre mitigation not enabled by default in GCC. No point in enabling for DOSBox.

https://wiki.gentoo.org/wiki/GCC_optimization
gcc -c -Q -march=native --help=target
gcc -### -march=native /usr/include/stdlib.h

Remove mtune and only use march
March=i386
March=i686
March=x86-64

-----------------------
UNSORTED


MOUSE ISSUES WITH SDL
https://discourse.libsdl.org/t/win10-fa ... ng/23526/3
https://bugzilla.libsdl.org/show_bug.cgi?id=3931
https://bugzilla.libsdl.org/show_bug.cgi?id=4152#c8


CONFIGURE CHANGES
--enable-dynamic-x86 (32bit binary only)
--enable-dynrec

Useful for testing only otherwise have to:
Modify config.h
Set #define C_DYNAMIC_X86 1
Remove #define C_DYNREC 1

SDL 1.2.13 vs SDL 1.2.15 vs SDL 1.2.15 w/ SDL 1.2.13 mouse code


Openwatcom
https://sourceforge.net/projects/openwa ... 017-11-01/


COMPILING RESEARCH

DOSBOX

SDL2 (Needs modified DOSBox)

MUNT
git clone http://www.github.com/munt/munt.git
cd munt/mt32emu
cmake -DCMAKE_BUILD_TYPE:STRING=Release .
make install

FluidSynth
https://sourceforge.net/projects/fluids ... urce=files
./autogen.sh
./configure
make install

Patch for OpenGL fullscreen bug
http://www.vogons.org/viewtopic.php?f=3 ... 20#p276738

FluidSynth soundfont patch
http://www.vogons.org/viewtopic.php?f=3 ... 20#p385413

Basic GLSL shader support (prototype)
http://www.vogons.org/viewtopic.php?f=4 ... 20#p319636

An adaptation to SDL 2.0
http://www.vogons.org/viewtopic.php?f=3 ... 40#p433097

---------------------------------
Update
git pull
make install
User avatar
DosFreak
l33t++
 
Posts: 9783
Joined: 2002-6-30 @ 16:35
Location: Your Head

Re: DOSBox Compilation Guides

Postby DosFreak » 2018-5-18 @ 19:50

DOSBOX Debug
http://www.vogons.org/viewtopic.php?t=3944



UNOFFICIAL PATCHES
viewtopic.php?f=41&t=34642&hilit=VHD#p293556


Extra Libraries:
physfs
fluidsynth
libpcap
freetype
libtbb


LINUX
*If compiled for one distro can it work on all?

Install tools:
apt-get install autoconf libglew-dev g++ cmake cmake-qt-gui

Install Mercurial, Git and Subversion:
apt-get install mercurial git subversion

ALSA
apt-get install libasound2-dev libpulse-dev

LIBPCAP
apt-get install flex bison

******* automake and libtool
The automake tool can be obtained from the http://ftp.gnu.org/gnu/automake
Get the automake-1.13.4 (http://ftp.gnu.org/gnu/automake/automake-1.13.4.tar.gz)
and extract it to /tmp
./configure --prefix=/usr/local && make && make install

Download the libtool from the http://www.gnu.org/software/libtool/ and extract it to /tmp
./configure --prefix=/usr/local && make && make install

Don't install the automake 1.14 or above that may interrupt the compilation of Glib and DOSBox.

Moe's OpenglHQ
Get Moe's OpenglHQ patch from the http://ykhwong.x-y.net and apply it to the SDL source.
This patch includes several fixes for DOSBox and also implements Moe's OpenglHQ output.

patch -up1 < openglhq-dosbox-for-sdl-202121117_msvc_gcc.patch
./autogen.sh && ./configure --enable-shared=no && make && make install

physfs
This is used for zip/7z mounting.
hg clone http://hg.icculus.org/icculus/physfs/

Change to the physfs directory and type:
cmake-gui .

Click configure -> unix makefiles -> use default native compilers.
Uncheck physfs_build_shared
Click configure again
Click generate and close the cmake window.
Type:
make && make install

******* glib (needed for Fluidsynth)
In order to install glib, libffi, expat and python are required.
Visit http://www.linuxfromscratch.org/blfs/vi ... ibffi.html
Get libffi, extract it to /tmp and type:
./configure --prefix=/usr/local && make && make install

Get expat from the http://www.linuxfromscratch.org/blfs/vi ... expat.html
Extract it to /tmp and type:
./configure --prefix=/usr/local && make && make install

Get Python 2.7.9 from the http://www.linuxfromscratch.org/blfs/vi ... thon2.html
(don't install if the Python has already been installed)
Extract it to /tmp and type:
./configure --prefix=/usr/local --enable-shared=no --with-system-expat --with-system-ffi --enable-unicode=ucs4 && make && make install

Get glib from the http://www.linuxfromscratch.org/blfs/vi ... glib2.html
Extract it to /tmp and type:
./configure --prefix=/usr/local --enable-gtk-doc-html=no --enable-debug=no --enable-static=yes --enable-shared=no && make && make install

******** Fluidsynth
This is used for loading soundfonts with MIDI synth.
git clone git://git.code.sf.net/p/fluidsynth/code-git fluidsynth-code-git
Change to the fluidsynth directory and type:
cmake-gui .
Click configure -> unix makefiles -> use default native compilers
Uncheck build_shared_libs, pulseaudio, enable-dbus, and enable-ipv6
Click configure again. Click generate, close cmake window, and type:
make
If pthread is missing, add "-lpthread" to src/CMakeFiles/fluidsynth.dir/link.txt
make install

SDL_sound
--enable-physfs=no

libfreetype
This is used for printing.
git version may not work. /*git clone git://git.sv.gnu.org/freetype/freetype2.git*/
Get freetype-2.5.5.tar.gz from the http://www.freetype.org/. extract it to /tmp and type:
./configure --enable-shared=no && make && make install

libpcap
This is used for computer networking / Internet.
Get libpcap-1.6.2.tar.gz from tcpdump.org. Extract it /tmp and type:
./configure --enable-shared=no && make && make install

libtbb
This library will be used by xbrz scaler. (Don't compile!)
Get the latest version of tbb from the official website http://threadingbuildingblocks.org/
Extract it to /tmp and move the bin, include, and lib directories to /usr/local
Copy everything from /usr/local/lib/ia32/gcc4.4 to /usr/local/lib



2. Get openglide source from the http://sourceforge.net/projects/openglide/
Don't compile! Just extract it to /tmp/openglide

---------------------------------
Compiling DOSBox SVN-Daum

To add some missing libraries and the support for the C++11 to dosbox, type:
export LIBS='-ltbb -lglib-2.0 -lgthread-2.0 -lFLAC -ldl -lglib-2.0 -ldbus-1 -lasound -lpulse'
export CXX='/usr/bin/g++ -std=c++11'
export CFLAGS="-s -O2 -msse2"
export CXXFLAGS="-s -O2 -msse2"
export LDFLAGS="-static-libgcc -static-libstdc++"

./configure --enable-core-inline && make


OS X
https://solarianprogrammer.com/2017/05/ ... gcc-macos/

DOSBox can be compiled with one of the following compilers: Clang or GCC.

1. Open App Store and download and install Xcode that contains the Clang first.

The MacPorts is already included as a bundle of the XCode.
However, the Macports can also be manually downloaded from the http://www.macports.org/

Usage of the MacPorts:
In order to install a package, type: sudo port install [package-name]
For more information about the [package-name], refer to the http://www.macports.org/ports.php

Example:
In order to install the FluidSynth, type: sudo port install fluidsynth +universal

Most of the remaining libraries required by DOSBox can be installed by this way.

For the GCC installation (optional):
In order to install the GCC version 4.8 type:
sudo port install gcc48 +universal
port select --set gcc mp-gcc48

Obtain the source and extract it to /dosbox. Change to the dosbox source directory.
Do "./autogen.sh" or type the following:
aclocal
autoheader
automake --include-deps --add-missing --copy
autoconf
export CPPFLAGS="-I/opt/local/include"

For the Clang:
export CC='gcc -arch i386'
export CXX='g++ -std=c++11 -arch i386'
export GCOV='gcov -arch i386'

For the GCC:
export CC='/opt/local/bin/gcc -arch i386 -static-libgcc -static-libstdc++'
export CXX='/opt/local/bin/g++ -std=c++11 -arch i386 -static-libgcc -static-libstdc++'
export GCOV='/opt/local/bin/gcov -arch i386'

For the libraries to be dynamically linked, type:
export LIBS='libtbb.dylib -framework CoreAudio -framework CoreMidi -framework AudioToolbox -framework AudioUnit'

For the libraries to be statically linked, set the following LIBS variable in src/Makefile:
LIBS=-framework IOKit -framework OpenGL -framework Carbon -framework ApplicationServices /opt/local/lib/libSDL_sound.a
-framework CoreAudio -framework CoreMidi -framework AudioToolbox -framework AudioUnit -L/opt/local/lib /opt/local/lib/libSDLmain.a
-Wl,-framework,AppKit /opt/local/lib/libSDL.a -Wl,-framework,Cocoa /opt/local/lib/libpng.a /opt/local/lib/libz.a -L/opt/local/lib
/opt/local/lib/libfreetype.a /opt/local/lib/libz.a /opt/local/lib/libbz2.a /opt/local/lib/libpng16.a /opt/local/lib/libpcap.a
/opt/local/lib/libSDL_net.a /opt/local/lib/libX11.a /opt/local/lib/libfluidsynth.a /opt/local/lib/libphysfs.a /opt/local/lib/libz.a
/opt/local/lib/libflac.a /opt/local/lib/libogg.a /opt/local/lib/libmodplug.a /opt/local/lib/libspeex.a /opt/local/lib/libvorbis.a
/opt/local/lib/libxcb.a /opt/local/lib/libvorbisfile.a /opt/local/lib/libvorbisenc.a /opt/local/lib/libportaudio.a /opt/local/lib/libdbus-1.a
/opt/local/lib/libgthread-2.0.a /opt/local/lib/libreadline.a /opt/local/lib/libsndfile.a /opt/local/lib/libjack.a /opt/local/lib/libXrandr.a
/opt/local/lib/libglib-2.0.a /opt/local/lib/libiconv.a /opt/local/lib/libintl.a /opt/local/lib/libtermcap.a /opt/local/lib/libXext.a
/opt/local/lib/libXrender.a /opt/local/lib/libXau.a /opt/local/lib/libXdmcp.a /opt/local/lib/libtbb.a

./configure --enable-core-inline --prefix=/opt/local --host=i386
make


MinGW on Linux will need DX files
User avatar
DosFreak
l33t++
 
Posts: 9783
Joined: 2002-6-30 @ 16:35
Location: Your Head

Re: DOSBox Compilation Guides

Postby DosFreak » 2018-5-21 @ 23:30

Clang and mingw-w64
Try clang++ -Xclang -flto-visibility-public-std for static libstdc++

WSL Install Instructions
*Need to find appx download

Open Powershell as an Administrator
Run enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
Go to Start->Run and type in "ms-windows-store://pdp/?productid=9N9TNGVNDL3Q&referrer=unistoreweb&scenario=click&webig=0c38a303-bb74-4377-af49-5aee43944125&muid=057088A8765F68B1287B835077A2697C" and install

https://icculus.org/~dolson/sdl/build-cross.sh
https://askubuntu.com/questions/689935/ ... le_rich_qa
WSL currently does not support executing 32bit programs

Upload Windows 10 WSL and Ubuntu guide

TODO
X11 and WSL https://www.scivision.co/x11-gui-window ... for-linux/
opengl and linux build

Windows
NSIS

Linux
?

OSX
https://hexeract.wordpress.com/2016/09/ ... os-sierra/
Macports
xcode
Package creation

SDL2 98SE - No emulator supports D3D9 in 98. Find software D3D9 wrapper or OpenGL Mesa3D that works with SDL2 on Windows 98 or dig out laptop from closet.

SDL2 Windows 2000 - SDL 2.0.5 mouse code was patched for 2k. Need to see if works on 2000 and if so put mouse code in latest SDL version.
Goal is to not have to use kernelex or any other wrapper if possible
https://www.tapatalk.com/groups/win2kga ... t1073.html
viewtopic.php?f=32&t=34770&start=60#p537272

https://github.com/unterwulf/ipxbox/blob/master/README
http://tanalin.com/en/articles/lossless-scaling/

https://github.com/joncampbell123/dosbo ... win32.diff

Latest DOSBox with Clang warnings
Ignore -switch and -Waddress-of-packed-member warnings
-Wl,-Bstatic -lc++ -Wl,-Bdynamic


Code: Select all
clang++ -m32 -DHAVE_CONFIG_H -I. -I../..  -I../../include -I/mingw32/include/libpng16 -I/mingw32/include/SDL -I/mingw32/include -I/mingw32/include/SDL -D_GNU_SOURCE=1 -Dmain=SDL_main  -O3 -march=i686 -m32 -mno-ms-bitfields  -MT sdl_mapper.o -MD -MP -MF .deps/sdl_mapper.Tpo -c -o sdl_mapper.o sdl_mapper.cpp
sdlmain.cpp:635:29: warning: logical not is only applied to the left hand side of this bitwise operator [-Wlogical-not-parentheses]
                if (!sdl.blit.surface || (!sdl.blit.surface->flags&SDL_HWSURFACE)) {
                                          ^                       ~
sdlmain.cpp:635:29: note: add parentheses after the '!' to evaluate the bitwise operator first
                if (!sdl.blit.surface || (!sdl.blit.surface->flags&SDL_HWSURFACE)) {
                                          ^
                                           (                                    )
sdlmain.cpp:635:29: note: add parentheses around left hand side expression to silence this warning
                if (!sdl.blit.surface || (!sdl.blit.surface->flags&SDL_HWSURFACE)) {
                                          ^
                                          (                       )
mv -f .deps/sdl_mapper.Tpo .deps/sdl_mapper.Po
clang++ -m32 -DHAVE_CONFIG_H -I. -I../..  -I../../include -I/mingw32/include/libpng16 -I/mingw32/include/SDL -I/mingw32/include -I/mingw32/include/SDL -D_GNU_SOURCE=1 -Dmain=SDL_main  -O3 -march=i686 -m32 -mno-ms-bitfields  -MT render.o -MD -MP -MF .deps/render.Tpo -c -o render.o render.cpp


make clean not working for libraries when switching between archs. Need to find out which ones and do rm for deps and libs. This will eliminate having to maintain multiple source files.

DOSBox may need --disable-shared and --disable-static switches:
When compiling DOSBox statically on win32 then have to change configure to use wsock32 instead of ws2_32 because test case adds ws2_32 lib or mabye just remove test case.
When compiling DOSBox statically on Linux then have to change configure to remove -x11 because SDL_net adds this library and they conflict or mabye just remove test case.

Possibly SDL and SDL_net add the libraries anyway so DOSBox adding the library may be redundant. Need to check.
Propose --enable-static which doesn't add the libs.

https://github.com/emendelson/OneStopDO ... SBoxOSX.sh

https://forums.libsdl.org/viewtopic.php?p=30978
https://blogs.msdn.microsoft.com/oldnew ... 0/?p=23923

Change dosbox default settings from original to 0x0. Check steam monitor survey for window resolution.

Boxedwine SDL1 http://www.boxedwine.org/community/patc ... 2/#post-21

Could be useful for Windows OS less than XP for old Windows games that are too fast and also for use with HX DOS?

Winfile retro https://github.com/Microsoft/winfile/tree/retro

https://code.visualstudio.com/
https://blogs.msdn.microsoft.com/vcblog ... udio-code/
https://code.visualstudio.com/docs/languages/cpp

Linux
sudo curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
sudo mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg
sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list'

sudo apt-get update
sudo apt install libgtk2.0-0
sudo apt-get install code

Windows
Download
Install Microsoft C/C++ Extension for VS Code

Visual Studio Community
https://docs.microsoft.com/en-us/cpp/po ... -targeting
User avatar
DosFreak
l33t++
 
Posts: 9783
Joined: 2002-6-30 @ 16:35
Location: Your Head

Re: DOSBox Compilation Guides

Postby robbforce » 2018-5-24 @ 21:03

Hi, thanks for all the work on the Visual Studio compilation guide! It got me most of the way to producing a working Dosbox exe from the SVN source. I have some updates where I deviated or made corrections. I used the multi text since I only have Visual Studio 2017 and it seemed to apply better. I'm pasting the diffs between the original and the new text:

I found and added libModPlug and libMikMod to the SDL_sound library:
Code: Select all
--- F:/(projects)/dosbox/DOSBOXVisualStudioMultTarget.txt   Wed May 23 19:03:32 2018
+++ F:/(projects)/dosbox/DOSBOXVisualStudioMultTarget_new.txt   Thu May 24 00:32:00 2018
@@ -93,6 +93,12 @@
 https://ftp.osuosl.org/pub/xiph/releases/flac/?C=M;O=A
 flac-1.3.1.tar.xz
 
+libModPlug
+https://sourceforge.net/projects/modplug-xmms/files/libmodplug/0.8.9.0/libmodplug-0.8.9.0.tar.gz/download
+
+libMikMod
+https://sourceforge.net/projects/mikmod/files/libmikmod/3.3.11.1/libmikmod-3.3.11.1.tar.gz/download
+
 SDL_SOUND
 https://www.icculus.org/SDL_sound/downloads/SDL_sound-1.0.3.tar.gz


Instead of installing the DirectX SDKs, I extracted them with 7-zip and copied the include and library folders, per your notes.

When opening some solutions and letting VS2017 upgrade them, it would sometimes prompt for the Windows SDK target. For this compilation, I always chose 8.1, over the Windows 10 SDK.

Some libraries provided "static" and "dynamic" projects. Since I went for a static build this time, I only updated and built the static project and ignored steps that prompted modifying the dynamic project. This was done for FLAC and SDL_sound.

When adding include or library folders, I used relative paths in all cases:
Code: Select all
@@ -448,10 +451,11 @@
 VISTA+
 b. Verify that "Platform Toolset" is set to "Visual Studio 2017 (v141)"
 
-**If you want to keep SDL_net.DLL seperate from DOSBox.exe then set to "Dynamic Library (.dll)"
+**If you want to keep libvorbis.DLL seperate from DOSBox.exe then set to "Dynamic Library (.dll)"
 
    c. Select "VC++ directories" then "Include Directories" and add the following directory:
-    C:\Build\DOSBOX\multi\VSXXXX\XXXX\COMPILE\libogg\include\ogg
+
+    ..\..\..\..\libogg\include\ogg
 
    e. Click "Apply" and then "OK"


For SDL_sound, instead of removing blocks of code, I removed the definition instead from the project, to remove those dependencies. In this case, I turned off smpeg support:
Code: Select all
@@ -520,9 +524,15 @@
 
    c. Select "VC++ directories" then "Include Directories" and add the following directory:
     C:\Build\DOSBOX\multi\XXXX\XXXX\COMPILE\SDL-1.2.15\include
-    C:\Build\DOSBOX\multi\XXXX\XXXX\COMPILE\flac-1.3.1\include
-    C:\Build\DOSBOX\multi\VS2017\XP\COMPILE\libvorbis-1.3.5\include
+    ..\..\SDL-1.2.15\include
+    ..\..\flac-1.3.1\include
+    ..\..\libvorbis-1.3.5\include
+    ..\..\libmikmod-3.3.11.1\include
+    ..\..\libmodplug-0.8.9.0\src
 
+   d. Select "C/C++" then "Preprocessor". Edit Preprocessor Definitions and remove:
+    SOUND_SUPPORTS_SMPEG
+   
    e. Click "Apply" and then "OK"
 


The last thing I did was set some flags that didn't carry over during the VS upgrade. In the dosbox properties, C/C++ -> Optimization, changed "Whole Program Optimization" to Yes. Then in Command Line, I added /GA to "Additional Options", which should optimize dosbox for windows: https://docs.microsoft.com/en-us/cpp/bu ... pplication I probably should go back and check the flags for the libraries too.

It seems like a couple more flags could be set, like under C/C++ -> General, "SDL Checks" and "Multi-processor Compilation", but I haven't done that research.

After building the static libraries and wiring everything up, dosbox-svn compiled in Visual Studio 2017 and ran in Windows 10! I've tested a couple games and they seem to work ok. Thanks again for all your work on creating new guides!
--------------------------
I've been playing around with getting munt to compile in Visual Studio and learned about vcpkg. With it and the cmake support in Visual Studio 2017, I was able to build munt/mt32emu (use "open folder" and select the munt folder). So, I went back to try using the vcpkg libraries on dosbox-svn. This seems to have worked (a working dosbox exe is built and runs games as expected). This method should also provide some options for x64 or universal windows builds, without much effort.

Install vcpkg following the easy instructions in the repo readme. It's recommended to clone to a short path like C:\src\vcpkg This will contain the headers and libraries.

Install the following libraries via powershell (these are the x86 static versions):
Code: Select all
cd c:\src\vcpkg
.\vcpkg install libmikmod:x86-windows-static
.\vcpkg install libmodplug:x86-windows-static
.\vcpkg install libflac:x86-windows-static
.\vcpkg install libogg:x86-windows-static
.\vcpkg install libvorbis:x86-windows-static
.\vcpkg install libpng:x86-windows-static
.\vcpkg install zlib:x86-windows-static

For x64 static libraries you would use x64-windows-static. These can be installed side-by-side with the x86 versions and we'll target a triplet later. Notes on using "triplets" found here: https://blogs.msdn.microsoft.com/vcblog ... available/

SDL1 isn't available via vcpkg, so SDL, SDL_net and SDL_sound still need to be built using the manual method, but should be able to use the vcpkg libraries instead of pulling the source for the other libraries.

Open the dosbox solution with Visual Studio and let it upgrade the solution and the project as usual.

Following notes from the triplet blog above, I now opended the new project file (.vcxproj) in notepad++ and added these properties to the "Globals" property group:
Code: Select all
    <VcpkgTriplet>x86-windows-static</VcpkgTriplet>
    <VcpkgEnabled>true</VcpkgEnabled>

I'm not sure if there's a direct way to get to the globals from the Visual Studio property editor.

Now VS will pull libraries and header files from vcpkg. All that's needed is to edit the project properties:
In Solution Explorer right-click dosbox and select properties.
  • Add the SDL directories to VC++ Directories -> Include Directories and Library Directories.
  • Also change Linker -> Input -> Additional Dependencies to (match the lib names in vcpkg, specifically FLAC++, ogg, vorbis, libpng16):
    Code: Select all
    sdl_sound_static.lib;FLAC++.lib;ogg.lib;vorbis.lib;dinput8.lib;dxguid.lib;opengl32.lib;winmm.lib;zlib.lib;libpng16.lib;sdl_net.lib;sdlmain.lib;sdl.lib;odbc32.lib;odbccp32.lib;ws2_32.lib;%(AdditionalDependencies)
  • Click on C/C++ -> Optimization -> and set Whole Program Optimization to Yes (/GL).
  • Click on C/C++ -> Code Generation -> and set Runtime Library to Multi-threaded (/MT).
  • Click on C/C++ -> Command Line -> and type /GA in Additional Options.

Edit the config.h with #define C_CORE_INLINE 1

Compile!

I'd like to be able to specify the triplet globals via configuration manager so x64 and universal builds could be easily selected. I haven't tried building with the x64 libraries yet, so I have no idea if the x64 problems are still present.
robbforce
Newbie
 
Posts: 5
Joined: 2013-11-08 @ 06:16

Re: DOSBox Compilation Guides

Postby DosFreak » 2018-6-06 @ 11:20

OSX,MacOS and DOSBox

MacOS 13.4
x86_X64 w/SDL2.0.8 (OpenGL deprecated, needed for Metal)

OSX 10.5 to MacOS 13.4
x86_X64 w/SDL2 (If 10.11+ then can use Metal)
x86 w/SDL2 (If 10.11+ then can use Metal)

OSX 10.5 to 10.6.8
x86 w/SDL2 w/OpenGL

OSX 10.4.4 to 10.4.11
x86 w/SDL1 w/OpenGL

OSX 10.0 - 10.5.8
PowerPC w/SDL1 w/OpenGL

Universal Binary
https://github.com/gs11/dosbox-macbuild
User avatar
DosFreak
l33t++
 
Posts: 9783
Joined: 2002-6-30 @ 16:35
Location: Your Head

Re: DOSBox Compilation Guides

Postby DosFreak » 2018-6-06 @ 23:57

SURFACE/OVERLAY/DDRAW with fullresolution=original
Switching to fullscreen results in windows going to other screen when DOSBox is switched fullscreen but are moved back when DOSBox is minimized
DOSBox freezes for a couple of seconds when switching between fullscreen and windowed mode.

OPENGL with fullresolution=original
Switching to fullscreen results in windows moving to other screen when DOSBox is switched to fullscreen and are not moved back
DOSBox freezes for less that surface/overlay/ddraw

SURFACE with fullresolution=0x0
Windows are not moved to other screens
DOSBox still freezes for a couple of seconds when switching between fullscreen and windowed mode
Dosbox video is not scaled

OVERLAY with fullresolution=0x0
Windows are not moved to other screens
DOSBox still freezes for a couple of seconds when switching between fullscreen and windowed mode
Dosbox video is scaled and takes up the full screen

DDRAW with fullresolution=0x0
Windows are not moved to other screens
DOSBox still freezes for a couple of seconds when switching between fullscreen and windowed mode
Dosbox video is scaled and takes up the full screen

OPENGL with fullresolution=0x0
Windows are not moved to other screens
DOSBox freezes for less than surface/overlay/ddraw
Dosbox video is scaled and takes up the full screen
OPENGL with fullresolution=0x0
Switching to fullscreen results in windows moving to other screen when DOSBox is switched to fullscreen and are not moved back
DOSBox freezes for less that surface/overlay/ddraw



Recommendation:
fullresolution=0x0
windowresolution=1280x800 (60% of steam users have a 1920x1080 display)
aspect=true
scaler=none
windows use output=ddraw or openglnb (OpenGL ICD may not be present so SDL1=DDRAW (unless unofficial d3d) SDL2=D3D)
User avatar
DosFreak
l33t++
 
Posts: 9783
Joined: 2002-6-30 @ 16:35
Location: Your Head

Re: DOSBox Compilation Guides

Postby DosFreak » 2018-6-13 @ 10:05

Add new options LCD, CRT to dosbox.conf?

LCD = disregards fullresolution and aspect. Sets both to fullscreen=0x0 and aspect=true behind the scenes
CRT = disregards fullresolution and aspect. Sets both to fullscreen=original and aspect=false behind the scenes
User avatar
DosFreak
l33t++
 
Posts: 9783
Joined: 2002-6-30 @ 16:35
Location: Your Head

Re: DOSBox Compilation Guides

Postby DosFreak » 2018-6-14 @ 23:26

MSYS2 supposedly updated to Clang v6 today. Need to check and test.
User avatar
DosFreak
l33t++
 
Posts: 9783
Joined: 2002-6-30 @ 16:35
Location: Your Head

Re: DOSBox Compilation Guides

Postby DosFreak » 2018-6-26 @ 19:42

scaler confusion
https://www.gog.com/forum/general/dosbo ... game/page1

Need to:
default DOSBox to fullresolution=desktop (0x0 may confuse people),scaler=none, aspect=true, vs 1600x1200 for full
Default windowresolution to 1280x960



Put info in dosbox.conf about checking video card scaler settings, most default to aspect. If DSR used then disable scaling in video card properties.


DOSBox compilation:
viewtopic.php?f=32&t=60960
viewtopic.php?f=32&t=61019
https://github.com/Interrupt/systemshock
FLAC viewtopic.php?f=32&t=49999&start=20
SDL_SOUND viewtopic.php?f=41&t=34770&start=120#p685580
viewtopic.php?f=41&t=31881&start=1520#p691063
User avatar
DosFreak
l33t++
 
Posts: 9783
Joined: 2002-6-30 @ 16:35
Location: Your Head

Re: DOSBox Compilation Guides

Postby DosFreak » 2018-7-14 @ 16:23

Priorities:
Linux guide uploaded
Thread cleanup and prioritize
See about converting guide to wiki with pics and see about updating DOSBox INSTALL as well as build script.

Visual Studio
viewtopic.php?f=32&t=40800&p=650891#p650891
viewtopic.php?f=32&t=62023
User avatar
DosFreak
l33t++
 
Posts: 9783
Joined: 2002-6-30 @ 16:35
Location: Your Head


Return to DOSBox General

Who is online

Users browsing this forum: DosFreak, Stretch, viktorz and 1 guest