If the call used to open the browser does not return until the
browser is closed, this would previously cause ScummVM to hang.
Since we are using waitpid now, we can avoid hanging by telling
waitpid to not block on a child which has not exited.
This reverts commit 6b4195a542.
There seemed to be no clear benefit in using RLE for transparent
surfaces, and there were a few reports that it might cause crashes
on Windows. So to be on the safe side I prefer to revert this
commit.
- Flag them as repeat events
- Disable ScummVM's own repeat event generation
This fixes keyboard repeat events not being flagged as such with SDL2,
and complies with the user's operating system preferences regarding key
repeat timings.
Folks are confused about the new behaviour where the mouse is not
restricted to the game area in fullscreen, which is understandable.
This changes mouseIsGrabbed to use SDL directly in order to avoid
making changes to the user preference in the _inputGrabState.
Otherwise we'd either clobber the user's previous windowed mouse
grab preference, or require maintaining a second variable just to
track the original state, when we can have SDL do that for us.
Normally with SDL, a mouse motion event will be sent after the
system mouse cursor has been moved by a call to
SDL_WarpMouseInWindow, but if the system cursor cannot be moved
(e.g. because the window does not have mouse focus), games still
need to receive these mouse events so they can successfully update
the mouse position internally. Otherwise, games continue to think
the mouse is still in the original position and will continue to
try to perform whatever action is associated with that mouse
position.
Refs Trac#9689.
This patch refactors the OpenGL and SDL graphics backends,
primarily to unify window scaling and mouse handling, and to
fix coordinate mapping between the ScummVM window and the
virtual game screen when they have different aspect ratios.
Unified code for these two backends has been moved to a new
header-only WindowedGraphicsManager class, so named because it
contains code for managing graphics managers that interact with
a windowing system and render virtual screens within a larger
physical content window.
The biggest behavioral change here is with the coordinate
system mapping:
Previously, mouse offsets were converted by mapping the whole
space within the window as input to the virtual game screen
without maintaining aspect ratio. This was done to prevent
'stickiness' when the mouse cursor was within the window but
outside of the virtual game screen, but it caused noticeable
distortion of mouse movement speed on the axis with blank
space.
Instead of introducing mouse speed distortion to prevent
stickiness, this patch changes coordinate transformation to
show the system cursor when the mouse moves outside of the virtual
game screen when mouse grab is off, or by holding the mouse inside
the virtual game screen (instead of the entire window) when mouse
grab is on.
This patch also improves some other properties of the
GraphicsManager/PaletteManager interfaces:
* Nullipotent operations (getWidth, getHeight, etc.) of the
PaletteManager/GraphicsManager interfaces are now const
* Methods marked `virtual` but not inherited by any subclass have
been de-virtualized
* Extra unnecessary calculations of hardware height in
SurfaceSdlGraphicsManager have been removed
* Methods have been renamed where appropriate for clarity
(setWindowSize -> handleResize, etc.)
* C++11 support improved with `override` specifier added on
overridden virtual methods in subclasses (primarily to avoid
myself accidentally creating new methods in the subclasses
by changing types/names during refactoring)
Additional refactoring can and should be done at some point to
continue to deduplicate code between the OpenGL and SDL backends.
Since the primary goal here was to improve the coordinate mapping,
full refactoring of these backends was not completed here.
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.
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.
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.
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.
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.
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.
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>
Fixes erratic speeds in analog pointer motion
Implemented option to set analog/keyboard pointer speed
and control the analog joystick deadzone. The deadzone option appears
only if the build supports analog joystick (via JOY_ANALOG define)
This means that when using SDL 1.2 we use SDL_net 1.2, but when
using SDL 2 we now use SLD_net 2 as well. Both versions work
properly and there is not code change needed in ScummVM.
This change is because SDL_net depends on SDL, and using
SDL_net 1.2 with SDL 2 means we can end up needing to link with
both the SDL and SDL2 libraries.
Commit adds kFeatureClipboardSupport. hasTextInClipboard() and
getTextFromClipboard().
OSystem_SDL has this feature if SDL2 is used.
EditableWidget and StorageWizardDialog use g_system to access clipboard
now.
Now we can do REST API request by creating CurlJsonRequest and waiting
for it to call our callback. Passed pointer is Common::JSONValue.
This commit also does some minor variable renaming fixes.
This commit introduces Common::CloudManager, which can be accessed from
OSystem.
The backend for this manager is Cloud::Manager (defined in
backends/cloud/manager.h). It should load all users storages from
configs and provide access to current Storage instance. For now it just
creates a new one.
Cloud::Storage (backends/cloud/storage.h) provides an API to interact
with cloud storage, for example, create new directory or sync files.
Right now it's not ready and has only two dummy methods: listDirectory()
and syncSaves().
There is Cloud::Dropbox::DropboxStorage backend
(backends/cloud/dropbox/dropboxstorage.h) for Cloud::Storage. Right now
it implements both listDirectory() and syncSaves() with starting timer
task and handling it by printing out some JSON examples.
Adding a bit of code to make ScummVM AmiUpdate aware.
Everything else will be dealt with through a (yet to finish) AmigaOS installer script and the entries in AmiUpdate's database.
I'd like to ask for hints regarding
- Code Formatting
- Optimizations
- Comments
- Obivous errors
or
- Ill-designed code.
It's not much code, but i'm sure i still messed up glorious either way
Since Mac OS X Carbon/Cocoa API isn't stable (in that it's changed multiple times over the years). Maintaining two versions of the same code (one in some foreign language with overly long names) isn't very appealing to me.
AmigaOS's Rexx interpreter seems to have problems with './' in the path to the
Rexx script. We work around this by copying it to the cwd and using it from
there.
Manual merge of PR #669 "AMIGAOS: Fix amigaos.mk to make the rexx script work
on local builds".
This is what the XDG Base Directory Specification suggests to use. We still
use the old location of '~/.scummvmrc' in case that is present.
This tackles an aspect of bug #6036 "POSIX: Use XDG dirs instead of HOME".
This makes use use the XDG Base Directory Specification for the log file path.
This tackles one part of bug #6036 "POSIX: Use XDG dirs instead of HOME".
We remove the menus added by SDL before inserting our own menus,
but the code assumed that there were two SDL generated menus. SDL2
actually adds three menus. So the new code makes no assumptions on
the number of menus so that it works with both SDL1.2 and SDL2.
Also fix an issue on OS X 10.4 and earlier that caused the app menu
to be nameless.
In SDL 2.0, intrin.h is now included in SDL_cpuinfo.h, which includes
setjmp.h. SDL_cpuinfo.h is included from SDL.h and SDL_syswm.h.
Thus, we remove the exceptions for setjmp and longjmp before these two
includes.
On AmigaOS the user can customize every icon including drawers.
This is a customized drawer icon for ScummVM with the original "S"
scaled on top of it.
This icon may change with further revisions of AmigaOS4 (if the
default icon images change).
This moves the AmigaOS4 specific packaging rules from the global
ports.mk to a port specific makefile in the AmigaOS subdirectory of
the SDL backend (used for AmigaOS).
Previously, port specific makefiles were only used for cross compiling
builds and thus had a single entry in the cross compiling section of
the configure. Since AmigaOS4 is a desktop system supporting native
build, this required a second entry for when the host system is detected
as ppc-amigaos to support native builds.
However, currently this does break packaging of cross compiled builds
for Win32, OSX and Unix when done on AmigaOS4... but this is not likely
and has limited impact. To fix this, default _port_mk lines would need
to be added to the sections of the cross compiling switch for mingw32
etc. to override the AmigaOS4 OS setting of _port_mk.
This implements count badge, progress bar, and icon overlay.
It uses the NSDockTile API which is available since OS X 10.5.
The code compiles and run on older system but without doing
anything.
The fix is the change in the MAXPATHLEN check, but have also migrated
this to Common::String to make the fix easier.
Thanks to klusark for pointing out this problem.
A call to setlocale can invalidate the string a previous setlocale call
returned. Instead of saving a pointer we copy the returned string now. This,
for example, fixes invalid memory access on my system.
See de8da01b0e for the commit introducing the
invalid memory access.
This is to fix bug #3615148 - "ALL: sscanf("%f"), atof() etc. not
portable due to Locale"
The side effect of setlocale("") is to change the active locale
from the default of "C" to the detected system locale, but this
changes the behaviour of sscanf() and several other functions
in a system dependent and non-portable way. This has caused
bugs in the ZVISION engine when running Zork Nemesis.
The solution is to restore the default "C" locale after the call
to get the language.
Thanks to criezy for working out this fix.
The former code (incorrectly) assumed that the getDefaultGraphicsMode returns
the index in the table returned by getSupportedGraphicsModes. Now the correct
ID is searched and then used.