Commit Graph

1967 Commits

Author SHA1 Message Date
Zach Bacon c0f8a8a335 Resolves undefined issues, just doesn't fix using libretro... yet. 2016-11-17 19:29:10 -05:00
Zach Bacon 7c23a38147 Merge pull request #41 from rkitover/msys2_build
msys2 build improvements
2016-11-14 15:27:58 -05:00
Rafael Kitover 3c30d59aba msys2 build improvements
* Enable ffmpeg by default only on linux and msys2, it will be disabled
for normal windows builds and on mac.

* Set SFML_STATIC_LIBRARIES only for normal non-msys2 windows builds,
because msys2 does not currently have static versions of the SFML
sub-libraries, e.g. system, network, etc.. Dynamic linking works fine
for now.

* Fix quoting for -DLOCALEDIR, on windows spaces were causing errors in
make on msys2.

* Update to upstream FindSFML.cmake .

* Add an ./installdeps-msys2 script to install all necessary tools and
libraries on msys2 for building both 64 and 32 bit windows Wx binaries.

* Add the dependencies/mingw-xaudio/include directory to
INCLUDE_DIRECTORIES so that XAudio compiles on msys2, as mingw-w64 does
not currently have XAudio headers. Also check that the user pulled the
git submodule in the process (the ./installdeps-msys2 script does this
for you.)

TODO:

* Generalize ./installdeps to work on more platforms.

* Make console Wx app in debug mode so that debug prints will work.

* Fix game keyboard input for msys2 builds.

* Add HiDPI support for Windows.

* Fix the -D*DIR defines to have the correct paths on windows.
2016-11-14 10:56:50 -08:00
Zach Bacon 39360b88d8 Merge pull request #40 from rkitover/bin2c
enormous speedup for compiling Wx resources
2016-11-13 17:48:10 -05:00
Rafael Kitover 10fd7f926e enormous speedup for compiling Wx resources
Replace bin2c.cmake script with one written in C and compiled as an
intermediate target.

The C version is roughly 12000 times faster.

On msys2, the cmake version takes 7.5 minutes on this system, while the
C version takes 0.037 seconds.
2016-11-13 14:31:34 -08:00
Zach Bacon 1dc4ab845a Merge pull request #39 from atsampson/master
SFML is required for link support.
2016-11-10 07:26:28 -05:00
Adam Sampson 4bf4248985 SFML is required for link support. 2016-11-10 11:39:45 +00:00
Zach Bacon 0d6b94afb7 Slow fix of libretro interface 2016-11-10 00:40:22 -05:00
Zach Bacon 9e0c8cec8b Fix compiling d3d 2016-11-08 09:15:52 -05:00
Zach Bacon a2f5d1338e Merge pull request #38 from rkitover/master
fix wx GL viewport + build improvements
2016-11-08 08:08:36 -05:00
Rafael Kitover 30f80ab22b fix wx GL viewport + build improvements
Add GetRealPixelClientSize() method to HiDPIAware and implement using
wx GetClientSize() in panel.cpp for the generic version, and using
convertSizeToBacking: in macsupport.mm .

Add an AdjustViewport() method to GLDrawingPanel that sets glViewport()
using GetRealPixelClientSize(), and call it for the SIZE event. Debug
print the viewport size here instead of in DrawingPanelInit().

Build improvements:

* default to Cairo off for all platforms, currently libcairo2-dev does
  not install on Ubuntu

* default to ON for ENABLE_LINK and ENABLE_FFMPEG (for game recording),
  this will allow for more fully-featured default builds

* do not set SFML_STATIC_LIBRARIES on Mac because this is currently
  broken

* fix the Mac bundling/linking script to deal with links in dependent
  libs that already use @rpath (very minor change.)
2016-11-08 04:51:26 -08:00
Christopher Snowhill 63b086af20 Merge pull request #37 from rkitover/wx_accels_with_modifiers_fix
fix wx kbd accels that are game key + modifier
2016-11-06 15:42:29 -08:00
Christopher Snowhill f0e8c94c9c Merge pull request #36 from rkitover/cmake_xcode_support
fix Xcode project generation via cmake
2016-11-06 15:41:23 -08:00
Rafael Kitover 491cef4872 fix wx kbd accels that are game key + modifier
Pass the keyboard modifiers to process_key_press so that it only
registers a game key if the modifiers match. That is, if e.g. ENTER is a
game key, then ALT+ENTER gets passed to other Wx controls and does not
register as a game key.
2016-11-06 14:48:05 -08:00
Rafael Kitover 981026dc80 fix Xcode project generation via cmake
Move Objective-C++ Mac code for Wx into macsupport.mm with stub methods
in panel.cpp, and stop compiling all C++ as Objective-C++.

