Fix name of FAudio option XRC control: "FAudio" and not "Faudio".
Create list of valid sound driver options by using macros for the ones
that are compiled in (with windows being a special case.)
The default keyboard/joystick bindings for the "special" keys have
assumptions about axis numbers that do not hold with modern game pads.
For reference, the 360 controller has the following mappings:
Axis 0/1: left stick
Axis 3/4: right stick
Axis 2: left trigger
Axis 5: right trigger
This triggers another bug causing the depressed state of a trigger axis
to fire continuously. In this case, this is the left trigger on a 360
controller which is axis 2.
This triggers yet another bug where a stream of joystick events blocks
keyboard events from registering, resulting in hotkeys like ctrl+p to
pause not working.
Replace all joystick binds for special keys with null values.
With this change, a default installation of vbam will not trigger the
hotkeys not working bug when a joystick is plugged in.
The other bugs here mentioned also need to be fixed.
When trying to do the necessary edits to linklibs.rsp or link.txt for
static linking, first check if the files were created by cmake,
otherwise a fatal error is generated.
When connecting the debugger the debugger variable was
being set to true before setting up the dbgMain and other related
function pointers. This caused the idle loop to attempt to call dbgMain
which was still NULL. This change makes sure that debugger isn't
set to true until all function pointers are set and that when disconnecting
the remotePort variable is reset back to 0 so we can reconnect properly.
The latest version of gdb from devkitpro expects slightly
different response to some of the remote queries. For instance
when sending back the current thread id there should be no
space or dash between 'm' and the thread id. Additionally a
handful of other common remote gdb query params were
added to better support current versions of gdb
https://github.com/llvm-mirror/lldb/blob/master/docs/lldb-gdb-remote.txt
The qHostInfo command is listed as a high priority to implement for gdb
stubs that lldb can connect to. Adding support for this command allows
lldb to properly connect with it's `gdb-remote 55555` command and
correctly determine the target and allow debugging.
When doing a remote memory read the debugger can ask for any size.
The buffer being allocated however was only 1024 bytes long and the
code in remoteMemoryRead also attempts to write a zero byte at the
end of the array. This code will now take the count of bytes the debugger
is trying to read and allocates a buffer that is count * 2 + 1 large. This is large
enough to hold the $02x formatted hex byte for each byte as well as the zero
byte written at the end.
If the packet passed into remotePutPacket was 1024 bytes or
larger then the buffer array would not be large enough to hold
the $, checksum and zero byte written. This now allocates a buffer
of size count + 5 to accommodate these extra characters.
Use the IsWindowsVistaOrGreater() function from VersionHelpers.h, which
fortunately is part of mingw, to check for the availability of the
comctl32 LoadIconWithScaleDown API, which we use to fix issues with the
app icon, like the icon being too big in the volume mixer.
Rename cmake script to copy .gmo files into the .app introduced in
bf4606fc from mac-localizations.cmake to mac-translations.cmake since
these are really translations and not localizations.
Add a POST_BUILD hook to run a cmake script to install translations into
the .app.
Tested to work correctly, when system language is different a
translation is loaded.
Remove -fpermissive from the list of flags passed to gcc and clang.
Remove -fpermissive from the cxxflags from wxWidgets config as well.
When checking wxWidgets ABI compatibility version, temporarily add
-fpermissive to compiler flags on Win32 because minhook requires it.
- Add the cross root from the mingw-w64 mac brew to the cmake toolchain
files.
- Remove strerror_r/strerror_s from ConfigManager.cpp because the
mingw-w64 brew does not support strerror_s for some reason.
- Strip the vbam executable from the builder script in the build_project
phase.
- Change the bzip2 URL to the github mirror because the bzip.org domain
expired.
- Add libuuid as it's required by the new fontconfig, use the mingw
version for mingw builds, for mingw also set UUID_LIBS to
'-luuid_mingw -luuid' in mingw.sh for fontconfig, the mingw version
is called uuid_mingw because uuid is a core win32 library.
- Lower glib version to 2.57.2 stable.
- Update wxwidgets version to current master sha.
- Fix a bug in flex-2.5.3 post_build where it tries to build flex
current but flex has been removed, and it was just rebuilding 2.5.3.
- Fix "aggressive" relocation and the relocation of .l[ao] and .pc files
in install_dist to ignore /usr/local, and only match /usr.
- Add a "project" pre_build and post_build hooks.
- Add getopt to host-only dists in mingw-cross.sh.
- Use perl instead of readlink -f to get the absolute path of the cmake
toolchain files in mingw-cross.sh, as readlink -f is linux-only.
- In mingw-cross.sh, replace the glib post_build to rebuild
gettext-target instead of gettext --without-included-glib.
- Add overridable functions set_host_env_hook and unset_host_env_hook in
mingw.sh to override in other scripts, in this case mac-cross-builder.
- Update mingw glib patches to current fedora versions.
- Add tools/win/mac-cross-builder script to build mingw windows binaries
on mac, it borrows some necessary parts from the mac native builder
for host dists, and inherits from mingw-cross.sh.
TODO: currently the resulting mac-built binary segfaults due to gcc
8.2.0, just as the msys2-built binary does, this is a separate issue.
Use find_program() to check for the existance of wx-config-gtk4, then
wx-config-gtk3 and finally wx-config, instead of calling find_package()
for each separately, FindwxWidgets module does not like being called
multiple times, it screws up some cache variables.
unset(VAR PARENT_SCOPE CACHE FORCE)
seemed to work on my version of cmake on gentoo, but does not work on
other versions.
Rewrite the function as a macro and use the syntax:
unset(VAR CACHE)
instead.
Clear FindwxWidgets module variables from the cache after each
unsuccessful try with WX_CONFIG_EXECUTABLE set, otherwise the succeeding
find_package(wxWidgets) call with WX_CONFIG_EXECUTABLE unset will fail,
as it does with cmake on gentoo.
Remove usage of RETRO_MEMORY_RTC - not required since real-time clock is always updated and is using current time and not ingame time.
Add some more rom info to logs during loading
Gb,gbc and sgb enhanced version of roms and savestates working. Bios loading for gb/gbc works too. No save ram / battery handling yet.
Fix offset and pitch issues with vba rendering and when borders are enabled.
Some people are reporting stuttering, and @retro-wertz tested both
DrawArea() and Refresh() on wxgtk3 under xorg and found that the
Refresh() method produces more stuttering.
Change the compile check for wxgtk2 to a runtime check for wayland, and
use Refresh() under Wayland only.
For the most part, save types should now be identified during rom loading and then allow libretro to correctly use flash or eeprom save types and save size.
Make mac builder use -m32 in CFLAGS etc. to produce a 32 bit binary
targetting 10.7 (Lion.) This provides the greatest backward
compatibility for older macs, and also allows for asm filters.
Fix an issue with m4 on 10.13 using a patch from macports.
Support `-pX` patch level args in DIST_PATCHES in builder.
Fix an issue with bison on 10.13 by bumping the version to 3.0.5.
Build libxslt `--without-crypto` so that it doesn't try to link the brew
libgcrypt.
Invoke cmake for dists with -DCMAKE_C_COMPILER_LAUNCHER=ccache and
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache to use ccache, and set
CMAKE_C_COMPILER and CMAKE_CXX_COMPILER to the actual compilers not
prefixed by ccache.
When checking for ccache in vbam cmake code, check that
CMAKE_CXX_COMPILER_LAUNCHER and CMAKE_C_COMPILER_LAUNCHER were not
already defined (generally on the command line.)
Remove align attributes from sections in 2xSaImmx.asm, macho format on
mac does not support this and the filter works fine without them.
In the Quartz2D renderer, pass the NSRect view.bounds through
NSRectToCGRect when calling CGContextDrawImage(), this is necessary for
the 32 bit API.
Bump openssl to 1.0.2o.
Bump libxml2 to 2.9.8.
Update URL for urw fonts, and improve the dist downloading/unpacking
code to handle URLs that do not contain the filename (for .tar.gz and
.zip as identified by `file`.)
Change post-build for harfbuzz from `rebuild_dist freetype;` to
`rebuild_dist freetype --with-harfbuzz=yes;` as it was supposed to have
been.
Build cmake itself with --parallel and --enable-ccache.
Silence errors from killed jobs due to tmp directory being gone.
Write a couple of string functions, rtrim() and gsub().
Make path_exists() handle globs with spaces in them, by escaping the
space.
Use --host and --build args to autoconf configure to "cross-compile" for
32 bits, this is necessary for some dists, and does not work for others,
remove it for dists where it does not work.
Add COMMAND_MODE=unix2003 to the build environment, this is necessary to
fix some build errors, why I have no clue, found it on stackoverflow.
Pass -Wl,-no_compact_unwind in LDFLAGS to openssl, this is necessary for
32 bits.
Force sfml to compile as 32 bit, it normally does not allow this.
Remove shared-mime-info from this build, it's not necessary for anything
and there are issues XML::Parser linked to our expat and brew perl that
need to be resolved.
Implement the recommendations described in issue #255 by @zzazzdzz:
- Check bounds when reading ELF program header sections.
- Skip reading ELF section headers if the string table pointer is NULL.
- Increase the buffer size for dissassembled instructions in the
dissassembly view and pass the buffer size to the disArm() and
disThumb() functions so that rudimentary bounds checking can be done.
Also add the constants WORK_RAM_SIZE and ROM_SIZE to reduce incidence of
magic numbers and make the code a bit cleaner.
In MainFrame::ShowModal, which is used as a wrapper for
wxDialog::ShowModal to also pause emulation, add the current window
style flags to the additional CAPTION and RESIZE_BORDER flags being set
with SetWindowStyle(), otherwise the other style flags of the window are
reset causing erroneous behavior such as save dialogs appearing as open
dialogs on Mac.
When using GTK2, call DrawArea(dc) instead of GetWindow()->Refresh(),
this prevents glib from using huge amounts of CPU (as discovered by
@retro-wertz .)
Switching video drivers sometimes crashes the app, the DrawArea() call
is as safe as possible, the problem is elsewhere.
Skip the check for wx-config-gtk3 if the WX_CONFIG environment variable
is set, indicating that the user wants to override the version of wx to
build against.
Use a loop to check for wx-config-gtk4 then wx-config-gtk3 and unset the
config executable variable otherwise.
Also remove gl from the initial wx libraries list.
Change installdeps to install wxgtk3 on arch instead of the wxgtk
package which uses gtk2.
Update the cmake code to check for the renamed wx-config executable
wx-config-gtk3 on arch, first checking for wx-config-gtk4 for the
future.
Compile out the min/max functions in GBALink.cpp when compiling with
clang, clang does not like them because of some sort of changes in the
preprocessor.
Run the mac builder script with homebrew bash, system bash does not work
and dash no longer works.
TODO: fix dash compat
Minor rework on how bios is loaded when CPUInit is called, removes a few conditions.
Disable cheats by default. This is automatically re-enabled when enabling and applying cheats. Should save a few cycles during runtime if cheats are not needed.
Fix crash when adjusting echo/stereo sliders.
Fix enhancements not working when selected
Fix settings not loaded at startup
Reviews and/or modifications are welcome. Obviously, im trying out if I understand how options are linked in WX so I am not quite sure if this is the right thing to do this.
On Windows we still need to pause on menu pulldown until we figure out
how to keep the game running, with the code disabled it still pauses and
the audio loops.
Previously I disabled this for mac because of bugs in keyboard handling,
but it turns out most people don't like the game pausing on menu
pulldown anyway, so now I disable it for all platforms.
TODO: the game still pauses for modal dialogs.
Put shared code for linux cross builds and cygwin cross builds into
builder/mingw-cross.sh .
Call wxrc when the build platform is cygwin with files resolved via
`cygpath -m` in case the wxrc is a native binary.
Add -fpermissive to CXX/OBJCXX flags.
Reenable libzvbi support for ffmpeg.
Stop building ffmpeg and related dists by default until we fix game
recording.
Set CMAKE_PREFIX_PATH in cmake args as a FILEPATH type variable.
Support xml catalog made with native libxml2 using cygpath in related
commands, make cygpath a noop on non-cygwin platforms.
Remove gdb and zip from msys2 deps.
Add a cygwin installdeps routine using a copy of cyg-apt that it
fetches.
When creating symlinks in install_dist() fully resolve all symlinks in
path parts for the source file, so that host and target binaries are
correctly linked.
When cp -af fails to preserve permission related data, fall back to cp
-rf.
When installing libs with a cross suffix, make a symlink for the lib
without the cross suffix.
Make sure cygwin runs with CYGWIN=winsymlinks:native .
Add paths to host gettext executables to cmake args, otherwise it tries
to use the target executables and fails on paths.
For the pkgconfig bundled glib, turn off win32 platform for the cygwin
host build.
For gettext, remove --disable-auto-import from link flags.
Compile target freetype on cygwin with cmake and manually install the
pkgconfig .pc file using sed.
Add a relocation type 'aggressive', when a dist is marked with this
type, rewrite all '/usr' prefixes to the build root. By default only
files that exist in the dist are matched and rewritten.
Fix regression in linux build by adding some iconv related flags to the
cmake invocation for doxygen and disabling -Werror for xorg dists.
When relocating scripts, use the actual resolved root path for host or
target.
Build libxslt --without-python so that it doesn't try to pick up the
msys2 python.
Other misc. minor tweaks and cleanups.
cmake reconfigure was failing for the gtk2 case because the pkg-config
cmake code was not being loaded.
Load pkg-config cmake code before any gtk checks.
In SoundSDL, when building on windows add this init code:
```
SDL_setenv("SDL_AUDIODRIVER", "directsound", true);
```
Otherwise there is no sound on windows.
Also update SDL to 2.0.8 from 2.0.7 in build scripts.
The FF_MIN_BUFFER_SIZE macro was renamed to AV_INPUT_BUFFER_MIN_SIZE at
some point, so check for the newer variant first.
The AVFMT_RAWPICTURE macro seems to be gone, but affected code was an
edge-case so compile it out if the macro is not present.
A Linux user (Eleuin) has reported menu lockups with the default OpenAL
(probably thread related) and no lockups with SDL.
A Windows user has reported popping noises with all audio drivers except
SDL (#178).
Change the audio driver default to SDL for the time being until these
issues can be looked into.
under `tools/` add some scripts to invoke the build system to build all
deps for vbam and vbam itself:
- `tools/linux/builder`
This builds a mostly static linux binary with a few dynamic deps for
xorg and wayland. Using gtk3. This will run on just about any dist.
- `tools/osx/builder`
Builds a static mac app targetting 10.7.
- `tools/win/linux-cross-builder`
Builds a static windows binary using the mingw-w64 toolchain.
- `tools/win/msys2-builder`
Builds a static windows binary in the MSYS2 environment, this may be
suffering from a few regressions.
Change some cmake code to support the build system, refactor a few
things in it.
Improve, refactor and clean up `tools/osx/builder` to build a relatively
full-featured ffmpeg as well. This requires lots of other dists. It's
kind of like a mini port system now. Will generalize it shortly to a
sourced library for using with both the mac and the mingw builds. Will
hopefully become a separate repo on github at some point.
Add perl dist support to the builder.
Add an `--env` flag to the builder to print the build environment
variables so that they can be read in with `eval` for debugging
purposes.
Also add the `FFMPEG_STATIC` cmake option to link static ffmpeg
libraries correctly.
Move the codesigning and zipping of the `.app` bundle to the builder
script and out of cmake, as this is something most users don't need.
Add POST_BUILD commands on Mac to codesign the `.app` and make a zip
file from it.
Also add xz/liblzma dist to `tools/osx/builder` because something
apparently wants liblzma.
Add `tools/osx/builder`, a POSIX sh script to build all dependant
libraries as static, targetted to OS X 10.7, and build the project with
them (also targetted to OS X 10.7.)
ffmpeg currently does not link, as recording functionality is currently
non-functional anyway, this will be fixed later.
MISC:
- set WORKING_DIRECTORY and ERROR_QUIET for all git commands, for the
cases when the build directory is not under the git checkout
- #include <cerrno> in ConfigManager.cpp as it uses errno
- change `build*` in `.gitignore` to `build/*` so that files starting
with "build" are not affected
To get the version, find the last tag in git tag of the form "v2.0.0" or
"2.0.0". If this is the last tag and the current commit matches the ref
of this tag, the revision will be empty.
In the case that the current commit is not tagged with a version, to get
the revision, use the short sha unless the current commit is tagged with
something that is not a version string, e.g. "feature-foo", in which
case the revision will be "feature-foo".
If the current commit is tagged as e.g. "v2.0.1-foo" or "2.0.1-foo" then
the version will be "2.0.1" and the revision will be "foo". Tags of this
form are also checked when finding the current version.
This is all done in cmake. If there is no git detected, the version will
be "2.0.0" and the revision will be "unknown".
On SoundSDL destructor and `reset()`, there was a deadlock with Linux
pthreads, it happened sometimes that the reader thread would call
`SDL_SemWait(data_available)` while `deinit()` would destroy the
semaphore and the `SDL_SemWait()` would end up waiting forever on a null
semaphore.
Change the sequencing of deinit() to prevent this from happening, set
`initialized = false` at the beginning of the sequence to prevent
subsequent entries into the reader callback, and add an SDL_Delay(100)
between the final `SDL_SemPost()` and `SDL_UnlockMutex()`s and the
`SDL_DestroySemaphore()` and `SDL_DestroyMutex()`s to allow a running
reader to complete with a valid mutex and semaphores before they are
destroyed and the thread is joined.
Resetting the sound system also sometimes triggers a memory corruption
bug, but that's a separate issue.
We were setting the app icon based on the 256x256 xpm icon in the xrc,
and this triggered a bug where the app-specific icon in Windows volume
settings was huge:
https://stackoverflow.com/questions/17949693/windows-volume-mixer-icon-size-is-too-large/46310786#46310786
Adapt the code from that SO question to use Windows-specific code to
load and scale the icon appropriately using a Vista+ API, and fall back
to the normal Wx icon loading mechanism on XP.
Also generate a nice new `vbam.ico` Windows icon file based on the
`.svg` using the app from:
https://iconverticons.com
Use `git submodule update --remote --recursive` instead of `git
submodule update --init --recursive` so that the latest version of the
repo is always installed.
Run the command from cmake instead of throwing an error if the submodule
is not checked out. Only throw an error if the checkout failed or the
source tree is not a git checkout.
Don't add the `mingw-xaudio` include directory if using MSVC.
Remove the submodule check from src/wx/CMakeLists.txt, having it in the
main CMakeLists.txt is enough.
gcc lto wrapper commands such as `gcc-ar` will segfault with some
versions of gcc 7.x when called via an absolute path, see:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80717
Generalize the mechanism for compiling a small C program on the host
(currently used for bin2c for Wx resources) and use it to wrap the gcc
wrappers in a little executable that prepends their dirname to PATH and
runs them with `execvp()`.
Make LTO default to ON again, except on win32 with gcc < 7, because
those toolchains produce broken binaries with LTO enabled.
Also add `-ffat-lto-objects` to compiler flags for gcc when LTO is
enabled, this will increase the chances that the LTO build will succeed
even if there are issues with the binutils wrappers. Clang does not
support this.
Fix building with wx 2.8 by rewriting some more string related code.
Replace all calls to .c_str() with .mb_str().
Remove some of the .c_str()/.mb_str() calls where the target is already
wxString.
Move the split()/enum_idx() functions from opts.cpp into
str_split()/vec_find() in strutils.h/strutils.cpp for use in other
files.
Replace the C-style string parsing code in a couple of places in
wxvbam.cpp for processing possible command line options by splitting on
'='.
Also replace a couple of places that use pointer arithmetic in
widgets/joyedit.cpp and widgets/keyedit.cpp with wxString methods.
When calling find_package(wxWidgets ...) allow the first call to fail
because the OpenGL library may not be found. A subsequent call without
listing the OpenGL library is done with REQUIRED.
And if the OpenGL library is not found, skip the OpenGL compile test.
When cross-compiling (e.g. with mxe or other mingw packages) skip the wx
ABI compatibility run tests.
When choosing which minhook lib to link to the wx ABI compat run test
program, check for 64 bit but fallback to 32 bit just in case.
When Wx is built with --enable-stl, wxString to wxChar*/char* implicit
conversions and vice-versa no longer work.
Change all wxChar* data members to wxString and change all pointer
arithmetic code (mostly in opts.cpp, cmdevents.cpp and
widgets/joyedit.cpp) to use wxString methods instead.
Also make mostly minor changes in various other files for all of this to
work.
Fix error dialog boxes popping up when the Wx ABI compat tests are run
from cmake.
Wx 3.x is hardcoded to use MessageBox for wxLogFatalError(), even in a
console app, so use the minhook trampoline lib (added to dependencies)
to hook the Win32 API MessageBoxW and MessageBoxA (the second just in
case) so that no error dialogs pop up.
Details here:
https://www.codeproject.com/Articles/44326/MinHook-The-Minimalistic-x-x-API-Hooking-Libra
Include `wx/wxprec.h` (precompiled header first in test programs to
possibly make the tests slightly faster.
For the ABI compat check, set a variable for the test program instead of
listing it twice.
Following some suggestions from @ArtiiP, first check if there are no
issues without an -fabi-version flag, and then instead of incrementing
from 0, decrement from 15 to find the highest working ABI version.
This is very slow if the needed ABI version is 2 for example, but not
much to do about that for the time being.
Start checking the ABI version at -fabi-version=0, which is the default,
and if that succeeds don't set the flag at all.
This will allow the code to work properly if and when Wx removes the ABI
check alltogether.
In 4e665ae I hardcoded -fabi-version=2 for g++ flags, and @ArtiiP
pointed out that this is wrong, because Wx may be compiled with other
ABI versions.
Add cmake check_cxx_source_runs() tests to determine the correct ABI
version flag to use with Wx.
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.
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.
- 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.
In d1918c12 I manually sent a SIZE event to the DrawingPanel after
calling Layout() in the setup code in OnIdle().
But the obvious problem is that the ->Connect() calls to set up the
event handlers, including SIZE, are after all the setup code including
the Layout().
Move the ->Connect() calls to the top of the setup code and remove the
manual SIZE event sending. This is a much better solution that for some
reason I didn't notice at the time.
Tested to also fix the problem.
Add the `m32` parameter to ./installdeps to fetch 32 bit multilib
dependencies on Fedora, Arch and Solus linuxes and add a cmake toolchain
file to build with them.
For MSYS2 support both an `m32` and an `m64` to choose deps for 32 bit
or 64 bit mingw targets.
Adjust build instructions from ./installdeps to support both usages.
Other changes:
- use --nogpgcheck --best --allowerasing for dnf invocations for Fedora,
the --nogpgcheck is necessary when Rawhide is confused about which
keys it has, and the latter two are needed for upgrades that remove
unneeded deps etc
- when finding GTK2, first try using pkg-config, and only fall back to
the cmake script when that fails, pkg-config works better for cross
builds
- add cairo to dep lists in ./installdeps for the time being
- for arch, list individual packages from base-devel instead of
base-devel that do not require gcc-libs because of potential conflicts
between gcc and gcc-multilib
Because of how asm subroutines are linked to C/C++ programs,
src/filters/2xSaImmx.asm had an %ifdef __DJGPP__ (the DOS port of gcc)
with the subroutine names prepended with an extra underscore.
In 902a7a7e I removed the %ifdef and just kept the extra underscore for
all symbols, and this worked fine until #98 where some version of Fedora
did not like that and would not link the code.
So adopt the behavior of the other asm filters, which have a NEWSYM
macro that defines the symbol name both with and without the extra
underscore, by listing the symbol twice, both with and without the extra
underscore, this is confirmed to fix the linking issue on that Fedora
build host.
Stop saving and restoring the CMAKE_REQUIRED_* variables for the compile
test, because the subsequent Wx header symbol tests need them set up for
Wx support as well.
Also --param foo=bar needs to be a single string in the list of compiler
flags, or cmake can misinterpret the second part as a library when it is
passed to libraries/link-options.
When determining gcc/clang flags, save resulting C flags as MY_C_FLAGS,
C++ flags as MY_CXX_FLAGS, and linker flags as MY_C_LINKER_FLAGS, then
use them in the Wx OpenGL compile test.
This fixes the test erroneously failing on git mxe on mac.
Also, don't use -fPIC on Win32, set Wx defines separately from the test,
and save all CMAKE_REQUIRED_* variables before the test and restore them
afterwards.
Since we are using sound frequency to control game speed, not quality,
change ConfigManager to default to a frequency of 44100 instead of
22050.
This also fixes trace.log files showing up with "unknown sound quality"
warnings.
Support throttle in all sound drivers: SDL, openal, dsound and xaudio.
Link OpenAL at compile time instead of runtime.
Minor improvement on 891f17d6, which added throttle support to SoundSDL
and made it actually work more often and crash less: check that throttle
is non-zero before scaling the frequency.
For dsound, add the CTRLFREQUENCY capability to buffers and call
SetFrequency on the secondary buffer in setThrottle().
For OpenAL, set AL_PITCH on the source to throttle / 100.0 in
setThrottle() and remove all dynamic library loading stuff.
For xaudio, 441e6c9e allows throttle to work, and is also necessary for
these changes to dsound and openal.
Move the soundSetThrottle() calls after the soundSetSampleRate() calls
in LoadGame(), because the core calls soundInit() again after
soundSetSampleRate() wiping out the throttle value. This allows the
throttle setting to work with xaudio on startup and game loads.
TODO: the throttle config setting only works correctly for the xaudio
driver at the moment, it needs to be implemented for other sound drivers
and eventually moved out of the sound drivers altogether.
Check if link mode is active in GameArea::Pause() and refuse to pause if
it is.
Remove the check for the app not having focus with pauseWhenInactive
enabled in GameArea::OnIdle() as this is now handled in
MainFrame::OnActivate() (which receives focus events) since f10e2e99.
Revert 13f5afa9 which tried to check for link status in
MainFrame::MenuPopped() because it was completely wrong and the link
check is better done in GameArea::Pause().
Trigger OnSize in the drawing panel after setting the geometry and
calling Layout(). I'm not sure what exactly broke but this seems to fix
the issue for the time being.
Also do a bit of very minor refactoring, change some calls to GetSize()
to GetClientSize() and simplify GLDrawingPanel::OnSize(ev&), tested to
work fine in wx 2.8.
Homebrew SFML links itself with @rpath/ instead of the dylib path,
update the mac linking and bundling script to handle that case, also
move it from src/wx/tools/osx to tools/osx now that wx is the primary
port.
This fix is temporary and I will write a better one that takes
DYLD_LIBRARY_PATH and such into account, but will suffice for linking
Homebrew libs for now. The script needs more work in general.
Check that the CMAKE_VERSION is 3.0 or greater when setting the CMP0043
policy to NEW. The Ubuntu 14 cmake which is 2.8.12 throws an unknown
policy error otherwise.
Disable OpenGL support under Wayland because wxGLCanvas segfaults, and
fix an issue with drawn frames not appearing.
If the user has opengl as the render method in their config, it will not
be changed, but at runtime will be set to simple under Wayland.
To fix the issue with frames not being drawn, Call Refresh() to queue a
PaintEv from DrawArea(data) instead of calling DrawArea(device_context)
directly.
Also remove the DrawOSD() call from PaintEv, this was causing the OSD to
sometimes show up twice in one frame, because DrawArea(data) draws the
OSD directly on the frame data.
Add new files wayland.cpp and wayland.h with a bool IsItWayland() global
function. This uses a GDK (part of GTK) call to detect Wayland. This
unfortunately requires linking GTK libs separately.
Add cmake code to detect the version of GTK used by the wx being linked
and link it as well. Add gtk2 and gtk3 dev packages to the code for the
supported linux dists in ./installdeps.
In the MenuPopped method (which received MENU_OPEN, MENU_CLOSE and
MENU_HIGHLIGHT) check that gba_joybus_active is not true before pausing
the emulator, so that if Link mode is on it will not pause.
Remove the "check for updates" and "Update ROM database" menu entries,
as well as the automatic update checking and all supporting code.
This fixes the issue with the emulator hanging without access to the
internet.
Updating code will be reimplemented in the future using something like
Sparkle. wxHTTP does not support redirects or https so is pretty much
useless now.
Also update the About box to bump copyright year to 2017 and change my
name to "rkitover", which is what I use on github, and mention other
contributors.
Add -std=gnu+11 to CMAKE_CXX_COMPILE_OBJECT in the main CMakeLists.txt
to force the option for all C++ sources.
The right way to do this is to use a generator expression with
ADD_COMPILE_OPTIONS, but this is only available in cmake 3.3 and we must
maintain 2.8.12 compatibility to support Ubuntu 14.
This fixes the mac build (clang.)
Call GameArea::Pause and ::Resume in MainFrame::OnActivate based on
focus state if the pauseWhenInactive config option is set.
Also stop/play the primary dsound buffer in pause()/resume() in
dsound.cpp, not onlyu the secondary, this may not be necessary but it
doesn't hurt.
Apparently in some configurations, holding a key on the keyboard makes
Wx stop processing Idle events, so the emulator does not run until the
key is released, freezing the game and ignoring the key.
Hopefully fix this by calling wxWakeUpIdle() from OnKeyDown() and
OnKeyUp().
Other Misc. Improvements:
- refactor process_key_press() to only return true if the system is in a
pressed key state on key presses or a game key was released on
releases and always true on double releases.
- call ev.StopPropagation() from OnKey* events for game keys, this may
not actually do anything, but just in case.
- remove static OnKeyUp and OnKeyDown events from GameArea, these are
connected to the DrawingPanel dynamically now.
- remove the dynamic_cast<>s from PaintEv/EraseBackground/OnSize event
forwarders, since there is already a panel member to use.
TODO:
The state returned by process_key_press() is still not entirely correct,
if a joystick button is pressed, it will return true for a non-game
keyboard press, and it needs to return the correct state for double
releases.
As suggested by @Mystro256, try:
wxDynamicLibrary::CanonicalizeName(wxT("openal"))+wxT(".1")
before just the canonical name for "openal" when trying to load the
library.
Also add a utility method to quietly try loading the library, because on
wx 2.8 wxDL_QUIET does not work.
Fix some porting issues to make everything work on Debian 8 "Jessie"
and Ubuntu 14 "Trusty":
- set cmake minimum version to 2.8.12, this is the Ubuntu 14 version
- combine C and C++ flags and add all of them using
ADD_COMPILE_OPTIONS() without using generator expressions, which is a
cmake 3.2 or so feature
- add -fpermissive to force some non-const type casts to compile on
older versions of gcc
- add -std=c++11 for gcc to enable support on older versions of gcc
- check that the compiler supports -fstack-protector-strong before
adding it, older versions of gcc do not
- fix the debian section of ./installdeps to include libpng-dev instead
of libpng16-dev and add gettext for msginit etc.
- fix compat checks in src/common/ffmpeg.cpp and src/wx/cmdevents.cpp to
check for libavcodec >= 56 instead of > 56, the Debian Jessie version
is exactly version 56 . With the one exception of
AV_CODEC_FLAG_GLOBAL_HEADER which is defined in later versions.
Fix backcompat with wx 2.8. This involved writing
wxPositiveDoubleValidator and rewiring the DrawingPanel inheritance tree
and event handling mechanisms (because 2.8 does not have ->Bind, only
->Connect which is less flexible.) As a result all the event handling
has been gathered into GameArea and the affected code is somewhat
cleaner. 2.8 support is untested on Mac because it requires 32 bit libs
and Carbon.
Add support for cross-compiling for windows using the Fedora MinGW
packages in ./installdeps.
Check for OpenGL support in the wx library being linked, this was
necessary because the Fedora MinGW wx library does not have OpenGL
support.
Remove vbamDebug() in favor of wxLogDebug(), and add an override for it
so that it works in non-debug builds of wx as well as on Windows. Turn
off buffering on stdout and stderr on startup so that debug logging
works in msys2/cygwin mintty as well.
On Windows, build a console binary for debug builds.
Update README.md to reflect Fedora MinGW support and debug logging
support.
Add -Wextra to cflags for debug builds.