Commit Graph

2601 Commits

Author SHA1 Message Date
Rafael Kitover 8ce60e1745
cmake: Fix ffmpeg regression on Windows.
Remove LDFLAGS from list of required variables for finding ffmpeg to
succeed. Both main and component LDFLAGS.

Added by f7f424ea.

This is necessary because of platforms lacking pkg-config, like vcpkg +
Visual Studio, no LDFLAGS are found.

Fixes finding ffmpeg in the vcpkg + Visual Studio configuration.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-01-23 01:49:44 +00:00
Rafael Kitover 5de47935cf
cmake: Followup on release commit automation.
This is a followup on 93f906e2.

Simplify the FileIterator interface by doing the eof check in
fi_get_next_line().

Add rollback instructions to final instructions message.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-01-22 18:15:21 +00:00
Edênis Freindorfer Azevedo f69febfd71
Add `.wav` support for sound recording.
WAV is also set to be the default extension for audio recording.
2020-01-22 13:50:27 -03:00
Rafael Kitover 93f906e2db
cmake: Automate release commit and tag.
Add a TAG_RELEASE cmake variable which engages a cmake script to
generate a signed release commit with changelog entries from git and
signed tag.

The value can be ON/TRUE/1 or a specific next version number, or UNDO to
rollback changes just made with this script.

The script tries to make sure all the preliminaries are in the right
state to do a release, the source is a git clone, on branch master, with
a clean working tree and gpg is available.

Also add a utility script FileIterator.cmake which is an OO-like line
iterator interface for text files, used by the release commit script.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-01-22 03:14:26 +00:00
Edênis Freindorfer Azevedo 588e82f03c
Cleanup from PR 586. 2020-01-21 13:57:42 -03:00
Rafael Kitover 4e607da067
Transifex pull.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-01-20 11:48:57 +00:00
Rafael Kitover 5cc1fd28b4
cmake: Wrap vcpkg code in a function.
Wrap the main body of code in Set-Toolchain-vcpkg.cmake in the
vcpkg_set_toolchain() function to not pollute the global variable
namespace with helper variables.

VCPKG_ROOT and toolchain variables are set in the cache.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-01-17 21:55:26 +00:00
Rafael Kitover 47880ff9c6
cmake: Limit vcpkg upgrades to one port per run.
In order to not overrun the appveyor time limit of one hour, limit vcpkg
port upgrades to only the first port. This way the cache will be rebuilt
gradually instead of all at once, and the job won't fail due to
overrunning the time limit.

Also do a bit of refactoring and code improvements for
Set-Toolchain-vcpkg.cmake.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-01-17 19:47:09 +00:00
Zack 6a8a9e6244 Fix integer overflow in cheatsImportGSACodeFile length check.
Although a length check is being performed on the imported GSA Codes file, `len` is both a signed int and attacker controlled.

With a specially crafted GSA Codes file, an attacker could specify a value for `len` that overflows the `int` type, rolling over into a negative number. By doing so, the attacker can bypass the conditional mentioned above.

The `fseek` length parameter is of type `size_t` which is an unsigned int, this will result in `len` being interpreted as a large unsigned int, allowing for a stack based buffed overflow in the desc char array.

By making `len` an unsigned integer, it will prevent the overflow. It ensures that the bounds check works as intended.
2020-01-17 16:39:58 -03:00
Rafael Kitover 77c299c13f
cmake: Check for libcharset and use if found.
For Visual Studio, the static builds now require linking libcharset
explicitly, otherwise an `unresolved external symbol locale_charset`
error is thrown during linking.

This library is sometimes required on other platforms for iconv/gettext,
and checking for it and linking it should be harmless.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-01-17 16:03:07 +00:00
Rafael Kitover 0c0a35fd04
Transifex pull.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-01-16 16:13:35 +00:00
Rafael Kitover 920f5ac704
Merge remote-tracking branch 'vbam-libretro/master'
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-01-16 15:47:53 +00:00
twinaphex 7d88e045a2 (MSVC 2017) Buildfix 2020-01-07 17:57:00 +01:00
Edênis Freindorfer Azevedo b27d853d48
Merge pull request #586 from negativeExponent/bps
BPS support and fix bug when patching rom.

Add support for BPS patch format (by @ArtiiP ).

Fix crash when patched rom new size is larger than original rom. This was bugged due 
to the rom block in memory being less than required after the `realloc` of the patch.