cmake -G Xcode # now works fine
2016-11-06 14:09:50 -08:00
Zach Bacon 24e2b0ba81 Merge pull request #35 from rkitover/todos
some TODO entries from me
2016-11-04 20:42:45 -04:00
Rafael Kitover 77a14ae7a4 some TODO entries from me
Some stuff I would like to wrap up from the Mac port and some longer
term things as well.
2016-11-04 13:43:59 -07:00
Christopher Snowhill 6cc2db09ab Update Cheats.cpp
Bounds checking again.
2016-11-04 11:59:03 -07:00
Zach Bacon ecc6f7c3c6 Default to OpenAL and OpenGL on linux 2016-11-03 19:47:00 -04:00
Zach Bacon 0e9e003a02 Merge pull request #34 from rkitover/lion_build
Mac OS X 10.7 (Lion) build and runtime support
2016-11-03 14:10:37 -04:00
Rafael Kitover 01200fadbd Mac OS X 10.7 (Lion) build and runtime support
Make a custom cstdint.h header file that includes <tr1/cstdint> if
<cstdint> is not available, because the clang 3.x used on Lion does not
have it. Change all references to <cstdint> to use it instead.

Add missing OpenGL header for older OS X in sdl/SDL.cpp .

When calling HiDPI methods, use respondsToSelector: to check if the
methods are available first.

Fix the bundling/linking script to support multiple copies of the same
dylib with different versions. Necessary to include both the Lion system
libpng and the brew libpng. Including the system libpng is necessary
because it is removed in later versions of OS X.
2016-11-03 10:49:13 -07:00
Christopher Snowhill 36d84cfa2b Update gbCheats.cpp
Bounds checking is important.
2016-11-02 21:28:58 -07:00
Christopher Snowhill 87630fdf84 Merge pull request #33 from rkitover/master
fix Mac post-build bundle/link broken in a775cc4
2016-11-02 19:06:55 -07:00
Rafael Kitover ba043f4f97 fix Mac post-build bundle/link broken in a775cc4
Instead of checking if CMAKE_BUILD_TYPE is "Release", check that it is
**NOT** "Debug", because by default CMAKE_BUILD_TYPE is empty.
2016-11-02 19:05:18 -07:00
Christopher Snowhill b7a633b70a Merge pull request #32 from rkitover/master
fix kbd controls on Mac + misc.
2016-11-02 18:34:32 -07:00
Rafael Kitover a775cc409f fix kbd controls on Mac + misc.
After creating the drawing panel, call SetFocus() on it and use
Connect() to bind keyboard events from it. Add the wxWANTS_CHARS flag to
all DrawingArea subclasses so that wxEVT_CHAR_HOOK can be used instead
of wxEVT_KEY_DOWN, because it is more general and catches more keys.

Change the process_key_press function to return a bool indicating
whether a game control is currently pressed or not, this is used in the
key events to determine whether the event should be propagated or not.
If in a game key, do not propagate the event, otherwise it hits one of
the other controls and generates a beep sound.

The menu open/closed/highlighted events had to be turned off for Mac,
because the menubar is catching all keyboard events for some reason even
before they reach the drawing panel event handler. So on Mac the game
will not be paused when the menu is being used, this is not really a big
deal and can be fixed later.

Other improvements:

* do not bundle and link dylibs when CMAKE_BUILD_TYPE is not "Release",
  this makes for quicker debug builds

* finally make a generic PaintEv for the DrawingPanel abstract base
  class using dynamic_cast<> and Bind(), unfortunately this is not wx
  2.8 compatible

* set the default audio_buffers to 10 instead of 5, this completely or
  almost completely fixes sound stuttering during normal game play on
  Mac with OpenAL

* spew path info on startup only once
2016-11-02 18:14:58 -07:00
Zach Bacon e609bb9c8c Merge pull request #31 from rkitover/master
Mac build improvements
2016-10-28 21:05:53 -04:00
Rafael Kitover d18afb982f support for fully independent .app build on Mac
The resulting Mac wX .app build is now completely independent and
redistributable, only needs to be codesigned.

Necessary dylibs are bundled and linked in a POST_BUILD step using
third_party_libs_tool (included) for which I created a separate repo
here as well:

http://github.com/rkitover/mac-third-party-libs-tool

Turn off Cairo on Mac because it does not work for now.

Set RPATH on the executable to @loader_path/../Frameworks, the bundling
tool also does this.

Update .gitignore for Finder .DS_Store files.

TOOD:

* write a ./quickbuild for Mac and other platforms such as msys2 and
  linux
