VOGONS

Common searches


Reply 20 of 72, by dugan

User metadata
Rank Newbie
Rank
Newbie

Here is the shader support as a numbered series of patches. Apply them in order against r4006.

The first patch ports DosBox to SDL2. It is the exact same patch I just posted in the SDL2 thread:

An adaptation to SDL 2.0 (Alpha-level Android build attached)

The second patch ports DosBox's OpenGL output backend to OpenGL 3.3. Core profile.

One thing you might want to note about the OpenGL 3 patch that it drops PBO (Pixel Buffer Object) support. The reason is that DosBox's PBO's don't work properly; they're the cause of a screen corruption bug. Also, I simply can't imagine an OpenGL 3.3-supporting setup where dropping this optimization is going to make a difference. If you're incorporating this patch into your own fork, and you want them, you can easily add them back; you can probably find a working PBO-enabled version in my git history.

Another thing you might want to note about the OpenGL 3 patch is that it uses GLEW. I include GLEW (including its license file) right in the codebase. As far as I know, this isn't a problem.

The third patch adds support for loadable, external shaders. The shader format is of my own design, and the goals were: a) use OpenGL 3.3, and b) make RetroArch shaders easy to port. The uniforms (values passed from the CPU to the GPU) are passed to the shader in the following format:

layout (std140) uniform program
{
vec2 video_size;
vec2 texture_size;
vec2 output_size;
} IN;

If you're porting a bsnes shader, see here for how to match bsnes uniform names to DosBox (and RetroArch) uniform names:

https://forums.libretro.com/t/cg-vs-glsl-syntax-help/400/2

Here is a repository of compatible shaders that I've made available:

https://github.com/duganchen/dosbox_shaders

The fourth patch gets fullscreen working retina Macs. You should only apply this one if you actually intend to run it on a retina Mac and you find that you actually need it. What it does is documented here:

An adaptation to SDL 2.0 (Alpha-level Android build attached)

Attachments

Reply 21 of 72, by Ant_222

User metadata
Rank Oldbie
Rank
Oldbie

Would you consider implementing pixel-perfect scaling in your SDL2 fork via the
SDL_RenderSetScale() function and the SDL_HINT_RENDER_SCALE_QUALITY set to 0 (nearest). You may take the scale-calculation routine from my patch:

get_perfect_scale()
in src\gui\pixelscale.cpp

and let SDL2 do the rest. The only problem will be to bypass the standard scaling and aspect correction. This version should work much faster than mine, and with any output supported by SDL2.

Edit: Furthermore, all the standard modes of scaling and aspect-ratio correction may be delegated to SDL_RenderSetScale() and the scale quality hint.

Reply 24 of 72, by Dominus

User metadata
Rank DOSBox Moderator
Rank
DOSBox Moderator

You can just clone it from github and send a pull request once you are done

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

Reply 26 of 72, by Dominus

User metadata
Rank DOSBox Moderator
Rank
DOSBox Moderator

It's pretty easy if you used any othe versioning system. Clone is just the term git uses and pull requests are well explained on github. Of course grabbing the source via git, changing stuff and then let git make diff/patch is easy as well. Pull requests are just easier for the project maintainer.

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

Reply 28 of 72, by Ant_222

User metadata
Rank Oldbie
Rank
Oldbie

I am not very comfortable with Unix and makefiles either, and had to follow these instructions to the letter in order to setup a working build environment on Windows in MinGW. Will those work for your fork, with the exception that I shall need to download and install SDL2 SDK?

If git can work from MinGW I will use it, but now I shall just download the patch, apply them to the source and see what is to be done.

Reply 29 of 72, by Ant_222

User metadata
Rank Oldbie
Rank
Oldbie
dugan wrote:

The fourth patch gets fullscreen working retina Macs. You should only apply this one if you actually intend to run it on a retina Mac and you find that you actually need it.

Does it have any harmful effects?

Reply 31 of 72, by dugan

User metadata
Rank Newbie
Rank
Newbie
Ant_222 wrote:
dugan wrote:

The fourth patch gets fullscreen working retina Macs. You should only apply this one if you actually intend to run it on a retina Mac and you find that you actually need it.

