Commit Graph

6400 Commits

Author SHA1 Message Date
Colin Snover
20bd289ebe BACKENDS: Remove references to old normal1xScaler transaction property from ports 2017-10-07 15:25:47 -05:00
Colin Snover
04f357e6ff BACKENDS: Make initSizeHint an optional extension point
There is no particular reason why backends that don't need to
calculate screen dimensions in advance should still need to
implement initSizeHint at this point.
2017-10-07 12:30:29 -05:00
Colin Snover
6e157429b7 BACKENDS: Fix window sizing of games that switch between multiple resolutions 2017-10-07 12:30:29 -05:00
Colin Snover
9a82bc6d96 SDL: Deduplicate scaling factors 2017-10-07 12:30:29 -05:00
Colin Snover
432fd522d2 ENGINES: Remove default1x scaler flag
This flag is removed for a few reasons:

* Engines universally set this flag to true for widths > 320,
  which made it redundant everywhere;
* This flag functioned primarily as a "force 1x scaler" flag,
  since its behaviour was almost completely undocumented and users
  would need to figure out that they'd need an explicit non-default
  scaler set to get a scaler to operate at widths > 320;
* (Most importantly) engines should not be in the business of
  deciding how the backend may choose to render its virtual screen.
  The choice of rendering behaviour belongs to the user, and the
  backend, in that order.

A nearby future commit restores the default1x scaler behaviour in
the SDL backend code for the moment, but in the future it is my
hope that there will be a better configuration UI to allow users
to specify how they want scaling to work for high resolutions.
2017-10-07 12:30:29 -05:00
Colin Snover
ebe6c40a6a SDL: Do not reset window size when engines update rendering surface
This change allows:

* Engines to update their target rendering surface/size and pixel
  format with the backend multiple times during gameplay;
* Users to resize the ScummVM window without having it reset
  size/position every time an engine updates its target surface
  format;
* Conversions/scaling to continue to run efficiently in hardware,
  instead of requiring engines to pick their maximum possible
  output format once and upscale inefficiently in software;
* The window to reset size once when an engine calls to set its
  initial output size, and to reset again once ScummVM returns to
  the launcher.

This is relevant for at least SCI32 and DreamWeb engines, which
perform graphics mode switches during games.
2017-10-07 12:30:29 -05:00
Thierry Crozat
6f8f27ecb2 MACOSX: Change name for CoreAudio MIDI device
Also remove a couple of TODOs. I think we can limit the CoreAudio
plugin to the Apple DLS softsynth since with have the CoreMidi
plugin to access other MIDI devices.
2017-10-06 00:03:37 +01:00
Thierry Crozat
9a07050888 MACOSX: Allow selecting device for CoreMidi 2017-10-06 00:03:37 +01:00
Cameron Cawley
51949bbc9e RISCOS: Add RISC OS filesystem 2017-10-01 20:19:42 +02:00
Vincent Bénony
8bc745fb55 IOS: Improve iOS 11 compatibility 2017-09-30 11:16:42 +02:00
Bastien Bouclet
4890dd4466 NETWORKING: Fix mismatched curl callback declaration and definition 2017-09-24 08:24:40 +02:00
Bastien Bouclet
2832332e74 NETWORKING: Changed NetworkReadStream not to subclass MemoryReadWriteStream
Also fix the MemoryReadWriteStream managed buffer being leaked.
Fixes #9718.
2017-09-22 07:05:59 +02:00
Colin Snover
9203bdcf4e SDL: Remove USE_RGB_COLOR #ifdefs from detectSupportedFormats
This function is only defined when USE_RGB_COLOR is defined so
these additional conditions are redundant.
2017-09-15 23:05:48 -05:00
Thierry Crozat
20e628cac3 SDL: Remove code for unused DoubleBufferSDLMixerManager 2017-09-12 21:46:20 +01:00
Thierry Crozat
f7436a9b3a OPENPANDORA: Remove unused include
The use of DoubleBufferSDLMixerManager in the OpenPandora backend was
removed in commit b157269 but the include for it was left behind.
2017-09-12 21:41:55 +01:00
Thierry Crozat
629ea05ffc GPH: Remove unused include
The use of DoubleBufferSDLMixerManager in the GPH backend was removed
in commit 3b6398c but the include for it was left behind.
2017-09-12 21:37:52 +01:00
Thierry Crozat
3607b79d7d MACOSX: Remove mixer init from derived class for macosx backend
Since the macosx backend now does the same as the base SDL backend
we can just let the base class do its stuff.
2017-09-12 21:30:29 +01:00
Colin Snover
bcbd443359 SDL: Stop using double buffering mixer on macOS
This mixer type was added in
943b4c2036 because "anything which
produces sampled data with high latency (like the MT-32 emulator)
will sound terribly", but as far as I can see (or reproduce), this
mixer doesn't do anything that would solve that problem, except
that it effectively doubles the size of the audio buffer so there's
less chance of an underflow due to slower-than-realtime synthesis
by the softsynth. But you don't need the overhead of a separate
thread to do that, you just need to increase the buffer size.
2017-09-12 11:35:51 -05:00
Colin Snover
fa52df018e SDL: Fix DoubleBufferSDLMixerManager doubling audio latency
If it turns out that everything that had previously been fixed by
this manager is broken by this change, everything that had been
fixed probably could have been fixed by just increasing the audio
buffer size in SdlMixerManager. :\
2017-09-12 11:35:50 -05:00
Colin Snover
4a75fbab1b SDL: Reduce audio playback latency
The previous default buffer size of 4096 samples for 44kHz mixer
would add up to 93ms of audio latency, which is fine for early
adventure games, but this is significantly more latency than is
acceptable for games with full motion video. For these games,
the latency needs to be kept within roughly +15ms and -45ms of
video frame presentation to avoid lip sync problems. With this
change, the default audio buffer size is calculated to be 1024
samples at 44kHz (which happens to match what DOSBox uses).

