native resolution downscaling for scummvm

Ask for help with ScummVM problems

Moderator: ScummVM Team

rotchild
Posts: 15
Joined: Tue Jun 19, 2012 11:20 pm

native resolution downscaling for scummvm

Post by rotchild »

First of all, sorry about creating a new topic on this. I just googled and searched these forums for a while, and couldn't find the correct answer.

I'm on a 1920x1080 @60Hz native resolution, and when I start ScummVM is scales down to 1024x768 @60Hz (Hq3x graphics mode). I know it won't matter, since all of the games native resolutions are way lower than that, but when this downscale occurs, there are obviously black borders on the top, bottom and sides of the screen. Is it possible to run ScummVM at 1920x1080? I've read about OpenGL-HQ SDL, but links are dead. I found the archives, but even after replacing SDL.DLL, and creating a batch file, which reads as below:

set SDL_VIDEODRIVER=openglhq
set SDL_OPENGLHQ_WINRES=1920x1080
scummvm.exe

It crashed before starting. No idea if it's my video card, or what it is. I read in another topic that there's a scaler included in the daily snapshot, but...

Please, I don't know if I'm doing something wrong, or how to proceed. Please help!!

Thanks in advance.
digitall
ScummVM Developer
Posts: 1185
Joined: Thu Aug 02, 2012 1:40 pm

Post by digitall »

This is not a supported configuration, so I can only offer basic help.

I assume you are referring to OpenGL-HQ SDL from here:
http://www.syntax-k.de/projekte/sdl-opengl-hq/

I assume you are using Win32 so you should use this one:
http://www.syntax-k.de/projekte/sdl-ope ... -win32.zip

And take the SSE enabled DLL from there and replace our SDL.dll.

However, that download is missing the README file. Try looking at the README from here:
http://www.syntax-k.de/projekte/sdl-ope ... -10-19.zip

I think the issue is that you need to set SDL_OPENGLHQ_VIDEODRIVER and probably use SDL_OPENGLHQ_FULLRES, rather than WINRES:

You can get the value for SDL_OPENGLHQ_VIDEODRIVER by running "scummvm -d 1" with the original SDL.dll and the executable will print to the debug console something like:
Using SDL Video Driver "x11"

Take the value i.e. x11 and use that in SDL_OPENGLHQ_VIDEODRIVER.

So the result for me would be:
set SDL_VIDEODRIVER=openglhq
set SDL_OPENGLHQ_VIDEODRIVER=x11
set SDL_OPENGLHQ_WINRES=800x600
set SDL_OPENGLHQ_FULLRES=1920x1080
scummvm.exe

This should allow ScummVM to start normally in Windowed mode within the screen boundaries and then you can enable the Full Screen mode in the Options->Graphics section.

If it crashes or will not start, either remove fullscreen=1 from your scummvm.ini with a text editor or force windowed mode from command line.
rotchild
Posts: 15
Joined: Tue Jun 19, 2012 11:20 pm

Post by rotchild »

Any help is appreciated mate, thanks!!

Yep, I am referring to that OpenGL-HQ SDL link...

I am on a 64-bit operating system, although ScummVM is installed in the (x86) folder. Is that a problem?

Replaced the original SDL.DLL with the SSE enabled one. Got the readme file from that .zip archive, but can't find any further help in it :(

When running the "-d 1" extension in scummvm, the only thing the debug console displays is something like:

"Debuglevel (from command line): 1
Output sample rate: 22050 Hz
Output buffer size: 2048 samples"