Does it have any harmful effects?

Yes. It's been reported that it causes issues if you have two monitors.

An adaptation to SDL 2.0 (Alpha-level Android build attached)

Reply 32 of 72, by Dominus

User metadata
Rank DOSBox Moderator
Rank
DOSBox Moderator

But on Windows it will not have any effect at all 😉

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

Reply 33 of 72, by _MagicMyth_

User metadata
Rank Newbie
Rank
Newbie

Hi all,

I would post a new topic for this but I'm either thick or new members cannot post a new topic in this forum section.

I wanted to get DOS games running well on Steam Linux and with the Steam Link but as has become known DOS games don't work well with the Steam overlay due to how frames are only rendered when something changes. On Windows this is worked around with DosBox builds supporting DirextX pixel shaders that force the frames to sync with the display. Unfortunately no such feature is available for the OpenGL output. As I soon found dugan's SDL2 fork was working best for me (much more reliable screen resolution handling) I decided to write a patch to solve this with my very limited C++ skills. I think its kind of hackish but it works well for me. You can find the branch over at:

https://github.com/magicmyth/dosbox/tree/force-frame-update

This patch adds a new configuration option to the render section: forceframeupdate. When set to true this will set a default minimal frame refresh rate. Only when the last frame render was below this minimum will a frame re-draw be forced. You can also set your own desired minimum refresh by setting it to a numeric value in milliseconds (e.g. 50 for roughly 20fps). The default is conservative (10fps) to be just good enough for a hooked in render overlay to work. Its disabled by default ("false") so make sure to add that config option.

The minimum config setup for this to work then is:

fullresolution=desktop
output=openglnb
...

[render]
# Force minimum regular frame updates to fix overlay.
forceframeupdate=true

Combine this with dugan's shader support and you have a great streaming experience to your lounge's big screen 😎

I've uploaded a build for Ubuntu 16.04 64bit (may work with later releases as well) to:
https://drive.google.com/open?id=0B4dD2fOx1XJ … WUhBU2FZRWlVUDA

You'll need a few dependantcies installed so in the terminal just run:

sudo apt install libsdl2-2.0-0 libsdl2-net-2.0-0 libfluidsynth1 

There is a known issue with the build if you don't use fluidsynth. It takes a few extra seconds to start as for some reason it probes for Jack. It only takes a few seconds though or you can simply follow dugan's instruction and hook it into fluidsynth with a soundfont which bypasses the issue.

I've only tested a few games and I'm really interested to find out how well it works for others. It should work on Mac's but I've not tested that myself.

Reply 34 of 72, by Marty2dos

User metadata
Rank Newbie
Rank
Newbie

Hello dugan,
I could succesfully build a Dosbox Fork from your Repository for Windows (using msys/mingw 32bit on Windows 7) but the sound doesnt work. Only "General Midi". No Soundblaster. No GUs etc. I hear only crackled Sound ?
If i capture to waveout, there is Sound.

aufnhame0304.png

Edit: Sound Works, SDL2.dll mismatch ..... 😒

Compiling with SDL2 v2.0.6+ the sound is cracled. With SDL2 2.0.4, sound works normal.