There is a possibility that the reduced latency may cause issues
that did not previously exist with things like the MT-32 emulator,
where a larger buffer size allowed for a larger window where
high-complexity synthesis that could not be generated in realtime
could be balanced out by low-complexity synthesis that could be
generated faster than realtime. In this case, rather than
increasing the system mixer buffer size again, please move the
MT-32 emulator into its own thread and give it its own larger ring
buffer into which it can generate more sample data in advance,
independently from the rest of the audio system.

For other systems where this buffer size reduction might cause a
problem with audio drop-outs, a new audio_buffer_size
configuration option has been added to allow users to tweak the
audio buffer size to match their machine's ability to generate
audio samples.

Fixes Trac#10033. Also improves playback of samples in SCI that
were programmed to restart across several consecutive frames,
relying on lower audio latency in the original engine for this to
not sound bad, like the hopping sound at the start of chapter 1
of KQ7, and the sound of turning on the power in the digger train
in the Lighthouse volcano.
2017-09-12 11:30:01 -05:00
Colin Snover
eb4e9fe1d4 GUI: Remove mostly-broken audio output sample rate control
Removing this GUI control was suggested as far back as 2011 at
<http://lists.scummvm.org/pipermail/scummvm-devel/2011-November/010416.html>.
There were no objections, but it was never removed. When working
on audio latency bugs, I independently rediscovered that the GUI
option was broken: the per-game options would *never* work, and the
option would not take effect until ScummVM was restarted because
there is no API for interacting with the backend audio mixer. So
now, it is finally gone.

Primarily for the sake of future troubleshooting, configurability
of the audio sample frequency within SdlMixerManager is maintained
for the moment, but now users will need to edit their ScummVM
configuration file manually to change it.
2017-09-12 11:27:45 -05:00
Colin Snover
c2a4784706 SDL: Fix compilation on PSP2 2017-09-12 11:27:45 -05:00
Colin Snover
2228ae255c SDL: List supported 32bpp pixel formats when using SDL2
_hwscreen is always initialized to 16bpp so the supported 32bpp
pixel formats would never be put into the list of supported pixel
formats, making it useless for engines to query for usable 32bpp
pixel formats.

This patch changes things so that the native desktop pixel format
is at the top of the supported formats list, and all pixel formats
<= the default desktop pixel format will now show up in the list
of supported formats. ("Supported" is somewhat of a misnomer here
since there is no hardware querying beyond checking the default
desktop pixel format. SDL generally accepts a wide variety of pixel
formats and tries to convert them to whatever the hardware
supports.)
2017-09-12 10:12:53 -05:00
Colin Snover
b8f89a772e MACOS: Fix builds on case-sensitive filesystems 2017-09-10 23:30:25 -05:00
Colin Snover
6e2f18c498 MACOS: Fix warnings about undeclared selectors
When -Wundeclared-selector is enabled (recommended by Apple), the
calls to the setBadgeLabel selector in MacOSXTaskbarManager are
warned on because NSDockTile declarations are not included because
they do not exist in macOS 10.4 and earlier. While I don't know
that we are even supporting such old macOS versions these days, it
is simple enough to fix this problem when compiling to modern
macOS versions by conditionally including the necessary header.
2017-09-10 22:17:16 -05:00
Colin Snover
56810b5598 MACOS: Fix deprecation warnings in macOS 10.12 2017-09-10 22:17:16 -05:00
Colin Snover
d2b4e16ab2 SDL: Fix unsafe sprintf usage
Translation strings come from external data sources and can cause
a stack buffer overflow here just by accidentally (or maliciously)
being too long.
2017-09-03 20:00:23 -05:00
Cameron Cawley
aba431ca9b RISCOS: Use double quotes in sed command 2017-09-03 10:40:07 +02:00
Cameron Cawley
0d1df59be1 RISCOS: Automatically calculate the correct WimpSlot size 2017-09-03 10:40:07 +02:00
Cameron Cawley
b9694a01db RISCOS: Use shorter filenames for config and log files 2017-09-03 10:40:07 +02:00
Cameron Cawley
0e7d9414a6 RISCOS: Correctly set executable extension 2017-09-03 10:40:07 +02:00
Cameron Cawley
7a00045df0 RISCOS: Add networking files to application 2017-09-03 10:40:07 +02:00
cameron
a11985c46d RISCOS: Add RISC OS support 2017-09-03 10:40:07 +02:00
Eugene Sandulenko
bb58647588 NETWORKING: Fix warning 2017-08-11 22:05:35 +02:00
Eugene Sandulenko
addcdd5ae8 NETWORKING: Fix data type cast in comparison. char is usually signed 2017-08-11 22:00:15 +02:00
Eugene Sandulenko
1d086b9f20 BACKENDS: SURFACESDL: Add missing break statement 2017-08-11 21:59:59 +02:00
Torbjörn Andersson
665f5c99b2 JANITORIAL: Silence some more GCC 7 fall through warnings
I think these are the last one that were already flagged as being
deliberate.
2017-08-06 16:54:38 +02:00
Bastien Bouclet
8e4697946e OPENGL: Always clear the whole backbuffer
Previously we were clearing the whole backbuffer for 3 frames after a
window size change, and then only clearing the game area. This assumes
the OpenGL driver uses at most 3 render buffer and uses them in
sequential order. This does not seem to be the case on Linux when using
an Intel integrated GPU.
Instead we now clear the whole backbuffer on each frame to make sure
there are no leftovers remaining on the screen. All semi-recent GPUs
should have hardware clear anyway so this should not impact negatively
performance.

