Commit Graph

1770 Commits

Author SHA1 Message Date
Rafael Kitover 0f0d2400bc
more specific check for 3.1.2 xrc error
The `wxEXPAND` flag is necessary for the game area in wxWidgets 3.0 and
earlier, it may be necessary in 3.1.2 as well, but it throws an xrc
error, so we check for windows and at least 3.1.2 to test for the visual
studio and vcpkg environment to avoid the xrc error.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-04-01 09:28:19 -07:00
Rafael Kitover d9a7df6105
fix if statement in SDL sound driver #396
@denisfa found this due to a warning, this should improve the
functionality of the SDL sound driver.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-04-01 08:42:52 -07:00
Rafael Kitover 2097b5aaa5
wx 2.8 compat fixes, centos support, cmake fixes
Add support for RHEL/centos to installdeps. There is no SFML package.

Add some string compatibility stuff so that everything builds on wx 2.8
unicode builds.

TODO: add travis slaves for 2.8, with and without unicode

Disable the game frame spacer code on 2.8 because it does not work (the
frame does not expand.)

cmake improvements:

- set ENABLE_LTO=OFF for Debug builds by default

- set ENABLE_LINK=OFF if SFML cannot be found and continue

- use better logic for finding wx utilities wx-config and wxrc

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Closes #395
Closes #297
2019-03-28 21:45:06 +00:00
Rafael Kitover b69fced749
cmake: refactor, better clang support
Do some reformatting towards the more modern cmake style.

Clean up some code.

Support linking to gcc compiled wxWidgets by setting
`-D__GXX_ABI_VERSION=` appropriately for clang.

Use the new method of calling `FindwxWidgets.cmake`, the old method
causes some problems now.

Set all necessary policies in both cmake files.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-03-27 03:25:43 +00:00
Rafael Kitover f2e9dc5530
cmake: check for policy CMP0077 existence
Check `if(POLICY CMP0077)` before trying to set it, because setting a
policy a version of cmake does not know about is an error.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-03-26 13:40:35 +00:00
Rafael Kitover ae38a70d1e
cmake: gcc/clang colors with ninja, fix warnings
Ninja requires `-fdiagnostics-color=always` instead of
`-fdiagnostics-color=auto` with gcc because it pipes output from the
compiler unlike regular makes.

Use `-fcolor-diagnostics` for clang, which also works correctly with
ninja to show colors.

Information for this taken from here:

https://medium.com/@alasher/colored-c-compiler-output-with-ninja-clang-gcc-10bfe7f2b949

Set all cmake policies in both the root `CMakeLists.txt` and
`src/wx/CMakeLists.txt` to silence warnings about unset policies from
cmake.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-03-26 00:35:23 +00:00
Rafael Kitover 59e9c69097
reset Xorg screensaver on joy events
Use the libXss Xorg screensaver extension library to call
`XResetScreenSaver()` on joystick events to inhibit screen blanking when
for whatever reason the joystick driver or DE (xboxdrv and KDE in this
case) does not do this.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-03-22 11:30:31 -07:00
Rafael Kitover a0283eadb6
fix game panel size on wxGTK #325
On wxWidgets 3.1.2, which is what vcpkg uses (and we use vcpkg for
Visual Studio) the wxEXPAND flag for the game area in the sizer throws
an XRC error dialog, removing the flag works correctly on Windows, but
not on wxGTK.

As a workaround, do not use the wxEXPAND flag on Windows.

TODO: with max zoom set, the game area is not centered vertically in
wxGTK.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-03-22 11:24:56 -07:00
Rafael Kitover f1ecd7c322
auto deps for visual studio, take 1
Use vcpkg to build deps when Visual Studio on Windows is detected, this
only happens on first build, but does take a while because things like
wxWidgets need to be built. Building from the developer command line is
also supported.

I considered making a pre-built tarball available, but the resulting
files are just too big for this to be practical.

Make the necessary cmake code changes for this to work and to use the
vcpkg packages, which work just like on linux or have other cmake glue
code available.

To do this, we make vcpkg a submodule, use git to checkout all
submodules, then just build and use the `vcpkg.exe`. Then we set the
CMAKE_TOOLCHAIN_FILE to the vcpkg toolchain and also include it
directly, why this is necessary I don't know, without it it doesn't work
in the IDE but does on the command line.

All of this requires no vcpkg integration with either the user or the
project. A user-wide `ENV{VCPKG_ROOT}` is also supported.

Fix the dynamic arrays in the GBA core, MSVC follows the C++ standard on
this and gcc does not.

TODO: add the necessary gcc flags to make this an error in cmake.

Use `wxArrayString` instead of `std::vector<wxString>` in
`src/wx/strutils.cpp` which is used in options parsing. This was
necessary because of a bizarre linker error with wxWidgets when using
Visual Studio:

https://trac.wxwidgets.org/ticket/10884#comment:46

In `src/wx/panel.cpp` make sure the unimplemented D3D renderer code does
not get compiled if it's actually `OFF`.

Also fix the new spacer code for the drawing panel to not combine
`wxEXPAND` with `wxALIGN_CENTER`, which is an error on wxWidgets 3.1.2,
which is what vcpkg uses. The drawing panel seems to be automatically
stretched to the max size automatically anyway.

TODO: if all of this works, we'll need an Appveyor set up for visual
studio.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-03-21 16:01:46 -07:00
Edênis Freindorfer Azevedo c714ff825a fix problems of command line parameters
* Fix return code for wrong command line parameters.

* Update return code for incorrect command line option on WX port.
2019-03-18 20:38:42 -07:00
Edênis Freindorfer Azevedo a1f0c34ace XDG followup work #94
* Apply save order for save states and batteries.
The order for save state/battery:
1. StateDir / BatteryDir;
2. The path of the current loaded game;
3. XDG Base Dir fallback.

* Use XDG Base Dir fallback to save screenshots and recordings.

* Apply search order for all dirs except recording (not implemented yet) of SDL port.
The order for battery/save state/screenshot is:
1. StateDir/BatteryDir/ScreenshotDir;
2. The path of the current loaded game;
3. XDG Base Dir (or equivalent) fallback.

* Refactor code.

* Fix freeing and setting pointer to NULL of SDL port.
2019-03-18 01:08:53 -07:00
Edênis Freindorfer Azevedo a57e51f699 Return non-error code for given command line parameters. 2019-03-14 16:17:45 -07:00
Edênis Freindorfer Azevedo 3fd444da91 XDG related cleanups #94
* Add migration support for 'vbam.cfg' to 'vbam.ini' on MacOS and Windows.

* Cleanup from XDG Base Dir code.

* Set home to NULL after using free().
2019-03-13 22:05:02 -07:00
Edênis Freindorfer Azevedo 1ebb8efdb6 Fix to set correctly position Y. 2019-03-12 11:16:09 -07:00
Edênis Freindorfer Azevedo 944c263e7f auto save/load geometry for wx GUI #94
* Add support to save/load geometry options for GUI window.

* Refactor code to use wxWidgets functions to get window geometry.

* Call update_opts() from ::OnSize and ::OnMove functions.
2019-03-11 10:32:39 -07:00
Rafael Kitover 530af14030
rpi plugins fix + paths enhancements #94
Store the full relative path to found `.rpi` plugins, relative to the
standard Plugins directory, as specified by wxWidgets.

This fixes the problem of plugins being in a subdirectory while only the
basename was stored, making the plugins unusable.

This is done by using `wxFileName::GetFullPath()` instead of
`wxFileName::GetFullName()` with a relative filename instance.

Make a `GetPluginsDir()` method on the app class to simplify getting
this directory, and for possible future overrides.

Also make some minor, functionally equivalent changes to
`get_config_path()` in `wxvbam.cpp`:

- use the new `GetPluginsDir()` method for the plugins directory when
  building the config file search path

- print the XdgConfigDir on all platforms, since the function works on
  all platforms

- make a `add_nonstandard_path` macro which duplicates the `add_path`
  macro for wxWidgets standard paths but for any arbitrary string path

- use `wxFileName` methods to make the XDG config directory path instead
  of string concatenation

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-03-07 07:13:07 -08:00
Rafael Kitover 6a98f3c200
define S_ISDIR for win32 #94
Followup on #383.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-03-06 18:53:22 -08:00
Edênis Freindorfer Azevedo 7373da1528 Fix segmentation fault issue when using WX port command line
on Linux and MacOS.
2019-03-06 18:03:37 -08:00
Edênis Freindorfer Azevedo 36453885fc XDG Base Dir Spec followup #383
* Add XDG Base Dir Spec for other Unix alike platform.

* Add XDG Base Dir support for the fallback on SDL port.

* Add migration for Unix configuration file.
We migrate from 'vbam.conf' to 'vbam.ini' automatically.

* Refactor code for portability of dir creation functions.

* Fix for MacOS compilation directive.
2019-03-06 15:38:57 -08:00
Wes Smith f87e085079 added a8a35 2019-03-05 15:22:21 -05:00
retro-wertz 286c8ff487 Fix #52 2019-03-03 15:16:11 -05:00
Rafael Kitover 24fd4e91a0
move factory reset to help menu
Per Squall's suggestion.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-03-02 14:37:08 -08:00
Rafael Kitover 5835dafe9a
translate battery save error #318
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-03-02 11:04:06 -08:00
Rafael Kitover d2922cfc5d
stop showing "wrote battery" msg on panel #318
Remove the "wrote battery" system message that is painted on the panel,
because it annoys people, and show errors writing the battery with
`wxLogError()`.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-03-02 08:15:30 -08:00
Edênis Freindorfer Azevedo 646557e24e Add support for the XDG Base Dir Spec for Linux with legacy support.
We check if `$HOME/.vbam` exists; if it does, then we use
`$HOME/.vbam/vbam.conf`; otherwise, use
`${XDG_CONFIG_HOME:-$HOME/.config}/visualboyadvance-m/vbam.conf`.
2019-02-28 16:22:09 -08:00
retro-wertz eaa9b6c57b Map Viewer: Fix crash when running a gb/gbc game,
...caused by invalid start address of mapbase.

Fix https://github.com/visualboyadvance-m/visualboyadvance-m/issues/372
2019-02-24 18:31:24 -08:00
Rafael Kitover 98cb298efc
GB: fix 32/64 bit save/state incompatibility
The MBC3 and TAMA5 battery formats save the RTC data including a
`time_t` field which is the last field.

Since `time_t` is 32 bits for 32 bit builds and 64 bits for 64 bit
builds, pad it in the two battery structs with a `uint64_t` and detect
the 4 byte shorter saves made by older 32 bit builds.

Also remove some pointless code in save state reading that also uses
`sizeof(time_t)`.

Add two new constants for RTC data size in gbMemory.h and use them.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-02-23 13:40:25 -08:00
Rafael Kitover d7cf15e076
implement factory reset option #368
Add a "Factory Reset" item to the Options menu, which calls
`DeleteAll()` on the config object, which actually deletes the config
file. After this the application is relaunched asynchronously without
parameters and the current instance is closed.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-02-20 19:44:42 -08:00
laqieer 7b350c09b9 bugfix: crash when loading elf 2019-02-05 20:44:17 +08:00
Rafael Kitover eb6dfb4bfa
fix libretro build broken in 16dd5d40 #339
Conditionally compile out the code for the feature implemented in
16dd5d40 (which is the throttle and frame skip configuration for the
speedup button) for libretro, and use the old behavior of skipping 9
frames.