Attachments

  • Filename
    DOSBox_r4006_fs.7z
    File size
    3.35 MiB
    Downloads
    118 downloads
    File comment
    Same Version which Include Fluidsynth 1.1.8 but not static linking the libs. :(
    File license
    Fair use/fair dealing exception
  • Filename
    DOSBox_r4006.7z
    File size
    1.51 MiB
    Downloads
    135 downloads
    File comment
    The DOSbox Fork for Windows
    - Compiled as static
    - Change Configpath -> Shaderpath. Add a "gl.shpath=" section. I dont like App Data Only
    File license
    Fair use/fair dealing exception
Last edited by Marty2dos on 2017-11-01, 06:35. Edited 1 time in total.

Reply 37 of 72, by Marty2dos

User metadata
Rank Newbie
Rank
Newbie

No idea how can i static link the Fluidsynth Depends. I have tried 2 Days. No Chance. If it fully static linked. Dosbox Say's:

fluidsynth: error: FluidSynth hinstance not set, which is needed for DirectSound
Failed to create the audio driver

and can not load Soundfonts etc.... If it not static linked, also shared then it works with all the dlls. Damned.....

Reply 38 of 72, by Marty2dos

User metadata
Rank Newbie
Rank
Newbie

First.. I have figured out.Second i not very familar with Mingw and c++. This was a hell. But the compild fluidsynth.exe in mingw/bin folder works too and now i can compie Dosbox as single exe (fully static linked)

Source File Chnages:
In the fluidsynth\include\fluidsynth.

#if defined(WIN32)
#if defined(FLUIDSYNTH_DLL_EXPORTS)
#define FLUIDSYNTH_API __declspec(dllexport)
#elif defined(FLUIDSYNTH_NOT_A_DLL)
#define FLUIDSYNTH_API
#else
#define FLUIDSYNTH_API __declspec(dllimport)
#endif

to

#if defined(WIN32)
#define FLUIDSYNTH_API

This tip comes from ScummVM

In the fluidsynth\src\drivers\fluid_dsound.c

  /* check if the globals are initialized */
if (FLUID_HINSTANCE == NULL) {
FLUID_LOG(FLUID_ERR, "FluidSynth hinstance not set, which is needed for DirectSound");
return NULL;
}

/*
if (fluid_wnd == NULL) {
if (fluid_win32_create_window() != 0) {
FLUID_LOG(FLUID_ERR, "Couldn't create window needed for DirectSound");
return NULL;
}
}
*/

to

  /* check if the globals are initialized */
// if (FLUID_HINSTANCE == NULL) {
// FLUID_LOG(FLUID_ERR, "FluidSynth hinstance not set, which is needed for DirectSound");
// return NULL;
// }


if (FLUID_HINSTANCE == NULL) {
if (fluid_win32_create_window() != 0) {
FLUID_LOG(FLUID_ERR, "Couldn't create window needed for DirectSound");
return NULL;
}
}

in the mingw32\lib\pkgconfig\fluidsynth.pc

[code]prefix=D:/System_Development/Msys32Bit_ScummVm_Dosbox/mingw32
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include

Name: FluidSynth
Description: Software SoundFont synth
Version: 1.1.8
Libs: -L${libdir} -lfluidsynth
Cflags: -I${includedir}[/code]

to

prefix=D:/System_Development/Msys32Bit_ScummVm_Dosbox/mingw32
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include

Name: FluidSynth
Description: Software SoundFont synth
Version: 1.1.8
Libs: -L${libdir} -lfluidsynth -lreadline -lncurses -L/mingw32/lib -lportaudio -ldsound -lsetupapi -luuid -lgthread-2.0 -lglib-2.0 -lws2_32 -lole32 -lwinmm -lshlwapi -lintl -lpcre -lsndfile -lFLAC -logg -lvorbis -lvorbisenc -lspeex -lpthread
Cflags: -I${includedir}

My cmake argument

$ cmake -DCMAKE_BUILD_TYPE:STRING=Release -G"MSYS Makefiles" -Dincludedir=$MINGW_PREFIX/include -DCMAKE_INSTALL_PREFIX=$MINGW_PREFIX -DBUILD_SHARED_LIBS=off -DLIB_SUFFIX= .
make -j4 && make install

SDL2 Static. In the bin\sdl2-config

    --libs)
echo -L${exec_prefix}/lib -lmingw32
;;
--static-libs)

to

    --libs)
echo -L${exec_prefix}/lib -lmingw32 -lglew32 -lSDL2_net -lSDL2main -lSDL2 -mwindows -Wl,--no-undefined -lm -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lversion -luuid -static-libgcc -liphlpapi
;;
--static-libs)

I added the needed glew32.dll as "-lglew32" and "-lSDL2_net" before -lSDL2main and " -liphlpapi" at the end

In the Dosbox configure.ac

AH_TEMPLATE(C_FLUIDSYNTH,[Define to 1 to enable fluidsynth MIDI synthesis])
AC_CHECK_HEADER(fluidsynth.h,have_fluidsynth_h=yes,)
AC_CHECK_LIB(fluidsynth, new_fluid_synth, have_fluidsynth_lib=yes,,)
if test x$have_fluidsynth_lib = xyes -a x$have_fluidsynth_h = xyes ; then
LIBS="$LIBS -lfluidsynth"
AC_DEFINE(C_FLUIDSYNTH,1)
else
AC_MSG_WARN([fluidsynth MIDI synthesis not available])
fi

