Commit Graph

2788 Commits

Author SHA1 Message Date
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 7fbb017cd5
Update macOS/Xcode version to latest for travis.
Use "osx_image: xcode12" which is Xcode 12.0 and macOS 10.15.5, the
latest available for travis.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-07-09 09:52:54 +00:00
Rafael Kitover a5f863f390
Transifex pull.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-07-08 13:28:31 +00:00
Rafael Kitover 36e61d765a
Test with utf8 and nostl variants of wx on Travis.
Build on bionic with downloaded stow packages in /usr/local.

f51e1ee4 is actually a fix for a wx with --enable-utf8 and NOT for a wx
with --disable-stl, as it turns out.

FreeBSD uses --enable-utf8, while Linux distributions generally don't.

Tested by reverting f51e1ee4.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-06-30 00:52:20 +00: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 8e88363163
Transifex pull.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-06-28 00:27:41 +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 047cc29787
Transifex pull.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-06-23 06:45:12 +00:00
Rafael Kitover 3a2b97fd08
Transifex pull.
New complete translation by @Ds886 for he_IL.

New locale en_PL.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-06-21 20:12:55 +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 de93330125
Merge pull request #671 from visualboyadvance-m/turbo-gba
Input refactoring.
2020-06-18 23:01:32 -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
Rafael Kitover 0b7f11018d
Transifex pull.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-06-14 19:08:41 +00:00
Edênis Freindorfer Azevedo 0c5ee9941b Fix PNG capture screen.
- Fix #680.
2020-06-07 18:06:04 +00:00
Rafael Kitover 3d83590774
Remove 32 bit mac binary, builder updates.
We are not going to release 32 bit mac builds anymore, because any mac
sold after 2007 will run a 64 bit binary. And since we are building for
10.7, which requires a 64 bit mac, and will run 64 bit binaries even on
a 32 bit kernel, the 32 bit binary was always pointless.

More on this here:

https://apple.stackexchange.com/questions/99640/how-old-are-macs-that-cannot-run-64-bit-applications/99644#99644

https://apple.stackexchange.com/a/261793/206363

Remove references to 32 bit mac binary from the dev manual.

Builder updates:

- Bump cmake 3.13.0-rc1 -> 3.17.3. This is needed for the new
  FetchContent feature in cmake, which we use for Sparkle (online
  updates for mac.)

- Bump sfml to newer master commit.

- Add pre-build hook for libvpx on mac to set
  -mmacosx-version-min=$MACOSX_DEPLOYMENT_TARGET in CFLAGS.

- Force C locale in all builder scripts, homebrew bash was erroring due
  to some kind of locale bug with a non-English locale.

- Remove .app in build_project() before building, rebuilds were failing
  due to reinstallation of frameworks (Sparkle.)

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-06-07 12:38:48 +00:00
Rafael Kitover d8da93897a
Minor improvements for mac dyld linker.
Minor code improvements.

Do not suppress output of sudo invocation, this may cause it hang on an
invisible password prompt.

- Fix #676.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-06-05 03:36:59 -07:00
Rafael Kitover 7c0c53a332
Transifex pull.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-06-04 22:38:36 +00:00
Rafael Kitover c294b86635
Transifex pull.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-06-01 18:20:56 +00:00
Rafael Kitover bfab4321cb
Improve gentoo support for installdeps.
- Use gtk3 slot for wxWidgets.

- Fully qualify all ebuilds.

- Only rebuild if necessary.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-06-01 12:24:41 +00:00
Rafael Kitover 0436797080
Transifex pull.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-05-23 20:09:17 +00:00
Rafael Kitover a5e776eea3
Transifex pull.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-05-16 22:42:18 +00:00
Rafael Kitover 7d15117536
Transifex pull.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-05-16 11:25: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 51b66714c5
Small update to powershell section in dev manual.
- Fix pkill function.

- Give more example of comma separating arguments.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-05-13 22:38:22 +00:00
Rafael Kitover b4aeab689a
Transifex pull.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-05-13 08:47:46 +00:00
Rafael Kitover 44202abdb5
Transifex pull.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-05-12 08:14:48 +00:00
Rafael Kitover 710d356084
Improve powershell notes in the dev manual.
I now know some things better about powershell.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-05-11 00:33:30 +00:00
Rafael Kitover 4f0f942e31
Transifex pull.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-05-09 20:51:09 +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 8024c87832
Fix vcpkg upgrades.
We upgrade only the first listed package to upgrade for vcpkg to not
overrun the CI time limit.

Sometimes these packages are up-to-date but are listed for rebuild due
to depending on other packages that would be upgraded.

Find the first package in the upgrade list that is not up-to-date and
use that as the package to upgrade.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-05-07 01:11:18 +00:00
Rafael Kitover 43b749fe0b
Transifex pull.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-05-06 10:20:23 +00:00
Rafael Kitover 6bf107f75d
Transifex pull.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-05-05 14:00:58 +00: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 ad3327d437
Transifex pull.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-05-03 00:08:09 +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
Rafael Kitover 0f55b5d1c8
Transifex pull.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-05-01 23:58:42 +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
Rafael Kitover a972da8ddb
Update github issue template.
Use html comments for section instructions that shouldn't be visible in
the completed form.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-04-24 12:53:51 +00:00
Rafael Kitover eecde424ae
Transifex pull.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-04-21 21:56:56 +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 ed438d6e52
Transifex pull.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-04-15 10:09:27 +00:00
Rafael Kitover b7f5754338 Add to dev manual on translations and char sets.
Document how we interact with transifex and how to pass strings to
non-wxWidgets code.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-04-13 00:25:11 +00:00