diff --git a/gtk/src/gtk_display.cpp b/gtk/src/gtk_display.cpp index 9a4fd5a5..d59090c0 100644 --- a/gtk/src/gtk_display.cpp +++ b/gtk/src/gtk_display.cpp @@ -965,6 +965,7 @@ void S9xDeinitDisplay() if (driver) driver->deinit(); delete driver; + driver = nullptr; if (pool) { diff --git a/gtk/src/gtk_s9xwindow.cpp b/gtk/src/gtk_s9xwindow.cpp index 5222fb62..b7f24684 100644 --- a/gtk/src/gtk_s9xwindow.cpp +++ b/gtk/src/gtk_s9xwindow.cpp @@ -1293,8 +1293,17 @@ void Snes9xWindow::leave_fullscreen_mode() } #endif +#ifdef GDK_WINDOWING_WAYLAND + if (GDK_IS_WAYLAND_WINDOW(gdk_window)) + { + S9xDeinitDisplay(); + } +#endif + window->unfullscreen(); + window->show(); + #ifdef GDK_WINDOWING_X11 if (GDK_IS_X11_WINDOW(gdk_window)) { @@ -1310,6 +1319,15 @@ void Snes9xWindow::leave_fullscreen_mode() config->rom_loaded = rom_loaded; config->fullscreen = 0; configure_widgets(); + window->show(); + +#ifdef GDK_WINDOWING_WAYLAND + if (GDK_IS_WAYLAND_WINDOW(gdk_window)) + { + S9xReinitDisplay(); + } +#endif + } void Snes9xWindow::resize_viewport(int width, int height) diff --git a/qt/CMakeLists.txt b/qt/CMakeLists.txt index 3dde4d83..54291c08 100644 --- a/qt/CMakeLists.txt +++ b/qt/CMakeLists.txt @@ -74,7 +74,7 @@ set(SNES9X_CORE_SOURCES ../fscompat.cpp) add_library(snes9x-core ${SNES9X_CORE_SOURCES}) target_include_directories(snes9x-core PRIVATE ../) -target_compile_definitions(snes9x-core PRIVATE ZLIB HAVE_STDINT_H ALLOW_CPU_OVERCLOCK) +target_compile_definitions(snes9x-core PRIVATE ${DEFINES} ZLIB HAVE_STDINT_H ALLOW_CPU_OVERCLOCK) if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") set(PREBUILT_QT "${PROJECT_SOURCE_DIR}/../external/qt6-mingw-clang-bin") diff --git a/unix/configure b/unix/configure index 9dd94b72..a187226f 100755 --- a/unix/configure +++ b/unix/configure @@ -5813,14 +5813,14 @@ else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - SYSTEM_ZIP_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "minizip" 2>&1` + SYSTEM_ZIP_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "minizip" 2>&1` else - SYSTEM_ZIP_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "minizip" 2>&1` + SYSTEM_ZIP_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "minizip" 2>&1` fi - # Put the nasty error message in config.log where it belongs - echo "$SYSTEM_ZIP_PKG_ERRORS" >&5 + # Put the nasty error message in config.log where it belongs + echo "$SYSTEM_ZIP_PKG_ERRORS" >&5 - if test "x${with_system_zip}" != "xcheck"; then + if test "x${with_system_zip}" != "xcheck"; then as_fn_error $? "--with-system-zip requested but no proper minizip lib found." "$LINENO" 5 else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: minizip not found. Build without SYSTEM_ZIP support." >&5 @@ -5830,7 +5830,7 @@ printf "%s\n" "$as_me: WARNING: minizip not found. Build without SYSTEM_ZIP supp elif test $pkg_failed = untried; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } - if test "x${with_system_zip}" != "xcheck"; then + if test "x${with_system_zip}" != "xcheck"; then as_fn_error $? "--with-system-zip requested but no proper minizip lib found." "$LINENO" 5 else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: minizip not found. Build without SYSTEM_ZIP support." >&5 @@ -5838,11 +5838,11 @@ printf "%s\n" "$as_me: WARNING: minizip not found. Build without SYSTEM_ZIP supp fi else - SYSTEM_ZIP_CFLAGS=$pkg_cv_SYSTEM_ZIP_CFLAGS - SYSTEM_ZIP_LIBS=$pkg_cv_SYSTEM_ZIP_LIBS + SYSTEM_ZIP_CFLAGS=$pkg_cv_SYSTEM_ZIP_CFLAGS + SYSTEM_ZIP_LIBS=$pkg_cv_SYSTEM_ZIP_LIBS { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } - S9XZIP="S9XZIP=1" + S9XZIP="S9XZIP=1" S9XDEFS="$S9XDEFS -DUNZIP_SUPPORT" S9X_SYSTEM_ZIP="SYSTEM_ZIP=1" S9XLIBS="$S9XLIBS $SYSTEM_ZIP_LIBS" @@ -7264,18 +7264,60 @@ fi if test "x$enable_sound" = "xyes"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether sound is supported on this platform" >&5 -printf %s "checking whether sound is supported on this platform... " >&6; } - if test "x$snes9x_cv_linux_os" = "xyes"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } - else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Your OS is not Linux. Build without sound support." >&5 -printf "%s\n" "$as_me: WARNING: Your OS is not Linux. Build without sound support." >&2;} + ac_fn_cxx_check_header_compile "$LINENO" "sys/soundcard.h" "ac_cv_header_sys_soundcard_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_soundcard_h" = xyes +then : + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for _oss_ioctl in -lossaudio" >&5 +printf %s "checking for _oss_ioctl in -lossaudio... " >&6; } +if test ${ac_cv_lib_ossaudio__oss_ioctl+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_check_lib_save_LIBS=$LIBS +LIBS="-lossaudio $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +namespace conftest { + extern "C" int _oss_ioctl (); +} +int +main (void) +{ +return conftest::_oss_ioctl (); + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO" +then : + ac_cv_lib_ossaudio__oss_ioctl=yes +else $as_nop + ac_cv_lib_ossaudio__oss_ioctl=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ossaudio__oss_ioctl" >&5 +printf "%s\n" "$ac_cv_lib_ossaudio__oss_ioctl" >&6; } +if test "x$ac_cv_lib_ossaudio__oss_ioctl" = xyes +then : + + S9XLIBS="$S9XLIBS -lossaudio" + +fi + + +else $as_nop + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Your OS does not have OSS. Build without sound support." >&5 +printf "%s\n" "$as_me: WARNING: Your OS does not have OSS. Build without sound support." >&2;} enable_sound="no" - fi + +fi + fi if test "x$enable_sound" = "xyes"; then diff --git a/unix/configure.ac b/unix/configure.ac index 50a14c1a..e6d804eb 100644 --- a/unix/configure.ac +++ b/unix/configure.ac @@ -479,14 +479,16 @@ AC_ARG_ENABLE([sound], [], [enable_sound="yes"]) if test "x$enable_sound" = "xyes"; then - AC_MSG_CHECKING([whether sound is supported on this platform]) - if test "x$snes9x_cv_linux_os" = "xyes"; then - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - AC_MSG_WARN([Your OS is not Linux. Build without sound support.]) + AC_CHECK_HEADER([sys/soundcard.h], + [ + AC_CHECK_LIB([ossaudio], [_oss_ioctl], [ + S9XLIBS="$S9XLIBS -lossaudio" + ], [], []) + ], + [ + AC_MSG_WARN([Your OS does not have OSS. Build without sound support.]) enable_sound="no" - fi + ]) fi if test "x$enable_sound" = "xyes"; then diff --git a/unix/unix.cpp b/unix/unix.cpp index e16c6dad..14476801 100644 --- a/unix/unix.cpp +++ b/unix/unix.cpp @@ -164,7 +164,7 @@ static bool8 ReadJoysticks (void); void S9xLatchJSEvent(); #endif -static long log2 (long num) +static long snes9x_log2 (long num) { long n = 0; @@ -1456,7 +1456,7 @@ bool8 S9xOpenSoundDevice (void) bool(unixSettings.ThreadSound) ); - J = log2(unixSettings.SoundFragmentSize) | (4 << 16); + J = snes9x_log2(unixSettings.SoundFragmentSize) | (4 << 16); if (ioctl(so.sound_fd, SNDCTL_DSP_SETFRAGMENT, &J) == -1) return (FALSE); diff --git a/vulkan/vulkan_swapchain.cpp b/vulkan/vulkan_swapchain.cpp index 358d642f..37563d40 100644 --- a/vulkan/vulkan_swapchain.cpp +++ b/vulkan/vulkan_swapchain.cpp @@ -124,7 +124,10 @@ bool Swapchain::create(unsigned int desired_num_swapchain_images, int new_width, else num_swapchain_images = desired_num_swapchain_images; - extents = surface_capabilities.currentExtent; + // If extents aren't reported (Wayland), we have to rely on Wayland to report + // the size, so keep current extent. + if (surface_capabilities.currentExtent.width != -1) + extents = surface_capabilities.currentExtent; uint32_t graphics_queue_index = 0; auto queue_properties = physical_device.getQueueFamilyProperties(); @@ -396,4 +399,4 @@ vk::RenderPass &Swapchain::get_render_pass() return render_pass.get(); } -} // namespace Vulkan \ No newline at end of file +} // namespace Vulkan