Affects GBA.cpp and GB.cpp .

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-02-03 15:28:26 -08:00
Rafael Kitover 16dd5d4068
make speedup/turbo configurable + misc #339
Add Speedup / Turbo configuration panel which allows setting the
throttle or number of frames to skip for when the speed key is pressed
or turbo is enabled (which just presses the speed key.)

Throttle and frame-skip are mutually exclusive, throttle must be 0 (no
throttle) when number of frames to skip is non-zero. The dialog controls
handle this.

This is implemented in the core in GBA.cpp, GB.cpp and ConfigManager.

Two new options are added both in ConfigManager and in the wx options,
speedup_throttle and speedup_frame_skip, the defaults are:

```
speedup_throttle   = 0 (no throttle)
speedup_frame_skip = 9
```

this was the original behavior.

Add support for unsigned ints to wx/opts.cpp for these and for throttle,
this requires a new validator wxUIntValidator to use them in spin
controls.

Clean up appearance of the throttle spin control in the General dialog.

Maximum throttle and speedup_throttle is 600, values much over 500 will
not behave differently from 0 on modern hardware.

Maximum frame skip is 30 at the moment.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-02-02 18:43:55 -08:00
ZachBacon 5379708fcc I guess I'll try the gtk2 build of wxwidgets instead 2019-02-02 18:32:38 -05:00
ZachBacon d70dd37326 Let's use the proper wxwidgets package 2019-02-02 18:29:19 -05:00
ZachBacon ede6b371a4 Fix snap deps 2019-02-02 18:23:24 -05:00
ZachBacon 44208c82d7 Add basic snapcraft yaml for building a snap 2019-02-02 18:01:59 -05:00
retro-wertz ba678f4f2e GB: Make gbTimerOn an INT type instead of BOOL 2019-01-31 16:35:36 -08:00
retro-wertz 43647d3234 GB: Prevent gbSpritesTicks from going out-of-bounds 2019-01-31 16:35:36 -08:00
Rafael Kitover f8c6953151 fix drawing panel alignment in frame #325
Add wxEXPAND spacers to frame wxBoxSizer on the top and bottom around
the drawing panel so that panel is correctly centered if maximum zoom is
set.

Set proportion to 1 on the spacers and 0 on the panel so that both
centering with maximum zoom and full expansion work correctly.