- Fix #549.
2020-01-04 07:26:08 -03:00
negativeExponent b50d48458f GBA: Fix crash when new size is larger than rom size after soft-patching 2020-01-04 04:46:49 +08:00
Ar't 9e1a63af0b support for patches in BPS format 2020-01-04 00:44:55 +08:00
Zach Bacon 7a7c86d315
Fix the git versioning for the snapcraft.yaml 2020-01-03 05:22:52 -05:00
Rafael Kitover ff0dbf8fe6
Transifex pull.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-12-31 02:47:40 +00:00
Zach Bacon ac8ada553c
Stupid that I am
I forgot to add nasm to the build routine, this should resolve the build issues for snapcrafts build service.
2019-12-28 22:24:32 -05:00
Zach Bacon 1fa66c1f32
just a minor change to the readme
have the snap badge on a separate line
2019-12-28 22:18:23 -05:00
Zach Bacon d785cd4e6c
Add build status for snapcraft 2019-12-28 22:12:54 -05:00
Zach Bacon e9dc6dfd64
change to devel for this snapcraft file 2019-12-28 22:08:00 -05:00
Zach Bacon d58d4ee1d2
Move the snapcraft to root for snapcraft edgechannel setup 2019-12-28 22:04:03 -05:00
Zach Bacon 312b541625
Fix up the icon location in the desktop file
For regular desktop users they don't need this work around, it's mainly due to how snaps are mounted.
2019-12-28 22:01:53 -05:00
Rafael Kitover 065e700fc8
Fix icon in about dialog.
Use GetIcons() to get the IconBundle and call GetIcon() on it to get a
32x32 icon with fallback.

For whatever reason this works while just GetIcon() does not.

Source:

https://forums.wxwidgets.org/viewtopic.php?t=44818

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-12-29 02:03:46 +00:00
Rafael Kitover f3e4b05fa8
Linux: fix icon name in .desktop file.
Followup on f306cc63.

The icon name was changed from "vbam" to "visualboyadvance-m", so also
change the Icon field in the .desktop file.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-12-29 01:26:15 +00:00
ZachBacon f26480bb07
Move this snapcraft yaml to git releases and fix the icon location 2019-12-28 19:21:49 -05:00
Rafael Kitover d3397e6a1a
cmake: Release automation followup.
Followup on e98d8931.

Set the BITS variable in Architecture.cmake even if
CMAKE_SYSTEM_PROCESSOR is not set, and it often isn't. This allows for
generating the right release zip for 32 bit MinGW builds.

When invoking zip to make the translations.zip, use `.` instead of `*`
as the argument, with the correct WORKING_DIRECTORY, so as not to rely
on shell globbing of any sort. This broke for the 32 bit MinGW cross
build.

Fix the keychain unlock command on mac, the keychain must be unlocked to
use the codesigning certificate.

Fix the translations.zip.asc signature overwrite prompt on Windows.

For the mac builder, automatically use Xcode 9 for 32 bit builds if
installed, this is necessary on 10.14 (Mojave) and later.

Add interactive-pause.cmake script to wait for the user to press enter
before continuing, invoke it before gpg commands so that waiting for the
passphrase does not time out. It will not run if ENV{CI} is set or
ENV{VBAM_NO_PAUSE} is set, this is so that later we can set up automated
builds.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-12-25 23:14:45 +00:00
Rafael Kitover f7f424ea1b
cmake: Find FFMPEG_LDFLAGS in FindFFmpeg.cmake.
Add support for setting the <component>_LDFLAGS and FFMPEG_LDFLAGS cmake
variables based on pkg-config in FindFFmpeg.cmake.

The LDFLAGS can be necessary when linking FFmpeg statically, as is the
case for the mac builder script.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-12-25 07:59:56 -08:00
Rafael Kitover fb068e55c4
Poll joysticks before emumain in OnIdle #582.
Call PollJoysticks() before entering the emulator in OnIdle for the
lowest input latency.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-12-24 21:53:41 +00:00
Rafael Kitover 7a8aeb9842
Poll joysticks even when emulator is paused.
Call mainframe->PollJoysticks() on every pass through OnIdle, not just
when game is not paused.

Fix #582.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-12-24 13:54:53 +00:00
Rafael Kitover e98d89310e
cmake: Add some release automation steps.
Use ENV{MSYSTEM_PREFIX} instead of ENV{MSYSTEM} to check for msys2 as
that is more reliable.

Generate the translations.zip when building for Windows from the
generated .gmo files.

Add the UPSTREAM_RELEASE option to perform some additional release
automation steps:

- Codesign for Windows with either the Visual Studio signtool or
  osslsigncode when using MinGW.

- On Windows zip up the .exe into the appropriate zip file for release.

- Generate the gpg signature .asc files for the translations zip and the
  .exe zip on Windows.

- On Mac codesign the app, zip it and sign the zip.

- On all platforms try to strip the binary.

Remove the release automation steps from the builder script as they are
now in cmake.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-12-24 06:32:01 +00:00
Rafael Kitover bbbe9fe73f
Only poll joysticks with a valid device.
Followup on 0577f8af.

