Commit Graph

2054 Commits

Author SHA1 Message Date
Fabrice de Gans-Riberi e91b5e1eac Use constant aliases in MainFrame::FilterEvent()
Previously, this function returned -1 or "true" but wxWidgets
defines constants for the returned values for FilterEvent()
overrides so use these instead.
2021-04-28 16:06:38 -07:00
ds22x 210e79bb74 Add descriptions for the 'Interframe Blending' and 'LCD Color Filter' options 2021-03-16 00:17:19 +01:00
twinaphex f355646fb8 Add ios-arm64/tvos-arm64 2021-03-14 11:50:23 +01:00
Rafael Kitover 31789aafba
Merge remote-tracking branch 'libretro/master'
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2021-02-11 02:13:55 +00:00
Rafael Kitover 8a3456f823
Default to not change battery on state load.
This is a more reasonable and less destructive default.

Fix #781.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2021-02-09 15:01:22 +00:00
Rafael Kitover ab68794361
cmake: Fix mac app zip + misc..
Remove keychain unlock for codesigning, that doesn't work anymore, the
key has to be in the system keychain.

Use `zip -9yr` instead of `zip -9r` to make the .zip file of the .app so
that symlinks are preserved, this was creating a corrupted .app.

Don't build zip in the mac builder, use the system zip instead.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2021-02-02 01:49:16 -08:00
twinaphex c13de4518c (macOS) Add 64bit ARM MacOS support 2021-01-29 19:25:53 +01:00
Squall Leonhart b50ff8584c add a missing break in half word reads
Fixes illegal halfword and byte reads (Croket! 2 slowdown)
2021-01-27 05:35:48 +00:00
Clownacy b0c029a389 SDL: Fix more indentation mistakes 2021-01-24 06:09:13 +00:00
Clownacy 524c594a73 SDL: Use sizeof to determine buffer sizes
I think the use of 2048 was a typo, so this prevents one like that
from happening again.
2021-01-24 06:09:13 +00:00
Clownacy d464bc4dfe SDL: Fix Windows build never searching PATH
Some local variable was blocking the global variable.
2021-01-24 06:09:13 +00:00
Clownacy 2a237aea6b SDL: Mark some parameters as const 2021-01-24 06:09:13 +00:00
Clownacy d412711465 SDL: Silence a warning and optimise some logic 2021-01-24 06:09:13 +00:00
Clownacy fd445481a0 Minor cleanup to SDL.cpp
Just a typo and some inconsistent indentation
2021-01-24 06:09:13 +00:00
Rémi Verschelde 619a5cce68 SDL: Fix build with SDL 2.0.14 after KMOD_GUI change to enum
Since SDL 2.0.14, KMOD_GUI is no longer a macro but an enum value:
https://hg.libsdl.org/SDL/rev/15a0bc9612e9

So this code broke as the enum value doesn't satisfy `defined()`.
2020-12-31 00:59:50 +00:00
twinaphex 331ba35aeb Update 2020-12-20 19:35:08 +01:00
Clownacy 064fa7b067 Fix SDL audio delay
Fixes #647

300ms is just too big, and produces an audible delay. 100ms sounds
much better.
2020-12-18 14:29:21 +00:00
Clownacy 7db3c817eb Fixed SDL audio using the wrong audio specification
This bug was responsible for audio on Windows not working without
forcefully setting the audio driver to DirectSound.