2016-10-27 22:06:06 -07:00
Rafael Kitover 2d9ec99c11 Mac build improvements
Move closer to allowing an "out of the box" distributable build for Mac:

* fix the icon for the .app

* link SDL2 statically, a PR has been sent to the original repo here:
  https://github.com/tcbrindle/sdl2-cmake-scripts/pull/9

* link SFML statically

TODO:

For a releasable build on OS X, system libs must be linked
dynamically while third party libs are linked statically or bundled. The
goal is to link them statically.

The two remaining libs that need static linking are PNG and wX.

For PNG a similar approach to the one used for SDL2 using pkg-config
should work fine and be simple to implement.

For wX things are more complicated. The default build of wX does not
include static libs, I will need to submit a PR for Homebrew to change
the default build to include both dynamic and static versions.
2016-10-26 16:58:21 -07:00
Zach Bacon 6899b97dbc Merge pull request #30 from rkitover/linux_fixes
Fix namespace issue, missing parens, missing func
2016-10-24 16:26:07 -04:00
Rafael Kitover 2b45cc7662 fix typo in CMakeLists.txt from 7a7a72f
Fix typo in the default cpp flag when CMAKE_BUILD_TYPE is "Release"
from `-NDEBUG` to `-DNDEBUG`.
2016-10-24 13:12:40 -07:00
Renato "Lond" Cerqueira 91a9b75d40 Fix namespace issue, missing parens, missing func 2016-10-24 12:40:43 -07:00
Zach Bacon 9200bba41d Merge pull request #29 from rkitover/master
fix DisplayConfig panel brkn in 7a7a72f
2016-10-24 14:57:57 -04:00
Rafael Kitover d075bacf94 fix DisplayConfig panel brkn in 7a7a72f
Change the Scale control in the DisplayConfig dialog from a SpinCtrl to
a TextCtrl (for a simple text field) because GenericValidator does not
support using a double* with a SpinCtrl.

Also force adjustment on minimum size and resize the window when
necessary on panel creation, so that when the user sets the value
higher, the window size automatically adjusts.
2016-10-24 10:02:44 -07:00
Zach Bacon 179987f8c4 Merge pull request #27 from rkitover/master
fix backcompat on unix for config brkn in 7a7a72f
2016-10-23 17:05:46 -04:00
Rafael Kitover 0192d9a362 simplify DrawingPanel classes w. dynamic_cast<>
Use dynamic_cast<wxWindow*>(this) in the DrawingPanel abstract class to
implement GetWindow() and Delete() so that all concrete classes do not
have to duplicate the code.
2016-10-23 11:38:54 -07:00
Rafael Kitover d543217f6a fix backcompat on unix for config brkn in 7a7a72f
Only load config files with the app name set to "visualboyadvance-m" on
Windows and Mac, on unix keep the default of "vbam" for now so that
users' ~/.vbam directories are found correctly.

TODO:

* migrate all of this properly to XDG paths on unix, giving users the
  option to move their config
2016-10-22 17:26:05 -07:00
Zach Bacon db85f54b1c Merge pull request #26 from rkitover/mac_hidpi
Mac OS X HiDPI fixes + other misc
2016-10-22 11:04:03 -04:00
Rafael Kitover 7a7a72f2bd Mac OS X HiDPI fixes + other misc
Use a high-res surface on HiDPI (e.g. retina) Macs for the OpenGL
renderer, and scale window accordingly. Also fix fullscreen toggle not
working in HiDPI mode. And some other stuff.

Aside from the .app not being linked statically, the app is now fully
functional on Mac and ready to ship.

Full change details:

* add -DDEBUG or -DNDEBUG based on CMAKE_BUILD_TYPE (-DNDEBUG for
  Release and -DDEBUG for Debug)

* properly search for homebrew/macports/fink directories, and only add
  them if they exist

* fix building with wx debug support, when available

* use explicit OpenGL context on Mac too for new versions of wx

* add main_frame pointer in GameArea back to MainFrame, and a
  SetMainFrame(MainFrame* parent) public method to set it in guinit

* add full support for reading and writing double value config options
  (the GUI still needs to be updated for options that can take doubles,
  such as video_scale)

* change video_scale option (Display/Scale) to a double, putting a
  double value such as 3.6 in the config file works correctly

* add a HiDPIAware mixin class for GameArea and DrawingPanel, with the
  method HiDPIScaleFactor which returns the current window's
  backingScaleFactor

* change the GameArea sizing methods (DelBorder(), AdjustMinSize() and
  AdjustSize()) to divide the window size by the
  HiDPIAware::HiDPIScaleFactor so that the window is scaled properly

