From 906083a0a983cb1df7dcf785b9457113e5a817e5 Mon Sep 17 00:00:00 2001 From: Ompronce <88358700+Ompronce@users.noreply.github.com> Date: Fri, 27 Aug 2021 20:28:50 -0400 Subject: [PATCH 01/14] Removed unused references to snd_mpu401.h and corrected minor typo --- src/sound/snd_audiopci.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/sound/snd_audiopci.c b/src/sound/snd_audiopci.c index 886ab4ff2..e34324657 100644 --- a/src/sound/snd_audiopci.c +++ b/src/sound/snd_audiopci.c @@ -16,7 +16,6 @@ #include <86box/timer.h> #include <86box/sound.h> #include <86box/midi.h> -#include <86box/snd_mpu401.h> #include <86box/snd_ac97.h> @@ -27,8 +26,6 @@ static float low_fir_es1371_coef[ES1371_NCoef]; typedef struct { - mpu_t mpu; - uint8_t pci_command, pci_serr; uint32_t base_addr; @@ -897,7 +894,7 @@ static uint8_t es1371_pci_read(int func, int addr, void *p) case 0x04: return es1371->pci_command; case 0x05: return es1371->pci_serr; - case 0x06: return 0x10; /* Supports support ACPI */ + case 0x06: return 0x10; /* Supports ACPI */ case 0x07: return 0x00; case 0x08: return 0x02; /* Revision ID */ From b9e07113caf914cfb90132082d96277fd48e3fe8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hrdli=C4=8Dka?= Date: Sat, 28 Aug 2021 19:20:28 +0200 Subject: [PATCH 02/14] cmake: add `DEBUG` define for debug builds --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index f66f0c4ac..5507570fa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,6 +33,7 @@ include(CPack) include(CMakeDependentOption) add_compile_definitions(CMAKE) +add_compile_definitions("$<$:DEBUG>") if(WIN32) # Disables *_s function warnings From 44ccefb28af6167794dd3ed19cb2f18a803b2500 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hrdli=C4=8Dka?= Date: Sun, 29 Aug 2021 03:37:07 +0200 Subject: [PATCH 03/14] cmake: refactor the architecture detection --- CMakeLists.txt | 14 ++-- cmake/TargetArch.cmake | 141 --------------------------------- src/CMakeLists.txt | 2 +- src/arch_detect.c | 27 +++++++ src/codegen/CMakeLists.txt | 7 +- src/codegen_new/CMakeLists.txt | 11 ++- 6 files changed, 45 insertions(+), 157 deletions(-) delete mode 100644 cmake/TargetArch.cmake create mode 100644 src/arch_detect.c diff --git a/CMakeLists.txt b/CMakeLists.txt index 5507570fa..410db2af8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,9 +24,13 @@ project(86Box HOMEPAGE_URL "https://86box.github.io/" LANGUAGES C CXX) -list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") -include(TargetArch) -target_architecture(CMAKE_TARGET_ARCHITECTURES) +# Detect the target architecture by trying to compile `src/arch_detect.c` +try_compile(RESULT_VAR ${CMAKE_BINARY_DIR} "${CMAKE_CURRENT_SOURCE_DIR}/src/arch_detect.c" OUTPUT_VARIABLE ARCH) +string(REGEX MATCH "ARCH ([a-zA-Z0-9_]+)" ARCH "${ARCH}") +string(REPLACE "ARCH " "" ARCH "${ARCH}") +if (NOT ARCH) + set(ARCH unknown) +endif() include(CPack) @@ -83,12 +87,12 @@ CMAKE_DEPENDENT_OPTION(XL24 "ATI VGA Wonder XL24 (ATI-28800-6)" ON "DEV_BRANCH" CMAKE_DEPENDENT_OPTION(VECT486VL "HP Vectra 486VL" ON "DEV_BRANCH" OFF) # HACK: Avoid a MSVC2019 compiler bug on ARM64 Debug builds -if(MSVC_TOOLSET_VERSION GREATER_EQUAL 142 AND CMAKE_TARGET_ARCHITECTURES STREQUAL "armv8") +if(MSVC_TOOLSET_VERSION GREATER_EQUAL 142 AND ARCH STREQUAL "arm64") # Define a cache option in case somebody wants to disable this workaround set(AVOID_LNK1322 ON CACHE BOOL "Prevent LNK1322 on MSVC2019 ARM64 debug builds") if(AVOID_LNK1322) - message(STATUS "Working around LNK1322 (#1268)") + message(STATUS "Working around LNK1322 (86Box#1268)") set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /Gy") set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /Gy") endif() diff --git a/cmake/TargetArch.cmake b/cmake/TargetArch.cmake deleted file mode 100644 index c8eb27735..000000000 --- a/cmake/TargetArch.cmake +++ /dev/null @@ -1,141 +0,0 @@ -# Based on the Qt 5 processor detection code, so should be very accurate -# https://qt.gitorious.org/qt/qtbase/blobs/master/src/corelib/global/qprocessordetection.h -# Currently handles arm (v5, v6, v7, v8), x86 (32/64), ia64, and ppc (32/64) - -# Regarding POWER/PowerPC, just as is noted in the Qt source, -# "There are many more known variants/revisions that we do not handle/detect." - -set(archdetect_c_code " -#if defined(__arm__) || defined(__TARGET_ARCH_ARM) || defined(_M_ARM) || defined(_M_ARM64) - #if defined(__ARM64_ARCH_8__) \\ - || defined(__aarch64__) \\ - || defined(__ARMv8__) \\ - || defined(__ARMv8_A__) \\ - || (defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM-0 >= 8) \\ - || (defined(_M_ARM64) && _M_ARM64 >= 1) - #error cmake_ARCH armv8 - #elif defined(__ARM_ARCH_7__) \\ - || defined(__ARM_ARCH_7A__) \\ - || defined(__ARM_ARCH_7R__) \\ - || defined(__ARM_ARCH_7M__) \\ - || (defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM-0 >= 7) \\ - || (defined(_M_ARM) && _M_ARM >= 7) - #error cmake_ARCH armv7 - #elif defined(__ARM_ARCH_6__) \\ - || defined(__ARM_ARCH_6J__) \\ - || defined(__ARM_ARCH_6T2__) \\ - || defined(__ARM_ARCH_6Z__) \\ - || defined(__ARM_ARCH_6K__) \\ - || defined(__ARM_ARCH_6ZK__) \\ - || defined(__ARM_ARCH_6M__) \\ - || (defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM-0 >= 6) - #error cmake_ARCH armv6 - #elif defined(__ARM_ARCH_5TEJ__) \\ - || (defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM-0 >= 5) - #error cmake_ARCH armv5 - #else - #error cmake_ARCH arm - #endif -#elif defined(__i386) || defined(__i386__) || defined(_M_IX86) - #error cmake_ARCH i386 -#elif defined(__x86_64) || defined(__x86_64__) || defined(__amd64) || defined(_M_X64) - #error cmake_ARCH x86_64 -#elif defined(__ia64) || defined(__ia64__) || defined(_M_IA64) - #error cmake_ARCH ia64 -#elif defined(__ppc__) || defined(__ppc) || defined(__powerpc__) \\ - || defined(_ARCH_COM) || defined(_ARCH_PWR) || defined(_ARCH_PPC) \\ - || defined(_M_MPPC) || defined(_M_PPC) - #if defined(__ppc64__) || defined(__powerpc64__) || defined(__64BIT__) - #error cmake_ARCH ppc64 - #else - #error cmake_ARCH ppc - #endif -#endif -#error cmake_ARCH unknown -") - -# Set ppc_support to TRUE before including this file or ppc and ppc64 -# will be treated as invalid architectures since they are no longer supported by Apple - -function(target_architecture output_var) - if(APPLE AND CMAKE_OSX_ARCHITECTURES) - # On OS X we use CMAKE_OSX_ARCHITECTURES *if* it was set - # First let's normalize the order of the values - - # Note that it's not possible to compile PowerPC applications if you are using - # the OS X SDK version 10.6 or later - you'll need 10.4/10.5 for that, so we - # disable it by default - # See this page for more information: - # http://stackoverflow.com/questions/5333490/how-can-we-restore-ppc-ppc64-as-well-as-full-10-4-10-5-sdk-support-to-xcode-4 - - # Architecture defaults to i386 or ppc on OS X 10.5 and earlier, depending on the CPU type detected at runtime. - # On OS X 10.6+ the default is x86_64 if the CPU supports it, i386 otherwise. - - foreach(osx_arch ${CMAKE_OSX_ARCHITECTURES}) - if("${osx_arch}" STREQUAL "ppc" AND ppc_support) - set(osx_arch_ppc TRUE) - elseif("${osx_arch}" STREQUAL "i386") - set(osx_arch_i386 TRUE) - elseif("${osx_arch}" STREQUAL "x86_64") - set(osx_arch_x86_64 TRUE) - elseif("${osx_arch}" STREQUAL "ppc64" AND ppc_support) - set(osx_arch_ppc64 TRUE) - else() - message(FATAL_ERROR "Invalid OS X arch name: ${osx_arch}") - endif() - endforeach() - - # Now add all the architectures in our normalized order - if(osx_arch_ppc) - list(APPEND ARCH ppc) - endif() - - if(osx_arch_i386) - list(APPEND ARCH i386) - endif() - - if(osx_arch_x86_64) - list(APPEND ARCH x86_64) - endif() - - if(osx_arch_ppc64) - list(APPEND ARCH ppc64) - endif() - else() - file(WRITE "${CMAKE_BINARY_DIR}/arch.c" "${archdetect_c_code}") - - enable_language(C) - - # Detect the architecture in a rather creative way... - # This compiles a small C program which is a series of ifdefs that selects a - # particular #error preprocessor directive whose message string contains the - # target architecture. The program will always fail to compile (both because - # file is not a valid C program, and obviously because of the presence of the - # #error preprocessor directives... but by exploiting the preprocessor in this - # way, we can detect the correct target architecture even when cross-compiling, - # since the program itself never needs to be run (only the compiler/preprocessor) - try_run( - run_result_unused - compile_result_unused - "${CMAKE_BINARY_DIR}" - "${CMAKE_BINARY_DIR}/arch.c" - COMPILE_OUTPUT_VARIABLE ARCH - CMAKE_FLAGS CMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES} - ) - - # Parse the architecture name from the compiler output - string(REGEX MATCH "cmake_ARCH ([a-zA-Z0-9_]+)" ARCH "${ARCH}") - - # Get rid of the value marker leaving just the architecture name - string(REPLACE "cmake_ARCH " "" ARCH "${ARCH}") - - # If we are compiling with an unknown architecture this variable should - # already be set to "unknown" but in the case that it's empty (i.e. due - # to a typo in the code), then set it to unknown - if (NOT ARCH) - set(ARCH unknown) - endif() - endif() - - set(${output_var} "${ARCH}" PARENT_SCOPE) -endfunction() \ No newline at end of file diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a1f4b9c7c..dc7f76dd0 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -62,7 +62,7 @@ find_package(PNG REQUIRED) include_directories(${PNG_INCLUDE_DIRS}) target_link_libraries(86Box PNG::PNG) -if(CMAKE_TARGET_ARCHITECTURES STREQUAL "i386") +if(ARCH STREQUAL "i386") if(MSVC) set_target_properties(86Box PROPERTIES LINK_FLAGS "/LARGEADDRESSAWARE") elseif(MINGW) diff --git a/src/arch_detect.c b/src/arch_detect.c new file mode 100644 index 000000000..03d3b61e7 --- /dev/null +++ b/src/arch_detect.c @@ -0,0 +1,27 @@ +/* + * 86Box A hypervisor and IBM PC system emulator that specializes in + * running old operating systems and software designed for IBM + * PC systems and compatibles from 1981 through fairly recent + * system designs based on the PCI bus. + * + * This file is part of the 86Box distribution. + * + * Configure-time architecture detection for the CMake build. + * + * + * + * Authors: David Hrdlička, + * + * Copyright 2020-2021 David Hrdlička. + */ + +#if defined(__arm__) || defined(__TARGET_ARCH_ARM) + #error ARCH arm +#elif defined(__aarch64__) || defined(_M_ARM64) + #error ARCH arm64 +#elif defined(__i386) || defined(__i386__) || defined(_M_IX86) + #error ARCH i386 +#elif defined(__x86_64) || defined(__x86_64__) || defined(__amd64) || defined(_M_X64) + #error ARCH x86_64 +#endif +#error ARCH unknown diff --git a/src/codegen/CMakeLists.txt b/src/codegen/CMakeLists.txt index 7ee69bf3b..1d310c0de 100644 --- a/src/codegen/CMakeLists.txt +++ b/src/codegen/CMakeLists.txt @@ -16,16 +16,15 @@ if(DYNAREC) add_library(dynarec OBJECT codegen.c codegen_ops.c) - if(CMAKE_TARGET_ARCHITECTURES STREQUAL "i386") + if(ARCH STREQUAL "i386") target_sources(dynarec PRIVATE codegen_x86.c codegen_accumulate_x86.c) - elseif(CMAKE_TARGET_ARCHITECTURES STREQUAL "x86_64") + elseif(ARCH STREQUAL "x86_64") target_sources(dynarec PRIVATE codegen_x86-64.c codegen_accumulate_x86-64.c) else() message(SEND_ERROR - "Dynarec is incompatible with target platform " - ${CMAKE_TARGET_ARCHITECTURES}) + "Dynarec is incompatible with target platform ${ARCH}") endif() target_link_libraries(86Box dynarec cgt) diff --git a/src/codegen_new/CMakeLists.txt b/src/codegen_new/CMakeLists.txt index 0a6db2827..15f1874f8 100644 --- a/src/codegen_new/CMakeLists.txt +++ b/src/codegen_new/CMakeLists.txt @@ -25,27 +25,26 @@ if(DYNAREC) codegen_ops_mmx_pack.c codegen_ops_mmx_shift.c codegen_ops_mov.c codegen_ops_shift.c codegen_ops_stack.c codegen_reg.c) - if(CMAKE_TARGET_ARCHITECTURES STREQUAL "i386") + if(ARCH STREQUAL "i386") target_sources(dynarec PRIVATE codegen_backend_x86.c codegen_backend_x86_ops.c codegen_backend_x86_ops_fpu.c codegen_backend_x86_ops_sse.c codegen_backend_x86_uops.c) - elseif(CMAKE_TARGET_ARCHITECTURES STREQUAL "x86_64") + elseif(ARCH STREQUAL "x86_64") target_sources(dynarec PRIVATE codegen_backend_x86-64.c codegen_backend_x86-64_ops.c codegen_backend_x86-64_ops_sse.c codegen_backend_x86-64_uops.c) - elseif(CMAKE_TARGET_ARCHITECTURES STREQUAL "armv8") + elseif(ARCH STREQUAL "arm64") target_sources(dynarec PRIVATE codegen_backend_arm64.c codegen_backend_arm64_ops.c codegen_backend_arm64_uops.c codegen_backend_arm64_imm.c) - elseif(CMAKE_TARGET_ARCHITECTURES MATCHES "arm") + elseif(ARCH STREQUAL "arm") target_sources(dynarec PRIVATE codegen_backend_arm.c codegen_backend_arm_ops.c codegen_backend_arm_uops.c) else() message(SEND_ERROR - "Dynarec is incompatible with target platform " - ${CMAKE_TARGET_ARCHITECTURES}) + "Dynarec is incompatible with target platform ${ARCH}") endif() target_link_libraries(86Box dynarec cgt) From 8365b7b1873d04c73c1488b09ae612cb39fce250 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hrdli=C4=8Dka?= Date: Sun, 29 Aug 2021 04:01:36 +0200 Subject: [PATCH 04/14] workflows: add artifacts to cmake/mingw --- .github/workflows/cmake.yml | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 928bb7107..a8b335844 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -16,9 +16,6 @@ on: - .github/workflows/** - vcpkg.json -env: - BUILD_TYPE: RelWithDebInfo - jobs: mingw: name: ${{ matrix.target-arch.msystem }} build (DEV_BUILD=${{ matrix.dev-build }}, NEW_DYNAREC=${{ matrix.new-dynarec }}) @@ -30,9 +27,17 @@ jobs: shell: msys2 {0} strategy: + fail-fast: false matrix: - dev-build: ['ON', 'OFF'] - new-dynarec: ['ON', 'OFF'] + build: + - name: Debug + dev-build: off + new-dynarec: off + type: Debug + - name: Dev + dev-build: on + new-dynarec: on + type: Debug target-arch: - msystem: MINGW32 prefix: mingw-w64-i686 @@ -58,12 +63,17 @@ jobs: run: >- cmake -S . -B build -G "MSYS Makefiles" - -D CMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} - -D DEV_BRANCH=${{ matrix.dev-build }} - -D NEW_DYNAREC=${{ matrix.new-dynarec }} + -D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/build/artifacts + -D CMAKE_BUILD_TYPE=${{ env.build.type }} + -D DEV_BRANCH=${{ matrix.build.dev-build }} + -D NEW_DYNAREC=${{ matrix.build.new-dynarec }} -D VNC=OFF - name: Build - run: cmake --build build + run: cmake --build build --target install + - uses: actions/upload-artifact@v2 + with: + name: '86Box-${{ matrix.target-arch.msystem }}-${{ matrix.build.name }}-${{ matrix.target-arch }}-${{ github.sha }}' + path: build/artifacts/bin/** vs2019: name: VS2019 ${{ matrix.build.name }} ${{ matrix.target-arch }} build (${{ matrix.toolset }}) From 02f965d82a4048d8515e92cff7c7c96129695d5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hrdli=C4=8Dka?= Date: Sun, 29 Aug 2021 04:08:36 +0200 Subject: [PATCH 05/14] workflows: fix up job names --- .github/workflows/cmake.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index a8b335844..d34841573 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -18,7 +18,7 @@ on: jobs: mingw: - name: ${{ matrix.target-arch.msystem }} build (DEV_BUILD=${{ matrix.dev-build }}, NEW_DYNAREC=${{ matrix.new-dynarec }}) + name: MSYS2 ${{ matrix.build.name }} build (${{ matrix.target-arch.msystem }}) runs-on: windows-latest @@ -72,7 +72,7 @@ jobs: run: cmake --build build --target install - uses: actions/upload-artifact@v2 with: - name: '86Box-${{ matrix.target-arch.msystem }}-${{ matrix.build.name }}-${{ matrix.target-arch }}-${{ github.sha }}' + name: '86Box-MSYS2-${{ matrix.target-arch.msystem }}-${{ matrix.build.name }}-${{ github.sha }}' path: build/artifacts/bin/** vs2019: From f3d04d2411d59bd538f13a21337451c0ab0e4d7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hrdli=C4=8Dka?= Date: Sun, 29 Aug 2021 04:14:21 +0200 Subject: [PATCH 06/14] workflows: add msys2/ucrt64 and msys2/clang64 --- .github/workflows/c-cpp.yml | 47 +++++++++++++++++++++++++------------ .github/workflows/cmake.yml | 4 ++++ 2 files changed, 36 insertions(+), 15 deletions(-) diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml index 4734f1bc4..82db5a769 100644 --- a/.github/workflows/c-cpp.yml +++ b/.github/workflows/c-cpp.yml @@ -14,7 +14,7 @@ on: jobs: build: - name: Build (DEV_BUILD=${{ matrix.dev-build }}, NEW_DYNAREC=${{ matrix.new-dynarec }}, X64=${{ matrix.target-arch.x64 }}) + name: ${{ matrix.build-target.msystem }} makefile build (DEV_BUILD=${{ matrix.dev-build }}, NEW_DYNAREC=${{ matrix.new-dynarec }}) runs-on: windows-latest @@ -22,33 +22,50 @@ jobs: run: shell: msys2 {0} + continue-on-error: ${{ matrix.build-target.continue-on-error }} + strategy: + fail-fast: false matrix: dev-build: ['y', 'n'] new-dynarec: ['y', 'n'] - target-arch: - - x64: 'n' - msystem: MINGW32 + build-target: + - msystem: MINGW32 prefix: mingw-w64-i686 - - x64: 'y' - msystem: MINGW64 + x64: n + clang: n + continue-on-error: false + - msystem: MINGW64 prefix: mingw-w64-x86_64 + x64: y + clang: n + continue-on-error: false + - msystem: UCRT64 + prefix: mingw-w64-ucrt-x86_64 + x64: y + clang: n + continue-on-error: false + - msystem: CLANG64 + prefix: mingw-w64-clang-x86_64 + x64: y + clang: y + continue-on-error: true steps: - uses: msys2/setup-msys2@v2 with: update: true - msystem: ${{ matrix.target-arch.msystem }} + msystem: ${{ matrix.build-target.msystem }} install: >- make - ${{ matrix.target-arch.prefix }}-toolchain - ${{ matrix.target-arch.prefix }}-openal - ${{ matrix.target-arch.prefix }}-freetype - ${{ matrix.target-arch.prefix }}-SDL2 - ${{ matrix.target-arch.prefix }}-zlib - ${{ matrix.target-arch.prefix }}-libpng - ${{ matrix.target-arch.prefix }}-libvncserver + ${{ matrix.build-target.prefix }}-toolchain + ${{ matrix.build-target.prefix }}-openal + ${{ matrix.build-target.prefix }}-freetype + ${{ matrix.build-target.prefix }}-SDL2 + ${{ matrix.build-target.prefix }}-zlib + ${{ matrix.build-target.prefix }}-libpng + ${{ matrix.build-target.prefix }}-libvncserver - uses: actions/checkout@v2 - name: make - run: make -fwin/makefile.mingw -j DEV_BUILD=${{ matrix.dev-build }} NEW_DYNAREC=${{ matrix.new-dynarec }} X64=${{ matrix.target-arch.x64 }} VNC=n + run: make -fwin/makefile.mingw -j DEV_BUILD=${{ matrix.dev-build }} NEW_DYNAREC=${{ matrix.new-dynarec }} X64=${{ matrix.build-target.x64 }} CLANG=${{ matrix.build-target.clang }} VNC=n working-directory: ./src diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index d34841573..ac722ca35 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -43,6 +43,10 @@ jobs: prefix: mingw-w64-i686 - msystem: MINGW64 prefix: mingw-w64-x86_64 + - msystem: UCRT64 + prefix: mingw-w64-ucrt-x86_64 + - msystem: CLANG64 + prefix: mingw-w64-clang-x86_64 steps: - uses: msys2/setup-msys2@v2 From 69a8c63c333b47b278f49c0a893ec79df5979739 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hrdli=C4=8Dka?= Date: Sun, 29 Aug 2021 04:55:05 +0200 Subject: [PATCH 07/14] cmake: no SSE2 flag on non-x86 targets --- src/video/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/video/CMakeLists.txt b/src/video/CMakeLists.txt index 03436ba32..78be96495 100644 --- a/src/video/CMakeLists.txt +++ b/src/video/CMakeLists.txt @@ -48,7 +48,7 @@ add_library(voodoo OBJECT vid_voodoo.c vid_voodoo_banshee.c vid_voodoo_fb.c vid_voodoo_fifo.c vid_voodoo_reg.c vid_voodoo_render.c vid_voodoo_setup.c vid_voodoo_texture.c) -if(NOT MSVC) +if(NOT MSVC AND (ARCH STREQUAL "i386" OR ARCH STREQUAL "x86_64")) target_compile_options(voodoo PRIVATE "-msse2") endif() From 523fa0cd2d989c2b17f7a43a6f38240a02ab0e5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hrdli=C4=8Dka?= Date: Sun, 29 Aug 2021 04:55:46 +0200 Subject: [PATCH 08/14] workflows: fix cmake/mingw artifacts --- .github/workflows/cmake.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index ac722ca35..8a5f7ef63 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -67,7 +67,7 @@ jobs: run: >- cmake -S . -B build -G "MSYS Makefiles" - -D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/build/artifacts + -D CMAKE_INSTALL_PREFIX=./build/artifacts -D CMAKE_BUILD_TYPE=${{ env.build.type }} -D DEV_BRANCH=${{ matrix.build.dev-build }} -D NEW_DYNAREC=${{ matrix.build.new-dynarec }} @@ -114,7 +114,7 @@ jobs: cmake -S . -B build -G "Visual Studio 16 2019" -A ${{ matrix.target-arch }} -T ${{ matrix.toolset }} -D CMAKE_TOOLCHAIN_FILE=C:\vcpkg\scripts\buildsystems\vcpkg.cmake - -D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/build/artifacts + -D CMAKE_INSTALL_PREFIX=./build/artifacts -D DEV_BRANCH=${{ matrix.build.dev-build }} -D NEW_DYNAREC=${{ matrix.build.new-dynarec }} -D VNC=OFF From f0fe6646d3160938981bc2a3e74342e583b15425 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hrdli=C4=8Dka?= Date: Sun, 29 Aug 2021 05:06:25 +0200 Subject: [PATCH 09/14] workflows: slight fix to triggers --- .github/workflows/c-cpp.yml | 6 ++++-- .github/workflows/cmake.yml | 5 ++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml index 82db5a769..79c9fe59f 100644 --- a/.github/workflows/c-cpp.yml +++ b/.github/workflows/c-cpp.yml @@ -5,12 +5,14 @@ on: push: paths: - src/** - - .github/workflows/** + - .github/workflows/c-cpp.yml + - "!**/CMakeLists.txt" pull_request: paths: - src/** - - .github/workflows/** + - .github/workflows/c-cpp.yml + - "!**/CMakeLists.txt" jobs: build: diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 8a5f7ef63..0b585ef14 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -6,15 +6,18 @@ on: paths: - src/** - "**/CMakeLists.txt" - - .github/workflows/** + - .github/workflows/cmake.yml - vcpkg.json + - "!**/Makefile*" pull_request: paths: - src/** - "**/CMakeLists.txt" - .github/workflows/** + - .github/workflows/cmake.yml - vcpkg.json + - "!**/Makefile*" jobs: mingw: From 7ec39be770855c3c4f3e9cf88ce1345aa5adc980 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hrdli=C4=8Dka?= Date: Sun, 29 Aug 2021 06:38:01 +0200 Subject: [PATCH 10/14] workflows: remove the broken clang64 build --- .github/workflows/c-cpp.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml index 79c9fe59f..5ab4f0117 100644 --- a/.github/workflows/c-cpp.yml +++ b/.github/workflows/c-cpp.yml @@ -47,11 +47,11 @@ jobs: x64: y clang: n continue-on-error: false - - msystem: CLANG64 - prefix: mingw-w64-clang-x86_64 - x64: y - clang: y - continue-on-error: true +# - msystem: CLANG64 +# prefix: mingw-w64-clang-x86_64 +# x64: y +# clang: y +# continue-on-error: true steps: - uses: msys2/setup-msys2@v2 From 2596c0143cd420ae43cb8dcc15851c9bac3264b4 Mon Sep 17 00:00:00 2001 From: Ompronce <88358700+Ompronce@users.noreply.github.com> Date: Sun, 29 Aug 2021 00:40:21 -0400 Subject: [PATCH 11/14] Make the Innovation SSI-2001's IO address configurable (#1636) --- src/include/86box/resource.h | 1 + src/sound/snd_ssi2001.c | 32 ++++++++++++++++++++++++++++++-- src/win/86Box.rc | 1 + src/win/win_settings.c | 11 +++++++++++ 4 files changed, 43 insertions(+), 2 deletions(-) diff --git a/src/include/86box/resource.h b/src/include/86box/resource.h index 7d2233ea6..7168ce5ba 100644 --- a/src/include/86box/resource.h +++ b/src/include/86box/resource.h @@ -164,6 +164,7 @@ #define IDC_CONFIGURE_GUS 1049 #define IDC_COMBO_MIDI_IN 1050 #define IDC_CONFIGURE_CMS 1051 +#define IDC_CONFIGURE_SSI 1052 #define IDC_COMBO_NET_TYPE 1060 /* network config */ #define IDC_COMBO_PCAP 1061 diff --git a/src/sound/snd_ssi2001.c b/src/sound/snd_ssi2001.c index ad65a9010..bd4e70ea9 100644 --- a/src/sound/snd_ssi2001.c +++ b/src/sound/snd_ssi2001.c @@ -65,7 +65,8 @@ void *ssi2001_init(const device_t *info) ssi2001->psid = sid_init(); sid_reset(ssi2001->psid); - io_sethandler(0x0280, 0x0020, ssi2001_read, NULL, NULL, ssi2001_write, NULL, NULL, ssi2001); + uint16_t addr = device_get_config_hex16("base"); + io_sethandler(addr, 0x0020, ssi2001_read, NULL, NULL, ssi2001_write, NULL, NULL, ssi2001); sound_add_handler(ssi2001_get_buffer, ssi2001); return ssi2001; } @@ -79,11 +80,38 @@ void ssi2001_close(void *p) free(ssi2001); } +static const device_config_t ssi2001_config[] = +{ + { + "base", "Address", CONFIG_HEX16, "", 0x280, "", { 0 }, + { + { + "0x280", 0x280 + }, + { + "0x2A0", 0x2A0 + }, + { + "0x2C0", 0x2C0 + }, + { + "0x2E0", 0x2E0 + }, + { + "" + } + } + }, + { + "", "", -1 + } +}; + const device_t ssi2001_device = { "Innovation SSI-2001", 0, 0, ssi2001_init, ssi2001_close, NULL, { NULL }, NULL, NULL, - NULL + ssi2001_config }; diff --git a/src/win/86Box.rc b/src/win/86Box.rc index 78b37c697..d6e98e6ee 100644 --- a/src/win/86Box.rc +++ b/src/win/86Box.rc @@ -519,6 +519,7 @@ BEGIN CONTROL "Innovation SSI-2001",IDC_CHECK_SSI,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,7,84,95,10 + PUSHBUTTON "Configure",IDC_CONFIGURE_SSI,214,82,46,12 CONTROL "CMS / Game Blaster",IDC_CHECK_CMS,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,7,102,95,10 diff --git a/src/win/win_settings.c b/src/win/win_settings.c index 4a7dbc0bb..7e90ef1ba 100644 --- a/src/win/win_settings.c +++ b/src/win/win_settings.c @@ -1380,6 +1380,7 @@ win_settings_sound_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) settings_set_check(hdlg, IDC_CHECK_GUS, temp_GUS); settings_enable_window(hdlg, IDC_CONFIGURE_GUS, temp_GUS); settings_set_check(hdlg, IDC_CHECK_SSI, temp_SSI2001); + settings_enable_window(hdlg, IDC_CONFIGURE_SSI, temp_SSI2001); settings_set_check(hdlg, IDC_CHECK_FLOAT, temp_float); free(lptsTemp); @@ -1456,6 +1457,16 @@ win_settings_sound_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) case IDC_CONFIGURE_GUS: temp_deviceconfig |= deviceconfig_open(hdlg, (void *)&gus_device); break; + + case IDC_CHECK_SSI: + temp_SSI2001 = settings_get_check(hdlg, IDC_CHECK_SSI); + + settings_enable_window(hdlg, IDC_CONFIGURE_SSI, temp_SSI2001); + break; + + case IDC_CONFIGURE_SSI: + temp_deviceconfig |= deviceconfig_open(hdlg, &ssi2001_device); + break; } return FALSE; From 88295f807c23fc479c40218a2e92293e907ff947 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hrdli=C4=8Dka?= Date: Sun, 29 Aug 2021 07:22:00 +0200 Subject: [PATCH 12/14] cmake: fix pure clang/win32 build --- src/win/86Box.rc | 2 +- src/win/CMakeLists.txt | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/win/86Box.rc b/src/win/86Box.rc index d6e98e6ee..e48df8eae 100644 --- a/src/win/86Box.rc +++ b/src/win/86Box.rc @@ -1296,7 +1296,7 @@ BEGIN VALUE "FileDescription", EMU_NAME "\0" VALUE "FileVersion", EMU_VERSION "\0" VALUE "InternalName", EMU_NAME "\0" - VALUE "LegalCopyright", "Copyright © 2007-2020 " EMU_NAME " contributors\0" + VALUE "LegalCopyright", "Copyright \u00A9 2007-2020 " EMU_NAME " contributors\0" VALUE "OriginalFilename", "86box.exe\0" VALUE "ProductName", EMU_NAME "\0" VALUE "ProductVersion", EMU_VERSION "\0" diff --git a/src/win/CMakeLists.txt b/src/win/CMakeLists.txt index 839f2b0bb..6102cde68 100644 --- a/src/win/CMakeLists.txt +++ b/src/win/CMakeLists.txt @@ -29,12 +29,14 @@ if(MSVC) target_compile_definitions(ui PRIVATE NO_INCLUDE_MANIFEST) target_sources(86Box PRIVATE 86Box.manifest) - target_sources(plat PRIVATE win_opendir.c) - # Append null to resource strings (fixes file dialogs) set_property(SOURCE 86Box.rc PROPERTY COMPILE_FLAGS -n) endif() +if(NOT MINGW) + target_sources(plat PRIVATE win_opendir.c) +endif() + if(DINPUT) target_sources(plat PRIVATE win_joystick.cpp) target_link_libraries(86Box dinput8) From 1ab23d5531ed2c80f1ebd370a924ad0f92030251 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hrdli=C4=8Dka?= Date: Sun, 29 Aug 2021 08:38:26 +0200 Subject: [PATCH 13/14] cmake: more fixes --- src/CMakeLists.txt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index dc7f76dd0..cbe6f79f5 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -64,12 +64,16 @@ target_link_libraries(86Box PNG::PNG) if(ARCH STREQUAL "i386") if(MSVC) - set_target_properties(86Box PROPERTIES LINK_FLAGS "/LARGEADDRESSAWARE") - elseif(MINGW) - set_target_properties(86Box PROPERTIES LINK_FLAGS "-Wl,--large-address-aware") + target_link_options(86Box PRIVATE "/LARGEADDRESSAWARE") + else() + target_link_options(86Box PRIVATE "LINKER:--large-address-aware") endif() endif() +if(NOT MSVC) + target_link_options(86Box PRIVATE "-static") +endif() + configure_file(include/86box/version.h.in include/86box/version.h @ONLY) include_directories(${CMAKE_CURRENT_BINARY_DIR}/include) From 139268c7495cf8e46680ad18c542e6993ba8f584 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hrdli=C4=8Dka?= Date: Sun, 29 Aug 2021 08:49:46 +0200 Subject: [PATCH 14/14] fix copyright sign in version information --- src/win/86Box.rc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/win/86Box.rc b/src/win/86Box.rc index e48df8eae..9f98c9350 100644 --- a/src/win/86Box.rc +++ b/src/win/86Box.rc @@ -1296,7 +1296,7 @@ BEGIN VALUE "FileDescription", EMU_NAME "\0" VALUE "FileVersion", EMU_VERSION "\0" VALUE "InternalName", EMU_NAME "\0" - VALUE "LegalCopyright", "Copyright \u00A9 2007-2020 " EMU_NAME " contributors\0" + VALUE "LegalCopyright", "Copyright \xc2\xa9 2007-2020 " EMU_NAME " contributors\0" VALUE "OriginalFilename", "86box.exe\0" VALUE "ProductName", EMU_NAME "\0" VALUE "ProductVersion", EMU_VERSION "\0"