The problem was that WASAPI (or whatever API SDL2 was choosing)
defaults to an incompatible audio specification (possibly F32 sample
format - I didn't check).

Despite the `audio` struct requesting the S16 sample format, SDL2 was
granted permission to use whatever format it preferred because it was
given the `SDL_AUDIO_ALLOW_ANY_CHANGE` flag.

To fix this, I've removed that flag, effectively forcing SDL2 to use
the audio specification VBA-M requires.
2020-12-18 14:29:21 +00:00
twinaphex 2cdd1fafb6 Update osx target 2020-12-09 08:20:42 +01:00
Rafael Kitover 7aa0509e0e
Update copyright year in about dialog to 2020.
- Fix #783.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-11-29 18:40:51 +00:00
Rafael Kitover ecdaf6df23
MSVC+vcpkg build update.
Remove the `find_package(unofficial-gettext ...)` invocation for vcpkg
as it is no longer required, the normal `find_package(Gettext ...)`
mechanism works.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-11-25 15:44:10 +00:00
Koakuma 4fc3b4297d Handle allocation quirk on non-null-returning allocators
Some allocators return a non-null pointer when calling *alloc with
zero size, that will segfault upon access. Check for the size parameter
before allocating anything to ensure that the breakpoint and trace
fields will stay null when size >> 3 or size >> 1 is zero.
2020-11-21 06:41:02 -08:00
Fabrice de Gans-Riberi edc34942a8 Refactor wxSDLJoy
This is a major refactor of the wxSDLJoy class.
* Move handling of SDL objects creation and destruction to its own
  class. This simplifies the lifespan of SDL-related objects.
* Re-add handling of HATs. This is necessary for DirectInput
  controllers.
* Rename the public API for wxSDLJoy to be clearer.
* Add documentation for every class related to wxSDLJoy.
2020-10-19 08:11:38 +00:00
Rafael Kitover e1fd75629f
Link Windows Media Foundation libs with ffmpeg.
Link some Media Foundation libs required by newer versions of FFmpeg on
Windows.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-10-13 12:51:26 +00:00
Rafael Kitover 3a6e4b3c27
Merge remote-tracking branch 'libretro/master' into master
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-10-12 16:40:19 +00:00
twinaphex 26e9a6e3d9 (iOS/tvOS) fix building for iOS; add tvOS support 2020-10-10 03:23:59 +02:00
twinaphex dc9422c479 if not defined, define it 2020-10-08 05:41:56 +02:00
Rafael Kitover 13854135a9
Write CFBundleShortVersionString to Info.plist.
CFBundleVersion is already being written since denisfa's Sparkle
changes.

- Fix #750.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-09-29 14:13:26 -07:00
Joseph Griego 65a67f219a Don't set wx-config prefix from CMAKE_PREFIX_PATH
I'm not sure what purpose this currently serves but I know that it
breaks the build when CMAKE_PREFIX_PATH is set to something nontrivial.
Stop doing that.
2020-09-28 23:25:19 +00:00
Rafael Kitover cb0933bf44
Stop changing plane ptrs in rec. audio frames.
Stop setting the 4 plane data pointers in recording audio frames to the
sample stream. This confuses the converter and makes it write the right
channel to both channels.

- Fix #723.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-09-28 01:33:58 +00:00
Brian Searls 80634683b1 Force a panel update when configuring bilinear.
- Fix #727
2020-09-05 21:45:17 +00:00
Rafael Kitover 6a7142813d Differentiate between SDL joy index/instance_id.
Hopefully fix various bugs caused by not differentiating between SDL
joystick_index and SDL_JoystickID (the joystick instance id.)

On controller disconnect, disconnect and reconnect all configured
devices because the SDL joystick index may change, and this will update
the mapping.

Also fix creating a state entry for the configured joystick even when
it's not connected, add the controller/joystick name to the connected
message and increase the poll time from 10ms to 25ms.

- Fix #718.
- Fix #726.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-09-05 19:06:48 +00:00
Rafael Kitover 11693d8381
Clean up GB MBC30 check.
Based on feedback from @negativeExponent.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-09-04 17:33:25 +00:00
Rafael Kitover 020daad85f
Fix joy accels when emulation is paused.
Start the joystick polling timer on pause and stop it on resume, so that
accelerators bound to joystick events are still processed.

Followup on def5d3e4.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-09-02 00:50:45 +00:00
Rafael Kitover def5d3e486
Stop timer when game is loaded again.
Followup on 7031c1d1, which for some reason removed the calls to stop
the timer when a game is loaded and restart it when it is unloaded.

Add the calls back.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-08-31 07:25:38 +00:00
Rafael Kitover 546c9d3a11 Minor joystick event handler finding refactor.
Remove the `evthandler` member and `Attach()` method from `wxSDLJoy`.

Add the `GetJoyEventHandler()` method to `MainFrame`, which returns the
window in focus, or the panel if the option for joystick background
input is enabled.

Remove the handler parameter in `wxSDLJoy::CreateAndSendEvent()` and
call `wxGetApp().frame->GetJoyEventHandler()` to get the handler.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-08-29 20:53:49 +00:00
Edênis Freindorfer Azevedo e0816b0e10 Fix weird input/buttons memory leak.
Deleting the vector was not enough, although it was not clear what else
was causing the leak.
2020-08-29 20:53:49 +00:00
Edênis Freindorfer Azevedo cc5ddd1bb7 Isolate x11 keymap to its own header. 2020-08-29 20:53:49 +00:00
Edênis Freindorfer Azevedo 790628961d Include X11 libs and header without screensaver.
We need to always include these files and libs now due to using them
on our keyboard background input solution.
2020-08-29 20:53:49 +00:00
Edênis Freindorfer Azevedo 7031c1d155 [LINUX,WINDOWS] Key/Joy background input.
- Joystick background input.

Set as enabled by default.

- Linux: `X11` and `Wayland` done.

1. `Wayland` does not allow to listen for keypresses for security reasons.

Discussion here: https://github.com/albertlauncher/albert/issues/309

2. For `X11` we can use `XQueryKeymap` to check keyboard state.

- Windows: done.

We use `GetAsyncKeyState` most significant bit to check if the key
is being pressed.
2020-08-29 20:53:49 +00:00
Edênis Freindorfer Azevedo 84f3e8ce67 Allow joystick background input.
Refactor function to send joy events to `GameArea` even if vbam is not
focused.
2020-08-29 20:53:49 +00:00
Rafael Kitover bce91d1722
Run wxrc from the source dir.
Followup on ff03bcc1.

Running wxrc from the build directory turned out to be unnecessary,
because the dlls were not there anyway, and we added them to the PATH.

And using absolute paths for the xrc sources puts them into the gettext
pot comments which is not what we want.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-08-29 19:44:15 +00:00
Fabrice de Gans-Riberi 4074158061
Add GUI cmd line option for config file. (#724)
This adds the command-line option `-c` or `--config` to specify a custom
configuration file.

Co-authored-by: Fabrice de Gans-Riberi <steelskin+github@gmail.com>
2020-08-28 22:26:07 +00:00
Rafael Kitover a305f550e1
Replace Catch2 with doctest for unit tests.
Pretty much the same usage and functionality.

Add `tests.hpp` to configure doctest.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-08-28 05:14:22 +00:00
Rafael Kitover 22a3524c66
Fix linking on Msys2.
Do not link `SDL2main` on any WIN32, not just MSVC.

Define `WIN32_CONSOLE_APP` for Debug mode builds on any WIN32, not just
MSVC.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-08-28 05:09:58 +00:00
Rafael Kitover ff03bcc1e0
Better fix for wxrc with vcpkg.
When doing a dynamic build, the wxWidgets dlls are needed by the wxrc
executable.

Invoke wxrc with the target triplet debug and release bin directory
prepended to the PATH, this is where the dlls are.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-08-23 05:56:32 +00:00
Rafael Kitover c169420fbc Turbo/throttle config and DirectSound fixes.
Make `speedup_frame_skip` and `speedup_throttle` independent settings,
with `speedup_frame_skip == 0` when `speedup_throttle` is not in effect,
and `speedup_throttle == 100` when `speedup_frame_skip` is in effect.

This fixes a previously introduced bug where `speedup == true &&
speedup_frame_skip = X` was never enabled.

This also allows `speedup_throttle == 0` for no throttle and no frame
skip during speedup.

Also set the upper bound on `throttle` and `speedup_throttle` to `450`
instead of `600`, as the DirectSound driver does not support values
higher than that.

In the DirectSound implementation of `setThrottle`, for `throttle == 0`
use a `throttle == 450` frequency multiplier, because a zero frequency
does nothing.

- Fix #719.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-08-22 20:25:05 +00:00
Rafael Kitover 84d406ac0e
Temporary fix for wxrc on MSVC/vcpkg builds.
When the wxrc installed by vcpkg into tools was made with the non-static
wxWidgets, and the build is static, it will not find the wxWidgets dlls
and fail.

Use our own wxrc.exe from the dependencies submodule for the time being.

This is a temporary fix, a proper fix would be adding the dlls, if they
are installed, to the PATH.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-08-20 23:28:42 +00:00
Rafael Kitover 378c9493e9
Fix joystick config when game is loaded.
Rename the joystick polling timer accessors and add a predicate.

Check it and make sure the timer is running in the input and accelerator
config dialogs.

- Fix #711.
- Fix #716.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-08-19 11:32:38 +00:00
Rafael Kitover 61a726a828
Merge remote-tracking branch 'libretro/master'
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-08-19 10:57:35 +00:00
negativeExponent 95213a6d55 GB: Only use mapperLastTime to see if RTC data was loaded
- Removing mapperSeconds and mapperLSeconds since both of these can be
  zero at any time since they are seconds timer, not seconds since
epoch.
- This leaves only mapperLastTime as this is the number of seconds since
  last epoch. If this value is zero, then initialize rtc.
2020-08-18 21:14:21 +08:00
Rafael Kitover fb9e7e2059
Fix expat lib name for vcpkg.
It is now installed as `libexpatMD.lib` for release and
`libexpatdMD.lib` for debug and not `expat.lib`.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-08-17 22:05:01 +00:00
Rafael Kitover b23d463652
Use vcpkg installed wxrc, support mingw triplet.
Use the vcpkg installed wxrc, from a tools subdirectory, instead of
copying it out of the build tree.

Except when running on appveyor, for some reason the vcpkg wxrc does not
work there, so use our own from the dependencies submodule.

Support vcpkg mingw triplets, they don't work yet however.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-08-14 13:16:37 +00:00
negativeExponent 86fcffefd0 GB: Add support for 4MB MBC30 2020-08-14 19:21:56 +08:00
Rafael Kitover 08b5685049
Merge remote-tracking branch 'libretro/master'
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-08-14 11:00:06 +00:00
hizzlekizzle 6b70aa5de5
Merge pull request #90 from negativeExponent/input_updates
Move main input polling at the beginning of retro_run()
2020-08-13 08:44:40 -05:00
hizzlekizzle 2f1439c5bd
Merge pull request #89 from negativeExponent/add_color_and_interframe_options
Add color and interframe options
2020-08-13 07:59:14 -05:00
negativeExponent 2f9933ae49 GBA BIOS: ArcTan/ArcTan2 fixes for HLE bios
Fix ArcTan and ArcTan2 based on mgba's hle bios fixes
- References:
- 14dc01409c (diff-8f06a143a9fd912c83209f935d3aca25)
- b154457857 (diff-8f06a143a9fd912c83209f935d3aca25)
2020-08-12 22:44:43 +08:00
negativeExponent 5d5dc1b39b Move main input polling at the beginning of retro_run()
- This is done so we can poll inputs from one place all at once for all
  player ports instead of calling the function multiple times for each player port.
2020-08-12 22:30:22 +08:00
negativeExponent e58332c03a Add interframe blending core options
- Adds 'smart' and 'motion blur' interframe methods as core options for
both 16bit and 32bit color depths
2020-08-12 10:25:52 +08:00
negativeExponent 54399dffea Add LCD Color Filter core options 2020-08-12 07:43:21 +08:00
negativeExponent 97637f16d6 Buildfix 2020-08-11 21:22:07 +08:00
negativeExponent d9732f68db Fix clock cycle count for MUL, MLA instructions... (b91f39c787)
- backport Fix clock cycle count for some arm/thumb instructions (5243b2d806)
- backport Fix base cycle count for MUL, MLA series (b91f39c787)
2020-08-11 21:17:25 +08:00
negativeExponent c07d5b658b Fix vram 16/32 bit unaligned reads(backport 7f18771165) 2020-08-11 20:29:28 +08:00
Brian Searls 18c2ea61c6 Further fixing Multi Buffer formatting. 2020-08-10 21:44:01 +00:00
Brian Searls 1e5693009c Addressing audio plugin crash
Stereo buffer is not remade in the case of audio plugin
switch (only affects GBA, not GB).  This results in a crash.
We need to remake the stereo buffer and reinit the pointers
in Gba_Pcm.output or they will be dangling, and lead to a
crash.  Also, cleaning up the Multi_Buffer class a bit.
2020-08-10 21:44:01 +00:00
Edênis Freindorfer Azevedo 9c314a155d
Use proper string `"wglGetExtensionsStringEXT"`.
`"wglGetExtensionsString"` is not valid on Windows.
2020-08-09 07:01:34 +00:00
Rafael Kitover 81c88227fa Add Catch2 unit testing framework + some tests.
Add the Catch2 headers to third_party/include/catch2.

Add Catch.cmake and CatchAddTests.cmake to cmake/.

Add unit tests src/wx/tests/strutils.cpp using Catch2 to test
src/wx/strutils.cpp.

Make some code changes to strutils.cpp to make the tests pass.

See src/wx/tests/CMakeLists.txt for how to set up unit test files; they
plug into the normal CTest mechanism in cmake.

The test binaries are written to the tests/ subdirectory of the build
directory.

Building the tests and enabling the CTest support can be turned off by
passing -DBUILD_TESTING=OFF to cmake, the default is ON, this is the
standard mechanism.

Start running ctest on travis and appveyor.

Move stb to third_party/include where Catch2 is now as well.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-07-10 13:43:48 +00:00
Edênis Freindorfer Azevedo 3ba0529585 Improve BIOS Math tests score from 425 to 625.
Without using BIOS file.
2020-07-10 00:25:38 -03:00
Edênis Freindorfer Azevedo 6f2e320d59 Improve clock cycle count for THUMB operations. 2020-07-10 00:25:38 -03:00
Edênis Freindorfer Azevedo 9e537a8fe3 Improve cycle count for MUL, MLA.
Improves Timing score from 679 to 905.
2020-07-10 00:25:38 -03:00
Rafael Kitover 306f92f5d7 Check game kbd input with wxGetKeyState() again.
Followup on baa0341b.

Reintroduce checking if a key is actually pressed in the panel OnKeyDown
event with wxGetKeyState(key_code).

Introduced in b0ec846 and removed in baa0341b.

wxGetKeyState() does not work on Wayland and does not work for Unicode
keys, support for which was introduced in baa0341b, which is why the
call was removed.

Add two static functions is_key_pressed(ev) and is_key_released(ev) that
return true under Wayland or if the key is Unicode, and call
wxGetKeyState() otherwise.

The reason this call was introduced in b0ec846 was to work around a bug
in some Linux distributions that caused spurious keyboard events to be
generated. The bug apparently still persists, see #689.

Because the two additional checks were necessarily added, the bug may
persist on Wayland, if it exists there, and for Unicode keys, but will
be fixed in the more common case of Latin keys under Xorg.

Tested on Linux with both Latin and Unicode game input keyboard keys.

- Fix #689.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-06-29 01:24:40 +00:00
Rafael Kitover f51e1ee4ec Fix for non-stl wx builds.
Followup on baa0341b.

Use ToStdWstring() instead of wc_str() to look up strings in the map,
the key for the map is std::wstring.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-06-26 06:51:27 +00:00
Rafael Kitover 121013c534
Transifex push + fix for a couple of strings.
Fix a couple of strings noted by @Ds886.

Generate new pot and push to transifex.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-06-21 19:42:52 +00:00
Edênis Freindorfer Azevedo 91a6b53e02
Input followup (#687)
- Allow some control chars to be used as input.

This is actually a regression, since our default config uses some of
these chars.

- Allow default keys bindings to be used elsewhere.

If we try to use keys such as `KP_ADD`, `KP_ENTER` as game input, we
actually execute a `NOOP` command accelerator (nothing done), as we
associate the key with it to disable the accel.
Due to this, we do not allow any further processing of this key, such
as game input.
2020-06-20 19:36:24 -03:00
Edênis Freindorfer Azevedo baa0341bd5
Input refactor.
- Allow key shortcuts to run with loaded game.

For example, when we set `CTRL+A` for `load most recent save state` and
use `A` for some input command, holding `CTRL` and then pressing `A`
will not execute the shortcut. Instead, the key press `A` will be used
only as the input and nothing else.

With this, we use both the input and shortcut key.

- Isolate function to get keyboard key codes.

As explained on [1]:

"Using `GetUnicodeKey()` is in general the right thing to do if you are
interested in the characters typed by the user, `GetKeyCode()` should
be only used for special keys (for which `GetUnicodeKey()` returns
`WXK_NONE`)."

We also allow special keys to be mapped, hence the requirement of using
both functions.

[1] https://docs.wxwidgets.org/3.1/classwx_key_event.html

- Allow use of unicode keys for input and shortcut.

Use format `KeyCode:Modifier` for saving/loading unicode keys.

`WxWidgets=3.{0,1}` does not create an accelerator from strings with
unicode keys such as `ç` (`FromString` function). It fails with an
assertion error and stops execution. At the same time, we use the keys'
strings that are known for WxWidgets, such as `A`, `CTRL+O`,
`PAGEUP` etc.

Use both `EVT_KEY_DOWN` and `EVT_CHAR`.

`EVT_CHAR` is better than `EVT_KEY_DOWN` here because it is where the
raw key events will have been cooked using whatever recipes are in
effect from the os, locale, international keyboard settings, etc.

- Enable SDL joysticks input as key shortcuts.

Start/Stop polling joysticks on Unload/load game.

Our main loop already polls the joystick, we don't need the timer
while a game is running.

- Create function `str_split_with_sep` and use it.

For when we parse strings that may include the sep string, such as
game input and key shortcuts.
2020-06-18 20:47:47 -03:00
Edênis Freindorfer Azevedo 6b257d52f2
Avoid override of variable `throttle` for turbo.
It is not needed to set `throttle` on neither case. There is actually a
bug when using turbo/speedup and closing the emulator. The test case
is the following:

https://github.com/visualboyadvance-m/visualboyadvance-m/issues/627

On Windows:

1. use opengl;
2. load GBA game;
3. set throttle to `100%`;
4. set turbo throttle to `200%`;
5. enable turbo on menu;
6. save game;
7. close emulator && open emulator;
8. load GBA game;

==>

throttle is `200%`.

This is definitely not expected.
2020-06-17 13:23:14 -03:00
Edênis Freindorfer Azevedo bd2483cae7
Allow changing connection type without restart.
Before, if we tried changing the connection type without closing vbam,
we would get an error about a connection already existing. We needed
to restart vbam to change it.
2020-06-17 13:23:14 -03:00
Rafael Kitover d379a076df Decrease mouse sensitivity for menu hiding.
Ignore mouse movements of less than 11 pixels, to avoid spurious events
from mice in high DPI mode etc..

- Fix #675.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-06-15 19:32:33 +00:00
Edênis Freindorfer Azevedo 0c5ee9941b Fix PNG capture screen.
- Fix #680.
2020-06-07 18:06:04 +00:00
Rafael Kitover 1347026d40 Turbo config refactor followup.
In the Turbo config dialog, remove the selection list for entering the
value and leave only the spin control. Allow values above 600%, up to
4000%.

Reintroduce the speedup_frame_skip config variable, defaulting to 9, use
it for turbo selection values > 600%, with speedup_throttle == 0.

The rationale for this is that on average modern hardware, throttle
values above 500% or 600% will not be effective.

The default is now shown as 1000%, which is:

frame_skip == 9 && speedup == 1,

where:

speedup == 1 is equivalent to throttle == 0,

as was the case before the turbo config changes.

Values above 600% are automatically rounded up or down to the nearest
100%, on entry and on click of the up/down arrows of the spin control.

The frame skip checkbox is cleared and disabled for the "Unlimited"
setting (throttle == 0), and set and disabled for values > 600%, to
reflect the mechanism to the user.

When the value again enters the modifiable range in the spin control,
the previous value of the checkbox is restored.

Misc:

- Turn off translation of percentage values in the xrc.

- Remove the size element for the throttle selection list in the general
  config dialog xrc, it breaks the layout on GTK3.

- Add a note about passing wxWidgets_CONFIG_EXECUTABLE to cmake to
  select wxWidgets version to README.md.

Hopefully this will reduce confusion and present a nicer UI.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-05-15 02:01:57 +00:00
Rafael Kitover 1bced474a2
Codesign fix for mac.
Followup on 07064c87.

Use codesign --deep to sign the .app before signing all the frameworks,
otherwise codesign will refuse to sign the app due to unsigned dylibs
when not making a static build.

The error is:

./visualboyadvance-m.app: code object is not signed at all
In subcomponent: ...libtheoraenc.1.dylib

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-05-08 13:26:20 -07:00
Edênis Freindorfer Azevedo 07064c8714
[Windows,MacOS] Auto-updater refactoring. (#639)
Create and enable auto-updater for MacOS using `Sparkle=1.23`. We need
to sign our app using an `Apple Developer Key` for it to work properly,
since we are not going to sign updates with the Sparkle key.

Add all auto-updater files to `gettext`'s pot.

Use `str_split` to always get related stable version. We do not want
to check for nightly builds.

For Windows, we create the flag `-DHTTPS` to select between using an
HTTPS or HTTP URL for the auto-updater checks. We use this to keep
support for Windows XP (HTTP only) while all others should be HTTPS.

Also, use `::FreeLibrary` to allow us to remove the temporary file
that stores the `WinSparkle.dll`. Previously, we could not get it to
work with `wine`.
2020-05-07 23:06:00 -03:00
Rafael Kitover 09e8da43db Joystick refactor pt. Deux: Support Joysticks.
Add support for non-GameController SDL Joysticks.

Add proxy class wxSDLJoyDev to support using either SDL_GameController*
or SDL_Joystick* values in joystate.dev.

Add pretty much identical SDL code to support SDL_Joystick* when the
device cannot be opened as an SDL_GameController*, without changing the
API. SDL_Joystick* devices operate almost identically to SDL_Controller*
devices with their own default mappings, for both events and polling.

Filter axis motion events in the bindings editor widget for subsequent
events within 300ms. This gets rid of the double binding for +1/-1 when
the stick is moved to a direction.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-05-05 08:47:52 +00:00
Rafael Kitover 504ca08b6b Hide menubar + minor UI refactor.
Add ui/hideMenuBar boolean option, defaulting to on, which hides the
main menubar when the mouse is idle or outside the frame.

This is disabled on mac, because on macs the main menubar is not part of
the application window.

Fix pointer hiding/unhiding by connecting panel events to the gamearea
mouse event handler.

Clean up the pausing when menus are opened code, make it actually work
on Windows.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-05-02 13:14:46 +00:00
Rafael Kitover 2868c1b753 Fix changing aspect ratio option.
When toggling "retain aspect ratio", destroy the drawing panel so it is
recreated with the desired aspect ratio settings.

Only add the vertical spacers when aspect ratio is on, they are not
needed when it's off.

Set the sizer priority of the DrawingPanel to 1 if aspect ratio is off
so that wxEXPAND always works.

Clear the GameArea sizer when attaching a new DrawingPanel, this is so
that the vertical spacers used when aspect ratio is on are not included
when aspect ratio is off.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-05-02 13:08:34 +00:00
Josh Smith 3041e3262b Removing meaningless conditional
reg[0].I is unsigned so checking if it is greater than or equal to zero is always true by definition.

Fixes #578
2020-04-30 02:17:23 +00:00
Rafael Kitover 045e95ab4e GB: Support 4MiB MBC30 ROM bank select.
MBC30 is a variant of MBC3 with a 4MiB ROM size and a larger RAM size.

https://gekkio.fi/files/gb-docs/gbctr.pdf

Allow addressing 4MiB of the ROM in MBC3 ROM bank select if the ROM size
is 4MiB.

Fix provided by roytam1.

- Fix #652.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-04-27 18:32:12 +00:00
Edênis Freindorfer Azevedo 0b14e9f885
[WINDOWS] Add function to open unicode files. (#644)
We have some issues when trying to open files on Windows that contains
characters not included in the current codepage. Using `fopen` fails
when that happens.

One example is using the `pt_BR` codepage and then using a name with
japanese chars for the battery file.

The games and BIOS work since they use `blargg_open`. It converts a
`const char *` to `const wchat_t *` and uses `_wfopen` for windows.
(doing a multibyte to widechar conversion)

Since we want to avoid doing many code changes on our cores, we need
some `util*` functions for the matter.

Replace `mb_fn_str` by UTF-8 strings.

Replace all occurrences of `fopen` for `utilOpenFile` on GBA core.

Replace all occurrences of `fopen` for `utilOpenFile` on GBA e-reader.

Adjust e-readers calls on wx frontend.

Replace all occurrences of `fopen` for `utilOpenFile` on Patcher files.

Always apply UTF-8 when dealing with path strings.

On our wx frontend we should always send UTF-8 `char *` to our cores
functions. This way we can have consistency when dealing with them for
each platform.

On Windows, we will convert all multibyte to wide chars and use proper
functions for I/O operation.

Create function to deal with unicode calls of `gzopen`.

We use `gzopen_w` (`zlib>=1.27`).

Replace all occurrences of `fopen` for `utilOpenFile` on Config Manager.

Replace all occurrences of `fopen` for `utilOpenFile` on Cheat files.

Use proper functions for unicode on GB core.

Use function instead of macro for `UTF8()`.

Use `nullptr` instead of `NULL`.

Print wide char strings on status bar.
2020-04-21 10:24:28 -03:00
Rafael Kitover 8e3978b314 Speedup/Turbo/Throttle fixes.
Fix throttle=0 (unlimited speed) settings for both the Speedup/Turbo
config panel and the general throttle setting and make 100 the default.

Replace the speedup frame skip option with a "Frame skip" checkbox,
which enables skipping the appropriate number of frames if vsync or very
low system performance is in effect. The systemFrameSkip (under video
config) is added to this value.

With speedup_throttle=100, the old speedup behavior is used with 9
frames skipped.

With speedup_throttle == 0 && speedup_throttle_frame_skip, skip 9
frames at full speed, which is exactly the same as the old behavior,
since throttle == 0 is equivalent to speedup == true.

Hopefully these changes will make the turbo config dialog more useful
for users, by default frame skipping to work around vsync will be
enabled, and users can uncheck the "Frame skip" checkbox for a smoother
experience.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-04-10 10:19:03 +00:00
Rafael Kitover b21880ea15
cmake: Zip suffix fix for 60f05ced.
Fix problem with the ZIP_SUFFIX option, which causes zip files to have a
suffix of "OFF" if the option is not set.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-03-18 01:01:19 +00:00
Edênis Freindorfer Azevedo 166cf446f7 Disable menu LCD filter unless playing GB or GBA.
Since they share the filter function, but can change one from another
(setting on the GBA would apply to GB and vice-versa), we allow only
the proper setting to be toggled while a ROM is loaded.

If GB ROM, then `Options` > `Game Boy` > `LCD Filter` is enabled.

Likewise for GBA. If neither, then no option is enabled.
2020-03-18 00:48:43 +00:00
Edênis Freindorfer Azevedo 060010699d Init systemColorMaps after output module init.
It is done only once after the output module is initialized. It is also
adjusted to whatever ROM is being loaded.
2020-03-18 00:48:43 +00:00
Edênis Freindorfer Azevedo cd029ae696 Fix video recording with frame skip enabled.
When we skip frames, we just don't draw them on our frontend. The
function `systemDrawScreen` also send the video frames to be recorded,
but only when called from the core.

Our solution creates a auxiliary `systemSendScreen` that only adds the
frame to the recording. It is called when the core decides to skip a
frame. This way we can get the video frame for recording, just like
audio ones are always sent.
2020-03-18 00:48:43 +00:00
Edênis Freindorfer Azevedo 008aecde67 [LINUX] Fix display of `RGB` values on viewers.
The flag `wxST_NO_AUTORESIZE` does not behave well on our viewers. They
were being hidden due to not fitting the text box available.

On Windows, they were working as expected. It is unknown on MacOs.
2020-03-18 00:48:43 +00:00
Edênis Freindorfer Azevedo 834d153725 Fix accel shortcuts when using some menu options.
`gbColorOption`, `GBALcdFilter` and `GBLcdFilter` did not respond
to accelerators shortcuts.
2020-03-18 00:48:43 +00:00
Edênis Freindorfer Azevedo 994726dd8d Do not pause while opening configuration windows.
The only configuration that we cannot change while playing is the sound
driver. All the others should be changeable without any major issues.
2020-03-18 00:48:43 +00:00
Edênis Freindorfer Azevedo 54335dc67c [WINDOWS] Fix weird WX errors messages.
XRC error: 131: vertical alignment flag `wxALIGN_BOTTOM` has no effect
inside a vertical box sizer, remove it and consider inserting a spacer
instead.

- Fix #517.
2020-03-18 00:48:43 +00:00
Edênis Freindorfer Azevedo 7bac34eda4 Remove duplicate variable `winFlashSize`.
We already had `optFlashSize` for both SDL and WX ports. We assigned
this variable to replace all ocurrences of `winFlashSize`.

As a side note, this entire scope could/should be replaced by a better
auto-detect system for saving types. At the moment, it is only really
useful for the SDL port, since we have overrides for the WX port.

- Fix #585.
2020-03-18 00:48:43 +00:00
Edênis Freindorfer Azevedo 8d62a790e3 Change default options for GB.
We set to automatically display borders on SGB games, as well as
setting the default emulation system to `automatic`.
2020-03-18 00:48:43 +00:00
Edênis Freindorfer Azevedo 99b66e1326 Expose LCD filter for GBA and GB color saturation.
We offer a way to control the color saturation for GBA games such as
Fire Emblem Tactics Advance.

It will be enabled by default for GBA games and disabled for GB.
The user will be able to toggle both of them and these options
will be persistent by saving to `vbam.ini`.

- Fix #131.
2020-03-18 00:48:43 +00:00
Edênis Freindorfer Azevedo c789020e93 Fix `Save` button on OAM Viewer for GB and GBA.
No idea why this was not implemented yet...
2020-03-18 00:48:43 +00:00
Edênis Freindorfer Azevedo dcaa1b9abc Fix `Save` button on Tile Viewer for GB and GBA.
For some reason this was not implemented yet.
2020-03-18 00:48:43 +00:00
Edênis Freindorfer Azevedo d05e8fc141 Make AGBPrint output to our Logging.
We also output using `dbgOutput`, hence the behaviour will not change
for users relying on this.
2020-03-18 00:12:27 +00:00
Rafael Kitover 60f05cedc2
cmake: Add ZIP_SUFFIX option, for build configs.
Add a ZIP_SUFFIX option defaulting to "" that is added to the generated
.zip file with UPSTREAM_RELEASE before the .zip extension.

For example, for an experimental feature you could pass
-DZIP_SUFFIX=-timer_loop and the resulting .zip file would be
visualboyadvance-m-Win-64bit-timer_loop.zip or
visualboyadvance-m-Win-64bit-debug-timer_loop.zip for a debug build.

Also add a modeline to this cmake file because vim-sleuth always gets
the settings wrong. Or it could be the cmake filetype plugins.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-03-17 03:24:43 +00:00
Rafael Kitover abb8234174
Allow binding specific server IP. (#633)
For the netlink dialog, leave the server IP text field enabled when the
server radio button is selected and bind it to the new option
gopts.server_ip which defaults to "*" for binding on all addresses,
which was the previous behavior.

Copy this value to the new GBALink global IP_LINK_BIND_ADDRESS and use
it when creating a listening socket.

SFML supports creating sf:IpAddress values from hostnames, consequently
no additional code is needed to support hostnames in the netlink dialog.

Change GetLinkServerHost to return the primary local address when the
value is "*", which was the previous behavior, and the set value
otherwise.

Remove the min/max macros from GBALink as they are unnecessary and
conflict with std headers.

Require at least SFML 2.4 instead of 2.x for the IP binding
functionality in cmake.

- Fix #632

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-03-16 13:37:01 -03:00
Rafael Kitover a462904c58
Merge remote-tracking branch 'vbam-libretro/master'
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-03-16 11:48:19 +00:00
Rafael Kitover 7ab7bc3a9d
cmake: Add -debug suffix to windows debug zips.
For the zip file containing the executable (and symbols for debug builds
on msvc) add the -debug suffix to the basename of the zip file for debug
builds.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-03-15 20:44:22 +00:00
Rafael Kitover 571025da66
cmake: Do not use gpg if user has no keys.
When UPSTREAM_RELEASE is set, only use gpg to make detached signatures
if the output of gpg -k is not blank. If it is not, the user has likely
installed a private key to sign with.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-03-14 13:28:36 +00:00
Rafael Kitover 6c64db0794
cmake: Windows codesigning refactor.
Quote variables containing the HOME or USERPROFILE, as they may have
spaces.

Check for both osslsigncode and signtool regardless of platform, and
prefer osslsigncode.

The reason for this being that osslsigncode is more reliable and does
not depend on system configuration in any way, while signtool can fail
under more conditions.

The other reason being that you can use either program on both windows
and linux. E.g. the mingw version of osslsigncode or the signtool from
mono distributions on linux.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-03-13 00:30:26 +00:00
Edênis Freindorfer Azevedo 4f1a351d4a Try to configure vsync for multiple options.
When we have a notebook with intel+nvidia, OpenGL sets both
`glXSwapIntervalSGI` (nvidia) and `glXSwapIntervalMESA` (intel) for
usage. That means that if the display is controlled by one, we may
disable vsync for the other card, therefore having no actual effect
on gameplay. With this, we check for all available functions and try
them all.

This may lead to some false warnings, but useful for debugging
purposes.
2020-03-11 14:00:24 +00:00
Edênis Freindorfer Azevedo ed8a9af250 Use proper functions and checks for OpenGL VSYNC.
The vsync has to be {dis,en}abled before a ROM is loaded or we need to
restart the output module to apply it.

We also support MESA based installations (Intel HD Graphics, AMD/ATI and
Nouveau) on Linux.
2020-03-11 14:00:24 +00:00
negativeExponent 6092082e04
Fix Save Failed error for Super Monkey Ball Jr. 2020-03-11 06:47:25 +08:00
Rafael Kitover 2ba0d316cd
cmake: Include .pdb in zips of debug builds.
Include the visualboyadvance-m.pdb file alongside the .exe for Visual
Studio debug builds.

Visual Studio generates this file with the debug symbols for debug
builds. The file is not generated for release builds. It is also
generated for RelWithDebInfo builds.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-03-09 04:28:52 +00:00
Rafael Kitover f1099a213a
Check return value of soundInit().
soundInit() returns a bool to indicate success, and failure inevitably
leads to crashes as the emulator tries to use a NULL soundDriver.

On false, popup an error dialog saying that the sound driver failed to
initialize, this is at least better than crashes, which will also need
to be fixed.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-03-07 13:30:28 +00:00
Mystro256 410ede543c
Check for null pointer in soundReset().
Check that soundDriver is defined.
2020-03-07 13:08:44 +00:00
negativeExponent 9d1d707c01
Limit ROM size to 32 MiB.
Limit the utilLoad() function in src/Util.cpp to 32 MiB.

This function loads a file from disk and returns a memory image of it.

This is only used to load ROMs currently.
2020-03-07 11:45:19 +00:00
negativeExponent fd319d2184
GB: Check header for a valid ROM file.
Check some magic numbers in the ROM header to detect Game Genie and Game
Shark ROMs, and check for the Nintendo logo in the header in normal
ROMs.
2020-03-07 11:43:00 +00:00
Rafael Kitover 05bd2a95cd
Remove libpng direct dependency.
Followup on 513af13d which replaces the use of libpng with the stb_image
headers.

- Remove the use of libpng in cmake.

- Remove libpng from list of vcpkg dependencies.

- Add libpng to list of wxwidgets link libraries when using vcpkg, since
  it is no longer linked directly. This is necessary for static builds.

- Remove libpng from all package lists in installdeps.

- Remove libpng-dev from the debian control file.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-03-01 13:56:29 +00:00
Edênis Freindorfer Azevedo 513af13ddc Replace `libpng` code for `stb_image` one.
It is a very straightforward replacement calls.
2020-03-01 09:54:43 +00:00
Edênis Freindorfer Azevedo 8f48c1f01d Fix weird `wxWidgets>=3.0` error message.
ASSERT INFO:
/usr/include/wx-3.0/wx/object.h(160): assert "wxDynamicCast(ptr, T)"
failed in wxCheckCast(): wxStaticCast() used incorrectly
2020-03-01 09:54:43 +00:00
Rafael Kitover 32e7c69726
Gettext pot update improvements.
Extract strings from all wx sources, not just the enabled ones.

Ignore comments in the generated pot when checking if it was updated, we
don't care about just changes in line numbers.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-02-24 21:06:23 +00:00
Rafael Kitover 2f0653824e
Enable XAudio2 for Windows vcpkg build.
Add necessary headers to the dependencies submodule and default the
cmake option to on.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-02-24 20:49:01 +00:00
Rafael Kitover ba14cadba1
Fix 0e8e46f0 for gcc.
gcc (mingw) does not allow converting a const char*[] to a char**
without -fpermissive. Make some adjustments to the string handling to
execute the cmd.exe command to delete the temp file.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-02-24 19:46:50 +00:00
Rafael Kitover 0e8e46f0b7
Windows: Fix deleting tempfile for winsparkle dll.
Trying to delete the temp file for the winsparkle dll after unloading
the dll would still produce an access denied error, presumably because
for whatever reason not all resources used by the dll were freed.

Instead of trying to immediately delete the file, start an asynchronous
cmd.exe process to sleep for 2 seconds and delete the file. This gives
the app time to exit, after which the file can be deleted.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-02-24 13:17:32 +00:00
Rafael Kitover 89d378eb71
cmake: Fix gettext pot update check.
When the feature was added in d93f6350, I did not adequately test for
the normal case when the pot is not updated.

This does not work because the pot has a timestamp in the
POT-Creation-Date: field.

Fix check-pot-update.cmake to ignore the pot timestamp and not report
the pot as changed when it has not been.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-02-20 23:46:09 +00:00
Rafael Kitover d93f6350d0
cmake: Generate gettext pot automatically.
Remove po/update_pot.sh and generate the gettext .pot source
automatically in cmake on every build instead.

If the .pot is actually updated, print a loud message at the end of the
build to commit the result and push to transifex.

Fix the gettext tools and package loading block to only run when
ENABLE_NLS is enabled and find the xgettext and msginit binaries in the
Windows case as well. xgettext is used to generate the .pot.

Refactor the SRC_WX/HDR_WX/RES_WX/XRC_SOURCES handling to use only
relative paths and move all generated files into RES_WX. This was
necessary to generate the .pot from cmake.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-02-17 08:34:32 +00:00
s520 a320377040
Fix: a issue with loading e-Reader dot code (#608)
Fix issues with {sav,load}ing e-Reader `Dot Code`.

If `Dot Code` file is not specified, it tries to continually read it and does not accept input.

In Japanese (very likely other languages as well), the path of `Dot Code` file is garbled
internally due to failing conversion to UTF-8.
2020-02-15 14:02:53 -03:00
Rafael Kitover 83614290be
Turn on winsparkle update checking support.
Default to ON on Windows for x64 or x86.

Set new appcast URL, this will be in the github pages repo.

We will need to get everything ready for the next release.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-02-08 04:26:50 +00:00
Rafael Kitover 4aab08c47b Set link timeout default to 500ms, fix prev. dflt.
Default the linkTimeout ConfigManager variable to 500 (milliseconds.)

Detect if the previous default is set, which 1, and set to 500, to
repair existing configurations.

This may reduce the amount of reports about link being broken, as some
people have certainly not checked this setting, and the default should
not be so wrong.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-02-04 23:01:11 +00:00
Rafael Kitover 136c094f0c Add option to set link network port.
Add field for the network port to the start link dialog, default is 5738
as before.

The port is stored in the user's options config.

Add TextCtrl support to UIntValidator for this.

Related: #594.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-02-04 23:01:11 +00:00
Rafael Kitover 98f3948ea8
cmake: Add dep on catalogs for translations.zip.
This doesn't work to pick up changes from changed translations files
though, because git does not store file timestamps.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-02-03 18:10:29 +00:00
Edênis Freindorfer Azevedo 789cd2d0f0
Revert "Enable layers in non-tile modes."
We need to use proper documented behaviour when coding the
core, therefore this should be reverted until a proper
solution is done.

This reverts commit ca3b63d64c.
2020-02-03 07:38:26 -03:00
Edênis Freindorfer Azevedo ca3b63d64c
Enable layers in non-tile modes.
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.
2020-02-02 15:49:02 +00:00
Rafael Kitover 3edd9ba756
cmake: Fix fedora mingw build + misc improvements.
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>
2020-02-01 16:43:08 +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
Edênis Freindorfer Azevedo 588e82f03c
Cleanup from PR 586. 2020-01-21 13:57:42 -03: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 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
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 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 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 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 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 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 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
Rafael Kitover 6c2850cd59
Merge remote-tracking branch 'vbam-libretro/master'
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-12-04 01:59:38 +00:00
Rafael Kitover 498e4e858d
Windows joystick events fix.
Followup on 02520fb6.

Versions of wxWidgets after 3.0 change the windows event loop in such a
way that using QueueEvent for joystick events no longer works, use
ProcessEvent instead. This has no effect on latency since the joystick
events only cause the emulator controller state to be updated.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-12-03 20:09:56 +00:00
hizzlekizzle 2622db116c
Merge pull request #82 from negativeExponent/fix_window
Allow game window to resize on-the-fly when enabling/disabling borders
2019-12-02 13:26:45 -06:00
negativeExponent 72d0725bac Allow game window to resize on-the-fly when enabling/disabling borders 2019-12-02 22:23:07 +08:00
Rafael Kitover 24f13ef00f
Merge remote-tracking branch 'vbam-libretro/master'
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-12-01 00:35:05 +00:00
Rafael Kitover e04efa76b3
Release game controller device correctly. #568
A followup on 02520fb6.

In wxSDLJoy::Remove(n), which is the only API that needs to release a
game controller device from the application, actually call
SDL_GameControllerClose(dev) when a device is released.

This is used when the input config dialog is launched. First all sticks
are closed, and then all available sticks are added for the duration of
the dialog. Then they are closed again, and only the configured sticks
are open for the game, which is what happens generally.

The device ordering is determined by the OS.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-11-29 03:50:24 +00:00
Rafael Kitover 02520fb63e Joystick handling refactor.
Use the SDL GameController API with SDL events instead of polling
manually. Run SDL_PollEvent() in the panel OnIdle().

The API to the GUI remains the same, the sending of wxSDLJoyEvent
events. Except there are no more hat events, we just use the
GameController buttons. Also the GUI now has to make arrangements for
wxSDLJoy::Poll() to be called periodically, for the config dialog this
is done with a timer.

All Xbox 360 controller buttons and axes are now in the defaults, and
the SDL GameController API will map them to the appropriate keys on
other controllers.

As a consequence of using SDL events, controller attach/detach from the
system is now also handled correctly. It is no longer necessary to have
the controller attached and turned on when the program launches.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-11-27 23:09:35 +00:00
Rafael Kitover ae7349b06f
cmake: Use list var VBAM_LIBS for link libs.
Accumulate link libraries for wxvbam in the VBAM_LIBS list variable
instead of listing every possible library variable in the
target_link_libraries() call.

This fixes the issue with trying to use OPENAL_LIBRARIES when it's set
to NOTFOUND which generates a cmake error.

Fix #563.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-11-13 02:56:06 +00:00
Rafael Kitover e35d46254b
WinSparkle wrapper improvements.
- Make WinSparkleDllWrapper a real singleton.

Make the constructor private and add a static `GetInstance()` method
that constructs the single instance and/or returns it.

Make it encapsulate the function pointers and the wxDynamicLibrary
instance, with the API as friend functions.

- Make winsparkle API completely self-contained.

Make the instance of the WinSparkleDllWrapper a factory function local
static.

This way the calling program does not have to manage the life-cycle, the
singleton is initialized when the API is first invoked, and destroyed
during global destruction.

The destructor is now also private, because the singleton object is
destroyed during global destruction.

Found the solution here:

https://stackoverflow.com/a/46139631/262458

- Cmake improvements.

Only enable the ENABLE_ONLINEUPDATES option by default if we are going
to use winsparkle on 32 or 64 bit intel windows.

Do not inlclude winsparkle if the option is off.

- Disable for now.

Currently ENABLE_ONLINEUPDATES defaults to OFF even on intel/windows,
until we do more work on this feature.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-11-09 23:44:23 +00:00
Edênis Freindorfer Azevedo 76803caf5f
[Windows] Enable winsparkle update checker.
Remove traces of previous update checker.

We use version 0.6.0 available here:

https://github.com/vslavik/winsparkle/releases

We only support on Windows at the moment using `winspakrle`. So remove
this item for other platforms or when disabled in compilation.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-11-09 22:47:34 +00:00
ZachBacon 3f39bcd04f
Finally a working snapcraft yaml file with confinement enabled.
Tasks that need to be done
- Enable ffmpeg
- Fix icon location
- Enter testing phase before going onto the snap store.
2019-11-08 04:36:04 -05:00
Edênis Freindorfer Azevedo 225e4dc954 Remove top border black line when using filters.
We don't want to display the top border when using filters, since it
is a single line with black pixels.

- Fix #561.
2019-11-07 17:52:18 +00:00
Rafael Kitover 4352504385
Windows: load WinSparkle.dll as a resource
Add cmake glue and necessary code to load WinSparkle.dll as a binary
resource that gets written out to a temp file and loaded with
wxDynamicLibrary.

Object lifetime of the dll wrapper is handled by the app.

The API is the same as the winsparkle API, the only change required is
changing:

`#include <winsparkle.h>`

to:

`#include "winsparkle-wrapper.h"`

and handle the lifetime of a WinSparkleDllWrapper object.

On destruction the temp file is removed.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-11-06 12:04:29 +00:00
Rafael Kitover d0d22b3068
cmake: copy wxrc from vcpkg build if not exists
Do not copy the `wxrc.exe` from the vcpkg build tree if it has already
been copied, as in the case of the appveyor vcpkg installed cache.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-10-21 14:19:56 +00:00
mudlord 0535d5c797 Optimize CRC32. 2019-10-21 13:25:19 +00:00
orbea 65c908141c wx: Fix conditional jump on uninitialized value with valgrind.
==15788== Conditional jump or move depends on uninitialised value(s)
==15788==    at 0x5143A2: wxvbamApp::~wxvbamApp() (wxvbam.cpp:682)
==15788==    by 0x5144BB: wxvbamApp::~wxvbamApp() (wxvbam.cpp:676)
==15788==    by 0x739CD22: wxEntryCleanup() (in /usr/lib64/libwx_baseu-3.0.so.0.4.0)
==15788==    by 0x739D02B: wxUninitialize() (in /usr/lib64/libwx_baseu-3.0.so.0.4.0)
==15788==    by 0x739CE39: wxEntry(int&, wchar_t**) (in /usr/lib64/libwx_baseu-3.0.so.0.4.0)
==15788==    by 0x50BD42: main (wxvbam.cpp:32)

v2: Initialize overrides as a nullptr.
2019-10-10 02:47:43 -07:00
orbea 6adf5ea487 wx: Silence -Woverloaded-virtual warnings with debug builds.
The Clone function seem unused, the AcceptsFocus and HasFocus
functions are marked as const and Show is renamed to ShowAddr
to not conflict with unrelated functions.

[187/196] Building CXX object src/wx/CMakeFiles/visualboyadvance-m.dir/viewsupt.cpp.o
In file included from ../src/wx/viewsupt.cpp:1:
../src/wx/viewsupt.h:197:10: warning: 'Viewers::MemView::Show' hides overloaded virtual function [-Woverloaded-virtual]
    void Show(uint32_t addr, bool force_update = false);
         ^
/usr/include/wx-3.0/wx/gtk/window.h:64:18: note: hidden overloaded virtual function 'wxWindow::Show' declared here: different number of parameters (1 vs 2)
    virtual bool Show( bool show = true );
                 ^
In file included from ../src/wx/viewsupt.cpp:1:
../src/wx/viewsupt.h:410:10: warning: 'Viewers::DispCheckBox::AcceptsFocus' hides overloaded virtual function [-Woverloaded-virtual]
    bool AcceptsFocus()
         ^
/usr/include/wx-3.0/wx/window.h:724:18: note: hidden overloaded virtual function 'wxWindowBase::AcceptsFocus' declared here: different qualifiers ('const' vs unqualified)
    virtual bool AcceptsFocus() const { return true; }
                 ^
In file included from ../src/wx/viewsupt.cpp:3:
In file included from ../src/wx/wxvbam.h:14:
In file included from ../src/wx/widgets/wx/joyedit.h:9:
../src/wx/widgets/wx/sdljoy.h:115:14: warning: 'wxSDLJoyEvent::Clone' hides overloaded virtual function [-Woverloaded-virtual]
    wxEvent* Clone();
             ^
/usr/include/wx-3.0/wx/event.h:1569:22: note: hidden overloaded virtual function 'wxCommandEvent::Clone' declared here: different qualifiers ('const' vs unqualified)
    virtual wxEvent *Clone() const { return new wxCommandEvent(*this); }
                     ^
In file included from ../src/wx/viewsupt.cpp:3:
../src/wx/wxvbam.h:286:10: warning: 'MainFrame::HasFocus' hides overloaded virtual function [-Woverloaded-virtual]
    bool HasFocus()
         ^
/usr/include/wx-3.0/wx/window.h:715:18: note: hidden overloaded virtual function 'wxWindowBase::HasFocus' declared here: different qualifiers ('const' vs unqualified)
    virtual bool HasFocus() const;
                 ^
4 warnings generated.
2019-10-09 10:32:51 -07:00
orbea 4e9882f24d cmake: Don't install visualboyadvance-m twice on WIN32. 2019-10-08 13:23:44 -07:00
orbea 518c147281 cmake: Use an install target for visualboyadvance-m. 2019-10-07 17:36:27 -07:00
orbea abff89e4fb cmake: Use add_executable when not cross-compiling. 2019-10-07 04:46:20 -07:00
Rafael Kitover 61520df789
Add @orbea to About -> Contributors.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-10-06 23:48:13 +00:00
Rafael Kitover 7ee3cbe120
Joystick rumble followup. #522
Call `rtcEnableRumble(true);` always regardless of the `rtcEnabled`
option, because @negativeExponent points out that they are unrelated.

Check for at least SDL version `2.0.9` before using the
`SDL_JoystickRumble()` API, since it is not present in earlier versions.

Increase rumble duration to twice the poll time to keep the motors
running, subsequent poll events will cancel the rumble as necessary.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-10-06 17:42:12 +00:00
Rafael Kitover 4bc9bb84b4
Implement joystick rumble. #522
Call `rtcEnableRumble()` in the core if the rtc is enabled during ROM
loading.

On `systemCartridgeRumble(bool)` events from the core, set the state in
`wxSDLJoy` accordingly, to either rumbling or not rumbling based on the
boolean parameter.

On the `50ms` joystick poll events, use `SDL_JoystickRumble()` to enable
rumble on both the low and high frequencies at maximum for the poll time
of `50ms`, to be set or reset again on the next poll event.

Tested in Drill Dozer, rumbling is being activated. Will need testing
from users as well to see if this is implemented correctly.

Fix #522.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-10-06 11:06:08 +00:00
orbea 680af6d420 cmake: Silence cmake policy warning CMP0058.
See: cmake --help-policy CMP0058
2019-10-05 18:33:44 -07:00
Rafael Kitover 699d0c3724
Add denisfa to about -> contributors.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-10-05 19:35:15 +00:00
Edênis Freindorfer Azevedo 384f448757 Fix key accel overriding menus and dialogs.
All keys were being captured before being processed by any window of the
app to check for accelerators. This meant being impossible to use any
keys for input if they were saved for an accel.

- Fix #516.
2019-10-05 12:30:49 -07:00
Rafael Kitover 3e22d17fb2
fix Visual Studio build
The change to use an extern version variable in 24d83a12 produces a
linker error with Visual Studio due to the `version.c` source file being
compiled as C instead of C++.

Rename:

`version.c`   -> `version.cpp`
`version_c.h` -> `version_cpp.h`

And update all references accordingly.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-10-04 13:20:10 +00:00
Rafael Kitover 24d83a1262
make recompile for vers/git state change minimal
Make a `version.c` with `const char*` variables to store the version
strings used by other files, to make recompiles slightly faster when the
git state changes.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-10-04 08:14:22 +00:00
Rafael Kitover af0de1c4b3
xbrz: fix inline asm check
Use correct cpp code to detect x86/amd64 architecture to use inline asm.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-10-04 07:35:49 +00:00
Ar't ced2676926
win: set correct version in rc
xvbam.rc: use version.h to generate version strings,
cmake: adding version in odd format required by rc
2019-10-04 07:13:20 +00:00
Edênis Freindorfer Azevedo 806dd7daa6 Fix circular `--config` for SDL port.
When using the command line options, we had a circular issue:
- using `LoadConfig()` before `ReadOpts()` would mean the `--config` is
ignored.
- using `ReadOpts()` before `LoadConfig()` would mean the command line
options were ignored in favor of the default ones.

If we want to use a custom `vbam.ini`, we need to load it with
`--config`. Now we only consider params order on command line.
2019-09-25 20:59:37 -01:00
Edênis Freindorfer Azevedo 1aa8afb4dc Drop dead code entirely.
All this code protected by `#if 0` is implemented already one way or
another. Hence the decision to remove it, instead of commenting.

This also removes the need of the branch `arthur/sdl2`.
2019-09-25 20:59:37 -01:00
Edênis Freindorfer Azevedo 531172c4be Fix displaying of link menu when `ENABLE_LINK=NO`.
We disable the items, but not the menu. So, there was an empty list
on `Options` > `Link` > `Type`.
2019-09-16 21:36:44 -01:00
Edênis Freindorfer Azevedo 07107096b8 [Windows] Fix crash when setting weekly updates.
It happens due to our wxRadioButtons having 3 options (indexed by 0, 1
and 2) but we trying to get the index 7 (due to want to check every 7
days).

We should still implement something like WinSparkle for Windows.

- Fix #499.
2019-09-16 21:36:44 -01:00
Edênis Freindorfer Azevedo efa09bdb07 Add faster sqrt code for xBRZ filters.
We use ASM code for Windows `x86` and Linux desktop. The others remains
the same.
2019-09-16 21:36:44 -01:00
Edênis Freindorfer Azevedo 10f5576ecf Fix config file when removing system accels.
We assign the `NOOP` id for every command disabled by the user, but not
the command name (just `NOOP`). When updating the configuration file,
any command with `NOOP` id is valid, even if the label does not match
`NOOP`. Hence this weird issue.

- Fix #502.
2019-09-16 21:36:44 -01:00
Edênis Freindorfer Azevedo 1c6b016853 [Windows] Fix remaining UTF-8 issues.
We were missing some `wxConvLibc` on the output code. This meant crappy
messages on windows.
2019-09-16 21:36:44 -01:00
Rafael Kitover 0f2c8cab08
win: check APPDATA if LOCALAPPDATA is not found
Check for the APPDATA environment variable if there is no LOCALAPPDATA
environment variable for things like reading the config file.

Fix #407.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-09-12 03:01:16 +00:00
Edênis Freindorfer Azevedo 528c37f9e0 Allow "Browse" to be translated.
wxWidgets fails to translate some internal strings due to locale issues.

It is not clear how the current locale is detected, but it fails for
cases when the system is different from the set by the user. Eg: the
system is using `en_US`, but the user sets `LANG=pt_BR.utf8` for an
application. Some internal strings are translated because of `LANG`,
while others remain the same because `en_US`.
2019-09-10 07:59:56 +00:00
Edênis Freindorfer Azevedo d8c981fb42 Fix toggles for video/audio layer options on menu.
We could not use key shortcuts for this, since it was only checking if
the option was activated on menu. This only happens if you open the
menu and click it, so the key shortcut does not work.
2019-09-10 07:59:56 +00:00
Edênis Freindorfer Azevedo c0f96425e6 Show all commands available on menu.
We move from `Other commands` to several places of our main menu. This
way we allow texts to be translated and easier view of them for users.
2019-09-10 07:59:56 +00:00
Edênis Freindorfer Azevedo 51fa150f1c Adjust MMX menu variable and position.
It should only appear on `x86`.
2019-09-10 07:59:56 +00:00
Edênis Freindorfer Azevedo 27b038b378 Show messages about operations of state slot. 2019-09-10 07:59:56 +00:00
Edênis Freindorfer Azevedo 2e24845711 Allow translation of the words `Open` and `Quit`. 2019-09-10 07:59:56 +00:00
Edênis Freindorfer Azevedo 54991c5b14 Add extra keys default input when using GUI.
We also set the extra keys for controller input when using `defaults`
option.
2019-09-10 07:59:56 +00:00
Rafael Kitover b358c051c9 Fix compilation issue when `ENABLE_DEBUGGER=Off`.
We protect all code relevant to disabling this property with either
`BKPT_SUPPORT` or `NO_DEBUGGER`. This is mostly debugging options or
prints scattered around the code.

We also adjust cmake to ignore the specific files surround it, but
allowing the rest of the GUI to work.

- Fix #431.
2019-09-04 14:31:11 +00:00
Rafael Kitover 2a2be95397
builder: msys2 fixes
For cmake, the dependency on `bin2c` when using `HostCompile.cmake` does
not work if it's set to `bin2c.exe`, for whatever reason, so remove the
suffix.

Add `-DCURL_STATICLIB` to `CPPFLAGS` etc. to link to `libcurl`
correctly, needed for `osslsigncode`.

Add `--without-brotli` to curl configure args, because it can try to
link to some existing version and fail.

Add a `gmake` symlink to the system `make` into the `PATH` because some
things like Strawberry Perl install their own copy of `gmake` into the
`PATH`.

Add `pass` to list of msys2 deps, needed to store the windows
codesigning cert password.

Use `$CMAKE_ARGS` instead of `$CMAKE_BASE_ARGS` for building vbam,
adding `-DCMAKE_INSTALL_PREFIX=/usr`, this is necessary for extracting
the locales correctly.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-09-03 00:14:37 +00:00
Rafael Kitover d9e4a0874d
build fixes: ffmpeg, xbrz, travis, C++ version
Fix the cmake ffmpeg detection and make it not print the detection
messages twice.

Add `-D__STDC_FORMAT_MACROS` to compiler flags, some versions of ffmpeg
require this.

Redefine `static_assert(x)` to the `static_assert(x, msg)` form in
`xbrz.cpp`. This is a C++17 feature and some versions of gcc wrongly set
`__cpp_static_assert` even though they do not support it.

Also we want to stick to C++11 for the time being, until there is
consensus to support a newer a version.

For that reason, change the MSVC flag `/std:c++latest` to `/std:c++11`
as well.

Remove `-DENABLE_OPENAL=ON` and `-DENABLE_LINK=ON` from travis config,
as these are now automatic.

In `installdeps` remove the hacks for supporting the `https://` apt url
for mxe and use an `http://` url instead. This works perfectly on Ubuntu
14 (trusty).

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-08-31 22:58:59 +00:00
Rafael Kitover 381a7bfe78
/std:c++latest for MSVC, fix bool flip, warn opts
Use `/std:c++latest` for Visual Studio because the XBRZ 1.7 code
requires at least C++17.

Replace the use of `bool++` in `GBALink.cpp` which is now apparently an
error with `bool = !bool` to flip the value.

Use `/W4` to enable a good amount of warnings in Debug mode, and `/W0`
to disable warnings entirely in release modes.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-08-30 01:57:01 +00:00
Edênis Freindorfer Azevedo 234f1e9b1a Update to xBRZ `1.7`.
Get files from here `https://sourceforge.net/projects/xbrz/files/xBRZ/`.

Then, update the src to handle pitch params. For our case, the pitch
is necessary because we deal with borders (top and right) of our source
image. Normally, we would want to scale without it, and therefore we
need to adjust the pointers to skip the borders.

If we have a `width + 1 pixel border` per line, the we need to scale
a image with `width` line size, but advancing the pointer for each new
line processed including the border on the count.

Also, since our output pointer also allocates for the border, we need
to adjust the output moving pointer for each line in a custom way.
(output border in this case)

- Fix #164.
2019-08-28 22:07:52 +00:00
Edênis Freindorfer Azevedo 06a9d786c2 Allow UPS patch for GBA games.
From my very superficial understanding, the `rom[]` resize happens
only when `rom_size` is greater than 0x2000000.

We should probably study this better for an actual explanation.

- Fix #487.
2019-08-21 00:45:46 +00:00
Edênis Freindorfer Azevedo 03121c69c0 Add support for autohold buttons.
We implement this in the same way it is being done on `vba-rr`.

- Fix #414.
2019-08-20 23:00:48 +00:00
Edênis Freindorfer Azevedo e87213e369 Fix indentation. 2019-08-20 23:00:48 +00:00
Edênis Freindorfer Azevedo cf47942f09 Fix Autofire {L,R}.
We were using directionals (left and right) instead.
2019-08-20 23:00:48 +00:00
Rafael Kitover d9a7e0c964
cmake: auto-detect sfml, ffmpeg and openal
In cmake detect if the dependencies for link (sfml), recording (ffmpeg)
and openal are installed and default the features to `ON` if they are,
otherwise to `OFF`.

This simplifies the cmake usage.

Update the default column in the `README.md` table to `AUTO` as well.

Remove the cmake options from `installdeps` instructions, since they are
auto-detected.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-08-20 08:21:38 +00:00
Rafael Kitover 8ceef90fc4
fix appveyor visual studio build
See #465

To compile the build tool `bin2c`, add a target with `add_executable()`
on visual studio instead of using `HostCompile.cmake` because running
`cl.exe` fails in the appveyor visual studio environment, see:

https://developercommunity.visualstudio.com/content/problem/325122/c1356-unable-to-find-mspdbcoredll.html

Also update the dependencies module to latest.

appveyor build now tested to work.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-08-20 06:55:07 +00:00
Edênis Freindorfer Azevedo fc2eb38fcd Fix behaviour of `Tools` > `Memory Viewer` (#486)
We fix the wxWidgets error message when trying to open the dialog
via menu.

The scrollbar behaviour has been enhanced to adjust itself between
200 and 300 rows from GUI (0x6c0 memory to 0xf9ff - GB example).

Clicking on top or bottom line of the memory values now moves 1 row
position backwards and forward, respectively.

Arrow keys also functional for navigation.

* Remove clicking on top/bottom behaviour.
2019-08-19 19:25:47 -01:00
Rafael Kitover 51f61a3afb
Merge remote-tracking branch 'vbam-libretro/master' 2019-08-18 18:46:55 +00:00
Aaron Kling a01a2d4dd0 libretro: allow mingw cross compile 2019-08-17 09:17:06 -05:00
Rafael Kitover dc8d36a08c
minor fix for stl wx builds
`XRCID()` expects a `const char *` not a `wxString`.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-08-16 06:08:47 +00:00
Rafael Kitover 51a4f74b94
Merge remote-tracking branch 'vbam-libretro/master' 2019-08-15 18:42:08 +00:00
negativeExponent 9ccdeac3aa Add missing break; lines for switch statements
- As discussed at #cheats on discord, using the search engine will cause RetroArch to crash as
soon as you click on Start or Restart Cheat Search.
- This PR adds the missing break lines for the switch statements that is causing the core to crash
2019-08-15 15:23:58 +08:00
Rob Loach a17eb47103
Merge branch 'master' of github.com:fpscan/vbam-libretro into intl 2019-08-14 10:00:20 -04:00
Rob Loach 9b043daadf
libretro: Update core options API 2019-08-14 09:56:39 -04:00
Edênis Freindorfer Azevedo 6b18c1f9b8 Fix warning about frames left in queue.
Example:
- [libmp3lame @ 0x55b9e7248300] 4 frames left in the queue on closing
2019-08-14 08:27:51 -01:00
Edênis Freindorfer Azevedo f5b19475c9 [IDEA] Fix recording when using `speedup/turbo`.
We do not allow to skip frames while recording. The resulting length
will be extended compared to using turbo/speedup modes, because the
recording will be normal time (as in running without turbo/speedup).
2019-08-14 08:27:51 -01:00
Edênis Freindorfer Azevedo 738494a232 Support all sample rate available on GUI.
Before we could only use `44100`. Now we can use all available on GUI
for the supported codecs.
2019-08-14 08:27:51 -01:00
Edênis Freindorfer Azevedo aa3ecaf701 Add new output formats for recording audio/video.
We test each of these additions by trying to record gameplay with them.
Then we play it and check the results. Pretty straightforward.
2019-08-14 08:27:51 -01:00
Edênis Freindorfer Azevedo 5848feaea2 Fix video/audio recording.
We create a namespace to deal with most of our recording solution.

Besides that, we also add some functions to remove the need of
including libavutil headers on other part of the code. This is meant to
isolate most of recording solution components on the proper files.

We will start with a limited number of codecs supported; slowly we
should add them as they are tested (the previous one did not work for
most codecs listed).

This should support `ffmpeg 4.1` and further, including removing
all compilation warnings related to versions discrepancy.
2019-08-14 08:27:51 -01:00
Ömercan Kömür 9e3c26152e Update libretro_core_options.h
option_defs_tr
2019-08-13 11:23:36 +03:00
Ömercan Kömür 6c60ac334b Turkish Language option 2019-08-13 08:50:56 +03:00
retro-wertz ad43b32bdd Fix "index out of bounds" runtime error 2019-08-12 21:56:10 +08:00
retro-wertz 82e723a528 MBC3: Update mapper to check if RTC is present before running RTC functions 2019-08-10 19:01:10 +08:00
retro-wertz 03184dd513 libretro: Use GB RTC data when available
- Save GB RTC data using retro_get_memory/size and only init using localtime when its unavailable (check is done in retro_run)
2019-08-10 18:24:32 +08:00
retro-wertz b3744b3bd5 Simplify GB border core option 2019-08-10 01:06:15 +08:00
retro-wertz 9757a880c7 Core options cleanup and a few readability-related updates
changes includes:
- append "options_" to core-related variables
- remove some unnecessary function calls
- change some float data types to double
- set max geometry width/height depending on max values for the system being emulated
- create advanced core options to minimize the number of options shown
- style nits
2019-08-09 22:28:52 +08:00
Edênis Freindorfer Azevedo cfb03d8b3a Set default keybinding when key does not exist.
- Fix #463
2019-08-08 21:31:58 -01:00
retro-wertz 496b372d3e Allow enabling GBA RTC regardless of rom types
- Add core option to allow RTC to be enabled regardless of rom. This usuable for rom patches that requires the RTC to be enabled yet the RTC flag is not enabled. (aka Pokemon patches)
2019-08-07 20:05:57 +08:00
retro-wertz bb10954466
Update Makefile 2019-08-07 01:55:52 +08:00
retro-wertz 98313652d6 Update Makefile
- Try to fix osx build
- style nits and cleanup
2019-08-06 19:22:14 +08:00
Twinaphex 34de057969
Merge pull request #67 from retro-wertz/update_makefiles
Update Makefiles
2019-08-06 05:45:32 +02:00
retro-wertz d9f8396c67 Cleanup 2019-08-06 08:58:04 +08:00
retro-wertz 9a13449782 Update Makefiles
- Updating makefile from vba_next's makefiles, removing any defines that are not available in this core.
- Update Android.mk
2019-08-04 15:37:18 +08:00
retro-wertz d898288100 Automatically hide some core options depending on rom image type
- loading gba games will automatically hide gb/gbc only related core options at startup
- loading a gb/gbc game will also hide gba only options...
2019-07-30 00:51:06 +08:00
hizzlekizzle c3edd6d433
Merge pull request #65 from retro-wertz/libretro
retro_get_memory_data/size and memory descriptors update
2019-07-28 17:05:10 -05:00
retro-wertz 2084a63e1f Update GB/GBC memory maps (retro_memory_descriptors) 2019-07-28 21:52:13 +08:00
Twinaphex 90b051eee1
Update libretro_core_options.h 2019-07-28 07:40:43 +02:00
retro-wertz a727e22265 GB: Rename this variable to isolate from a global variable of the same name
- this is a temporary variable and should only affect on this section, and not the global one.
2019-07-27 19:35:58 +08:00
retro-wertz 0d423b98fa Cleanup GB palette struct and update retro_get_memory_data/size
- minor n0n-functional changes
- cleanup gb built-in palette struct
- update retro_get_memory_data/size to directly use related variables for RAM and VRAM
  and fix sizes (GB vs GBC pointers and pointer size) for proper cheat search support.
  You can now access full 32K ram of GBC for example.
2019-07-27 19:15:46 +08:00
retro-wertz bc80ecdb39 UtilRetro.cpp: Cleanup 2019-07-27 11:33:32 +08:00