Possibly fixes #10025.
2017-08-05 08:36:32 +02:00
Frank Richter
0f93962ef4 Windows: Use GetUserDefaultUILanguage() instead of GetThreadLocale().
The thread locale concerns display options (e.g. date formatting) not
the display language. There are typically, but not necessarily the same,
as Windows allows them to be configured separately.
2017-08-01 08:55:48 +02:00
Bastien Bouclet
8c587b54ab SDL: Make the window size when exiting fullscreen workaround macOS specific
The call to SDL_SetWindowSize works around a macOS specific SDL2 bug.
Fixes the window not restoring to its previous position when exiting
fullscreen on Linux/X11.
2017-07-29 17:25:37 +02:00
Thierry Crozat
00bbb73ce5 SDL: Make sure we get the correct window size with SDL2
When updating or recreating the window, if we changed the window
size at the same time we also toggle between OpenGL and non
OpenGL mode, or toggle fullscreen mode, we may have a pending
SDL resize event with the wrong size. So we need to make sure to
append another one with the correct size to end up with the correct
size. This fixes bug #9971.
2017-07-27 21:05:44 +01:00
Schrijvers Luc
a2792531f6 NETWORKING: fix missing SIOCGIFCONF for Haiku (#973) 2017-07-17 21:35:23 +02:00
Eugene Sandulenko
940b2a20f1 Revert "COMMON: Change way the Singleton instances are instantiated"
This reverts commit eefa72afa1.

With this patch ConfigManager is broken.
2017-07-10 21:17:41 +02:00
Thierry Crozat
eefa72afa1 COMMON: Change way the Singleton instances are instantiated
This fixes tons of warnings with clang from a recent xcode version on
macOS (and possibly other systems) complaining that an instantiation
of _singleton is required but no definition is available.
2017-07-10 21:11:20 +02:00
Colin Snover
065dd9671e SDL: Fix compilation with SDL1.2 2017-07-06 19:27:52 -05:00
Colin Snover
332fabcb8a SDL: Only recreate SDL2 window when necessary
Destroying and recreating the SDL window whenever the video mode
changes in SDL2 is not necessary and causes several problems:

1. In windowed mode, the game window shifts position;
2. In fullscreen mode in macOS, every time the window is
   recreated, it causes the OS to play its switch-to-fullscreen
   animation again and emit system alert noises;
3. The window content flickers; and
4. The engine loses events from the old destroyed window.

This patch changes the SDL backend code to avoid destroying and
recreating the SDL window when using SDL2, except when switching
OpenGL modes, since there is no way to change the OpenGL feature
of a window.

There are still some outstanding issues with OpenGL where window
size ends up getting reset even though the user has resized it;
this will probably need to be addressed at some point in another
patch.

Thanks to @bgK and @criezy for their feedback which made this
patch much better.

Co-Authored-By: Bastien Bouclet <bastien.bouclet@gmail.com>
2017-07-06 19:11:54 -05:00
lubomyr
4d53bdc7fe ANDROIDSDL: implemented checking and fixing sdcard path 2017-06-25 10:50:36 +02:00
Colin Snover
2d3c86187f MACOSX: Fix flipped return value of openUrl 2017-05-21 19:37:14 -05:00
Colin Snover
fa0bb7dd5a BACKENDS: Compress screenshots using PNG if available
Closes gh-948.
2017-05-21 15:55:39 -05:00
Bastien Bouclet
23abcffbc5 OPENGL: Don't update the cursor's texture when the cursor is invisible
Updating the cursor's texture is not necessary if it is not going to be drawn.

Fixes glDrawArrays sometimes failing due to using a framebuffer with an
incomplete color attachment. In SCI32 games, the framebuffer is incomplete
because the engine does not define pixel data for the cursor.
2017-05-08 06:50:30 +02:00