* change GameArea::ShowFullScreen to ignore fullscreen events for a
  maximized window on Mac, because maximized windows on OS X are
  actually native fullscreen windows

* change scale variables to double from int, and use std::ceil() to
  round scaled pixel or memory size values

* make a default base class DrawingPane::DrawingPanelInit() virtual
  method, call by all concrete class constructors based on the did_init
  flag

* call setWantsBestResolutionOpenGLSurface:YES on the view backing the
  wxGLCanvas for the OpenGL renderer (GLDrawingPanel) to get a high res
  OpenGL surface in HiDPI mode

* remove GLDrawingPanel::OnSize event, the OpenGL viewport resizes
  automatically without the need to call glViewport()

* do not hide the mouse pointer if the main frame has menus or dialogs
  open

* add variadic vbamDebug(const char* format, ...) function, active only
  #ifdef DEBUG, which sets the wx log target to STDERR and logs a
  message to it

* use full name of app "visualboyadvance-m" instead of "vbam" when
  getting configuration paths, this way the config is saved to
  ~/Library/Application Support/visualboyadvance-m rather than
  ~/Library/Application Support/vbam

* listen to the MENU_HIGHLIGHT_ALL event as well, as an extra way to
  check when the menus are open

* add public MainFrame::SetMenusOpened(bool state) method to force the
  main frame to change the internal menus_opened state, this is
  necessary because in HiDPI mode on Mac the keyboard accelerator for
  toggle fullscreen sends a menu open event, but not a menu close event,
  so on switch to fullscreen the state is changed to menus closed and
  the emu is unpaused

TODO:

* GUI option to change toggle fullscreen behavior between native and
  non-native fullscreen on Mac

* GUI support for double config values like Display/Scale

* add HiDPI support to simple renderer

* fix SDL sound, or disable the option

* fix Cairo suport on Mac, or disable the option

* use dynamic_cast<> to implement GetWindow() for DrawingPanel instead
  of pure virtual method, likewise for Delete()

* link .app statically by default so it can be shipped

* add Homebrew formula
2016-10-22 05:47:27 -07:00
Zach Bacon 258c7fec40 Merge pull request #25 from rkitover/master
rebind toggle fullscreen on mac
2016-10-18 17:35:40 -04:00
Rafael Kitover 61b1af9e16 rebind toggle fullscreen on mac
On OS X, the F11 key is by default bound to "show desktop", so is a poor
choice for the "ToggleFullscreen" accelerator.

The default key combo to take apps fullscreen should be Ctrl+Cmd+F
according to:

https://support.apple.com/kb/PH18744?locale=en_US

Fortunately, this was very easy to fix by using the "platform" attribute
in MainMenu.xrc .

NOTE: this does not give us "real" OS X fullscreen yet, where the app is
on its own space, like native fullscreen apps. In the future it would be
nice to add an option to do this.
2016-10-18 07:02:47 -07:00
Zach Bacon 153a5bf686 Merge pull request #24 from rkitover/master
make OpenGL default render method on OS X
2016-09-23 22:16:07 -04:00
Rafael Kitover 98e82247fc make OpenGL default render method on OS X
Currently the "simple" render method is way too slow on OS X, while
Cairo is completely broken. The OpenGL renderer, on the other hand, runs
with almost no stuttering.

Also fix dangling icon file after OS X build.
2016-09-22 11:00:47 -07:00
Zach Bacon 30801e1554 Merge pull request #23 from rkitover/master
improve OpenAL support on Mac and make it default
2016-09-20 20:38:38 -04:00
Rafael Kitover cc7394f730 improve OpenAL support on Mac and make it default
Fix the dynamic library path for OpenAL to the framework included with
OS X.

Make option initialization set the AudioAPI to OpenAL on mac by default,
since SDL sound is currently completely broken.

There is a lot of stuttering, will have to look at that next.
2016-09-20 05:24:25 -07:00
Zach Bacon 9b65a9cf29 Merge pull request #22 from kookerus/PR
Added cast to uint8
2016-09-09 06:59:28 -04:00
Zach Bacon b80ea69a12 Merge pull request #21 from sundhaug92/master
GDB: Range-checking for 'p' and 'P' ops
2016-09-09 06:59:04 -04:00
Taylor Rose 294296b226 Added cast to uint8 2016-09-08 18:08:23 -04:00
Martin Sundhaug 6176a57d81 Merge https://github.com/visualboyadvance-m/visualboyadvance-m 2016-09-07 18:49:54 -04:00
Martin Sundhaug 9ad1506ed7 GDB: Range check register in remoteReadRegister and remoteWriteRegister 2016-09-07 18:29:57 -04:00