to

AH_TEMPLATE(C_FLUIDSYNTH,[Define to 1 to enable fluidsynth MIDI synthesis])
#AC_CHECK_HEADER(fluidsynth.h,have_fluidsynth_h=yes,)
#AC_CHECK_LIB(fluidsynth, new_fluid_synth, have_fluidsynth_lib=yes,,)
#if test x$have_fluidsynth_lib = xyes -a x$have_fluidsynth_h = xyes ; then
LIBS="$LIBS -lfluidsynth -lreadline -lncurses -L/mingw32/lib -lportaudio -ldsound -lsetupapi -luuid -lgthread-2.0 -lglib-2.0 -lws2_32 -lole32 -lwinmm -lshlwapi -lintl -lpcre -lsndfile -lFLAC -logg -lvorbis -lvorbisenc -lspeex -lpthread -liconv"
AC_DEFINE(C_FLUIDSYNTH,1)
#else
# AC_MSG_WARN([fluidsynth MIDI synthesis not available])
#fi

I comment out the checks. With the command "-static" via configure. This test is always negative.. no idea ...

For libsdl2_net to avoid a "undefined reference to `GetAdaptersInfo@8". I have copied from \mingw32\i686-w64-mingw32\lib\libiphlpapi.a to \mingw32\lib\

#if test x$have_sdl_net_lib = xyes -a x$have_sdl_net_h = xyes ; then
#LIBS="$LIBS -l${LIBSDL_HEADER}_net"
AC_DEFINE(C_MODEM,1)
AC_DEFINE(C_IPX,1)
#else
# AC_MSG_WARN([Can't find ${LIBSDL_HEADER}_net, internal modem and ipx disabled])
#fi

I comment the five lines out.

My Build command

./configure --disable-debug --enable-core-inline --prefix=$MINGW_PREFIX CFLAGS="" LDFLAGS="-static -s" LIBS="" CXXFLAGS="-m32 -O3 -fomit-frame-pointer -march=i586 -mtune=i686 -fexpensive-optimizations"

Voila.. i can compile Dosbox as a single exe. All stuff is linked.

Edit: sdl2_net linkes in Dosbox exe. Adding a new Private Windows build Version to this thread to show what i mean.
And .. i would say
My thanks go to the DOSBox Team, dungan (for this Fork from Dosbox, i love the shader), nukeykt (Nuked OPL3 emulator), VileRancour (CGA w/ Monochrome Monitor Support), D_Skywalk (Multi-Floppy-Images), Michał Kępień (Volume Up/Down hotkeys ), TaeWoong Yoo (Various Patches), `Moe` (Speed Meter), Vasyl Tsvirkunov (Innovation SSI-2001 emulation ), kekko (3dfx voodoo emulation)

Reply 39 of 72, by Marty2dos

User metadata
Rank Newbie
Rank
Newbie

This Dosbox Fork and the modified Source for windows is now on my blog. I hope its OK? I did not want to write all the changes again.

DOSBox SVN r4063 (Optionals) Build on (Nov 18 2017 02:40:08)
Features Compiled:
32Bit DynamicX68 FpuCoreX68 OpenGL3 3DFX CGA-Extension PNG Fluidsynth MT32 SSI2001
M.A.M.E.-Sound Nuked-OPL3 DirectSerial IPX Modem
https://aeronextedit.wordpress.com/dosboxscummvm-ports/

greetings Marty

And thanks to the DOSBox Team, dungan (for this Fork from Dosbox, i love the shader), nukeykt (Nuked OPL3 emulator), VileRancour (CGA w/ Monochrome Monitor Support), D_Skywalk (Multi-Floppy-Images), Michał Kępień (Volume Up/Down hotkeys ), TaeWoong Yoo (Various Patches), `Moe` (Speed Meter), Vasyl Tsvirkunov (Innovation SSI-2001 emulation ), kekko (3dfx voodoo emulation).