diff --git a/CMakeLists.txt b/CMakeLists.txt index fb27596f..6be710c5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,9 +18,9 @@ option( ENABLE_DEBUGGER "Enable the debugger" ON ) option( ENABLE_NLS "Enable translations" ON ) option( ENABLE_ASM_CORE "Enable x86 ASM CPU cores" OFF ) option( ENABLE_ASM_SCALERS "Enable x86 ASM graphic filters" OFF ) -option( ENABLE_LINK "Enable GBA linking functionality" OFF ) +option( ENABLE_LINK "Enable GBA linking functionality" ON ) option( ENABLE_LIRC "Enable LIRC support" OFF ) -option( ENABLE_FFMPEG "Enable ffmpeg A/V recording" OFF ) +option( ENABLE_FFMPEG "Enable ffmpeg A/V recording" ON ) if(ENABLE_ASM_SCALERS) option( ENABLE_MMX "Enable MMX" OFF ) endif(ENABLE_ASM_SCALERS) @@ -133,9 +133,9 @@ FIND_PACKAGE(SDL2 REQUIRED) ADD_DEFINITIONS(${SDL2_DEFINITIONS}) if( ENABLE_LINK ) - if(WIN32 OR APPLE) + if(WIN32) set(SFML_STATIC_LIBRARIES TRUE) - endif(WIN32 OR APPLE) + endif(WIN32) FIND_PACKAGE ( SFML 2 COMPONENTS network system ) endif( ENABLE_LINK ) diff --git a/src/wx/CMakeLists.txt b/src/wx/CMakeLists.txt index 916359e2..ded3c76c 100644 --- a/src/wx/CMakeLists.txt +++ b/src/wx/CMakeLists.txt @@ -3,12 +3,7 @@ SET( CMAKE_CXX_FLAGS -std=gnu++11 ) # not yet implemented -IF(APPLE) - # does not work, no reason to link to it - SET(CAIRO_DEFAULT OFF) -ELSE(APPLE) - SET(CAIRO_DEFAULT ON) -ENDIF(APPLE) +SET(CAIRO_DEFAULT OFF) option(ENABLE_CAIRO "Enable Cairo rendering for the wxWidgets port" ${CAIRO_DEFAULT}) diff --git a/src/wx/drawing.h b/src/wx/drawing.h index f595b5de..a1f09217 100644 --- a/src/wx/drawing.h +++ b/src/wx/drawing.h @@ -23,6 +23,8 @@ public: protected: void DrawArea(wxWindowDC& dc); + void OnSize(wxSizeEvent& ev); + void AdjustViewport(); #if wxCHECK_VERSION(2, 9, 0) wxGLContext* ctx; #endif diff --git a/src/wx/macsupport.mm b/src/wx/macsupport.mm index 76f2088c..26727a3d 100644 --- a/src/wx/macsupport.mm +++ b/src/wx/macsupport.mm @@ -27,3 +27,13 @@ void HiDPIAware::RequestHighResolutionOpenGLSurface() [view setWantsBestResolutionOpenGLSurface:YES]; } } + +void HiDPIAware::GetRealPixelClientSize(int* x, int* y) +{ + NSView* view = (NSView*)(GetWindow()->GetHandle()); + + NSSize backing_size = [view convertSizeToBacking:view.bounds.size]; + + *x = backing_size.width; + *y = backing_size.height; +} diff --git a/src/wx/panel.cpp b/src/wx/panel.cpp index bc7cb5f3..df8efced 100644 --- a/src/wx/panel.cpp +++ b/src/wx/panel.cpp @@ -2037,12 +2037,9 @@ void GLDrawingPanel::DrawingPanelInit() DrawingPanel::DrawingPanelInit(); -#ifdef DEBUG - // you can use this to check that the gl surface is indeed high res - GLint m_viewport[4]; - glGetIntegerv(GL_VIEWPORT, m_viewport); - vbamDebug("GL VIEWPORT: %d, %d, %d, %d", m_viewport[0], m_viewport[1], m_viewport[2], m_viewport[3]); -#endif + AdjustViewport(); + + Connect(wxEVT_SIZE, wxSizeEventHandler(GLDrawingPanel::OnSize), NULL, this); // taken from GTK front end almost verbatim glDisable(GL_CULL_FACE); @@ -2123,6 +2120,25 @@ void GLDrawingPanel::DrawingPanelInit() #endif } +void GLDrawingPanel::OnSize(wxSizeEvent& ev) +{ + AdjustViewport(); +} + +void GLDrawingPanel::AdjustViewport() +{ + int x, y; + GetRealPixelClientSize(&x, &y); + glViewport(0, 0, x, y); + +#ifdef DEBUG + // you can use this to check that the gl surface is indeed high res + GLint m_viewport[4]; + glGetIntegerv(GL_VIEWPORT, m_viewport); + vbamDebug("GL VIEWPORT: %d, %d, %d, %d", m_viewport[0], m_viewport[1], m_viewport[2], m_viewport[3]); +#endif +} + void GLDrawingPanel::DrawArea(wxWindowDC& dc) { #if wxCHECK_VERSION(2, 9, 0) @@ -2463,4 +2479,9 @@ double HiDPIAware::HiDPIScaleFactor() void HiDPIAware::RequestHighResolutionOpenGLSurface() { } + +void HiDPIAware::GetRealPixelClientSize(int* x, int* y) +{ + GetWindow()->GetClientSize(x, y); +} #endif // HiDPI stubs diff --git a/src/wx/tools/osx/third_party_libs_tool b/src/wx/tools/osx/third_party_libs_tool index b204c419..40c3c604 100755 --- a/src/wx/tools/osx/third_party_libs_tool +++ b/src/wx/tools/osx/third_party_libs_tool @@ -1,6 +1,6 @@ #!/bin/sh -version=0.6 +version=0.7 main() { # parse options @@ -237,7 +237,7 @@ relink() { # remove full path and version of lib in executable lib_link_path=$( otool -l "$target" 2>/dev/null | \ - sed -n 's,^ *name \(/.*/*'"$lib_basename_unversioned_re"'[0-9.-]*\.dylib\) (offset .*,\1,p' | \ + sed -n 's,^ *name \(.*/*'"$lib_basename_unversioned_re"'[0-9.-]*\.dylib\) (offset .*,\1,p' | \ head -1 ) diff --git a/src/wx/wxvbam.h b/src/wx/wxvbam.h index 2ae5a174..3fc7d09e 100644 --- a/src/wx/wxvbam.h +++ b/src/wx/wxvbam.h @@ -347,6 +347,7 @@ class HiDPIAware { public: virtual double HiDPIScaleFactor(); virtual void RequestHighResolutionOpenGLSurface(); + virtual void GetRealPixelClientSize(int* x, int* y); virtual wxWindow* GetWindow() = 0; private: double hidpi_scale_factor = 0; diff --git a/todo.md b/todo.md index b720c306..a8ab1a7e 100644 --- a/todo.md +++ b/todo.md @@ -7,7 +7,7 @@ - [ ] add OnSize handler for GLDrawingPanel in wx back to reset the GL viewport, and set viewport on init as well - [x] fix wx accels that are a game key with a modifier, e.g. ALT+ENTER when ENTER is a game key - [ ] add an option to the video config dialog to choose native or non-native fullscreen for Mac (and check if the OS supports it) -- [ ] fix SFML cmake stuff to detect brew SFML on Mac +- [ ] fix SFML cmake stuff so that static linking works on Mac - [ ] update FindSDL2.cmake to use sdl2-config if available and pkg-config is not, get PR merged upstream - [ ] optimize all options defaults for modern hardware - [ ] fix filter options in wx to apply to both fullscreen and window mode @@ -22,6 +22,7 @@ - [ ] set up automatic builds for all platforms - [ ] see what code we can steal from other emu folks, e.g. filters etc. - [ ] update config handling, to switch to XDG on linux etc. +- [ ] add simple 'mute audio' option for wx interface # Coding Guidelines (for those that want to help out and send a pull request.)