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

Here you can discuss the development of patches.

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

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

I didn't think SDL supported Metal yet? I see a fork on github and posts about implementing metal and vulkan support awhile back though.
User avatar
Posts: 9695
Joined: 2002-6-30 @ 16:35
Location: Your Head

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

Postby Dominus » 2018-6-05 @ 14:07

With SDL 2.0.8 a 2D Metal function was added for MacOS, iOS and tvOS (edit, still proud of these release notes, as there are two changes that I instigated and partly added patches for it :) (SDL_HINT_IOS_HIDE_HOME_INDICATOR & SDL_HINT_RETURN_KEY_HIDES_IME))
User avatar
DOSBox Moderator
Posts: 7566
Joined: 2002-10-03 @ 09:54
Location: Vienna or Ludwigsburg

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

Postby DosFreak » 2018-6-05 @ 14:20

Nice! That's what I get for expecting their site to get updated. Gotta dig through those release notes. heh
User avatar
Posts: 9695
Joined: 2002-6-30 @ 16:35
Location: Your Head

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

Postby NY00123 » 2018-6-06 @ 16:38

Yeah, there's now a Metal implementation of SDL_Renderer. MoltenVK can be used for Vulkan, and ANGLE for OpenGL ES.

As for MinGW, well, it shall be possible to build DOSBox with Mingw-w64, as of the last SVN revision. If not, it's probably a matter of not more than a few simple fixes (this was done beforehand).
Posts: 224
Joined: 2010-2-13 @ 19:42

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

Postby NY00123 » 2018-6-12 @ 20:36

OK, so the recent update has made me go over the patch and make just a few simple clean-ups. Nothing major.

However, I've kinda reproduced an old problem with the mouse, at least on Ubuntu 14.04 with the Unity shell. While it's not the first time I observe it, I now have a way to reproduce this.
Since it wasn't the only issue I had, I'll give out a list. The issue I've referred to above is about pressing on an "Alt" key after moving an imaginary "captured" cursor to any of the screen's edge. (It isn't exactly captured by the way of warping the cursor, but hopefully the idea is clear.)

*** All of the behaviors listed below have been observed with Ubuntu 14.04, using the Unity shell. ***

SDL 1.2 and 2.0:
- I had to disable the ability to show the HUD upon pressing on an Alt key. This seemed to cause some problems. It was probably an issue with SDL 1.2 apps, and I'm quite sure it's also the case with SDL 2.0 apps.

SDL 1.2:
- Keyboard input is fully locked in full-screens: You can't leave the window with shortcuts like Alt+Tab, but almost all shortcuts shall be usable in the games.
- As of Ubuntu 14.04 with Unity, you simply *can't* use any of the Alt keys in a non-fullscreen SDL 1.2 window, unless the mouse cursor is captured. (This used to be OK with older versions of Ubuntu.)

SDL 2.0:
- Keyboard input isn't entirely locked anymore: Keyboard shortcuts like Alt+Tab are usable. However, it's possible a few more might be used, even when not desired or even expected...
- Can't use Ctrl+Alt+<Arrow_Keys>, which are reserved for workspace switching, *even if there's only one workspace*. You basically need to disable these shortcuts keys (might be important for Keen 4-6).
- Can't use Alt+Space, since it's reserved for showing the window menu, and seemingly also has an effect on games. You may have to disable this as well (say for Jazz Jackrabbit).
- A complicated case DETERMINISTICALLY REPRODUCED ONLY RECENTLY: If you enter fullscreen with the mouse "captured" using SDL_SetRelativeMouseMode (actually hidden and in a "relative mouse motion" mode of sorts), then move the (inivisible) mouse cursor to any of the screen's edges and FINALLY toggle full-screen off, there are chances there'll be a VISIBLE mouse cursor which ***cannot leave the window's boundaries***.

Regarding the last case (with some details figured out just yesterday), this is possibly related to an unexpected window focus change. Basically, when you press on "Alt", an unexpected X11 event of type "LeaveNotify" may be received, effectively leading to the mouse cursor *mistakenly* being *unlocked*.
When fullscreen is finally toggled off, a call to SDL_SetRelativeMouseMode shall unlock the mouse and show the cursor. However, apparently, it's assumed the cursor is already unlocked, and remains locked (albeit visible) in the non-fullscreen window.

Note that unfortunately, I couldn't easily reproduce this in a separate, smaller test app. Well, I technically could, it just wasn't reproduced as often.

As hinted above, I've added an updated patch. Following is a summary of changes, at least of what I haven't missed:

Code: Select all
- Removed useless '#include "SDL_version.h"' statements from cdrom-related
sources, originally added by me before the introduction of C_PHYSICAL_CDROM_MOUNT.
- cdrom.h: Added a comment about the inclusion of compat_SDL_cdrom.h, even
if C_PHYSICAL_CDROM_MOUNT is not defined at all, due
- dos_programs.cpp: Moved a relocated "int error = 0;" defintiion to at
a location closer to the original.
- dosbox.cpp: "cycles" is now *not* set to "max" by default on Android
(and also not on other platforms, as usual).
- sdl_mapper.cpp: Removed commented out MAXBUTTON definition.
- Made sure comments related to SDL 1.2 specific code pieces are either
inside the relevant #if...#endif blocks, or right after any
of the #if and #endif statement.
- sdl_mapper.cpp: Now comparing a joystick event's "event->jbutton.which"
field to a given stick for all SDL versions, instead of "event->button.which".
- Misc. E_Exit additions/changes.
- sdlmain.cpp, sdl struct: Changed sdl.update_window to sdl.resizing_window
(now storing the exact opposite values); Removed unused window_desired_width
and window_desired_height fields; Removed commented out sdl.desktop.bpp
field for good (also unused in DOSBox from SVN).
- Removed misc. comments for SDL_SetWindowTitle calls.
- sdlmain.cpp:GFX_GetBestMode: Misc. comments removal.
- sdlmain.cpp:GFX_GetBestMode: Shared code for SCREEN_OPENGL and SCREEN_TEXTURE.
- sdlmain.cpp:GFX_SetSDLWindowMode: Removed a few commented out lines,
made sure sdl.window is *not* dereferenced if SDL_CreateWindow failed.
- sdlmain.cpp:GFX_SetSize: Removed commented out "opengles" renderer driver checks.
- sdlmain.cpp:GFX_UpdateSDLCaptureState: Now unmodified from the original and
not compiled at all if SDL 2.0 is used. GFX_RestoreMode is also not compiled
in a similar manner.
- sdlmain.cpp:GFX_EndUpdate: Removed commented out checked call
to SDL_UpdateWindowSurfaceRects.
- sdlmain.cpp:GUI_StartUp: sdl.desktop.sdl2pixelFormat now gets the pixel
format from the window surface, rather than the window itself.
- sdlmain.cpp:GFX_Events: Reverted a useless rename of HandleVideoResize to
GFX_HandleVideoResize; It's a commented out line in an SDL 1.2 specific block.
- sdlmain.cpp:Config_Add_SDL: Removed a few useless words from description
of "vsync" setting (renamed from "fulldouble" in the case of SDL 1.2);
Added "metal" SDL renderer driver for OS X.
You do not have the required permissions to view the files attached to this post.
Posts: 224
Joined: 2010-2-13 @ 19:42


Return to DOSBox Patches

Who is online

Users browsing this forum: No registered users and 3 guests