diff --git a/CHANGES b/CHANGES index 28d1733ff..8d336824e 100644 --- a/CHANGES +++ b/CHANGES @@ -71,6 +71,8 @@ Bugfixes: - GB Timer: Minor accuracy improvements - GB Audio: Clock frame events on DIV - GBA: Fix SharkPort saves for EEPROM games + - Qt: Fix opening in fullscreen (fixes mgba.io/i/993) + - Python: Fix package directory Misc: - GBA Timer: Use global cycles for timers - GBA: Extend oddly-sized ROMs to full address space (fixes mgba.io/i/722) diff --git a/CMakeLists.txt b/CMakeLists.txt index 44aa4d99f..4b6f3d35f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -322,13 +322,20 @@ if(NOT CMAKE_SYSTEM_NAME STREQUAL "Generic") check_function_exists(uselocale HAVE_USELOCALE) check_function_exists(setlocale HAVE_SETLOCALE) else() - if(DEFINED 3DS) + if(DEFINED 3DS OR DEFINED WII) + set(CMAKE_REQUIRED_FLAGS -Wl,--require-defined,snprintf_l) check_function_exists(snprintf_l HAVE_SNPRINTF_L) + set(CMAKE_REQUIRED_FLAGS -Wl,--require-defined,strtof_l) check_function_exists(strtof_l HAVE_STRTOF_L) + set(CMAKE_REQUIRED_FLAGS -Wl,--require-defined,newlocale) check_function_exists(newlocale HAVE_NEWLOCALE) + set(CMAKE_REQUIRED_FLAGS -Wl,--require-defined,freelocale) check_function_exists(freelocale HAVE_FREELOCALE) + set(CMAKE_REQUIRED_FLAGS -Wl,--require-defined,uselocale) check_function_exists(uselocale HAVE_USELOCALE) + set(CMAKE_REQUIRED_FLAGS -Wl,--require-defined,setlocale) check_function_exists(setlocale HAVE_SETLOCALE) + unset(CMAKE_REQUIRED_FLAGS) endif() if(NOT DEFINED 3DS AND NOT DEFINED PSP2 AND NOT DEFINED WII) set(DISABLE_DEPS ON CACHE BOOL "This platform cannot build with dependencies" FORCE) @@ -355,7 +362,7 @@ if(HAVE_LOCALTIME_R) list(APPEND FUNCTION_DEFINES HAVE_LOCALTIME_R) endif() -if(HAVE_NEWLOCALE AND HAVE_FREELOCALE AND HAVE_USELOCALE OR APPLE OR DEFINED 3DS) +if(HAVE_NEWLOCALE AND HAVE_FREELOCALE AND HAVE_USELOCALE OR APPLE) list(APPEND FUNCTION_DEFINES HAVE_LOCALE) if (HAVE_STRTOF_L) list(APPEND FUNCTION_DEFINES HAVE_STRTOF_L) @@ -379,6 +386,7 @@ endif() # Feature dependencies set(FEATURE_DEFINES) +set(FEATURE_FLAGS) set(FEATURES) set(ENABLES) if(CMAKE_SYSTEM_NAME MATCHES .*BSD) @@ -517,6 +525,7 @@ if(USE_MAGICK) set(MAGICKWAND_DEB_VERSION "-6.q16-2") endif() list(APPEND FEATURE_DEFINES MAGICKWAND_VERSION_MAJOR=${MAGICKWAND_VERSION_MAJOR}) + list(APPEND FEATURE_FLAGS ${MAGICKWAND_CFLAGS_OTHER}) set(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS},libmagickwand${MAGICKWAND_DEB_VERSION}") endif() @@ -807,7 +816,7 @@ if(NOT SKIP_LIBRARY) add_library(${BINARY_NAME} SHARED ${SRC} ${VFS_SRC}) if(BUILD_STATIC) add_library(${BINARY_NAME}-static STATIC ${SRC}) - set_target_properties(${BINARY_NAME}-static PROPERTIES COMPILE_DEFINITIONS "${OS_DEFINES};${FEATURE_DEFINES};${FUNCTION_DEFINES}") + set_target_properties(${BINARY_NAME}-static PROPERTIES COMPILE_DEFINITIONS "${OS_DEFINES};${FEATURE_DEFINES};${FUNCTION_DEFINES}" COMPILE_OPTIONS "${FEATURE_FLAGS}") install(TARGETS ${BINARY_NAME}-static DESTINATION ${LIBDIR} COMPONENT lib${BINARY_NAME}) add_dependencies(${BINARY_NAME}-static version-info) endif() @@ -816,7 +825,7 @@ if(NOT SKIP_LIBRARY) endif() add_dependencies(${BINARY_NAME} version-info) - set_target_properties(${BINARY_NAME} PROPERTIES VERSION ${LIB_VERSION_STRING} SOVERSION ${LIB_VERSION_ABI} COMPILE_DEFINITIONS "${OS_DEFINES};${FEATURE_DEFINES};${FUNCTION_DEFINES}") + set_target_properties(${BINARY_NAME} PROPERTIES VERSION ${LIB_VERSION_STRING} SOVERSION ${LIB_VERSION_ABI} COMPILE_DEFINITIONS "${OS_DEFINES};${FEATURE_DEFINES};${FUNCTION_DEFINES}" COMPILE_OPTIONS "${FEATURE_FLAGS}") target_link_libraries(${BINARY_NAME} ${DEBUGGER_LIB} ${DEPENDENCY_LIB} ${OS_LIB}) install(TARGETS ${BINARY_NAME} LIBRARY DESTINATION ${LIBDIR} COMPONENT lib${BINARY_NAME} NAMELINK_SKIP ARCHIVE DESTINATION ${LIBDIR} RUNTIME DESTINATION ${LIBDIR} COMPONENT lib${BINARY_NAME}) diff --git a/README.md b/README.md index dc6d2aeb8..e8fc6376a 100644 --- a/README.md +++ b/README.md @@ -124,7 +124,7 @@ Note that you should not do a `make install` on macOS, as it will not work prope #### Windows developer building -To build on Windows for development, using MSYS2 is recommended. Follow the installation steps found on their [website](https://msys2.github.io). Make sure you're running the 32-bit version ("MSYS2 MinGW 32-bit") (or the 64-bit version "MSYS2 MinGW 64-bit" if you want to build for x86_64) and run this additional command (including the braces) to install the needed dependencies (please note that this involves downloading over 500MiB of packages, so it will take a long time): +To build on Windows for development, using MSYS2 is recommended. Follow the installation steps found on their [website](https://msys2.github.io). Make sure you're running the 32-bit version ("MSYS2 MinGW 32-bit") (or the 64-bit version "MSYS2 MinGW 64-bit" if you want to build for x86_64) and run this additional command (including the braces) to install the needed dependencies (please note that this involves downloading over 1100MiB of packages, so it will take a long time): For x86 (32 bit) builds: @@ -221,7 +221,7 @@ Missing features on DS are Copyright --------- -medusa is Copyright © 2013 – 2017 Jeffrey Pfau. It is distributed under the [Mozilla Public License version 2.0](https://www.mozilla.org/MPL/2.0/). A copy of the license is available in the distributed LICENSE file. +medusa is Copyright © 2013 – 2019 Jeffrey Pfau. It is distributed under the [Mozilla Public License version 2.0](https://www.mozilla.org/MPL/2.0/). A copy of the license is available in the distributed LICENSE file. medusa contains the following third-party libraries: diff --git a/README_DE.md b/README_DE.md index dd02c90a3..ddf87480f 100644 --- a/README_DE.md +++ b/README_DE.md @@ -106,7 +106,7 @@ Bitte beachte, dass Du unter macOS nicht 'make install' verwenden solltest, da d ### Für Entwickler: Kompilieren unter Windows -Um mGBA auf Windows zu kompilieren, wird MSYS2 empfohlen. Befolge die Installationsschritte auf der [MSYS2-Website](https://msys2.github.io). Stelle sicher, dass Du die 32-Bit-Version ("MSYS2 MinGW 32-bit") (oder die 64-Bit-Version "MSYS2 MinGW 64-bit", wenn Du mGBA für x86_64 kompilieren willst) verwendest und führe folgendes Kommando (einschließlich der Klammern) aus, um alle benötigten Abhängigkeiten zu installieren. Bitte beachte, dass dafür über 500MiB an Paketen heruntergeladen werden, was eine Weile dauern kann): +Um mGBA auf Windows zu kompilieren, wird MSYS2 empfohlen. Befolge die Installationsschritte auf der [MSYS2-Website](https://msys2.github.io). Stelle sicher, dass Du die 32-Bit-Version ("MSYS2 MinGW 32-bit") (oder die 64-Bit-Version "MSYS2 MinGW 64-bit", wenn Du mGBA für x86_64 kompilieren willst) verwendest und führe folgendes Kommando (einschließlich der Klammern) aus, um alle benötigten Abhängigkeiten zu installieren. Bitte beachte, dass dafür über 1100MiB an Paketen heruntergeladen werden, was eine Weile dauern kann: Für x86 (32 Bit): @@ -164,7 +164,7 @@ Fußnoten Copyright --------- -Copyright für mGBA © 2013 – 2017 Jeffrey Pfau. mGBA wird unter der [Mozilla Public License version 2.0](https://www.mozilla.org/MPL/2.0/) veröffentlicht. Eine Kopie der Lizenz ist in der mitgelieferten Datei LICENSE verfügbar. +Copyright für mGBA © 2013 – 2018 Jeffrey Pfau. mGBA wird unter der [Mozilla Public License version 2.0](https://www.mozilla.org/MPL/2.0/) veröffentlicht. Eine Kopie der Lizenz ist in der mitgelieferten Datei LICENSE verfügbar. mGBA beinhaltet die folgenden Bibliotheken von Drittanbietern: diff --git a/src/gba/cheats/gameshark.c b/src/gba/cheats/gameshark.c index d61ffbe6a..b7981699e 100644 --- a/src/gba/cheats/gameshark.c +++ b/src/gba/cheats/gameshark.c @@ -93,6 +93,7 @@ void GBACheatSetGameSharkVersion(struct GBACheatSet* cheats, enum GBACheatGameSh bool GBACheatAddGameSharkRaw(struct GBACheatSet* cheats, uint32_t op1, uint32_t op2) { enum GBAGameSharkType type = op1 >> 28; struct mCheat* cheat = 0; + int romPatch = 0; if (cheats->incompleteCheat != COMPLETE) { struct mCheat* incompleteCheat = mCheatListGetPointer(&cheats->d.list, cheats->incompleteCheat); @@ -148,10 +149,16 @@ bool GBACheatAddGameSharkRaw(struct GBACheatSet* cheats, uint32_t op1, uint32_t cheats->incompleteCheat = mCheatListIndex(&cheats->d.list, cheat); break; case GSA_PATCH: - cheats->romPatches[0].address = BASE_CART0 | ((op1 & 0xFFFFFF) << 1); - cheats->romPatches[0].newValue = op2; - cheats->romPatches[0].applied = false; - cheats->romPatches[0].exists = true; + while (cheats->romPatches[romPatch].exists) { + ++romPatch; + if (romPatch >= MAX_ROM_PATCHES) { + break; + } + } + cheats->romPatches[romPatch].address = BASE_CART0 | ((op1 & 0xFFFFFF) << 1); + cheats->romPatches[romPatch].newValue = op2; + cheats->romPatches[romPatch].applied = false; + cheats->romPatches[romPatch].exists = true; return true; case GSA_BUTTON: switch (op1 & 0x00F00000) { diff --git a/src/platform/python/setup.py.in b/src/platform/python/setup.py.in index 0a6fa8b52..a66e70e3c 100644 --- a/src/platform/python/setup.py.in +++ b/src/platform/python/setup.py.in @@ -22,7 +22,7 @@ setup(name="${BINARY_NAME}", url="http://github.com/mgba-emu/mgba/", packages=["mgba"], package_dir={ - "mgba": "${CMAKE_CURRENT_SOURCE_DIR}" + "mgba": "${CMAKE_CURRENT_SOURCE_DIR}/mgba" }, setup_requires=['cffi>=1.6', 'pytest-runner'], install_requires=['cffi>=1.6', 'cached-property'], diff --git a/src/platform/qt/AboutScreen.ui b/src/platform/qt/AboutScreen.ui index eaaab43d4..b697ce0bd 100644 --- a/src/platform/qt/AboutScreen.ui +++ b/src/platform/qt/AboutScreen.ui @@ -83,8 +83,8 @@ - © 2013 – 2017 Jeffrey Pfau, licensed under the Mozilla Public License, version 2.0 -Game Boy and Game Boy Advance are registered trademarks of Nintendo Co., Ltd. + © 2013 – 2019 Jeffrey Pfau, licensed under the Mozilla Public License, version 2.0 +Game Boy Advance is a registered trademark of Nintendo Co., Ltd. Qt::AlignCenter diff --git a/src/platform/qt/CMakeLists.txt b/src/platform/qt/CMakeLists.txt index 22327829c..0dda9e538 100644 --- a/src/platform/qt/CMakeLists.txt +++ b/src/platform/qt/CMakeLists.txt @@ -217,9 +217,6 @@ if(WIN32) configure_file(${CMAKE_SOURCE_DIR}/res/win.rc.in ${CMAKE_BINARY_DIR}/res/${BINARY_NAME}.rc) list(APPEND RESOURCES ${CMAKE_BINARY_DIR}/res/${BINARY_NAME}.rc) set_source_files_properties(${CMAKE_BINARY_DIR}/res/${BINARY_NAME}.rc PROPERTIES OBJECT_DEPENDS ${CMAKE_SOURCE_DIR}/res/${BINARY_NAME}.ico) - if(QT_STATIC) - list(APPEND QT_LIBRARIES qwindows Qt5PlatformSupport imm32) - endif() endif() if(NOT DEFINED DATADIR) if(APPLE) @@ -276,6 +273,10 @@ list(APPEND QT_LIBRARIES Qt5::Widgets) if(BUILD_GL OR BUILD_GLES2) list(APPEND QT_LIBRARIES Qt5::OpenGL ${OPENGL_LIBRARY} ${OPENGLES2_LIBRARY}) endif() +if(WIN32 AND QT_STATIC) + list(APPEND QT_LIBRARIES qwindows dwmapi imm32 uxtheme Qt5EventDispatcherSupport Qt5FontDatabaseSupport Qt5ThemeSupport) + set_target_properties(Qt5::Core PROPERTIES INTERFACE_LINK_LIBRARIES "qtpcre2;version;ws2_32") +endif() target_link_libraries(${BINARY_NAME}-qt ${PLATFORM_LIBRARY} ${BINARY_NAME} ${QT_LIBRARIES}) set(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}" PARENT_SCOPE) diff --git a/src/platform/qt/Window.cpp b/src/platform/qt/Window.cpp index 5b18cd056..3670d1b6c 100644 --- a/src/platform/qt/Window.cpp +++ b/src/platform/qt/Window.cpp @@ -216,7 +216,9 @@ void Window::resizeFrame(const QSize& size) { m_screenWidget->setSizeHint(newSize); newSize -= m_screenWidget->size(); newSize += this->size(); - resize(newSize); + if (!isFullScreen()) { + resize(newSize); + } } void Window::setConfig(ConfigController* config) { diff --git a/src/platform/qt/ts/medusa-emu-de.ts b/src/platform/qt/ts/medusa-emu-de.ts index dd0c77b0b..d0f1bdd85 100644 --- a/src/platform/qt/ts/medusa-emu-de.ts +++ b/src/platform/qt/ts/medusa-emu-de.ts @@ -40,10 +40,10 @@ - © 2013 – 2017 Jeffrey Pfau, licensed under the Mozilla Public License, version 2.0 -Game Boy and Game Boy Advance are registered trademarks of Nintendo Co., Ltd. - © 2013 – 2017 Jeffrey Pfau, lizenziert unter der Mozilla Public License, Version 2.0 -Game Boy und Game Boy Advance sind eingetragene Warenzeichen von Nintendo Co., Ltd. + © 2013 – 2019 Jeffrey Pfau, licensed under the Mozilla Public License, version 2.0 +Game Boy Advance is a registered trademark of Nintendo Co., Ltd. + © 2013 – 2019 Jeffrey Pfau, lizenziert unter der Mozilla Public License, Version 2.0 +Game Boy Advance ist ein eingetragenes Warenzeichen von Nintendo Co., Ltd. diff --git a/src/platform/qt/ts/medusa-emu-es.ts b/src/platform/qt/ts/medusa-emu-es.ts index 6628e18a0..177bb3d1f 100644 --- a/src/platform/qt/ts/medusa-emu-es.ts +++ b/src/platform/qt/ts/medusa-emu-es.ts @@ -30,9 +30,9 @@ - © 2013 – 2017 Jeffrey Pfau, licensed under the Mozilla Public License, version 2.0 + © 2013 – 2018 Jeffrey Pfau, licensed under the Mozilla Public License, version 2.0 Game Boy Advance is a registered trademark of Nintendo Co., Ltd. - © 2013 – 2017 Jeffrey Pfau, licenciado bajo la Mozilla Public License, versión 2.0 + © 2013 – 2018 Jeffrey Pfau, licenciado bajo la Mozilla Public License, versión 2.0 Game Boy Advance es una marca registrada de Nintendo Co., Ltd. diff --git a/src/platform/sdl/gl-common.c b/src/platform/sdl/gl-common.c index 13c20811b..0b73cc519 100644 --- a/src/platform/sdl/gl-common.c +++ b/src/platform/sdl/gl-common.c @@ -7,6 +7,13 @@ #include +void mSDLGLDoViewport(int w, int h, struct VideoBackend* v) { + v->resized(v, w, h); + v->clear(v); + v->swap(v); + v->clear(v); +} + void mSDLGLCommonSwap(struct VideoBackend* context) { struct mSDLRenderer* renderer = (struct mSDLRenderer*) context->user; #if SDL_VERSION_ATLEAST(2, 0, 0) diff --git a/src/platform/sdl/gl-common.h b/src/platform/sdl/gl-common.h index b517dd436..307da756f 100644 --- a/src/platform/sdl/gl-common.h +++ b/src/platform/sdl/gl-common.h @@ -12,6 +12,7 @@ CXX_GUARD_START #include "main.h" +void mSDLGLDoViewport(int w, int h, struct VideoBackend* v); void mSDLGLCommonSwap(struct VideoBackend* context); void mSDLGLCommonInit(struct mSDLRenderer* renderer); diff --git a/src/platform/sdl/gl-sdl.c b/src/platform/sdl/gl-sdl.c index 5ee7beccb..bc4531a68 100644 --- a/src/platform/sdl/gl-sdl.c +++ b/src/platform/sdl/gl-sdl.c @@ -13,13 +13,6 @@ #include "platform/opengl/gl.h" -static void _doViewport(int w, int h, struct VideoBackend* v) { - v->resized(v, w, h); - v->clear(v); - v->swap(v); - v->clear(v); -} - static bool mSDLGLInit(struct mSDLRenderer* renderer); static void mSDLGLRunloop(struct mSDLRenderer* renderer, void* user); static void mSDLGLDeinit(struct mSDLRenderer* renderer); @@ -47,7 +40,7 @@ bool mSDLGLInit(struct mSDLRenderer* renderer) { renderer->gl.d.init(&renderer->gl.d, 0); renderer->gl.d.setDimensions(&renderer->gl.d, renderer->width, renderer->height); - _doViewport(renderer->viewportWidth, renderer->viewportHeight, &renderer->gl.d); + mSDLGLDoViewport(renderer->viewportWidth, renderer->viewportHeight, &renderer->gl.d); return true; } @@ -63,7 +56,7 @@ void mSDLGLRunloop(struct mSDLRenderer* renderer, void* user) { // Event handling can change the size of the screen if (renderer->player.windowUpdated) { SDL_GetWindowSize(renderer->window, &renderer->viewportWidth, &renderer->viewportHeight); - _doViewport(renderer->viewportWidth, renderer->viewportHeight, v); + mSDLGLDoViewport(renderer->viewportWidth, renderer->viewportHeight, v); renderer->player.windowUpdated = 0; } #endif diff --git a/src/platform/sdl/gles2-sdl.c b/src/platform/sdl/gles2-sdl.c index c03486fb1..409e94183 100644 --- a/src/platform/sdl/gles2-sdl.c +++ b/src/platform/sdl/gles2-sdl.c @@ -115,6 +115,8 @@ bool mSDLGLES2Init(struct mSDLRenderer* renderer) { renderer->gl2.d.swap = mSDLGLCommonSwap; renderer->gl2.d.init(&renderer->gl2.d, 0); renderer->gl2.d.setDimensions(&renderer->gl2.d, renderer->width, renderer->height); + + mSDLGLDoViewport(renderer->viewportWidth, renderer->viewportHeight, &renderer->gl2.d); return true; } @@ -126,6 +128,14 @@ void mSDLGLES2Runloop(struct mSDLRenderer* renderer, void* user) { while (mCoreThreadIsActive(context)) { while (SDL_PollEvent(&event)) { mSDLHandleEvent(context, &renderer->player, &event); +#if SDL_VERSION_ATLEAST(2, 0, 0) + // Event handling can change the size of the screen + if (renderer->player.windowUpdated) { + SDL_GetWindowSize(renderer->window, &renderer->viewportWidth, &renderer->viewportHeight); + mSDLGLDoViewport(renderer->viewportWidth, renderer->viewportHeight, v); + renderer->player.windowUpdated = 0; + } +#endif } if (mCoreSyncWaitFrameStart(&context->impl->sync)) { diff --git a/src/util/vfs/vfs-zip.c b/src/util/vfs/vfs-zip.c index 13220a303..c3849d8e7 100644 --- a/src/util/vfs/vfs-zip.c +++ b/src/util/vfs/vfs-zip.c @@ -61,6 +61,7 @@ struct VFileZip { struct VFile d; unzFile z; void* buffer; + size_t bufferSize; size_t fileSize; }; #endif @@ -451,7 +452,9 @@ static enum VFSType _vdezType(struct VDirEntry* vde) { bool _vfzClose(struct VFile* vf) { struct VFileZip* vfz = (struct VFileZip*) vf; unzCloseCurrentFile(vfz->z); - free(vfz->buffer); + if (vfz->buffer) { + mappedMemoryFree(vfz->buffer, vfz->bufferSize); + } free(vfz); return true; } @@ -536,6 +539,8 @@ void* _vfzMap(struct VFile* vf, size_t size, int flags) { unzOpenCurrentFile(vfz->z); vf->seek(vf, pos, SEEK_SET); + vfz->bufferSize = size; + return vfz->buffer; } @@ -619,6 +624,7 @@ struct VFile* _vdzOpenFile(struct VDir* vd, const char* path, int mode) { struct VFileZip* vfz = malloc(sizeof(struct VFileZip)); vfz->z = vdz->z; vfz->buffer = 0; + vfz->bufferSize = 0; vfz->fileSize = info.uncompressed_size; vfz->d.close = _vfzClose;