Refactor frame OnSize event: pass a dummy userdata pointer to
distinguish resizing the frame from resizing the panel, and call
Layout() when the frame is resized.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-01-31 14:59:41 -08:00
retro-wertz e912c359f6 GBA: Remove some magic numbers for main pointers and save types size 2019-01-30 04:10:35 -08:00
retro-wertz 0697922179 Update libretro.cpp 2019-01-29 08:28:17 -08:00
retro-wertz 4700a2c1bf libretro: Enable mirroring for classic/famicom games for GBA and update 2019-01-29 08:28:17 -08:00
retro-wertz f2b3496298 GB: Add missing battery save for MMM01 cart 2019-01-29 08:28:17 -08:00
retro-wertz a0cec107a2 Update GBA save type detection and cleanup...
1. EEPROM: move eepromInUse and eepromSize from EepromReset() to eepromInit()
to avoid re-initializing during a reset (makes item below redundant)
2. Remove gbaSaveType variable - this is now redundant due to change above
which probably was added for this reason since games using eeprom fails with
gamepak error after a reset.
3. Add labels to identify cpuSaveTypes
4. libretro: remove workaround for eeprom reset issue (#1), do not apply
custom gbPalettes if not running in GB, change vram size to 0x18000 in
memory map
2019-01-29 08:28:17 -08:00
retro-wertz 2a796d48a0 libretro: Add GB color palettes 2019-01-26 06:45:35 -08:00
Rafael Kitover 4f9003112d persist chosen audio device in config file #353
Write `gopts.audio_dev` to the option `Sound/AudioDevice`.

Clear `gopts.audio_dev` when resetting the driver, because we cannot
assume anything about device enumeration order across sound drivers.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-01-24 03:14:23 -08:00
retro-wertz 3b87576e41 GB: Fix rumble support (MBC5)
- Fix missing call to rumble function on MBC5
- fix rumble flag gets disabled causing rumble not to work at all.
2019-01-21 05:28:27 -08:00
retro-wertz 089d7a40e5 libretro: Add support for tilt, gyro sensors and rumble pak (WIP)
- Uses analog stick to simulate tilt and gyro hw. By default, tilt uses
the right analog stick while gyro uses the left. The analog stick can be
swapped using a core option provided and with separate sensitivity level
for both sensors. WIP and will be fine tuned later (Kirby was fun to
play at least)
- Minor retro_run() cleanup and some minor stuff i forgot.
2019-01-21 05:28:27 -08:00
retro-wertz a2b3dd76a1 libretro: Update input descriptors for 4-player SGB and cleanup...
- Updates descriptors for 4-player SGB
- Remove alternate gamepad layouts for GBA
- Prevent crash when SGB border option executes at startup when GB is not
initialized yet
- Update input turbo function for 4-player support
- Minor cleanups (texts, style nits, etc)...
2019-01-19 00:11:16 +08:00
Rafael Kitover 9d058abb41 libretro: don't include getopt.h in configmanager
Check for __LIBRETRO__ before including getopt.h in ConfigManager.h,
because windows does not come with this header or function, and libretro
does not need it.
2019-01-17 10:36:18 -08:00
retro-wertz d5642fa333
libretro: Android buildfix (#348) 2019-01-17 23:56:12 +08:00
retro-wertz 093818a1d7 GBA: Resolve shifting negative value issue in some thumb/arm opcodes 2019-01-17 05:54:31 -08:00
retro-wertz 59f76d05b8 libretro: Use gbWram[] for $C000 in CGB mode
This uses full size of gbWram[] so we have a continouos memory block
for RAM addresses $C000 and $D000 in CGB mode. This helps with
retroachievements.
2019-01-14 09:42:53 -08:00
retro-wertz f9efb79a7d libretro: Fix GB games that uses serial (WIP)
Allow serial emulation without having the need to run link-related
communication stuff (NO_LINK define). Some games need this e.g. RC Pro-AM
racing. Dummy funcs/vars are added as placeholders.

Currently work-in-progress and might need to disable some more NO_LINK
sections.
2019-01-14 08:20:18 -08:00
retro-wertz af3fe01822 libretro: Update GB's memory map, expose all usuable ram 2019-01-14 08:20:18 -08:00
retro-wertz 470d86f5c8 libretro: Cleanup 2019-01-13 04:29:02 -08:00
retro-wertz ad432a6f70 libretro: Silence warning 2019-01-13 04:29:02 -08:00
retro-wertz bff08eafb7 libretro: Update Makefile, fix ASAN 2019-01-13 04:29:02 -08:00
retro-wertz c2b31635dd GBA: Only use eepromReset/flashReset during reset event (CPUReset) 2019-01-10 19:29:48 +00:00
retro-wertz 0d73da01a1 GBA: Get rid of blip_time() 2019-01-10 19:29:48 +00:00
Rafael Kitover 83b3ebd7f0 fix audio api radio buttons
Only the first wxRadioButton in a group is supposed to have the wxRB_GROUP
style, I broke this in 964f086b.
2019-01-09 08:32:03 -08:00
Rafael Kitover f6ad9a8ca7 remove bad hardcoded keybinds #298 #334
Remove esc to quit key bind #298.

Remove ctrl+x (cmd+x on mac) to quit key bind #334.

Remove FilterEvent app method, it is no longer being used anyway as key binds
work correctly.
2019-01-05 12:32:10 -08:00
Rafael Kitover ff2d31bf5e faudio: minor change
This translated xaudio2 driver may not be feasible to get working, but
I'll try at some point.
2019-01-02 07:16:08 -08:00
Rafael Kitover 964f086bea fix audioapi opt enum, reorder xrc
The config option name enum needs to match the actual enum, since the
value is an integer. Unavailable APIs are not shown using #ifdefs in
guiinit.cpp.

Also reorder the radio button xrcs to be in the order of the enum.
2019-01-01 18:44:51 -08:00
Rafael Kitover 8cb3f5a78c fix sound api config on linux/mac
Missing "|" in option spec would create the "sdlopenal" option instead
of separate "sdl|openal" options.

Add missing "|" to option spec.
2018-12-31 03:49:31 -08:00
Rafael Kitover 55a60e3e73 only block key event propagation for game keys #88
One bug noted in the #88 discussion is that when a joystick button is
held down, keyboard shortcuts do not work.

Rewrite the logic for process_key_press() to only block further
wxWidgets event propagation if the actual key pressed is a game key, not
if any game keys are being held down.

This takes care of all the issues in #88.

TODO:

- investigate other joystick issues
2018-12-28 21:51:28 -08:00
Rafael Kitover f8b5627bd8 fix support for old SDL versions
Check for at least SDL 2.0.6 when using the
SDL_JoystickGetAxisInitialState() API introduced in e57beed8.
2018-12-28 05:22:17 -08:00
Rafael Kitover e57beed890 ignore depressed gamepad triggers #88
On joystick event notification, filter out axis values that are equal to
their initial state.

The reason for doing this is explained in 539027ca. Triggers on e.g. the
360 controller are an axis that are the max negative value in the
depressed state, and for some reason a constant stream of events are
generated for them, that's another issue that needs to be addressed.

For the time being, this fixes the other half of the main issue in #88:
users with an old config with the default special key bindings will now
be able to use keyboard hotkeys as these spurious joystick events will
be filtered out and will not block keyboard events.

TODO:

- stop generating events for depressed triggers in the first place

- fix joystick events completely blocking keyboard events
2018-12-28 04:36:41 -08:00
Rafael Kitover 979ef8ebbd cmake: fix building without FAudio
Only add FAudio to target_link_libraries() if it's enabld.
2018-12-26 10:56:27 -08:00
Rafael Kitover edf2c0c461 fix xaudio2 when openal is disabled
Move the new faudio driver constant AUD_FAUDIO to the end of the sound
driver enum, otherwise the wrong is used.

Also check for NO_OAL before instantiating an openal driver.
2018-12-26 07:35:42 -08:00
Rafael Kitover 3ed08e8d68 finish connecting new faudio driver
Add cmake code to find and link faudio if enabled.

Fix typo for get devices faudio method in wxvbam.h

Selecting the faudio driver now works, but the driver not does
unfortunately.
2018-12-26 06:53:52 -08:00
Rafael Kitover 296e8e1693 fix valid sound driver config values + faudio fix
Fix name of FAudio option XRC control: "FAudio" and not "Faudio".

Create list of valid sound driver options by using macros for the ones
that are compiled in (with windows being a special case.)
2018-12-26 06:09:29 -08:00
Rafael Kitover 1f4487b836 faudio: add gui code for selecting driver
Add code to swtich to faudio api when the option is selected in the
config dialog in guiinit.cpp.
2018-12-26 05:33:19 -08:00
Rafael Kitover 396227661e add some missing faudio initialization code
Add case for faudio in the code for getting audio devices in
guiinit.cpp.
2018-12-26 05:28:53 -08:00
Rafael Kitover 0c2906d026 fix SDL sound defaulting code
The #if logic was leftover from when OpenAL was the default.

Default to SDL sound always instead.
2018-12-26 05:24:21 -08:00
ZachBacon 580a11e39e Let's not force FAudio just yet 2018-12-26 06:37:53 -05:00
ZachBacon d6f3fd23de Finish hooking up FAudio to the rest of the frontend 2018-12-25 20:58:31 -05:00
Rafael Kitover 539027ca16 remove problematic default joy binds #88
The default keyboard/joystick bindings for the "special" keys have
assumptions about axis numbers that do not hold with modern game pads.

For reference, the 360 controller has the following mappings:

Axis 0/1: left stick
Axis 3/4: right stick
Axis 2:   left trigger
Axis 5:   right trigger

This triggers another bug causing the depressed state of a trigger axis
to fire continuously. In this case, this is the left trigger on a 360
controller which is axis 2.

This triggers yet another bug where a stream of joystick events blocks
keyboard events from registering, resulting in hotkeys like ctrl+p to
pause not working.

Replace all joystick binds for special keys with null values.

With this change, a default installation of vbam will not trigger the
hotkeys not working bug when a joystick is plugged in.

The other bugs here mentioned also need to be fixed.
2018-12-25 17:42:46 -08:00
ZachBacon 5da48769ae fixed a typo and added faudio, but there's still persisting issues 2018-12-25 20:31:29 -05:00
Zach Bacon 514f355664
Merge pull request #337 from visualboyadvance-m/light-weight
Light weight
2018-12-25 20:00:09 -05:00
ZachBacon 429b8ceba2 I'm pretty sure some of this is very hacky and needs correcting, but it compiles at least. 2018-12-25 19:57:49 -05:00
ZachBacon 53e16e0411 Need to hook up the effects chain parameters 2018-12-25 18:48:55 -05:00
ZachBacon 8939455bb9 Next on the list is adding a few more arguments for certain functions 2018-12-25 17:47:21 -05:00
ZachBacon a8c44364e5 Next on the list is correcting the incomplete types 2018-12-25 17:31:22 -05:00
ZachBacon 4b664c69f7 Still not quite ready for d3d, but this one header mingw has anyways. 2018-12-25 16:22:13 -05:00
ZachBacon 14815135bc we need to release with the proper function in faudio 2018-12-25 16:07:12 -05:00
ZachBacon 0bfbcfa332 Needed the FAudio Processor in FAudioCreate 2018-12-25 15:40:14 -05:00
ZachBacon af98f532b1 Inbound FAudio fixes 2018-12-25 15:29:11 -05:00
Rafael Kitover 5f38c0da8a cmake: static: check for link file when editing
When trying to do the necessary edits to linklibs.rsp or link.txt for
static linking, first check if the files were created by cmake,
otherwise a fatal error is generated.
2018-12-23 19:43:32 -08:00
ZachBacon ba563c71b3 Add FAudio to the xrc 2018-12-23 12:46:01 -05:00
retro-wertz 0c579b20a1 Revert to a default audio api (SDL) when config is invalid
Prevents crash when an invalid or a non existing api is used in
vbam.conf
2018-12-23 09:29:48 +08:00
ZachBacon 4361c45b16 Fixed a few things, still have lots to fix though before it's a usable state. 2018-12-18 10:46:45 -05:00
ZachBacon 99795b270d cmake hookup is done, there are some issues that I'll be trying to fix within faudio.cpp before it's ready for mainstream 2018-12-18 10:24:39 -05:00
ZachBacon eab039cd78 This should allow faudio to be supported in vba-m, next is to further modify cmake to find faudio 2018-12-18 08:59:11 -05:00
ZachBacon e00aca18df Initial work on switching to faudio, WIP 2018-12-17 23:20:29 -05:00
retro-wertz 85891fc7fd Reduce input delay by 1 frame and audio timing fix 2018-12-10 18:47:09 +08:00
Rafael Kitover 27a874e3ba
Merge branch 'master' into tasks/add-lldb-support 2018-12-05 14:23:20 -08:00
Scott Knight a52eddb5b4 Handle debugger disconnect and reconnect properly
When connecting the debugger the debugger variable was
being set to true before setting up the dbgMain and other related
function pointers. This caused the idle loop to attempt to call dbgMain
which was still NULL. This change makes sure that debugger isn't
set to true until all function pointers are set and that when disconnecting
the remotePort variable is reset back to 0 so we can reconnect properly.
2018-12-05 14:17:52 -08:00
Scott Knight 6ba3b7791d Set correct register number in gdb stop reply
https://github.com/bminor/binutils-gdb/blob/master/gdb/features/arm/arm-core.xml

According to the current arm register definition file in gdb the cpsr register is
actually register number 25 and not 16.
2018-12-05 14:17:01 -08:00
Scott Knight f385fb2faf Update gdb remote query support
The latest version of gdb from devkitpro expects slightly
different response to some of the remote queries. For instance
when sending back the current thread id there should be no
space or dash between 'm' and the thread id. Additionally a
handful of other common remote gdb query params were
added to better support current versions of gdb
2018-12-05 14:17:01 -08:00
retro-wertz ca56ccffeb libretro: Simplify cheats, add multiline support for GB/GBC 2018-12-01 07:24:54 +08:00
retro-wertz a2d5c260ec libretro: Add turbo buttons 2018-12-01 07:13:14 +08:00
Scott Knight 3484ecc419
Add support for LLDB qHostInfo packet
https://github.com/llvm-mirror/lldb/blob/master/docs/lldb-gdb-remote.txt

The qHostInfo command is listed as a high priority to implement for gdb
stubs that lldb can connect to. Adding support for this command allows
lldb to properly connect with it's `gdb-remote 55555` command and
correctly determine the target and allow debugging.
2018-11-28 08:50:50 -05:00
Scott Knight dd2a1d9b51
Fix stack overflow in remoteMemoryRead
When doing a remote memory read the debugger can ask for any size.
The buffer being allocated however was only 1024 bytes long and the
code in remoteMemoryRead also attempts to write a zero byte at the
end of the array. This code will now take the count of bytes the debugger
is trying to read and allocates a buffer that is count * 2 + 1 large. This is large
enough to hold the $02x formatted hex byte for each byte as well as the zero
byte written at the end.
2018-11-28 08:50:49 -05:00
Scott Knight 4f28e84632
Fix stack overflow in remotePutPacket
If the packet passed into remotePutPacket was 1024 bytes or
larger then the buffer array would not be large enough to hold
the $, checksum and zero byte written. This now allocates a buffer
of size count + 5 to accommodate these extra characters.
2018-11-28 08:50:48 -05:00
Zach Bacon 5e58e4c3e6 when it comes to cross compiling, Most unices like linux are case sensitive 2018-10-23 22:06:18 -04:00
Rafael Kitover 9cb9ce86bd fix Windows XP Compatibility #315
Use the IsWindowsVistaOrGreater() function from VersionHelpers.h, which
fortunately is part of mingw, to check for the availability of the
comctl32 LoadIconWithScaleDown API, which we use to fix issues with the
app icon, like the icon being too big in the volume mixer.
2018-10-23 06:19:34 -07:00
ZachBacon 58083d9d4a Gonna use universaldxsdk for xaudio 2018-09-16 15:20:06 -04:00
retro-wertz 916c091a49 Libretro: Add GB/GBC cheat support...
- Add wram and vram to retro_get_memory* and minor cleanup
2018-08-19 23:34:38 +08:00
retro-wertz 14086d0007 Libretro: Fix crash on some linux systems 2018-08-19 22:19:06 +08:00
Rafael Kitover e67b513e94 rename mac-localizations to mac-translations.cmake
Rename cmake script to copy .gmo files into the .app introduced in
bf4606fc from mac-localizations.cmake to mac-translations.cmake since
these are really translations and not localizations.
2018-08-11 15:05:12 -07:00
Rafael Kitover bf4606fc18 install translations into mac .app
Add a POST_BUILD hook to run a cmake script to install translations into
the .app.

Tested to work correctly, when system language is different a
translation is loaded.
2018-08-11 14:52:18 -07:00
Rafael Kitover 6cbad61f36 fix cmake regression introduced in bfe21aee
Before calling list(REMOVE_ITEM ...) check if the variable exists, if it
doesn't cmake throws an error.
2018-08-10 09:37:55 -07:00
Rafael Kitover bfe21aee3e remove -fpermissive compiler flag
Remove -fpermissive from the list of flags passed to gcc and clang.

Remove -fpermissive from the cxxflags from wxWidgets config as well.

When checking wxWidgets ABI compatibility version, temporarily add
-fpermissive to compiler flags on Win32 because minhook requires it.
2018-08-10 06:46:51 -07:00
Rafael Kitover 571ecbe3e8 support mac-hosted mingw builds, misc. fixes
- Add the cross root from the mingw-w64 mac brew to the cmake toolchain
  files.

- Remove strerror_r/strerror_s from ConfigManager.cpp because the
  mingw-w64 brew does not support strerror_s for some reason.

- Strip the vbam executable from the builder script in the build_project
  phase.

- Change the bzip2 URL to the github mirror because the bzip.org domain
  expired.

- Add libuuid as it's required by the new fontconfig, use the mingw
  version for mingw builds, for mingw also set UUID_LIBS to
  '-luuid_mingw -luuid' in mingw.sh for fontconfig, the mingw version
  is called uuid_mingw because uuid is a core win32 library.

- Lower glib version to 2.57.2 stable.

- Update wxwidgets version to current master sha.

- Fix a bug in flex-2.5.3 post_build where it tries to build flex
  current but flex has been removed, and it was just rebuilding 2.5.3.

- Fix "aggressive" relocation and the relocation of .l[ao] and .pc files
  in install_dist to ignore /usr/local, and only match /usr.

- Add a "project" pre_build and post_build hooks.

- Add getopt to host-only dists in mingw-cross.sh.

- Use perl instead of readlink -f to get the absolute path of the cmake
  toolchain files in mingw-cross.sh, as readlink -f is linux-only.

- In mingw-cross.sh, replace the glib post_build to rebuild
  gettext-target instead of gettext --without-included-glib.

- Add overridable functions set_host_env_hook and unset_host_env_hook in
  mingw.sh to override in other scripts, in this case mac-cross-builder.

- Update mingw glib patches to current fedora versions.

- Add tools/win/mac-cross-builder script to build mingw windows binaries
  on mac, it borrows some necessary parts from the mac native builder
  for host dists, and inherits from mingw-cross.sh.

TODO: currently the resulting mac-built binary segfaults due to gcc
8.2.0, just as the msys2-built binary does, this is a separate issue.
2018-08-10 04:31:05 -07:00
retro-wertz f45935af98
Add vbam_libretro.info
to be copied into <retroarch_folder>/<core_info_folder
2018-08-06 13:46:48 +08:00
Rafael Kitover be508eb2fd simplify check for renamed wx-config, fix gentoo
Use find_program() to check for the existance of wx-config-gtk4, then
wx-config-gtk3 and finally wx-config, instead of calling find_package()
for each separately, FindwxWidgets module does not like being called
multiple times, it screws up some cache variables.
2018-08-05 21:16:33 -07:00
Rafael Kitover 3b44a29948 cmake: fix wrong unset syntax #295 from f78d45c0
unset(VAR PARENT_SCOPE CACHE FORCE)

seemed to work on my version of cmake on gentoo, but does not work on
other versions.

Rewrite the function as a macro and use the syntax:

unset(VAR CACHE)

instead.
2018-08-04 13:13:37 -07:00
Rafael Kitover f78d45c038 cmake: fix regression in finding wx from 2efcb620
Clear FindwxWidgets module variables from the cache after each
unsuccessful try with WX_CONFIG_EXECUTABLE set, otherwise the succeeding
find_package(wxWidgets) call with WX_CONFIG_EXECUTABLE unset will fail,
as it does with cmake on gentoo.
2018-08-04 04:34:24 -07:00
retro-wertz ddea50d3c8 GB: Cleanup sound registers
Seems to be left-overs from switching to blargg
2018-07-26 14:39:06 +08:00
retro-wertz faf01db2cf GB: Backport STAT register behavior
http://www.devrs.com/gb/files/faqs.html#GBBugs
2018-07-26 13:45:06 +08:00
retrowertz d9e0d0f88d GB: Remove references to gbReadOpcode
Merged with gbReadMemory since this basically is just a duplicate
2018-07-26 00:24:06 +08:00
Zach Bacon eb20bb4aad
We don't have a forum anymore
Please kindly use github issues
2018-07-24 17:42:55 -04:00
retro-wertz fca7e175d8 Libretro: Prevent crash when loading an incompatible state file 2018-07-24 14:23:52 -07:00
retro-wertz 1289e08cb4 Libretro: Enable battery save ram support for MBC2 and MBC7 2018-07-24 14:23:52 -07:00
retro-wertz a9ab09f749 Libretro: Fix realtime clock not updating in GB/GBC...
Remove usage of RETRO_MEMORY_RTC - not required since real-time clock is always updated and is using current time and not ingame time.

Add some more rom info to logs during loading
2018-07-24 14:23:52 -07:00
retro-wertz 6cda6c0c24 Libretro: Show basic details in log window during rom loading 2018-07-24 14:23:52 -07:00
retro-wertz 6ef938fc52 Libretro: Add memory descriptors for GB/GBC 2018-07-20 22:21:07 +08:00
retro-wertz bb64e8d8d6 Libretro: Use retro_get_memory_data/size for battery-enabled roms
Supports battery saving for MBC1, MM01, MBC3, MBC3+RTC, MBC5

WIP: TAMA5, MBC2, MBC7

Minor style nits
2018-07-19 03:06:06 +08:00
retro-wertz 119e1f5c99 Libretro: Add core options for GB border and hardware overrides 2018-07-17 21:34:14 +08:00
retro-wertz 76ad84fd28 Opps, accidentally broke borders in standalone 2018-07-17 02:29:03 +08:00
retro-wertz bf447bf89a Libretro: Add GB/GBC core
Gb,gbc and sgb enhanced version of roms and savestates working. Bios loading for gb/gbc works too. No save ram / battery handling yet.

Fix offset and pitch issues with vba rendering and when borders are enabled.
2018-07-17 01:55:19 +08:00
retro-wertz f05a05e622 Libretro: Refactoring for adding GB/GBC core 2018-07-15 17:53:44 +08:00
retro-wertz 0e60c34ab9
Fix this 2018-07-12 16:23:59 +08:00
retro-wertz 02e5f0bdce
Libretro: Bump version number 2018-07-06 22:47:41 +08:00
retro-wertz fc42f88bd7 GB: Fix SIO related issue 2018-07-06 04:23:58 -07:00
Rafael Kitover a8d0508cf2 use GetWindow()->Refresh() in Wayland only
Some people are reporting stuttering, and @retro-wertz tested both
DrawArea() and Refresh() on wxgtk3 under xorg and found that the
Refresh() method produces more stuttering.

Change the compile check for wxgtk2 to a runtime check for wayland, and
use Refresh() under Wayland only.
2018-07-02 18:32:18 -07:00
retro-wertz 9146f878d5 Cleanup 2018-06-30 12:15:08 -07:00
retro-wertz 88a19f7c07 Libretro: Add entries for games using 8KB eeprom 2018-06-30 12:15:08 -07:00
retro-wertz daf50fcdbe Libretro: Remove workaround for save file handling
For the most part, save types should now be identified during rom loading and then allow libretro to correctly use flash or eeprom save types and save size.
2018-06-30 12:15:08 -07:00
retro-wertz c1f281b7ba Libretro: Better auto detection of save types when not found in gbaover 2018-06-30 12:15:08 -07:00
retro-wertz 7337341166 Libretro: Set input descriptors to each retropad mapping options 2018-06-30 12:15:08 -07:00
Rafael Kitover 498019a39b support older 32 bit macs running 10.7, fix build
Make mac builder use -m32 in CFLAGS etc. to produce a 32 bit binary
targetting 10.7 (Lion.) This provides the greatest backward
compatibility for older macs, and also allows for asm filters.

Fix an issue with m4 on 10.13 using a patch from macports.

Support `-pX` patch level args in DIST_PATCHES in builder.

Fix an issue with bison on 10.13 by bumping the version to 3.0.5.

Build libxslt `--without-crypto` so that it doesn't try to link the brew
libgcrypt.

Invoke cmake for dists with -DCMAKE_C_COMPILER_LAUNCHER=ccache and
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache to use ccache, and set
CMAKE_C_COMPILER and CMAKE_CXX_COMPILER to the actual compilers not
prefixed by ccache.

When checking for ccache in vbam cmake code, check that
CMAKE_CXX_COMPILER_LAUNCHER and CMAKE_C_COMPILER_LAUNCHER were not
already defined (generally on the command line.)

Remove align attributes from sections in 2xSaImmx.asm, macho format on
mac does not support this and the filter works fine without them.

In the Quartz2D renderer, pass the NSRect view.bounds through
NSRectToCGRect when calling CGContextDrawImage(), this is necessary for
the 32 bit API.

Bump openssl to 1.0.2o.

Bump libxml2 to 2.9.8.

Update URL for urw fonts, and improve the dist downloading/unpacking
code to handle URLs that do not contain the filename (for .tar.gz and
.zip as identified by `file`.)

Change post-build for harfbuzz from `rebuild_dist freetype;` to
`rebuild_dist freetype --with-harfbuzz=yes;` as it was supposed to have
been.

Build cmake itself with --parallel and --enable-ccache.

Silence errors from killed jobs due to tmp directory being gone.

Write a couple of string functions, rtrim() and gsub().

Make path_exists() handle globs with spaces in them, by escaping the
space.

Use --host and --build args to autoconf configure to "cross-compile" for
32 bits, this is necessary for some dists, and does not work for others,
remove it for dists where it does not work.

Add COMMAND_MODE=unix2003 to the build environment, this is necessary to
fix some build errors, why I have no clue, found it on stackoverflow.

Pass -Wl,-no_compact_unwind in LDFLAGS to openssl, this is necessary for
32 bits.

Force sfml to compile as 32 bit, it normally does not allow this.

Remove shared-mime-info from this build, it's not necessary for anything
and there are issues XML::Parser linked to our expat and brew perl that
need to be resolved.
2018-06-30 03:40:47 -07:00
Rafael Kitover 6b4862581e fix some ELF parsing vulnerabilities #255
Implement the recommendations described in issue #255 by @zzazzdzz:

- Check bounds when reading ELF program header sections.

- Skip reading ELF section headers if the string table pointer is NULL.

- Increase the buffer size for dissassembled instructions in the
  dissassembly view and pass the buffer size to the disArm() and
  disThumb() functions so that rudimentary bounds checking can be done.

Also add the constants WORK_RAM_SIZE and ROM_SIZE to reduce incidence of
magic numbers and make the code a bit cleaner.
2018-06-29 08:17:13 -07:00
retro-wertz ef8c89fce0 Libretro: Do not compile arm disassembly module
fix compile issue in windows
2018-06-28 15:15:18 -07:00
Rafael Kitover e4923e7267 fix save dialogs on Mac #268
In MainFrame::ShowModal, which is used as a wrapper for
wxDialog::ShowModal to also pause emulation, add the current window
style flags to the additional CAPTION and RESIZE_BORDER flags being set
with SetWindowStyle(), otherwise the other style flags of the window are
reset causing erroneous behavior such as save dialogs appearing as open
dialogs on Mac.
2018-06-26 04:38:38 -07:00
Rafael Kitover ed00dc77a9 use GetWindow()->Refresh() on non-GTK too #260
Default to GetWindow()->Refresh() to draw the game area on non-GTK
platforms as well, and only use the DrawArea(dc) method in GTK2 and
lower.
2018-06-18 10:20:29 -07:00
Rafael Kitover 89228b0697 fix high CPU usage under wxgtk2 #260
When using GTK2, call DrawArea(dc) instead of GetWindow()->Refresh(),
this prevents glib from using huge amounts of CPU (as discovered by
@retro-wertz .)

Switching video drivers sometimes crashes the app, the DrawArea() call
is as safe as possible, the problem is elsewhere.
2018-06-18 10:11:14 -07:00
Rafael Kitover d160321811 fix $ENV{WX_CONFIG} check yet again
The expansion must be quoted as "$ENV{WX_CONFIG}" when passed as a
parameter e.g. to if() otherwise it expands to no parameter when empty.
2018-06-18 08:29:14 -07:00
Rafael Kitover 0489756d4c fix $ENV{WX_CONFIG} check in 46f52941
Apparently in cmake empty env vars do not evaluate to false, use
explicit STREQUAL "".
2018-06-18 04:11:35 -07:00
Rafael Kitover 46f5294129 do not prefer wxgtk3 if $ENV{WX_CONFIG} is set
Skip the check for wx-config-gtk3 if the WX_CONFIG environment variable
is set, indicating that the user wants to override the version of wx to
build against.
2018-06-18 04:04:47 -07:00
Rafael Kitover 437b366e39 clean up wxgtk3 finding cmake code
Use a loop to check for wx-config-gtk4 then wx-config-gtk3 and unset the
config executable variable otherwise.

Also remove gl from the initial wx libraries list.
2018-06-18 03:46:30 -07:00
Rafael Kitover 2efcb620bd support and default to wxgtk3 not gtk2 on arch
Change installdeps to install wxgtk3 on arch instead of the wxgtk
package which uses gtk2.

Update the cmake code to check for the renamed wx-config executable
wx-config-gtk3 on arch, first checking for wx-config-gtk4 for the
future.
2018-06-18 02:44:19 -07:00
Rafael Kitover 430b5d638d fix Mac OS 10.13 build issues
Compile out the min/max functions in GBALink.cpp when compiling with
clang, clang does not like them because of some sort of changes in the
preprocessor.

Run the mac builder script with homebrew bash, system bash does not work
and dash no longer works.

TODO: fix dash compat
2018-06-17 16:01:40 -07:00
retro-wertz 9c85991773 Opps 2018-06-16 16:47:44 +08:00
retro-wertz 009c09ef4a GBA: Show log when rom uses SRAM of FLASH save types
Log should only show once during the first write to SRAM or FLASH address using flashSaveDecide()
2018-06-16 15:59:53 +08:00
retro-wertz 90bc79f299 Libretro: implement vbam logging using libretro logging api 2018-06-16 15:55:26 +08:00
retro-wertz f4b88ba63a Libretro: Remove GBA LCD filter
Libretro use shaders for filters etc.
2018-06-16 15:53:20 +08:00
retro-wertz 76389d8e94 RTC: Change this #ifdef to GBA_LOGGING 2018-06-16 15:17:12 +08:00
retro-wertz 710d2f3ebf UtilRetro: Remove LCD filter 2018-06-16 15:08:04 +08:00
retro-wertz e0fe836516 Makefile: Add option for sanitizer, add -DNO_DEBUGGER 2018-06-16 15:02:27 +08:00
retro-wertz 94d076760d Makefile: Remove sources we dont need 2018-06-16 15:00:47 +08:00
retro-wertz 50e91f7973 Remove unrelated function during rom load 2018-06-15 13:07:22 -04:00
retro-wertz 3c0e88bcdf Remove wrong #ifdef decleration
#ifdef __libretro__ is incorrect and function has worked fine without it.
2018-06-15 13:07:22 -04:00
retro-wertz 3791b0a07f Libretro: Fix samplerate not passed correctly to gba core 2018-06-14 12:16:37 -04:00
retro-wertz 3385be2578 Silence some warnings 2018-06-14 11:48:35 -04:00
retro-wertz 4d4819f055 Libretro: Add core options for Sound Interpolation and Filtering 2018-06-14 11:48:35 -04:00
retro-wertz 94f1102395 Libretro: Add core option to mute sound channels 2018-06-14 11:48:35 -04:00
retro-wertz bdb164bd1c
Set mirroringEnable to false
Set mirroring to false when rom loaded is not found in database. Making this true all the time causes some issue, for one with soft-patching some games.

Fix this https://github.com/visualboyadvance-m/visualboyadvance-m/issues/182
2018-06-14 20:04:20 +08:00
retro-wertz 17b681b864 ereader.cpp: Silence warning 2018-06-13 22:54:07 +08:00
retro-wertz 27fa30b43c Libretro: Disable cheats by default, update to bios loading
Minor rework on how bios is loaded when CPUInit is called, removes a few conditions.

Disable cheats by default. This is automatically re-enabled when enabling and applying cheats. Should save a few cycles during runtime if cheats are not needed.
2018-06-13 22:49:26 +08:00
retro-wertz 01c5f465fe Libretro: Cleanup controller layout binds 2018-06-13 22:39:25 +08:00
retro-wertz 319a4869c7 Libretro: Do not allow opposing directions 2018-06-13 21:19:59 +08:00
U-DESKTOP-UVBJEGH\Cloud 2c46522e59 Libretro: Add Solar Sensor 2018-06-11 16:46:17 +08:00
ZachBacon 037e3771b1
let's place these in the correct spot shall we? 2018-06-10 12:37:28 -04:00
ZachBacon 90d2f5c808 Added retro-wertz for his contributions in bringing in libretro back to speed and other things
Signed-off-by: ZachBacon <zachbacon@budgiemedia.rocks>
2018-06-09 12:04:42 -04:00
retro-wertz 991fc74922 Do this for GBA sound enhancements too 2018-06-09 21:42:04 +08:00
retro-wertz 4e4424e806 GB: Fix sound options not working
Fix crash when adjusting echo/stereo sliders.

Fix enhancements not working when selected

Fix settings not loaded at startup

Reviews and/or modifications are welcome. Obviously, im trying out if I understand how options are linked in WX so I am not quite sure if this is the right thing to do this.
2018-06-09 21:08:20 +08:00
Rafael Kitover abb62df6f3 pause on menu pulldown on windows only (FIXED)
Previous commit had an #ifndef when what was needed was an #ifdef.
2018-06-08 17:24:23 -04:00
Rafael Kitover cb3e9e3252 pause on menu pulldown on windows only
On Windows we still need to pause on menu pulldown until we figure out
how to keep the game running, with the code disabled it still pauses and
the audio loops.
2018-06-08 13:58:19 -04:00
U-DESKTOP-UVBJEGH\Cloud bc0e169d23 Add missing file 2018-06-08 23:05:23 +08:00
retro-wertz edf939e96b Gfx: Add #ifdef _MSC_VER, fix tiled rendering on windows
This only affects when using TILED_RENDERING
2018-06-08 21:21:57 +08:00
retro-wertz 57dc0c25ff Move gfxDrawTextScreen() into GBAGfx.cpp 2018-06-08 20:56:39 +08:00
retro-wertz 27aeb6dc67 Re-add Types.h, remove some more #ifdef 2018-06-08 20:14:45 +08:00
U-DESKTOP-UVBJEGH\Cloud 9ec142daa8 Add header guard 2018-06-08 17:45:10 +08:00
Rafael Kitover 7a194fb224 do not pause games when menus are pulled down
Previously I disabled this for mac because of bugs in keyboard handling,
but it turns out most people don't like the game pausing on menu
pulldown anyway, so now I disable it for all platforms.

TODO: the game still pauses for modal dialogs.
2018-06-08 04:14:34 -04:00
ZachBacon 6e18c3c2d4 exclude headers for now 2018-06-06 07:05:18 -04:00
Rafael Kitover 947cd10e2f minor OSD code cleanup
Use strdup instead of a stack variable + strncpy to convert the osd
wxString message to a C string, hopefully fixes an MSVC incompatiblity.
2018-06-06 06:57:34 -04:00
ZachBacon cafe905b6d Fix a cast for msvc compilers 2018-06-06 04:44:05 -04:00
retro-wertz 1606ea7482 libretro: Cleanup some #ifdefs 2018-06-06 16:20:32 +08:00
Zach Bacon 1d4dacc6f9
Merge pull request #244 from retro-wertz/fix_gba_cheats
Fix cheats not working in GBA
2018-06-05 21:50:22 -04:00
retro-wertz e2dff89dec Fix cheats not working in GBA 2018-06-06 09:35:23 +08:00
Zach Bacon a3510c906e
Merge pull request #243 from retro-wertz/fix_opcode
Fix some opcodes in arm
2018-06-05 21:34:54 -04:00
retro-wertz 9ab2ee6730 Fix some opcodes in arm 2018-06-06 07:48:18 +08:00
Zach Bacon a5e717a284
add brace so it doesn't break compilation
Phone editing is a no, but I didn't want to break compilation.
2018-06-05 11:14:47 -04:00
ZachBacon 4a615ab395 Gonna take my time and actually work on a D3D9 panel. Documentation here I come. 2018-06-05 10:13:41 -04:00
Zach Bacon fdb39a1c8f
Merge pull request #242 from retro-wertz/fix_alignments
Fix some formatting alignments in arm/thumb opcodes
2018-06-05 07:00:18 -04:00
retro-wertz 26c8c61b88 Fix some formatting alignments in arm/thumb opcodes 2018-06-05 18:43:32 +08:00
retro-wertz 8edd4ce5de libretro: Fix save types not properly set using overrides 2018-06-05 08:23:19 +08:00
retro-wertz 3411aa33a4 libretro: Use stdint.h instead in most cases 2018-06-05 00:14:06 +08:00
retro-wertz 1f20ba81ad libretro: Update 2018-06-04 23:55:08 +08:00
retro-wertz b0982ac8e1 Always apply map masks
fixes libretro issue where loading rom will only show white screen
2018-06-04 18:12:02 +08:00
retro-wertz ff4f1235aa libretro: Fix wrong file pointer 2018-06-04 18:03:33 +08:00
retro-wertz 8f6e5de50a libretro: Fix error : narrowing conversion 2018-06-04 18:01:58 +08:00
retro-wertz 8a1fd58783 libretro: Add header guard to UtilRetro.h 2018-06-04 17:59:29 +08:00
Rafael Kitover 85dea8a57b add cygwin cross build support
Put shared code for linux cross builds and cygwin cross builds into
builder/mingw-cross.sh .

Call wxrc when the build platform is cygwin with files resolved via
`cygpath -m` in case the wxrc is a native binary.

Add -fpermissive to CXX/OBJCXX flags.

Reenable libzvbi support for ffmpeg.

Stop building ffmpeg and related dists by default until we fix game
recording.

Set CMAKE_PREFIX_PATH in cmake args as a FILEPATH type variable.

Support xml catalog made with native libxml2 using cygpath in related
commands, make cygpath a noop on non-cygwin platforms.

Remove gdb and zip from msys2 deps.

Add a cygwin installdeps routine using a copy of cyg-apt that it
fetches.

When creating symlinks in install_dist() fully resolve all symlinks in
path parts for the source file, so that host and target binaries are
correctly linked.

When cp -af fails to preserve permission related data, fall back to cp
-rf.

When installing libs with a cross suffix, make a symlink for the lib
without the cross suffix.

Make sure cygwin runs with CYGWIN=winsymlinks:native .

Add paths to host gettext executables to cmake args, otherwise it tries
to use the target executables and fails on paths.

For the pkgconfig bundled glib, turn off win32 platform for the cygwin
host build.

For gettext, remove --disable-auto-import from link flags.

Compile target freetype on cygwin with cmake and manually install the
pkgconfig .pc file using sed.

Add a relocation type 'aggressive', when a dist is marked with this
type, rewrite all '/usr' prefixes to the build root. By default only
files that exist in the dist are matched and rewritten.

Fix regression in linux build by adding some iconv related flags to the
cmake invocation for doxygen and disabling -Werror for xorg dists.

When relocating scripts, use the actual resolved root path for host or
target.

Build libxslt --without-python so that it doesn't try to pick up the
msys2 python.

Other misc. minor tweaks and cleanups.
2018-05-01 04:11:57 -04:00
Rafael Kitover 8638c76923 require pkg-config in cmake for gtk checks #227
cmake reconfigure was failing for the gtk2 case because the pkg-config
cmake code was not being loaded.

Load pkg-config cmake code before any gtk checks.
2018-04-26 17:09:21 -04:00
Rafael Kitover d5f90f0a05 fix SDL sound on windows
In SoundSDL, when building on windows add this init code:

```
SDL_setenv("SDL_AUDIODRIVER", "directsound", true);
```

Otherwise there is no sound on windows.

Also update SDL to 2.0.8 from 2.0.7 in build scripts.
2018-04-16 13:10:12 -04:00
Rafael Kitover 70c8dee8bf cmake: default ENABLE_OPENAL to OFF
Since the SDL sound driver is now the default on all platforms, change
the ENABLE_OPENAL default in cmake to OFF.
2018-04-13 12:31:07 -04:00
Eleuin d992cfa214 Finalize vertical draw fixes and code cleanup
Fix shenanigans
2018-04-04 14:33:20 -04:00
Lucas 62e8098f5b Fix forbidden conversion in remote.cpp
Conversion from std::string to char* is forbidden in ISO C++.
2018-04-03 16:00:45 -04:00
Eleuin 80bcdab924 Fix draw height across rendering modes 2018-03-22 21:00:11 -04:00
Rafael Kitover f3f6ee7b1c fix compile errors with ffmpeg git
The FF_MIN_BUFFER_SIZE macro was renamed to AV_INPUT_BUFFER_MIN_SIZE at
some point, so check for the newer variant first.

The AVFMT_RAWPICTURE macro seems to be gone, but affected code was an
edge-case so compile it out if the macro is not present.
2018-03-19 19:36:00 -04:00
Eleuin d7a4eddb3c Fixed filter draw bounds 2018-03-15 10:00:26 -04:00
Rafael Kitover d5c9c6bac7 change default audio driver to SDL
A Linux user (Eleuin) has reported menu lockups with the default OpenAL
(probably thread related) and no lockups with SDL.

A Windows user has reported popping noises with all audio drivers except
SDL (#178).

Change the audio driver default to SDL for the time being until these
issues can be looked into.
2018-02-28 17:53:55 -05:00
Eleuin 480541a205 Modify max_threads sanity check to better handle erroneous values 2018-02-28 17:18:52 -05:00
ZachBacon c7c6ad6a87
implemented the fix from nhdailey, should resolve #153. Will put up a
test build soon.
2018-02-25 13:38:25 -05:00
Rafael Kitover 66980934b2 add multi-platform build system
under `tools/` add some scripts to invoke the build system to build all
deps for vbam and vbam itself:

- `tools/linux/builder`

This builds a mostly static linux binary with a few dynamic deps for
xorg and wayland. Using gtk3. This will run on just about any dist.

- `tools/osx/builder`

Builds a static mac app targetting 10.7.

- `tools/win/linux-cross-builder`

Builds a static windows binary using the mingw-w64 toolchain.

- `tools/win/msys2-builder`

Builds a static windows binary in the MSYS2 environment, this may be
suffering from a few regressions.

Change some cmake code to support the build system, refactor a few
things in it.
2018-02-24 14:39:29 -05:00
orbea 3e052c943d cmake: Fix -DENABLE_FFMPEG=OFF 2018-01-18 13:18:35 -08:00
Rafael Kitover 420450255c mac build/builder improvements
Improve, refactor and clean up `tools/osx/builder` to build a relatively
full-featured ffmpeg as well. This requires lots of other dists. It's
kind of like a mini port system now. Will generalize it shortly to a
sourced library for using with both the mac and the mingw builds. Will
hopefully become a separate repo on github at some point.

Add perl dist support to the builder.

Add an `--env` flag to the builder to print the build environment
variables so that they can be read in with `eval` for debugging
purposes.

Also add the `FFMPEG_STATIC` cmake option to link static ffmpeg
libraries correctly.

Move the codesigning and zipping of the `.app` bundle to the builder
script and out of cmake, as this is something most users don't need.
2017-10-22 15:35:56 -07:00
Rafael Kitover afb1cd3dfc automate codesign/zip for mac build, add xz dep
Add POST_BUILD commands on Mac to codesign the `.app` and make a zip
file from it.

Also add xz/liblzma dist to `tools/osx/builder` because something
apparently wants liblzma.
2017-10-12 14:56:21 -07:00
Rafael Kitover d7ff2afb80 add mac release builder script
Add `tools/osx/builder`, a POSIX sh script to build all dependant
libraries as static, targetted to OS X 10.7, and build the project with
them (also targetted to OS X 10.7.)

ffmpeg currently does not link, as recording functionality is currently
non-functional anyway, this will be fixed later.

MISC:

- set WORKING_DIRECTORY and ERROR_QUIET for all git commands, for the
  cases when the build directory is not under the git checkout

- #include <cerrno> in ConfigManager.cpp as it uses errno

- change `build*` in `.gitignore` to `build/*` so that files starting
  with "build" are not affected
2017-10-12 01:32:18 -07:00
Rafael Kitover f5379ab806 read version and subversion info from Git
To get the version, find the last tag in git tag of the form "v2.0.0" or
"2.0.0". If this is the last tag and the current commit matches the ref
of this tag, the revision will be empty.

In the case that the current commit is not tagged with a version, to get
the revision, use the short sha unless the current commit is tagged with
something that is not a version string, e.g.  "feature-foo", in which
case the revision will be "feature-foo".

If the current commit is tagged as e.g. "v2.0.1-foo" or "2.0.1-foo" then
the version will be "2.0.1" and the revision will be "foo". Tags of this
form are also checked when finding the current version.

This is all done in cmake. If there is no git detected, the version will
be "2.0.0" and the revision will be "unknown".
2017-10-07 14:00:47 -07:00
Rafael Kitover 1fc0966384 minor code cleanup
Change one instance of a dummy local variable to a C++11 temporary via
CLASS{param}.
2017-09-23 15:29:35 -07:00
Rafael Kitover e9a86c541d fix deadlock in SoundSDL::deinit() #139 #130
On SoundSDL destructor and `reset()`, there was a deadlock with Linux
pthreads, it happened sometimes that the reader thread would call
`SDL_SemWait(data_available)` while `deinit()` would destroy the
semaphore and the `SDL_SemWait()` would end up waiting forever on a null
semaphore.

Change the sequencing of deinit() to prevent this from happening, set
`initialized = false` at the beginning of the sequence to prevent
subsequent entries into the reader callback, and add an SDL_Delay(100)
between the final `SDL_SemPost()` and `SDL_UnlockMutex()`s and the
`SDL_DestroySemaphore()` and `SDL_DestroyMutex()`s to allow a running
reader to complete with a valid mutex and semaphores before they are
destroyed and the thread is joined.

Resetting the sound system also sometimes triggers a memory corruption
bug, but that's a separate issue.
2017-09-21 15:39:30 -07:00
Rafael Kitover 3d792457b2 fix huge app icon in Win volume settings #149 #121
We were setting the app icon based on the 256x256 xpm icon in the xrc,
and this triggered a bug where the app-specific icon in Windows volume
settings was huge:

https://stackoverflow.com/questions/17949693/windows-volume-mixer-icon-size-is-too-large/46310786#46310786

Adapt the code from that SO question to use Windows-specific code to
load and scale the icon appropriately using a Vista+ API, and fall back
to the normal Wx icon loading mechanism on XP.

Also generate a nice new `vbam.ico` Windows icon file based on the
`.svg` using the app from:

https://iconverticons.com
2017-09-19 16:28:23 -07:00
Rafael Kitover 268c638456 improve win32 dependencies git submodule handling
Use `git submodule update --remote --recursive` instead of `git
submodule update --init --recursive` so that the latest version of the
repo is always installed.

Run the command from cmake instead of throwing an error if the submodule
is not checked out. Only throw an error if the checkout failed or the
source tree is not a git checkout.

Don't add the `mingw-xaudio` include directory if using MSVC.

Remove the submodule check from src/wx/CMakeLists.txt, having it in the
main CMakeLists.txt is enough.
2017-09-19 06:11:41 -07:00
Rafael Kitover 7f1fec88af work around gcc lto wrappers bug with gcc 7.x
gcc lto wrapper commands such as `gcc-ar` will segfault with some
versions of gcc 7.x when called via an absolute path, see:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80717

Generalize the mechanism for compiling a small C program on the host
(currently used for bin2c for Wx resources) and use it to wrap the gcc
wrappers in a little executable that prepends their dirname to PATH and
runs them with `execvp()`.

Make LTO default to ON again, except on win32 with gcc < 7, because
those toolchains produce broken binaries with LTO enabled.

Also add `-ffat-lto-objects` to compiler flags for gcc when LTO is
enabled, this will increase the chances that the LTO build will succeed
even if there are issues with the binutils wrappers. Clang does not
support this.
2017-09-16 19:47:39 -07:00
Rafael Kitover 02b3defcd0 restore wx 2.8 compat, improve string processing
Fix building with wx 2.8 by rewriting some more string related code.

Replace all calls to .c_str() with .mb_str().

Remove some of the .c_str()/.mb_str() calls where the target is already
wxString.

Move the split()/enum_idx() functions from opts.cpp into
str_split()/vec_find() in strutils.h/strutils.cpp for use in other
files.

Replace the C-style string parsing code in a couple of places in
wxvbam.cpp for processing possible command line options by splitting on
'='.

Also replace a couple of places that use pointer arithmetic in
widgets/joyedit.cpp and widgets/keyedit.cpp with wxString methods.
2017-09-13 05:32:44 -07:00
Rafael Kitover fa9afa4e18 cmake: wx and cross compiling fixes
When calling find_package(wxWidgets ...) allow the first call to fail
because the OpenGL library may not be found. A subsequent call without
listing the OpenGL library is done with REQUIRED.

And if the OpenGL library is not found, skip the OpenGL compile test.

When cross-compiling (e.g. with mxe or other mingw packages) skip the wx
ABI compatibility run tests.

When choosing which minhook lib to link to the wx ABI compat run test
program, check for 64 bit but fallback to 32 bit just in case.
2017-09-12 15:31:49 -07:00
Rafael Kitover f5cb7b2b40 support Wx built with --enable-stl #134
When Wx is built with --enable-stl, wxString to wxChar*/char* implicit
conversions and vice-versa no longer work.

Change all wxChar* data members to wxString and change all pointer
arithmetic code (mostly in opts.cpp, cmdevents.cpp and
widgets/joyedit.cpp) to use wxString methods instead.

Also make mostly minor changes in various other files for all of this to
work.
2017-09-10 15:44:18 -07:00
Rafael Kitover 142dbc0aca cmake: use arch specific minhook trampoline libs
Use either the 32 bit or 64 bit MinHook trampoline static lib for the Wx
ABI tests, depending on the detected arch of the host/target.
2017-09-10 12:24:36 -07:00
Rafael Kitover de95c70547 fix Wx ABI check for Win32/MinGW
Fix error dialog boxes popping up when the Wx ABI compat tests are run
from cmake.

Wx 3.x is hardcoded to use MessageBox for wxLogFatalError(), even in a
console app, so use the minhook trampoline lib (added to dependencies)
to hook the Win32 API MessageBoxW and MessageBoxA (the second just in
case) so that no error dialogs pop up.

Details here:

https://www.codeproject.com/Articles/44326/MinHook-The-Minimalistic-x-x-API-Hooking-Libra
2017-09-10 11:00:24 -07:00
Rafael Kitover 42f6c446ea minor improvements for Wx compile tests
Include `wx/wxprec.h` (precompiled header first in test programs to
possibly make the tests slightly faster.

For the ABI compat check, set a variable for the test program instead of
listing it twice.
2017-09-08 08:59:19 -07:00
Rafael Kitover ceef480e70 improve wx GCC ABI check #142
Following some suggestions from @ArtiiP, first check if there are no
issues without an -fabi-version flag, and then instead of incrementing
from 0, decrement from 15 to find the highest working ABI version.

This is very slow if the needed ABI version is 2 for example, but not
much to do about that for the time being.
2017-09-04 12:28:24 -07:00
Rafael Kitover b1937fe9cb improve Wx GCC ABI check #142
Start checking the ABI version at -fabi-version=0, which is the default,
and if that succeeds don't set the flag at all.

This will allow the code to work properly if and when Wx removes the ABI
check alltogether.
2017-09-02 18:52:01 -07:00
Rafael Kitover 2ad204619b compile/run test to detect Wx ABI version #142
In 4e665ae I hardcoded -fabi-version=2 for g++ flags, and @ArtiiP
pointed out that this is wrong, because Wx may be compiled with other
ABI versions.

Add cmake check_cxx_source_runs() tests to determine the correct ABI
version flag to use with Wx.
2017-09-01 21:51:24 -07:00
Zach Bacon 350619be93 Merge branch 'master' of https://github.com/visualboyadvance-m/visualboyadvance-m 2017-08-27 22:02:03 -04:00
Zach Bacon c6d8939304 Made a tiny, itty bitty, little accident. Forgot to remove cairo option
from the xrc.
2017-08-27 22:01:19 -04:00
Rafael Kitover e0f79f32a5 remove version.h in ConfigManager and AutoBuild.h
ConfigManager does not use any version info, but is part of libvbamcore,
so removing the `#include` makes rebuilds after git changes much much
faster.

Remove the AutoBuild.h includes from ConfigManager.cpp and SDL.cpp (the
SDL port) because the information in that file does not seem to be used
and it also includes version.h, forcing those files to rebuild
unnecessarily.
2017-08-27 13:32:13 -07:00
Rafael Kitover 2179215a8b fix rebuilds on git changes
Use cmake to generate the version.h from version.h.in which is a cleaned
up version of the old version.h with the git short sha into the build
directory, and include the version.h from there.

Continue to use the GetGitRevisionDescription plugin to make the cmake
configuration state depend on the current sha of HEAD, but throw away
the results (for the time being.)

This makes rebuilds after git changes such as a commit only recompile a
couple of files instead of the whole tree.
2017-08-27 13:20:17 -07:00
Zach Bacon 1583a226f4 *Removal of the cairo renderer, it never performed well to begin with. 2017-08-27 13:11:34 -04:00
Rafael Kitover 1a8f2f9886 "no throttle" fixes/cleanups
`throttle == 0` is supposed to emulate at full speed and drop audio
data, this is different from `throttle == 100` which is emulation
throttled at normal speed, the default setting.

Fix the recently rewritten SoundSDL sound driver to make `throttle == 0`
work, and make some minor changes to clean up the relevant code in the
XAudio2 sound driver.
2017-08-27 07:21:27 -07:00
Rafael Kitover 1e3a85a34b cleanup SoundSDL #139 #130 #97 #67 #65 #46 #47
Rewrite SoundSDL (the SDL sound driver).

Clean up the code and eliminate all deadlocks/hangs/crashes (hopefully.)

Many of the deadlocks were caused by initialize() not de-initializing
properly and causing the audio callback thread to deadlock, fix this.

Also use better logic for the semaphore controls, which will also
hopefully increase audio quality.

Use better logic for the throttle control, with throttle == 0 being the
same as throttle == 100 and implement setThrottle().

Also increase the buffer size to 300ms and the number of samples to
2048, for hopefully less choppiness in audio overall.
2017-08-17 02:44:40 -07:00
Rafael Kitover f88faef1b2 SoundSDL: write silence when paused #139
The SDL API documentation for the audio callback specifies that the
callback *MUST* write to the buffer and not just return:

https://wiki.libsdl.org/SDL_AudioSpec#Remarks

write silence to the buffer (value taken from the AudioSpec returned
from OpenAudioDevice) when the emulator is paused.
2017-08-16 15:20:05 -07:00
Rafael Kitover 4d7e102e26 hopefully fix resize artifacts on game panel #138
Paint the whole GameArea (containing the emulator graphics panel) black
on size events for both the GameArea and the panel.

This will hopefully fix reports of garbage around the panel when going
full screen with the OpenGL driver on Linux.
2017-08-16 04:02:12 -07:00
Rafael Kitover 346d97a760 remove default F11 keybinding for save state #137
Remove F11 as the default key for save state (GS=) in the defkeys array
in opts.cpp and leave it unmapped by default, because it conflicts with
the menu XRC mapping for full screen which is also F11 on non-macOS
platforms.
2017-08-16 03:36:18 -07:00
Rafael Kitover 5e9c9093c0 SoundSDL: lock conditional code cleanup
Move the `bool lock` condition used to wait for sound data to be
exhausted from two places in the code into the `bool should_wait()`
member function.
2017-08-16 03:20:10 -07:00
Rafael Kitover 03a20820cb temp fix for deadlocks in SoundSDL on pause #139
SDL_PauseAudioDevice seems to be causing thread deadlocks in combination
with Wx threads (e.g. on menu activation or modal dialogs.)

Remove these calls from SoundSDL::pause() and SoundSDL::resume() for the
time being so that deadlocks do not happen.

This effectively allows pausing, but on resume there is no sound for 2-3
seconds until the buffer is filled again.

This will need a proper fix at a later time.
2017-08-15 15:30:27 -07:00
Rafael Kitover fb15aed223 fix memory viewer xrc on wx 3.1+ #127
Remove the wxALIGN_CENTRE_VERTICAL flag from items that have the
wxEXPAND flag in the MemViewer.xrc because wx 3.1+ warns about the flags
being incompatible.
2017-08-09 03:03:56 -07:00
Avindra Goolcharan 0bdbcf3188 SUSE Lint: fix a few classes of warnings #136
- drop unused variables

- unused-but-set-variable

- stray trailing comments

- in viewsupt.cpp replace redundant expression with variable that holds the same value
2017-08-08 20:05:38 -07:00
Avindra Goolcharan dd91abf72e fix errors reported by SUSE's post-build linter
In StartRFUSocket() in gba/GBALink.cpp move a postincrement out of an
expression to a following statement, because the evaluation order is
undefined.

In GetDevices() in wx/openal.cpp replace an #else with an #endif so that
the function has a default return statement visible to the linter.

In FilterThread::Entry() add a `return 0;` (ExitCode) statement at the
end even though it is probably never reached.

In the TransferToWindow() for the positive double validator widget in
wx/widgets/wxmisc.cpp add a default `return true;`, for the rare case
there is no double value, in which case the string representation would
be displayed (since it is a subclass of wxGenericValidator(wxString&) .)
2017-08-07 20:31:08 -07:00
Rafael Kitover c99a58faee fix a memory leak due to wrong syntax
In C++ arrays are deleted with `delete[]` and not `delete`.
2017-08-03 16:29:37 -07:00
Rafael Kitover 783475bf39 switch to cmake module GNUInstallDirs #116
See:

https://cmake.org/cmake/help/v2.8.12/cmake.html#module:GNUInstallDirs

Use these variables to set all installation paths.

Add link and note about module to README.md .
2017-05-24 04:25:45 -07:00
kwkam 7405efef5f wx/wxvbam: fix GetAbsolutePath
Makes battery/state directory setting work when set as relative path
2017-05-12 20:40:37 +08:00
Zach Bacon e95c083466 this should fix the windows build 2017-05-11 22:13:11 -04:00
Zach Bacon dd34951d2f Windows doesn't have sterror_r 2017-05-11 21:34:18 -04:00
Rafael Kitover fed6f2389e Add #include <cmath> for std::ceil() #113
A couple files that use the std::ceil() math ceiling function were not
including the required header <cmath> and this seemed to have been
causing build errors on some Linux distributions.

Add the necessary #include <cmath> statement to both files.
2017-05-05 10:21:03 -07:00
Rafael Kitover 01dd7cef45 fix portability issue with strerror_r()
If _GNU_SOURCE is defined on linux, then strerror_r() is an alternate,
non-POSIX version.

Undefine _GNU_SOURCE when including <string.h> in ConfigManager.cpp to
get the POSIX version of strerror_r(), and initialize the error string
buffer to "unknown error" so that the code does not crash whichever
version of the library function is being used, or strerror_r() fails for
some reason.
2017-04-27 13:16:16 -07:00
Rafael Kitover 05555a23a8 SDL: fix deflt bat saving, improve dir checking
By default the SDL port tried to save the battery to a nonexistant
directory in saveDir, because if (saveDir) {...} evaluted to true since
saveDir was a non-NULL pointer but empty.

Change sdlCheckDirectory to return a bool indicating if the directory is
good or not, and if not set screenShotDir, saveDir and batteryDir to
NULL so that code that checks for their existance works correctly.
2017-04-27 08:52:14 -07:00
Rafael Kitover 02a1e38e6c SDL: improve error msg for unwritable config #105
Following up on 1ba2eef which fixed a crash caused by trying to write to
a NULL FILE* due to fopen() failure: write the error message to stderr
instead of trace.log and show the OS error using strerror_r().
2017-04-27 08:46:03 -07:00
Rafael Kitover cab6f0f026 delete memory in common/array.h on destruction
Hopefully fix a memory leak in common/array.h by adding a destructor
that does a delete on the underlying array if it was previously
allocated.
2017-04-27 08:35:25 -07:00
Christopher Snowhill a5ebd8d2b4 Merge pull request #109 from condret/elf-parser-security
fix some potential buffer-overflows
2017-04-23 13:45:48 -07:00
condret a9b1251b88 fix some potential buffer-overflows 2017-04-23 22:28:17 +00:00
condret 63b0760329 hotfix for potential buffer-overflow 2017-04-23 22:07:28 +00:00
condret d3b459ba0d fix gameboy header-detection in libretro interface 2017-04-23 21:54:56 +00:00
Jeremy Newton 1ba2eefebe Fix glibc crash: add log message on fopen failure
glibc's fclose implementation does not do a NULL check and will crash on "fclose(NULL)". A bunch of Fedora users have been sending in traces for this issue. I've added a log on failure case, likely if the user does not have permission to write to the file.
2017-04-17 12:04:07 -07:00
Rafael Kitover 247e584fe0 better fix for clipped video in GL fullscreen #89
In d1918c12 I manually sent a SIZE event to the DrawingPanel after
calling Layout() in the setup code in OnIdle().

But the obvious problem is that the ->Connect() calls to set up the
event handlers, including SIZE, are after all the setup code including
the Layout().

Move the ->Connect() calls to the top of the setup code and remove the
manual SIZE event sending. This is a much better solution that for some
reason I didn't notice at the time.

Tested to also fix the problem.
2017-04-04 13:30:56 -07:00
Zach Bacon b217f8b40b Oops, forgot Unices etc are case sensitive. 2017-03-25 07:23:30 -05:00
Rafael Kitover 5d4ce82d54 make bins built with asm disable exec stack #98
Add the `section .note.GNU-stack` markers to .asm files built with nasm
to make sure the final executables do not have an executable stack.

This is described here:

https://wiki.gentoo.org/wiki/Hardened/GNU_stack_quickstart
2017-03-25 03:58:30 -07:00
Zach Bacon 9324318373 Working on getting libretro updated 2017-03-24 07:59:10 -04:00
Zach Bacon fec17c7900 libretro: this should solve the configmanager stuff and libretro 2017-03-23 22:14:38 -04:00
Zach Bacon 93bb1d3417 Merge branch 'master' of https://github.com/visualboyadvance-m/visualboyadvance-m 2017-03-23 22:05:07 -04:00
Rafael Kitover 41ead88dcb 32 bit cross compiling support on Linux
Add the `m32` parameter to ./installdeps to fetch 32 bit multilib
dependencies on Fedora, Arch and Solus linuxes and add a cmake toolchain
file to build with them.

For MSYS2 support both an `m32` and an `m64` to choose deps for 32 bit
or 64 bit mingw targets.

Adjust build instructions from ./installdeps to support both usages.

Other changes:

- use --nogpgcheck --best --allowerasing for dnf invocations for Fedora,
  the --nogpgcheck is necessary when Rawhide is confused about which
  keys it has, and the latter two are needed for upgrades that remove
  unneeded deps etc

- when finding GTK2, first try using pkg-config, and only fall back to
  the cmake script when that fails, pkg-config works better for cross
  builds

- add cairo to dep lists in ./installdeps for the time being

- for arch, list individual packages from base-devel instead of
  base-devel that do not require gcc-libs because of potential conflicts
  between gcc and gcc-multilib
2017-03-23 14:09:17 -07:00
Zach Bacon 105bbba888 Almost there, just a few more blocks to go. 2017-03-21 21:52:28 -04:00
Rafael Kitover e1c1a5c95f fix src/filters/2xSaImmx.asm linking issues #98
Because of how asm subroutines are linked to C/C++ programs,
src/filters/2xSaImmx.asm had an %ifdef __DJGPP__ (the DOS port of gcc)
with the subroutine names prepended with an extra underscore.

In 902a7a7e I removed the %ifdef and just kept the extra underscore for
all symbols, and this worked fine until #98 where some version of Fedora
did not like that and would not link the code.

So adopt the behavior of the other asm filters, which have a NEWSYM
macro that defines the symbol name both with and without the extra
underscore, by listing the symbol twice, both with and without the extra
underscore, this is confirmed to fix the linking issue on that Fedora
build host.
2017-03-18 18:44:39 -07:00
Rafael Kitover 82c8a1e3fa fix linux build broken in 687c08a
Stop saving and restoring the CMAKE_REQUIRED_* variables for the compile
test, because the subsequent Wx header symbol tests need them set up for
Wx support as well.

Also --param foo=bar needs to be a single string in the list of compiler
flags, or cmake can misinterpret the second part as a library when it is
passed to libraries/link-options.
2017-03-10 06:38:50 -08:00
Zach Bacon 145f6d433c Some debian stuff, I honestly don't like debian packaging... but it's important for some people 2017-03-09 04:06:25 -05:00
Rafael Kitover 687c08a051 pass all compiler/linker flags for compile test
When determining gcc/clang flags, save resulting C flags as MY_C_FLAGS,
C++ flags as MY_CXX_FLAGS, and linker flags as MY_C_LINKER_FLAGS, then
use them in the Wx OpenGL compile test.

This fixes the test erroneously failing on git mxe on mac.

Also, don't use -fPIC on Win32, set Wx defines separately from the test,
and save all CMAKE_REQUIRED_* variables before the test and restore them
afterwards.
2017-03-07 16:15:02 -08:00
Zach Bacon 78cd223827 changed the throttle for sdl config example 2017-03-07 06:48:41 -05:00
Rafael Kitover d1b4abc85a fix sound in SDL port/ConfigManager
Since we are using sound frequency to control game speed, not quality,
change ConfigManager to default to a frequency of 44100 instead of
22050.

This also fixes trace.log files showing up with "unknown sound quality"
warnings.
2017-03-06 04:26:33 -08:00
Rafael Kitover 05610d84f6 fix linking OpenAL statically on Win32/MXE
Add the necessary AL_LIBTYPE_STATIC define for MXE and non-msys2 win32
builds so that OpenAL can be linked statically without errors.
2017-03-05 11:47:32 -08:00
Rafael Kitover 7b85964eb6 full throttle support + snd driver improvements
Support throttle in all sound drivers: SDL, openal, dsound and xaudio.

Link OpenAL at compile time instead of runtime.

Minor improvement on 891f17d6, which added throttle support to SoundSDL
and made it actually work more often and crash less: check that throttle
is non-zero before scaling the frequency.

For dsound, add the CTRLFREQUENCY capability to buffers and call
SetFrequency on the secondary buffer in setThrottle().

For OpenAL, set AL_PITCH on the source to throttle / 100.0 in
setThrottle() and remove all dynamic library loading stuff.

For xaudio, 441e6c9e allows throttle to work, and is also necessary for
these changes to dsound and openal.
2017-03-05 08:43:25 -08:00
Mystro256 891f17d62f Fixes for SDL throttle
- Throttle should be set on init
- SDL auido device was not being correctly closed on throttle change
2017-03-05 05:32:34 -08:00
Zach Bacon 8fcc32eeeb Merge pull request #93 from Mystro256/master
Fix incorrect bug tracker link
2017-03-05 03:16:53 -05:00
Mystro256 093bc40074 Fix incorrect bug tracker link
Clicking "Report Bugs" goes to SF instead of github
2017-03-05 01:56:31 -05:00
Rafael Kitover 441e6c9e0e fix setting throttle on LoadGame()
Move the soundSetThrottle() calls after the soundSetSampleRate() calls
in LoadGame(), because the core calls soundInit() again after
soundSetSampleRate() wiping out the throttle value. This allows the
throttle setting to work with xaudio on startup and game loads.

TODO: the throttle config setting only works correctly for the xaudio
driver at the moment, it needs to be implemented for other sound drivers
and eventually moved out of the sound drivers altogether.
2017-03-04 21:53:35 -08:00
Rafael Kitover 88d15c6ec8 partial fix for disabling pausing when linked #83
Check if link mode is active in GameArea::Pause() and refuse to pause if
it is.

Remove the check for the app not having focus with pauseWhenInactive
enabled in GameArea::OnIdle() as this is now handled in
MainFrame::OnActivate() (which receives focus events) since f10e2e99.

Revert 13f5afa9 which tried to check for link status in
MainFrame::MenuPopped() because it was completely wrong and the link
check is better done in GameArea::Pause().
2017-03-04 21:16:14 -08:00
Rafael Kitover d1918c12f4 fix clipped game area in GL fullscreen #89
Trigger OnSize in the drawing panel after setting the geometry and
calling Layout(). I'm not sure what exactly broke but this seems to fix
the issue for the time being.

Also do a bit of very minor refactoring, change some calls to GetSize()
to GetClientSize() and simplify GLDrawingPanel::OnSize(ev&), tested to
work fine in wx 2.8.
2017-02-28 17:16:46 -08:00
Mystro256 fa1e13e606 Use prefix add operator for non-prim types
Typically yields better or equal performance. Sometimes compilers don't
optimizer out keeping the previous values (not needed for only adding 1)
2017-02-28 15:04:56 -08:00
Mystro256 7c06968557 Typo, only 10 recent accels 2017-02-28 15:04:56 -08:00
Zach Bacon f145d6ab0e Still working on libretro stuff, working on cheatsenabled compile issue now. 2017-02-25 00:55:29 -05:00
Zach Bacon a8a48919db Fixes build on the libretro side by wrapping an ifndef statement around rederedframes 2017-02-25 00:38:06 -05:00
Rafael Kitover 4d12fcda10 fix Mac linker script for @rpath libs (like SFML)
Homebrew SFML links itself with @rpath/ instead of the dylib path,
update the mac linking and bundling script to handle that case, also
move it from src/wx/tools/osx to tools/osx now that wx is the primary
port.

This fix is temporary and I will write a better one that takes
DYLD_LIBRARY_PATH and such into account, but will suffice for linking
Homebrew libs for now. The script needs more work in general.
2017-02-24 12:24:20 -08:00
n-a-c-h 931fda459a Fix case where buffer is filled to capacity and becoming empty. There always needs to be an extra entry as a separator between the write and the read. 2017-02-22 03:39:57 +02:00
Rafael Kitover 095b48aabf minor fix for Ubuntu 14 (cmake)
Check that the CMAKE_VERSION is 3.0 or greater when setting the CMP0043
policy to NEW. The Ubuntu 14 cmake which is 2.8.12 throws an unknown
policy error otherwise.
2017-02-21 16:47:31 -08:00
n-a-c-h 3e0f5d89ba Rewrite of ringbuffer, and updated copyright file for Debian. 2017-02-22 02:03:21 +02:00
n-a-c-h e923015d45 Remove copyright header from ZSNES since it annoys some people. The original version in ZSNES including the entire 1.4x version was GPL2+. The changes since then are mine, and I licensed it as GPL2 only for ZSNES 1.5x. I have no issue with VBA-M distributing this as GPL2+. 2017-02-22 01:05:35 +02:00
Rafael Kitover 6a7d49419c initial Wayland support #72 #76
Disable OpenGL support under Wayland because wxGLCanvas segfaults, and
fix an issue with drawn frames not appearing.

If the user has opengl as the render method in their config, it will not
be changed, but at runtime will be set to simple under Wayland.

To fix the issue with frames not being drawn, Call Refresh() to queue a
PaintEv from DrawArea(data) instead of calling DrawArea(device_context)
directly.

Also remove the DrawOSD() call from PaintEv, this was causing the OSD to
sometimes show up twice in one frame, because DrawArea(data) draws the
OSD directly on the frame data.

Add new files wayland.cpp and wayland.h with a bool IsItWayland() global
function. This uses a GDK (part of GTK) call to detect Wayland.  This
unfortunately requires linking GTK libs separately.

Add cmake code to detect the version of GTK used by the wx being linked
and link it as well. Add gtk2 and gtk3 dev packages to the code for the
supported linux dists in ./installdeps.
2017-02-20 13:20:09 -08:00
Rafael Kitover 13f5afa9c5 don't pause on menu open when link active #83
In the MenuPopped method (which received MENU_OPEN, MENU_CLOSE and
MENU_HIGHLIGHT) check that gba_joybus_active is not true before pausing
the emulator, so that if Link mode is on it will not pause.
2017-02-19 10:39:46 -08:00
Rafael Kitover 99c6c4f938 Merge pull request #74 from Mystro256/gccwarnings
- fix C++ only flags being used for C

- check if cheats/patches files load correctly
2017-02-13 01:26:22 -08:00