SDL2

Technical discussion for those interested in Supermodel development and Model 3 reverse engineering. Prospective contributors welcome.
Forum rules
Keep it classy!

  • No ROM requests or links.
  • Do not ask to be a play tester.
  • Do not ask about release dates.
  • No drama!

SDL2

Postby Jason » Tue Nov 07, 2017 7:30 am

I wanted to run Supermodel on my virtual pinball cabinet setup where the vertical screen is the secondary monitor. Since SDL 1.x has no way to specify which screen is used for the full screen display, I ended up porting Supermodel to SDL2 and adding a -screen option.

What's the best way to contribute back these changes?

I've only compiled under Windows with Visual Studio 2013, so I haven't updated any of the makefiles, but all the source code changes I made should in theory work on Linux and OS X.

Testing consisted mostly of my kids playing a lot of Star Wars Trilogy Arcade. For that everything seems to work fine.

I was also thinking of adding an option to display a marquee or flyer image on a separate screen. Would people be interested in that as well? It would probably add an additional dependency on SDL_image.

- Jason
Jason
 
Posts: 2
Joined: Fri Nov 03, 2017 12:51 pm

Re: SDL2

Postby Bart » Tue Nov 07, 2017 9:00 am

Awesome! Would it be possible to produce a diff patch against the latest source revision? We can try incorporating it this way. I could probably test this on a Linux machine at work. One thing I'm wondering is whether SDL2 allows the display to be stretched over multiple monitors? I recall seeing people produce videos of Supermodel running in wide screen mode across 3 monitors but I think this may have used some Nvidia driver-specific feature.

Re: the marquee option, I think it's intriguing and if enough people want it, why not? The only thing I'm wondering is how this would be configured given that Supermodel does not yet have a GUI. I guess for now it would be a command line option (which in turn would map to a config option that could be specified on a per-game basis in the INI file).
User avatar
Bart
Site Admin
 
Posts: 3086
Joined: Thu Sep 01, 2011 2:13 pm
Location: Reno, Nevada

Re: SDL2

Postby Jason » Tue Nov 07, 2017 11:55 am

Attached is a diff against SVN as of October 19th, which is when I checked out the code.

SDL2 will let you span displays, although it's not clear to me exactly how and when it decides to do so. My development system has 4 screens. Two of them are 1920x1080 and sit side by side. If I tell SDL I want a full screen display on the left screen at 3840x1080 I get the game display stretched across both screens. But if I specify a width < 1920 I just get a full screen display on the one screen. As far as I can tell there isn't a way to tell SDL to switch both screens to a lower resolution and then span the displays.

For control of the marquee display I was thinking command line options and the ini files.
Attachments
sdl2.diff.gz
(14.28 KiB) Downloaded 366 times
Jason
 
Posts: 2
Joined: Fri Nov 03, 2017 12:51 pm

Re: SDL2

Postby Ian » Wed Nov 08, 2017 4:59 am

Just post the code, maybe .zip or something. Was there a lot of changes required to convert sdl1->2 ?
Ian
 
Posts: 2044
Joined: Tue Feb 23, 2016 9:23 am

Re: SDL2

Postby Bart » Wed Nov 08, 2017 10:03 pm

Awesome :) I should have time to look at this on Saturday morning.
User avatar
Bart
Site Admin
 
Posts: 3086
Joined: Thu Sep 01, 2011 2:13 pm
Location: Reno, Nevada

Re: SDL2

Postby Spindizzi » Sat Nov 11, 2017 2:49 am

hello,
Thx for your sdl2 port, I was looked 1 year ago with strict minimal change only, but at this moment, shadows was flickering as hell so not viable. It's corrected now, cool

My version is builded with v2.0.0.7 and your mod source code
my config, screen 0 : 1920x1200, screen 1 : 1440x900

Someone else noticed that :

The exit window cross box doesn't work anymore, esc is ok. This is due to windows message queue versus sdl message queue. As I read in the source code, the windows message was chosen because of the rawinput trouble

The fullscreen is quite strange (as you noticed too). if I set -fullscreen without -res, screen is stretched in a original resolution frame (496*384). Apparently aspect ratio (16/10 for me) of the screen applied to original resolution. If I set -fullscreen and -res (corresponding to the screen resolution (1920x1200 for me, it's ok).
-fullscreen <- bad
-fullscreen -res=800,600 <- bad
-fullscreen -res=1920,1200 <- ok
I suspect sdl2 not creating real screen at given resolution, but creating a screen on top of the desktop resolution. Maybe I'm wrong. It seems they talk about in their migration wiki page

Multi screen (span display onto the 2 monitors) not working in full screen for me but certainly because I've different screen resolution (desktop extended but no surround mode activated).
-fullscreen -res=3360,900 <- bad (only show a part of the game on screen 0)

However Working well assigning -screen=0 or -screen=1 in full screen resolution with right parameters of the screen
-fullscreen -screen=0 <- bad (stretched in a frame)
-fullscreen -screen=1 <- bad (stretched in a frame)
-fullscreen -screen=0 -res=1920,1200 <- ok
-fullscreen -screen=1 -res=1440,900 <- ok

Another thing I found, if mouse clicking in screen 0 after launching -fullscreen -screen=1 -res=1440,900 -> screen 1 becomes minimised
++
Spindizzi
 
Posts: 196
Joined: Thu Nov 17, 2016 8:55 am
Location: France

Re: SDL2

Postby Ian » Sat Nov 11, 2017 3:30 am

You don't need anything special to create an opengl window across 2 monitors. You simply create it the size of the two screens
Ian
 
Posts: 2044
Joined: Tue Feb 23, 2016 9:23 am

Re: SDL2

Postby Bart » Sun Nov 12, 2017 10:50 am

Spindizzi: thanks for this information. I'll have to take a look. I'm unsure by what you mean by Windows message queue vs. SDL. SDL's should be abstracting away the underlying Windows queue. Are you saying that we'll have to explicitly pump the Windows queue in order to support closing out of the program by clicking 'x'?
User avatar
Bart
Site Admin
 
Posts: 3086
Joined: Thu Sep 01, 2011 2:13 pm
Location: Reno, Nevada

Re: SDL2

Postby Spindizzi » Sun Nov 12, 2017 11:55 am

Hello,
see CDirectInputSystem::Poll() in DirectInputSystem.cpp
As I understand (not familiar with that), you actually treat windows messages not sdl messages. it worked with sdl1 that apparently treats windows messages also
Maybe sdl2 has changed the way it quits compared sdl1
If you treat SDL_QUIT event via sdl polling system, I suppose it'll work but as noticed in source code, there will be worries with rawinput

Just a thought (and may be totally wrong, lol)
if including in the while loop, a test on sdl2 event like SDL_WINDOWEVENT_CLOSE (logic OR with windows message) ?
Spindizzi
 
Posts: 196
Joined: Thu Nov 17, 2016 8:55 am
Location: France

Re: SDL2

Postby Bart » Sun Nov 12, 2017 1:45 pm

I've never looked closely at the input system code. Does RawInput otherwise work okay? Adding some code to listen to additional messages from another source (i.e., SDL queue) should not be too difficult.
User avatar
Bart
Site Admin
 
Posts: 3086
Joined: Thu Sep 01, 2011 2:13 pm
Location: Reno, Nevada

Next

Return to The Dark Room

Who is online

Users browsing this forum: No registered users and 1 guest