ConfigManager does not use any version info, but is part of libvbamcore,
so removing the `#include` makes rebuilds after git changes much much
faster.
Remove the AutoBuild.h includes from ConfigManager.cpp and SDL.cpp (the
SDL port) because the information in that file does not seem to be used
and it also includes version.h, forcing those files to rebuild
unnecessarily.
Use cmake to generate the version.h from version.h.in which is a cleaned
up version of the old version.h with the git short sha into the build
directory, and include the version.h from there.
Continue to use the GetGitRevisionDescription plugin to make the cmake
configuration state depend on the current sha of HEAD, but throw away
the results (for the time being.)
This makes rebuilds after git changes such as a commit only recompile a
couple of files instead of the whole tree.
`throttle == 0` is supposed to emulate at full speed and drop audio
data, this is different from `throttle == 100` which is emulation
throttled at normal speed, the default setting.
Fix the recently rewritten SoundSDL sound driver to make `throttle == 0`
work, and make some minor changes to clean up the relevant code in the
XAudio2 sound driver.
Add a "REPORTING CRASH BUGS" section to the README.md with instructions
for how to provide a symbolic backtrace on Linux and MSYS2.
Add a "Crash bugs" section the the issue template with a link to said
README.md section.
Rewrite SoundSDL (the SDL sound driver).
Clean up the code and eliminate all deadlocks/hangs/crashes (hopefully.)
Many of the deadlocks were caused by initialize() not de-initializing
properly and causing the audio callback thread to deadlock, fix this.
Also use better logic for the semaphore controls, which will also
hopefully increase audio quality.
Use better logic for the throttle control, with throttle == 0 being the
same as throttle == 100 and implement setThrottle().
Also increase the buffer size to 300ms and the number of samples to
2048, for hopefully less choppiness in audio overall.
The SDL API documentation for the audio callback specifies that the
callback *MUST* write to the buffer and not just return:
https://wiki.libsdl.org/SDL_AudioSpec#Remarks
write silence to the buffer (value taken from the AudioSpec returned
from OpenAudioDevice) when the emulator is paused.
Paint the whole GameArea (containing the emulator graphics panel) black
on size events for both the GameArea and the panel.
This will hopefully fix reports of garbage around the panel when going
full screen with the OpenGL driver on Linux.
Remove F11 as the default key for save state (GS=) in the defkeys array
in opts.cpp and leave it unmapped by default, because it conflicts with
the menu XRC mapping for full screen which is also F11 on non-macOS
platforms.
SDL_PauseAudioDevice seems to be causing thread deadlocks in combination
with Wx threads (e.g. on menu activation or modal dialogs.)
Remove these calls from SoundSDL::pause() and SoundSDL::resume() for the
time being so that deadlocks do not happen.
This effectively allows pausing, but on resume there is no sound for 2-3
seconds until the buffer is filled again.
This will need a proper fix at a later time.
Remove the wxALIGN_CENTRE_VERTICAL flag from items that have the
wxEXPAND flag in the MemViewer.xrc because wx 3.1+ warns about the flags
being incompatible.
As cmake now warns when policies are set to OLD, change the CMP0005
policy to NEW.
What this does is have cmake escape -D preprocessor definitions passed
to e.g. add_definitions() starting in cmake 2.6 . This is fine since the
minimum cmake version we support is 2.8.12 . It also makes the code
cleaner since we don't have to escape quotes anymore ourselves. This
will also work better on different platforms, where different escapes
may be needed.
Remove all quote escapes from string params to add_definitions() for
this policy change to work.
- drop unused variables
- unused-but-set-variable
- stray trailing comments
- in viewsupt.cpp replace redundant expression with variable that holds the same value
In StartRFUSocket() in gba/GBALink.cpp move a postincrement out of an
expression to a following statement, because the evaluation order is
undefined.
In GetDevices() in wx/openal.cpp replace an #else with an #endif so that
the function has a default return statement visible to the linter.
In FilterThread::Entry() add a `return 0;` (ExitCode) statement at the
end even though it is probably never reached.
In the TransferToWindow() for the positive double validator widget in
wx/widgets/wxmisc.cpp add a default `return true;`, for the rare case
there is no double value, in which case the string representation would
be displayed (since it is a subclass of wxGenericValidator(wxString&) .)
A couple files that use the std::ceil() math ceiling function were not
including the required header <cmath> and this seemed to have been
causing build errors on some Linux distributions.
Add the necessary #include <cmath> statement to both files.
If _GNU_SOURCE is defined on linux, then strerror_r() is an alternate,
non-POSIX version.
Undefine _GNU_SOURCE when including <string.h> in ConfigManager.cpp to
get the POSIX version of strerror_r(), and initialize the error string
buffer to "unknown error" so that the code does not crash whichever
version of the library function is being used, or strerror_r() fails for
some reason.
By default the SDL port tried to save the battery to a nonexistant
directory in saveDir, because if (saveDir) {...} evaluted to true since
saveDir was a non-NULL pointer but empty.
Change sdlCheckDirectory to return a bool indicating if the directory is
good or not, and if not set screenShotDir, saveDir and batteryDir to
NULL so that code that checks for their existance works correctly.
Following up on 1ba2eef which fixed a crash caused by trying to write to
a NULL FILE* due to fopen() failure: write the error message to stderr
instead of trace.log and show the OS error using strerror_r().
glibc's fclose implementation does not do a NULL check and will crash on "fclose(NULL)". A bunch of Fedora users have been sending in traces for this issue. I've added a log on failure case, likely if the user does not have permission to write to the file.
Add a link to the Joystick page in the Arch Wiki so that users hopefully
use it to troubleshoot their joystick issues before filing an issue.
Also note that any joystick issues would be SDL related.