When looping through configured joysticks, ignore ones that do not have
a valid open device pointer.

Also remove the use of std::get for the joystate map tuple and use
.first instead.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-12-22 17:59:57 +00:00
Rafael Kitover 99cdbb8860
cmake: Remove libcmt from SDL bin in debug mode.
For the SDL binary vbam when built with MSVC add /nodefaultlib:libcmt to
debug link flags, because in debug mode libcmtd is linked and libcmt
should not be.

This is the same as was done for the wx executable in cf9a88df.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-12-22 17:46:21 +00:00
Rafael Kitover 54072f9711
Update icon xrc.
Followup on f306cc63.

Set the correct reference to icon .xpm file in MainIcon.xrc.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-12-22 17:34:50 +00:00
Rafael Kitover 0577f8afc2
Better joystick hotplug support.
Combine SDL events with polling the axes and buttons of controllers
every 10 milliseconds, this is necessary because of this bug in SDL:

https://bugzilla.libsdl.org/show_bug.cgi?id=4886

which causes SDL to not generation button and axes events after a
joystick is disconnected and then reconnected to the system.

Change the axes state from a unordered_map to an std::array because the
number of axes is fixed, add analogous buttons array.

Keep controller state synchronized between the event receiving code and
the polling code.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-12-22 03:17:33 +00:00
Rafael Kitover f306cc63b0 App name cleanup.
Rename all icon basenames and references to them from "vbam" to
"visualboyadvance-m".

Change app name in desktop file from "VBA-M" to "visualboyadvance-m" as
well.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-12-21 18:22:57 +00:00
Rafael Kitover 9e4fd8fb2e
Transifex pull.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-12-20 23:46:19 +00:00
Rafael Kitover 17d2fbc5cc
builder: mingw 32 bit updates.
Fix cross building glib with meson for 32 bit Windows, set cpu_family
correctly in the cross file.

Do not build ffmpeg for 32 bit Windows because it is not compatible with
Windows XP and it's better to have a smaller 32 bit binary.

Turn off LTO for 32 bit Windows because it is now broken too, in a
different way than for 64 bit Windows.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-12-19 02:57:03 +00:00
ZachBacon b57bd76e3a
Added snapcraft store page.
This allows linux users that use snapd and for distro's like ubuntu that do not have vba-m in their repo's to install it to their system without having to compile their own releases.
2019-12-18 19:00:09 -05:00
Rafael Kitover 939a88ab4a
cmake: No default ffmpeg on 32 bit Windows.
Only check for ffmpeg if it's not explicitly turned off and the target
is not 32 bit Windows.

This is done because Windows XP does not have bcrypt.dll which ffmpeg
requires and the 32 bit builds are more likely to be used on older
systems which would also benefit from the smaller binary size.

Also add the X86 and X64 cmake architecture variable flags.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-12-18 14:17:20 +00:00
Rafael Kitover 4e00fa605b
cmake: Make wrong vcpkg arch error more clear.
Followup on 49ca52ba.

Improve the code that shows a fatal error if the vcpkg target
architecture does not match the build environment, by showing both the
target architecture and the build environment architecture.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-12-16 00:56:10 +00:00
Rafael Kitover 49ca52ba03
cmake: Visual Studio misc followup on cf9a88df.
Fix the vcpkg root setting, which was trying to use CMAKE_PROJECT_DIR
before a project is defined by switching back to CMAKE_SOURCE_DIR. Also
check if the user has \vcpkg or c:\vcpkg and use those if found. Use
\vcpkg if ENV{CI} is set, e.g. on Appveyor.

Enable nasm for visual studio builds by using the nuget nasm2 package.

In Architecture.cmake check that the vcpkg arch matches the compiler
arch, and throw a fatal error otherwise.

When using GLOB to find the nuget package directory, use the package
name as the prefix, this is quite necessary when using multiple nuget
packages.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-12-15 19:34:18 +00:00
Rafael Kitover b3932e4e3d
cmake: Fix localization for Visual Studio.
Default to ENABLE_NLS=ON for vcpkg builds too.

Check for libintl under both the names "intl" and "libintl", likewise
for libiconv. The vcpkg versions have the "lib" prefix.

Use the Gettext.Tools package from NuGet for the tools to build the
translation files. vcpkg does not yet have gettext-tools.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-12-12 19:01:58 +00:00
Rafael Kitover 3aefcf64c9
cmake: Add ffmpeg to appveyor vcpkg cache.
Now that the initial vcpkg cache has been populated in appveyor, we can
build ffmpeg to add to it without going over the job limit.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-12-12 14:10:36 +00:00
Rafael Kitover d0d087511f
MSVC: Fix SDL binary assertion failure on start.
sdlReadDesktopVideoMode() was apparently being called when the window
pointer is NULL.

