The current code is very messy as far as GFX goes. There are more
elegant ways of tackling this issue, but they are very difficult with
our current code.
The idea behind this issue is that the backgrounds are not switching
properly for the lcd. So we enable the layers accordingly to
`layerSettings & DISPCNT` on every `CPUUpdateRenderBuffers`.
The bits of `layerSettings` enconde each layer and objs.
We actually only need 2 of these, but I can't do much more here
unsupervised.
- Fix#376.
Search the lib-prefixed names of intl/iconv/charset libraries first to
avoid dlls being linked.
Update toolchain files to include the common source by full path, fixes
using them as toolchains for other projects broken in 3edd9ba7.
Update URL for nasm, use newer jpeg-turbo, tiff and wx.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Use the 3.x wxwidgets mingw package in installdeps.
Add the win64 alias to installdeps for 64 bit mingw builds, like the
win32 alias for 32 bit mingw builds.
Check CROSS_ARCH in Architecture.cmake, set by our mingw toolchains.
Disable LTO by default for all mingw builds, not just amd64, because it
is unfortunately broken on i686 as well now.
Search for heuristically the most appropriate wx-config and set
wxWidgets_CONFIG_EXECUTABLE accordingly in the mingw toolchains.
Refactor the mingw toolchains somewhat, put common code into a common
file, add static toolchains.
For static toolchains, also search for a static zlib and set ZLIB_ROOT.
Change installdeps instructions to use ninja instead of make. Add ninja
to all target dependencies where it was missing, this may be incorrect
in a couple of the rarely used targets, if this is the case the affected
users are free to open an issue.
Also start using ninja on travis instead of make, except for libretro
which uses a GNU Makefile.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Add macro fi_check_done() to set fi_done if leftover contents is empty,
use it in both fi_open_file() and fi_get_next_line().
This fixes the behavior when the opened file is empty and makes the code
cleaner.
Add a usage example to top comment.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
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>
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>
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>
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>
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>
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.
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>
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.
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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.
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>
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>
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>
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>