joncampbell123 / dosbox-x

DOSBox-X fork of the DOSBox project
GNU General Public License v2.0
2.66k stars 378 forks source link

SDL2 migration #306

Open aybe opened 6 years ago

aybe commented 6 years ago

Windows build

Just started bringing in SDL2 for Windows build: https://github.com/joncampbell123/dosbox-x/commits/master-sdl2

Here's how I did it: https://github.com/joncampbell123/dosbox-x/blob/master-sdl2/README.SDL2.MIGRATION.MD

Questions:

Right now it does not compile,

2017-09-20 16_27_44-dosbox-x - microsoft visual studio

I've tried to solve the first issue but failed to understand why it is doing this:

What am I supposed to do then, remove SDL1 projects ? If I do that then obviously it will not compile anymore, i.e. how did you manage to get yours to build ?

I guess I've missed something in what you said yesterday ...

aybe commented 6 years ago

Got it to compile, mostly ... from +1200, there are only 6 errors now.

Basically I've:

#ifdef WIN32
#undef MSF_TO_FRAMES
#undef FRAMES_TO_MSF
#endif

above your https://github.com/joncampbell123/dosbox-x/blob/master-sdl2/src/dos/cdrom.h#L200

For the rest, I've commented out specific to Windows blocks for Voodoo and Kanji.

Frankly, I didn't understand everything, but I assume that SDL2 made things more homogeneous, hence trying the simplest approach; I'll see whether it runs !

Does the branch currently run on your Linux side ?

aybe commented 6 years ago

Well, I somehow progressed but now facing another kind of errors : unresolved externals

GetSetSDLValue

Indeed it has been removed from https://github.com/joncampbell123/dosbox-x/blob/master-sdl2/src/gui/sdlmain.cpp.

The only trace I've found in the repo is https://github.com/joncampbell123/dosbox-x/blob/384fd39710784093fd9bfe7307dfb024816c11f3/src/gui/sdlmain.cpp however it's not on any branch ... and I couldn't find a way on how to know when it has been removed.

Did you remove it, possibly because menu.cpp is only for Windows ?

Shall we import it back in the branch ?

More generally how are we supposed to do with this kind of errors of missing stuff ?

Currently I'm commenting tiny portions of code until it builds, then I'll un-comment them one by one later.

joncampbell123 commented 6 years ago

GetSetSDLValue is defined in src/gui/sdlmain.cpp but only if WIN32 builds.

aybe commented 6 years ago

Okay, just found the cause, the imported patch in fact deleted many code ...

joncampbell123 commented 6 years ago

The latest master-sdl2 compiles on my end without issues. I compiled against commit e38425e98b5352763d0a7c930f5db0b7d7f074d6

joncampbell123 commented 6 years ago

menu.cpp if I recall is someone's code to add to the "system" menu of the SDL window (the dropdown menu from the leftmost side of a Windows application).

aybe commented 6 years ago

that's weird, it doesn't compile here ... need to find out why !

joncampbell123 commented 6 years ago

Hi all. I just modified the master branch to combine SDL1 and SDL2 support into one branch.

The SDL 1.x and SDL 2.x specific code is #ifdef'd out from one another.

You can continue to compile with SDL1 by default, or run configure with --enable-sdl2 to compile with SDL 2.x instead.

The idea is to keep feature parity between SDL1 and SDL2 while slowly modifying the code to support SDL 2.x more and more until at some point we deprecate SDL 1.x support and eventually remove it.

joncampbell123 commented 6 years ago

Any comments?

The SDL 2.x builds of course do not yet have Direct3D, OpenGL, windows menus, etc. but that will come along eventually.

Munin- commented 6 years ago

Apart from having to switch to the program's window because it runs in the background at first it seems to work, ie. I didn't have any crashes/bugs I would associate with using SDL2.