Wrap the code in an `if (window) { ... }`.

SDL binary now launches correctly.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-12-10 23:41:40 +00:00
Rafael Kitover cf9a88dfc3
cmake: Visual Studio support improvements.
Add support for vcpkg ffmpeg, this requires using someone's
FindFFmpeg.cmake instead of relying on pkg-config, since vcpkg does not
have pkg-config.

Do not use the ffmpeg from vcpkg on appveyor however, because that
pushes the build cache generation over the time limit for jobs.

Add secur32 and bcrypt to the list of ffmpeg libs on windows, these are
standard windows libraries.

Change some code in ffmpeg.cpp to remove C-style casts of struct
initializers, which are illegal in MSVC.

Add the INT64_C and UINT64_C macros missing in MSVC's stdint.h (if not
defined) to ffmpeg.h before the ffmpeg headers are included, because
they rely on them.

Rewrite the wxWidgets finding code for the vcpkg wxWidgets to be nicer
and work correctly for debug and static builds.

Remove all /W* and /w* warnings options from cmake compiler flags, and
replace them with /W4 for debug builds, and /w (no warnings) for release
modes.

When building a static binary, remove all /MD* flags from cmake compiler
flags, and use /MT for static release builds and /MTd for static debug
builds.

Improve the vcpkg toolchain wrapper to only rebuild the vcpkg binary if
there were git updates.

Redo the handling of SDL2 and SDL_main. Only link SDL2Main to the SDL
binary and don't use the definitions.

Update CMakeSettings.json to use Ninja and include static
configurations.

Use CMAKE_PROJECT_DIR instead of CMAKE_SOURCE_DIR to determine the vcpkg
root, as CMAKE_SOURCE_DIR is sometimes set incorrectly in the 2017 GUI.

Add /nodefaultlib:libcmt to the debug build link flags, as in debug
builds libcmtd is used and libcmt should not be.

Add /subsystem:console to debug build link flags to produce a windows
console app for debug builds, like we do for mingw builds. To do this,
define a WIN32_CONSOLE_APP macro and if set, define a main() that calls
WinMain().

Call wxMesdsageOutput::Set() in OnInit with an instance of
wxMessageOutputStderr for windows debug builds to make sure the --help
text etc. goes to the console instead of a popup box.

Update the Visual Studio related text in README.md.

Fix dynamic debug builds by linking to the debug version of SDL2 and
copying the debug version of the dll to the build dir.

Fix issue in MainFrame::BindAppIcon with the function we are using not
being found in a Windows DLL in debug builds by using
wxDynamicLibrary::GetSymboolAorW() instead of GetSymbol().

Enable LTO for MSVC in Release modes, if the option is set.

Change appveyor config to use an 8 item build matrix of
x64/x86 / Release/Debug / Static/Dynamic. And test the binary in debug
modes by running --help.

When copying the wxrc.exe out of the build tree, copy both the release
and debug versions, this is so that appveyor caching of vcpkg works,
since the build trees are not cached.

Add some necessary win32 libraries to the SDL binary. And enable
building it on appveyor.

Fix #465.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-12-10 11:13:58 +00:00
Rafael Kitover d183245bdd
builder: Link setupapi always, update libpng.
On Windows always link setupapi with SDL2, the find_library() call with
SetupAPI was failing on mingw because of case.

Update libpng 1.6.32 -> 1.6.37.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-12-08 15:28:03 +00:00
Rafael Kitover 2b34983b9f
cmake: Support VS Ninja/jom builds on Windows.
Only set CMAKE_GENERATOR_PLATFORM to "x64" for 64 bit toolchains for any
of the "Visual Studio" generators, which use msbuild.

For other generators such as Ninja or NMake (jom) set
CMAKE_C[XX]_COMPILER to "cl" to let cmake find the compiler in the
user's PATH and set up the toolchain appropriately. On the user's part,
all that is required is running the 64 bit dev tools command prompt, or
setting up the equivalent environment in powershell.

We are no longer restricted to msbuild, and other generators such as
Ninja will work correctly.

Switch the appveyor job to Ninja, this requires some wrangling because
the appveyor environment does not include ninja. I used this:

https://github.com/boostorg/hana/blob/master/.appveyor.yml

Also update the README.md instructions to use Ninja.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-12-07 17:39:19 +00:00
Rafael Kitover 1ccc377978
Improve joystick connection/disconnection.
Followup on 02520fb6.

Add ConnectController() and DisconnectController() protected methods in
wxSDLJoy, use them to open or close and clear the device pointer
properly.

For controller add/remap events, call DisconnectController() first
before ConnectController() to make sure the right device is associated.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-12-05 17:00:05 +00:00