Nothing about a value for a SDL video driver. I tested with both the original SDL and the SSE enabled one :(

It's really weird, if I use the batch suggestion from the readme file, which is:

set SDL_VIDEODRIVER=openglhq
set SDL_OPENGLHQ_WINRES=800x600
scummvm.exe

I get a fatal crash on nvoglv32.DLL

If I use your suggestion for the batch file, I get nothing (scummvm doesn't even start)

:,(
digitall
ScummVM Developer
Posts: 1185
Joined: Thu Aug 02, 2012 1:40 pm

Post by digitall »

Firstly, do not quote the entire previous post in your replies. It is irritating and makes the thread harder to read.

Not sure about x86_64 vs. 32, but this is unlikely to be the cause IMHO.

Hmm... What version of ScummVM are you trying this with? I assume it is the v1.6.0 stable Win32 release. You need to use the latest v1.7.0git development master for Win32 from here to get the relevant information I indicated for SDL Video Driver and to eliminate fixed issues as a cause:
http://buildbot.scummvm.org/builds.html
specifically:
http://buildbot.scummvm.org/snapshots/m ... latest.zip

You could also try the Win64 build from there if you can find a matching 64-bit OpenGL-HQ-SDL build:
http://buildbot.scummvm.org/snapshots/m ... latest.zip

I would suggest that you update your NVidia Graphics Drivers before you proceed to the latest stable version as I suspect that nvoglv32.dll is part of them.

Also, try running my full suggestion, but with scummvm.exe -d 1 i.e.

set SDL_VIDEODRIVER=openglhq
set SDL_OPENGLHQ_VIDEODRIVER=<INSERT YOUR SDL VIDEO DRIVER>
set SDL_OPENGLHQ_WINRES=800x600
set SDL_OPENGLHQ_FULLRES=1920x1080
scummvm.exe -d 1

For reference, I think your SDL Video driver will either be windib or directx... You may wish to try both.
rotchild
Posts: 15
Joined: Tue Jun 19, 2012 11:20 pm

Post by rotchild »

Really sorry about the quoting. I just realized it a second before you replied it, and edited :p

Yeah, I'm using the latest stable 1.6.0 version. Will try it with the 1.7 git. I don't think the 64-bit will do, since that sdl download page does not provide a matching 64-bit OpenGL-HQ-SDL build.

My NVidia drivers are up to date.

Have some other things to attend to. Will try your suggestions and report back in a few hours.

Thanks again for the support!!
rotchild
Posts: 15
Joined: Tue Jun 19, 2012 11:20 pm

Post by rotchild »

OK, status windows displays (this is the SDL from the git version):

"Debuglevel (from command line): 1
Using SDL Video Driver "windib"
Using SDL Audio Driver "dsound"
Output sample rate: 22050 Hz
Output buffer size: 2048 samples"

After the SDL from the OpenGL HQ, it displays

"Debuglevel (from command line): 1
Using SDL Video Driver "directx"
Using SDL Audio Driver "dsound"
Output sample rate: 22050 Hz
Output buffer size: 2048 samples"

Used your suggested batch:

set SDL_VIDEODRIVER=openglhq
set SDL_OPENGLHQ_VIDEODRIVER=directx
set SDL_OPENGLHQ_WINRES=800x600
set SDL_OPENGLHQ_FULLRES=1920x1080
scummvm.exe -d 1

Program doesn't start, the status window appears really quick, then back to desktop. Bummer...

Edit: after running the .bat through cmd, the message at the end (after failing to initialize says):

"Could not initialize SDL: No available video device!"
digitall
ScummVM Developer
Posts: 1185
Joined: Thu Aug 02, 2012 1:40 pm

Post by digitall »

Try this instead:
set SDL_VIDEODRIVER=openglhq
set SDL_OPENGLHQ_VIDEODRIVER=windib
set SDL_OPENGLHQ_WINRES=800x600
set SDL_OPENGLHQ_FULLRES=1920x1080
scummvm.exe -d 1

If it still fails, the issue may be related to OpenGL SDL support in the ScummVM nightly builds... or it just may not work :/

As I said, this is not a supported configuration and your mileage may vary.
rotchild
Posts: 15
Joined: Tue Jun 19, 2012 11:20 pm

Post by rotchild »

That "Could not initialize SDL: No available video device!" is kind of a head scratch to me. Am I missing SDL runtime binaries, maybe?

Also, I thought that the Daily Snapshot had an OpenGL scaler, as stated here (t=9983, can't post the link)

I just can't find it (the sclaer in scummVM git) :(
digitall
ScummVM Developer
Posts: 1185
Joined: Thu Aug 02, 2012 1:40 pm

Post by digitall »

No. It just means that the SDL.dll which is loaded into ScummVM fails to return a valid video device when SDL_VideoInit() is called.

This is probably because you are forcing the video device driver used by SDL to "openglhq" and this is not starting successfully. When SDL_VIDEODRIVER is set, it forces that driver or nothing in SDL... the normal behaviour would be to try the "best" driver and then fallback on to more compatible drivers i.e. directx vs. windib etc.

The debug statement was added precisely because we had a problem which only occurred when you were running a specific SDL driver, but this is outside of the scope of ScummVM.

We just initialise SDL and ask it for a video device and surface to draw on in 2D. How that is done is a problem for SDL.

I think you are getting a bit confused here over the terminology, so to break it down from lowest to highest level...

Your operating system uses a graphics driver for your video card which we have already indicated is an Nvidia card.

Windows then abstracts that away behind the DirectX 2D API and the standard VGA 2D graphics API (WinDIB). You could also use OpenGL to talk to your graphics card as well, which is more platform independent...

To provide a consistent interface, a graphics middleware library is used. This is the Simple Directmedia Layer v1.2.X, know as SDL: http://www.libsdl.org/

This provides a stable API across platforms and underlying Video API... However, you can force a specific underlying driver as the autodetection may not always get the best or most stable API from the several that may be available... Hence SDL_VIDEODRIVER exists.
digitall
ScummVM Developer
Posts: 1185
Joined: Thu Aug 02, 2012 1:40 pm

Post by digitall »

However, although libSDL exists for many platforms, it does not exist for all platforms including some of our more esoteric ones such as Nintendo 64... These require a custom graphics backend, but most ports to desktop platforms can use the SDL library as the default as it will have been ported.

Now... within the ScummVM codebase:

We have our own abstraction layer called OSystem which abstracts the platform specifics of how to initialise video, sound, mouse, keyboard etc. behind a standard API.

This is defined in:
https://github.com/scummvm/scummvm/blob ... n/system.h
This is an abstract interface and is implemented by the backend code.

The backend graphics specific parts which are shared between a number of ports as they use standard middleware APIs such as libSDL are implemented by the code here:
https://github.com/scummvm/scummvm/tree ... s/graphics

Most are variants of SDL API calls for specific platform types, though a few custom backends such as OpenPandora are in here.

Most of the rest of the Graphics API for SDL based ports is implemented here:
https://github.com/scummvm/scummvm/tree ... atform/sdl
digitall
ScummVM Developer
Posts: 1185
Joined: Thu Aug 02, 2012 1:40 pm

Post by digitall »

The main difference here is whether you have OpenGL set in your gfx_mode setting (Options->Graphics Mode->OpenGL).

The graphics mode sets an output scaler which is implemented in the ScummVM code between the OSystem Graphics Functions and the OSystem Graphics API to the backend, hence the code for that is in here under scaler.cpp/h and the scaler subdirectory:
https://github.com/scummvm/scummvm/tree/master/graphics

However, selecting the OpenGL option also switches the backend from plain SDL default to OpenGL SDL.

So you should test with both. You may need to switch back the original SDL.dll to use the GUI... or just directly edit your scummvm.ini.

The first step is to get ScummVM running with openglhq SDL.dll in some form... you can then work from there.

I don't know anyone else who has tried this before, so again your mileage may vary severely.
digitall
ScummVM Developer
Posts: 1185
Joined: Thu Aug 02, 2012 1:40 pm

Post by digitall »

One final point.

If you intend to look at modifying the scaler code, you should be aware that code may change radically at some point.

We have an outstanding Pull Request to merge which contains code to modify the Scalers to be plugins and extend the number supported to include newer ones:
https://github.com/scummvm/scummvm/pull/271
rotchild
Posts: 15
Joined: Tue Jun 19, 2012 11:20 pm

Post by rotchild »

I've found out by accident (and running DosBOX) that the only way to run an hq3x render/scaler that fills (the screen, without black borders) a 1920x1080 native resolution monitor with a 1024 x 768 max res. is by using DirectDraw as an output.

So my question basically is, can I force scummvm to run in DDraw mode?
digitall
ScummVM Developer
Posts: 1185
Joined: Thu Aug 02, 2012 1:40 pm

Post by digitall »

The video output is done via libSDL.

The Win32 libSDL should automatically choose DirectX by default, falling back to WinDIB.

If you run "scummvm -d 1" with a recent nightly build, it will print the video and audio drivers being used by libSDL.

To force a specific driver, you can use the environment variable ie.
set SDL_VIDEODRIVER=directx
rotchild
Posts: 15
Joined: Tue Jun 19, 2012 11:20 pm

Post by rotchild »

It starts with directx output, but with hq3x render, it still doesn't fill the whole screen (1024 x 768), unlike DOSBox. There are still black borders around :(

Pretty much giving up...
Post Reply