From ec948c8ab4bdd9c45de08e8da52a0ae0313a9af7 Mon Sep 17 00:00:00 2001 From: Totto16 Date: Thu, 9 May 2024 21:29:42 +0200 Subject: [PATCH 01/15] CI: update ubuntu image version from "22.04" to "24.04" --- .github/workflows/android.yml | 2 +- .github/workflows/cpp-linter.yml | 2 +- .github/workflows/flatpak.yml | 2 +- .github/workflows/meson.yml | 6 +++--- .github/workflows/nintendo.yml | 2 +- .github/workflows/test.yml | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 82b5deac..6ceed1e4 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -11,7 +11,7 @@ on: jobs: android-build: name: Build android apk for - ${{ matrix.config.arch }} - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 strategy: fail-fast: false matrix: diff --git a/.github/workflows/cpp-linter.yml b/.github/workflows/cpp-linter.yml index a943ae6e..6826843c 100644 --- a/.github/workflows/cpp-linter.yml +++ b/.github/workflows/cpp-linter.yml @@ -7,7 +7,7 @@ on: jobs: cpp-linter: - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 permissions: pull-requests: write issues: write diff --git a/.github/workflows/flatpak.yml b/.github/workflows/flatpak.yml index df653d2c..716db255 100644 --- a/.github/workflows/flatpak.yml +++ b/.github/workflows/flatpak.yml @@ -11,7 +11,7 @@ on: jobs: flatpak: name: "Flatpak build" - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 container: image: bilelmoussaoui/flatpak-github-actions:freedesktop-23.08 options: --privileged diff --git a/.github/workflows/meson.yml b/.github/workflows/meson.yml index 40278cbd..33a1b50e 100644 --- a/.github/workflows/meson.yml +++ b/.github/workflows/meson.yml @@ -34,7 +34,7 @@ jobs: - name: Linux Release os: ubuntu - os-version: 22.04 + os-version: 24.04 buildtype: release use-clang: false library_type: shared @@ -42,7 +42,7 @@ jobs: - name: Linux Clang Release (libstdc++) os: ubuntu - os-version: 22.04 + os-version: 24.04 buildtype: release use-clang: true use-clang_stdlib: false @@ -51,7 +51,7 @@ jobs: - name: Linux Clang Release (libc++) os: ubuntu - os-version: 22.04 + os-version: 24.04 buildtype: release use-clang: true use-clang_stdlib: true diff --git a/.github/workflows/nintendo.yml b/.github/workflows/nintendo.yml index 169d9ae3..3163c1d9 100644 --- a/.github/workflows/nintendo.yml +++ b/.github/workflows/nintendo.yml @@ -9,7 +9,7 @@ on: jobs: build: name: Nintendo ${{ matrix.config.name }} CI - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 container: image: devkitpro/${{ matrix.config.container }} ## base on debian:buster-slim strategy: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4b4fad8b..c9f4fe4e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,7 +9,7 @@ on: jobs: build: name: Run Tests - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v4 with: From d331e7b7b5e453bf6f8f387f5bb96f1e2c070633 Mon Sep 17 00:00:00 2001 From: Totto16 Date: Thu, 9 May 2024 22:10:48 +0200 Subject: [PATCH 02/15] CI: also add ucrt build to --- .github/workflows/meson.yml | 41 ++++++++++++++++++++++++++++--------- 1 file changed, 31 insertions(+), 10 deletions(-) diff --git a/.github/workflows/meson.yml b/.github/workflows/meson.yml index 33a1b50e..ccbeae88 100644 --- a/.github/workflows/meson.yml +++ b/.github/workflows/meson.yml @@ -14,12 +14,11 @@ jobs: strategy: fail-fast: false matrix: - # Customize the Meson build type here ("plain", "debug", "debugoptimized", "release", "minsize", "custom".) config: - name: Windows MSVC Release os: windows os-version: 2022 - msvc: true + environment: msvc buildtype: release library_type: static shell: pwsh @@ -27,11 +26,22 @@ jobs: - name: Windows MingGW Release os: windows os-version: 2022 - msvc: false + environment: mingw + architecture: x86_64 buildtype: release library_type: static shell: "msys2 {0}" + - name: Windows UCRT Release + os: windows + os-version: 2022 + environment: ucrt + architecture: ucrt-x86_64 + buildtype: release + library_type: static + shell: "msys2 {0}" + + - name: Linux Release os: ubuntu os-version: 24.04 @@ -84,21 +94,32 @@ jobs: fetch-depth: "0" - name: Setup MSVC (Windows) - if: matrix.config.os == 'windows' && matrix.config.msvc == true + if: matrix.config.os == 'windows' && matrix.config.environment == 'msvc' uses: TheMrMilchmann/setup-msvc-dev@v3 with: arch: x64 toolset: 14.39 - - name: Setup MinGW (Windows) - if: matrix.config.os == 'windows' && matrix.config.msvc == false + - name: Setup MYSYS2 (Windows) + if: matrix.config.os == 'windows' && ( matrix.config.environment == 'mingw' || matrix.config.environment == 'ucrt' ) uses: msys2/setup-msys2@v2 with: - msystem: MINGW64 + msystem: ${{matrix.config.environment == 'mingw' && 'MINGW64' || 'UCRT64'}} update: true - install: mingw-w64-x86_64-gcc mingw-w64-x86_64-ninja mingw-w64-x86_64-python mingw-w64-x86_64-python-pip mingw-w64-x86_64-SDL2 mingw-w64-x86_64-SDL2_ttf mingw-w64-x86_64-SDL2_mixer mingw-w64-x86_64-SDL2_image mingw-w64-x86_64-pkg-config mingw-w64-x86_64-ca-certificates mingw-w64-x86_64-cmake git - + install: >- + mingw-w64-${{matrix.config.architecture}}-gcc + mingw-w64-${{matrix.config.architecture}}-ninja + mingw-w64-${{matrix.config.architecture}}-python + mingw-w64-${{matrix.config.architecture}}-python-pip + mingw-w64-${{matrix.config.architecture}}-SDL2 + mingw-w64-${{matrix.config.architecture}}-SDL2_ttf + mingw-w64-${{matrix.config.architecture}}-SDL2_mixer + mingw-w64-${{matrix.config.architecture}}-SDL2_image + mingw-w64-${{matrix.config.architecture}}-pkg-config + mingw-w64-${{matrix.config.architecture}}-ca-certificates + mingw-w64-${{matrix.config.architecture}}-cmake + git - name: Setup Clang (Linux) if: matrix.config.os == 'ubuntu' && matrix.config.use-clang == true @@ -116,7 +137,7 @@ jobs: if: matrix.config.os == 'ubuntu' && matrix.config.use-clang == false uses: egor-tensin/setup-gcc@v1 with: - version: 13 + version: 14 platform: x64 - name: Setup Clang (MacOS) From 29eafe65fee05017fc240bdc18c18243c05cb3d1 Mon Sep 17 00:00:00 2001 From: Totto16 Date: Mon, 13 May 2024 00:20:21 +0200 Subject: [PATCH 03/15] gcc-14: - fix build of fmt, since it has a bug, this is solved later, when upgrading fmt (when there is a new release) --- subprojects/fmt.wrap | 3 ++- .../packagefiles/fmt-10.2.0-gcc-bug.diff | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 subprojects/packagefiles/fmt-10.2.0-gcc-bug.diff diff --git a/subprojects/fmt.wrap b/subprojects/fmt.wrap index 22ccfc3c..b7b9153b 100644 --- a/subprojects/fmt.wrap +++ b/subprojects/fmt.wrap @@ -8,7 +8,8 @@ patch_url = https://wrapdb.mesonbuild.com/v2/fmt_10.2.0-2/get_patch patch_hash = 2428c3a386a8390c76378f81ef804a297f4edc3b789499dd56629b7902b8ddb7 source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/fmt_10.2.0-2/fmt-10.2.0.tar.gz wrapdb_version = 10.2.0-2 -diff_files = fmt_dependency_override.diff +# TODO: remove the second after a new release (it's fixed after > 120.2.1) +diff_files = fmt_dependency_override.diff, fmt-10.2.0-gcc-bug.diff [provide] fmt = fmt_dep diff --git a/subprojects/packagefiles/fmt-10.2.0-gcc-bug.diff b/subprojects/packagefiles/fmt-10.2.0-gcc-bug.diff new file mode 100644 index 00000000..df6b4735 --- /dev/null +++ b/subprojects/packagefiles/fmt-10.2.0-gcc-bug.diff @@ -0,0 +1,19 @@ +diff --git a/meson.build b/meson.build +index 45cd1d1..13b276d 100644 +--- a/meson.build ++++ b/meson.build +@@ -1,10 +1,13 @@ + project('fmt', 'cpp', version: '10.2.0', license: 'MIT WITH fmt-exception', default_options: ['cpp_std=c++14']) + ++#TODO: remove with the next release ++cpp = meson.get_compiler('cpp') ++ + fmt_private_cpp_args = [] + fmt_interface_cpp_args = [] + if get_option('default_library') == 'shared' + fmt_private_cpp_args += ['-DFMT_LIB_EXPORT'] +- fmt_interface_cpp_args += ['-DFMT_SHARED'] ++ fmt_interface_cpp_args += ['-DFMT_SHARED', cpp.get_supported_arguments('-Wno-tautological-compare'),] + endif + + fmt_lib = library( From 1659c7201c3d1449ada959da4fd2e1ec8989c837 Mon Sep 17 00:00:00 2001 From: Totto16 Date: Mon, 13 May 2024 00:42:58 +0200 Subject: [PATCH 04/15] gcc 14: - fix some more compilation errors, use after destroy --- .../recording_selector/recording_selector.cpp | 18 ++++++++++-------- src/scenes/settings_menu/settings_menu.cpp | 7 ++++--- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/scenes/recording_selector/recording_selector.cpp b/src/scenes/recording_selector/recording_selector.cpp index 2a37aa11..2f9b6eaa 100644 --- a/src/scenes/recording_selector/recording_selector.cpp +++ b/src/scenes/recording_selector/recording_selector.cpp @@ -75,25 +75,24 @@ namespace scenes { if (m_next_command.has_value()) { return std::visit( helper::overloaded{ - [](const Return&) { - return UpdateResult{ SceneUpdate::StopUpdating, Scene::Pop{} }; - }, + [](const Return&) { return UpdateResult{ SceneUpdate::StopUpdating, Scene::Pop{} }; }, [this](const Action& action) { - m_next_command = helper::nullopt; - if (auto* recording_component = dynamic_cast(action.widget); recording_component != nullptr) { const auto recording_path = recording_component->metadata().path; + // action is a reference to a structure inside m_next_command, so resetting it means, we need to copy everything out of it + m_next_command = helper::nullopt; + return UpdateResult{ SceneUpdate::StopUpdating, - Scene::RawSwitch{"ReplayGame", + Scene::RawSwitch{ "ReplayGame", std::make_unique( - m_service_provider, ui::FullScreenLayout{ m_service_provider->window() }, + m_service_provider, ui::FullScreenLayout{ m_service_provider->window() }, recording_path - )} + ) } }; } #if defined(_HAVE_FILE_DIALOGS) @@ -108,6 +107,9 @@ namespace scenes { add_all_recordings(); + // action is a reference to a structure inside m_next_command, so resetting it means, we need to copy everything out of it + m_next_command = helper::nullopt; + return UpdateResult{ SceneUpdate::StopUpdating, helper::nullopt }; } diff --git a/src/scenes/settings_menu/settings_menu.cpp b/src/scenes/settings_menu/settings_menu.cpp index 98960ec4..29977d61 100644 --- a/src/scenes/settings_menu/settings_menu.cpp +++ b/src/scenes/settings_menu/settings_menu.cpp @@ -115,13 +115,14 @@ namespace scenes { return UpdateResult{ SceneUpdate::StopUpdating, Scene::Pop{} }; }, [this](const Action& action) { - m_next_command = helper::nullopt; - if (auto* settings_details = dynamic_cast(action.widget); settings_details != nullptr) { auto change_scene = settings_details->get_details_scene(); + // action is a reference to a structure inside m_next_command, so resetting it means, we need to copy everything out of it + m_next_command = helper::nullopt; + return UpdateResult{ SceneUpdate::StopUpdating, std::move(change_scene) }; } @@ -151,7 +152,7 @@ namespace scenes { if (const auto event_result = m_main_layout.handle_event(event, window); event_result) { if (const auto additional = event_result.get_additional(); additional.has_value() and additional.value().first == ui::EventHandleType::RequestAction) { - m_next_command = Command{ Action(additional.value().second) }; + m_next_command = Command{ Action{ additional.value().second } }; } return true; From 1dc6e75fba89a58ae4b012ae9ea95aa578a1e6b6 Mon Sep 17 00:00:00 2001 From: Totto16 Date: Mon, 13 May 2024 01:03:44 +0200 Subject: [PATCH 05/15] gcc-14: - fix build of fmt, use flag in correct spot --- subprojects/packagefiles/fmt-10.2.0-gcc-bug.diff | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/subprojects/packagefiles/fmt-10.2.0-gcc-bug.diff b/subprojects/packagefiles/fmt-10.2.0-gcc-bug.diff index df6b4735..aaf3d4f5 100644 --- a/subprojects/packagefiles/fmt-10.2.0-gcc-bug.diff +++ b/subprojects/packagefiles/fmt-10.2.0-gcc-bug.diff @@ -1,19 +1,16 @@ diff --git a/meson.build b/meson.build -index 45cd1d1..13b276d 100644 +index 45cd1d1..a3ff1e6 100644 --- a/meson.build +++ b/meson.build -@@ -1,10 +1,13 @@ +@@ -1,7 +1,10 @@ project('fmt', 'cpp', version: '10.2.0', license: 'MIT WITH fmt-exception', default_options: ['cpp_std=c++14']) +#TODO: remove with the next release +cpp = meson.get_compiler('cpp') + fmt_private_cpp_args = [] - fmt_interface_cpp_args = [] +-fmt_interface_cpp_args = [] ++fmt_interface_cpp_args = [cpp.get_supported_arguments('-Wno-tautological-compare')] if get_option('default_library') == 'shared' fmt_private_cpp_args += ['-DFMT_LIB_EXPORT'] -- fmt_interface_cpp_args += ['-DFMT_SHARED'] -+ fmt_interface_cpp_args += ['-DFMT_SHARED', cpp.get_supported_arguments('-Wno-tautological-compare'),] - endif - - fmt_lib = library( + fmt_interface_cpp_args += ['-DFMT_SHARED'] From e069cb76ecf568e1dc0611dc8f71f33aa078d86f Mon Sep 17 00:00:00 2001 From: Totto16 Date: Tue, 14 May 2024 18:57:32 +0200 Subject: [PATCH 06/15] CI: fix ubuntu 24.04 python package install of meson --- .github/workflows/android.yml | 3 ++- .github/workflows/cpp-linter.yml | 3 ++- .github/workflows/meson.yml | 3 ++- .github/workflows/test.yml | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 6ceed1e4..a63f16e7 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -25,10 +25,11 @@ jobs: with: fetch-depth: "0" + # NOTE: meson has no dependencies, so --break-system-packages doesn't really break anything! - name: Setup Meson run: | python -m pip install --upgrade pip - pip install meson + pip install meson --break-system-packages - name: Setup ninja run: | diff --git a/.github/workflows/cpp-linter.yml b/.github/workflows/cpp-linter.yml index 6826843c..f2e779e5 100644 --- a/.github/workflows/cpp-linter.yml +++ b/.github/workflows/cpp-linter.yml @@ -14,10 +14,11 @@ jobs: steps: - uses: actions/checkout@v4 + # NOTE: meson has no dependencies, so --break-system-packages doesn't really break anything! - name: Setup Meson run: | python -m pip install --upgrade pip - pip install meson + pip install meson --break-system-packages - name: Setup Clang uses: egor-tensin/setup-clang@v1 diff --git a/.github/workflows/meson.yml b/.github/workflows/meson.yml index ccbeae88..18c4673b 100644 --- a/.github/workflows/meson.yml +++ b/.github/workflows/meson.yml @@ -161,11 +161,12 @@ jobs: brew update brew install meson + # NOTE: meson has no dependencies, so --break-system-packages doesn't really break anything! - name: Setup meson if: matrix.config.os != 'macos' run: | python -m pip install --upgrade pip - pip install meson + pip install meson --break-system-packages - name: Install dependencies (Linux) if: matrix.config.os == 'ubuntu' diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c9f4fe4e..b02bd244 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -24,10 +24,11 @@ jobs: echo "CC=clang-18" >> "$GITHUB_ENV" echo "CXX=clang++-18" >> "$GITHUB_ENV" + # NOTE: meson has no dependencies, so --break-system-packages doesn't really break anything! - name: Setup meson run: | python -m pip install --upgrade pip - pip install meson + pip install meson --break-system-packages - name: Install dependencies run: | From 12ec052abc11a1d8ba74d7020cbf711942abc837 Mon Sep 17 00:00:00 2001 From: Totto16 Date: Tue, 14 May 2024 19:01:23 +0200 Subject: [PATCH 07/15] CI: ubuntu 24.04 => don't upgrade pip with pi itself, but use apt upgrade --- .github/workflows/android.yml | 2 +- .github/workflows/cpp-linter.yml | 3 ++- .github/workflows/installer.yml | 1 - .github/workflows/meson.yml | 2 +- .github/workflows/test.yml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index a63f16e7..2b46a7ed 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -28,12 +28,12 @@ jobs: # NOTE: meson has no dependencies, so --break-system-packages doesn't really break anything! - name: Setup Meson run: | - python -m pip install --upgrade pip pip install meson --break-system-packages - name: Setup ninja run: | sudo apt-get update + sudo apt-get upgrade -y sudo apt-get install ninja-build jq - name: Setup JDK diff --git a/.github/workflows/cpp-linter.yml b/.github/workflows/cpp-linter.yml index f2e779e5..bb91ae89 100644 --- a/.github/workflows/cpp-linter.yml +++ b/.github/workflows/cpp-linter.yml @@ -17,7 +17,6 @@ jobs: # NOTE: meson has no dependencies, so --break-system-packages doesn't really break anything! - name: Setup Meson run: | - python -m pip install --upgrade pip pip install meson --break-system-packages - name: Setup Clang @@ -29,7 +28,9 @@ jobs: - name: Prepare compile_commands.json run: | sudo apt-get update + sudo apt-get upgrade -y sudo apt-get install ninja-build libsdl2-2.0-0 libsdl2-dev libsdl2-ttf* libsdl2-mixer* libsdl2-image* -y + meson setup build -Dbuildtype=release -Dclang_libcpp=disabled -Dtests=true meson compile -C build git_version.hpp diff --git a/.github/workflows/installer.yml b/.github/workflows/installer.yml index 2cb4ff6a..689dd5b5 100644 --- a/.github/workflows/installer.yml +++ b/.github/workflows/installer.yml @@ -41,7 +41,6 @@ jobs: - name: Setup meson if: matrix.config.os != 'macos' run: | - python -m pip install --upgrade pip pip install meson - name: Configure diff --git a/.github/workflows/meson.yml b/.github/workflows/meson.yml index 18c4673b..afecb969 100644 --- a/.github/workflows/meson.yml +++ b/.github/workflows/meson.yml @@ -165,13 +165,13 @@ jobs: - name: Setup meson if: matrix.config.os != 'macos' run: | - python -m pip install --upgrade pip pip install meson --break-system-packages - name: Install dependencies (Linux) if: matrix.config.os == 'ubuntu' run: | sudo apt-get update + sudo apt-get upgrade -y sudo apt-get install ninja-build libsdl2-2.0-0 libsdl2-dev libsdl2-ttf* libsdl2-mixer* libsdl2-image* -y - name: Install dependencies (MacOS) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b02bd244..c5fe8bb0 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -27,12 +27,12 @@ jobs: # NOTE: meson has no dependencies, so --break-system-packages doesn't really break anything! - name: Setup meson run: | - python -m pip install --upgrade pip pip install meson --break-system-packages - name: Install dependencies run: | sudo apt-get update + sudo apt-get upgrade -y sudo apt-get install ninja-build libsdl2-2.0-0 libsdl2-dev libsdl2-ttf* libsdl2-mixer* libsdl2-image* -y pip install gcovr From 290e60e2bfe602cf65c632a923f578631bb79a4c Mon Sep 17 00:00:00 2001 From: Totto16 Date: Tue, 14 May 2024 19:19:02 +0200 Subject: [PATCH 08/15] CI: ubuntu 24.04 => use deb package for gcovr, since it's nearly the latest stable version now --- .github/workflows/test.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c5fe8bb0..723699e8 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -33,8 +33,7 @@ jobs: run: | sudo apt-get update sudo apt-get upgrade -y - sudo apt-get install ninja-build libsdl2-2.0-0 libsdl2-dev libsdl2-ttf* libsdl2-mixer* libsdl2-image* -y - pip install gcovr + sudo apt-get install ninja-build libsdl2-2.0-0 libsdl2-dev libsdl2-ttf* libsdl2-mixer* libsdl2-image* gcovr -y - name: Configure run: meson setup build -Dbuildtype=debug -Db_coverage=true -Dtests=true -Dclang_libcpp=enabled From 63e58e61d4f0efbb4a37a2e1a0cdd4f8361876b2 Mon Sep 17 00:00:00 2001 From: Totto16 Date: Tue, 14 May 2024 19:19:33 +0200 Subject: [PATCH 09/15] CI: gcc-14, fix bug in initialization order --- src/game/tetrion.cpp | 4 ++-- src/game/tetrion.hpp | 37 +++++++++++++++++++------------------ 2 files changed, 21 insertions(+), 20 deletions(-) diff --git a/src/game/tetrion.cpp b/src/game/tetrion.cpp index b8847fcd..ac4e775b 100644 --- a/src/game/tetrion.cpp +++ b/src/game/tetrion.cpp @@ -23,13 +23,13 @@ Tetrion::Tetrion( bool is_top_level ) : ui::Widget{ layout , ui::WidgetType::Component ,is_top_level}, - m_next_gravity_simulation_step_index{ get_gravity_delay_frames() }, m_lock_delay_step_index{ lock_delay }, m_service_provider{ service_provider }, m_recording_writer{ std::move(recording_writer) }, m_random{ random_seed }, m_level{ starting_level }, m_tetrion_index{ tetrion_index }, + m_next_gravity_simulation_step_index{ get_gravity_delay_frames() }, main_layout{ utils::size_t_identity<2>(), 0, @@ -494,7 +494,7 @@ void Tetrion::refresh_previews() { auto bag_index = usize{ 0 }; for (std::remove_cvref_t i = 0; i < num_preview_tetrominos; ++i) { m_preview_tetrominos.at(static_cast(i)) = Tetromino{ - grid::preview_tetromino_position + shapes::UPoint{0, static_cast(grid::preview_padding * i)}, + grid::preview_tetromino_position + shapes::UPoint{ 0, static_cast(grid::preview_padding * i) }, m_sequence_bags.at(bag_index)[sequence_index] }; ++sequence_index; diff --git a/src/game/tetrion.hpp b/src/game/tetrion.hpp index a847f0d6..85dd7e38 100644 --- a/src/game/tetrion.hpp +++ b/src/game/tetrion.hpp @@ -57,14 +57,14 @@ struct Tetrion final : public ui::Widget { bool m_down_key_pressed = false; bool m_allowed_to_hold = true; bool m_is_in_lock_delay = false; + u32 m_num_executed_lock_delays = 0; - u64 m_next_gravity_simulation_step_index; u64 m_lock_delay_step_index; ServiceProvider* const m_service_provider; helper::optional> m_recording_writer; MinoStack m_mino_stack; Random m_random; - u32 m_level = 0; + u32 m_level; u32 m_lines_cleared = 0; GameState m_game_state = GameState::Playing; int m_sequence_index = 0; @@ -75,6 +75,7 @@ struct Tetrion final : public ui::Widget { helper::optional m_tetromino_on_hold; std::array, num_preview_tetrominos> m_preview_tetrominos{}; u8 m_tetrion_index; + u64 m_next_gravity_simulation_step_index; ui::TileLayout main_layout; @@ -149,7 +150,7 @@ struct Tetrion final : public ui::Widget { static u8 rotation_to_index(Rotation from, Rotation to); static constexpr auto wall_kick_data_jltsz = WallKickTable{ - // North -> East + // North -> East std::array{ WallKickPoint{ 0, 0 }, WallKickPoint{ -1, 0 }, @@ -157,7 +158,7 @@ struct Tetrion final : public ui::Widget { WallKickPoint{ 0, 2 }, WallKickPoint{ -1, 2 }, }, - // East -> North + // East -> North std::array{ WallKickPoint{ 0, 0 }, WallKickPoint{ 1, 0 }, @@ -165,7 +166,7 @@ struct Tetrion final : public ui::Widget { WallKickPoint{ 0, -2 }, WallKickPoint{ 1, -2 }, }, - // East -> South + // East -> South std::array{ WallKickPoint{ 0, 0 }, WallKickPoint{ 1, 0 }, @@ -173,7 +174,7 @@ struct Tetrion final : public ui::Widget { WallKickPoint{ 0, -2 }, WallKickPoint{ 1, -2 }, }, - // South -> East + // South -> East std::array{ WallKickPoint{ 0, 0 }, WallKickPoint{ -1, 0 }, @@ -181,7 +182,7 @@ struct Tetrion final : public ui::Widget { WallKickPoint{ 0, 2 }, WallKickPoint{ -1, 2 }, }, - // South -> West + // South -> West std::array{ WallKickPoint{ 0, 0 }, WallKickPoint{ 1, 0 }, @@ -189,7 +190,7 @@ struct Tetrion final : public ui::Widget { WallKickPoint{ 0, 2 }, WallKickPoint{ 1, 2 }, }, - // West -> South + // West -> South std::array{ WallKickPoint{ 0, 0 }, WallKickPoint{ -1, 0 }, @@ -197,7 +198,7 @@ struct Tetrion final : public ui::Widget { WallKickPoint{ 0, -2 }, WallKickPoint{ -1, -2 }, }, - // West -> North + // West -> North std::array{ WallKickPoint{ 0, 0 }, WallKickPoint{ -1, 0 }, @@ -205,7 +206,7 @@ struct Tetrion final : public ui::Widget { WallKickPoint{ 0, -2 }, WallKickPoint{ -1, -2 }, }, - // North -> West + // North -> West std::array{ WallKickPoint{ 0, 0 }, WallKickPoint{ 1, 0 }, @@ -216,7 +217,7 @@ struct Tetrion final : public ui::Widget { }; static constexpr auto wall_kick_data_i = WallKickTable{ - // North -> East + // North -> East std::array{ WallKickPoint{ 0, 0 }, WallKickPoint{ -2, 0 }, @@ -224,7 +225,7 @@ struct Tetrion final : public ui::Widget { WallKickPoint{ -2, 1 }, WallKickPoint{ 1, -2 }, }, - // East -> North + // East -> North std::array{ WallKickPoint{ 0, 0 }, WallKickPoint{ 2, 0 }, @@ -232,7 +233,7 @@ struct Tetrion final : public ui::Widget { WallKickPoint{ 2, -1 }, WallKickPoint{ -1, 2 }, }, - // East -> South + // East -> South std::array{ WallKickPoint{ 0, 0 }, WallKickPoint{ -1, 0 }, @@ -240,7 +241,7 @@ struct Tetrion final : public ui::Widget { WallKickPoint{ -1, -2 }, WallKickPoint{ 2, 1 }, }, - // South -> East + // South -> East std::array{ WallKickPoint{ 0, 0 }, WallKickPoint{ 1, 0 }, @@ -248,7 +249,7 @@ struct Tetrion final : public ui::Widget { WallKickPoint{ 1, 2 }, WallKickPoint{ -2, -1 }, }, - // South -> West + // South -> West std::array{ WallKickPoint{ 0, 0 }, WallKickPoint{ 2, 0 }, @@ -256,7 +257,7 @@ struct Tetrion final : public ui::Widget { WallKickPoint{ 2, -1 }, WallKickPoint{ -1, 2 }, }, - // West -> South + // West -> South std::array{ WallKickPoint{ 0, 0 }, WallKickPoint{ -2, 0 }, @@ -264,7 +265,7 @@ struct Tetrion final : public ui::Widget { WallKickPoint{ -2, 1 }, WallKickPoint{ 1, -2 }, }, - // West -> North + // West -> North std::array{ WallKickPoint{ 0, 0 }, WallKickPoint{ 1, 0 }, @@ -272,7 +273,7 @@ struct Tetrion final : public ui::Widget { WallKickPoint{ 1, 2 }, WallKickPoint{ -2, -1 }, }, - // North -> West + // North -> West std::array{ WallKickPoint{ 0, 0 }, WallKickPoint{ -1, 0 }, From 9cd11a751cfc154e4bfca4b11b81d61b85f08812 Mon Sep 17 00:00:00 2001 From: Totto16 Date: Wed, 15 May 2024 00:45:34 +0200 Subject: [PATCH 10/15] CI: android: - also build mpg123 on x86 --- platforms/build-android.sh | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/platforms/build-android.sh b/platforms/build-android.sh index ac7064e4..635505f2 100755 --- a/platforms/build-android.sh +++ b/platforms/build-android.sh @@ -203,19 +203,10 @@ for INDEX in "${ARCH_KEYS_INDEX[@]}"; do cd "$BUILD_DIR_MPG123" - if [ "$ARCH_VERSION" = "i686" ]; then - #cmake .. -DCMAKE_TOOLCHAIN_FILE=linux_i686.toolchain.cmake --install-prefix "$SYS_ROOT/usr" "-DCMAKE_SYSROOT=$SYS_ROOT" -DOUTPUT_MODULES=dummy -DCMAKE_POSITION_INDEPENDENT_CODE=ON - # cmake --build . + cmake .. --install-prefix "$SYS_ROOT/usr" "-DCMAKE_SYSROOT=$SYS_ROOT" -DOUTPUT_MODULES=dummy -DCMAKE_POSITION_INDEPENDENT_CODE=ON + cmake --build . - # cmake --install . - : # nop, for bash syntax - - else - cmake .. --install-prefix "$SYS_ROOT/usr" "-DCMAKE_SYSROOT=$SYS_ROOT" -DOUTPUT_MODULES=dummy -DCMAKE_POSITION_INDEPENDENT_CODE=ON - cmake --build . - - cmake --install . - fi + cmake --install . fi From ea95deeddf43802196f5fe68f9582496fa5db2c5 Mon Sep 17 00:00:00 2001 From: Totto16 Date: Wed, 15 May 2024 00:48:23 +0200 Subject: [PATCH 11/15] CI: android: - fix openssl error on armv7 --- platforms/build-android.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/platforms/build-android.sh b/platforms/build-android.sh index 635505f2..793708f0 100755 --- a/platforms/build-android.sh +++ b/platforms/build-android.sh @@ -232,9 +232,13 @@ for INDEX in "${ARCH_KEYS_INDEX[@]}"; do cd "$BUILD_DIR_OPENSSL" + if [ ! -e "openssl-3.3.0.tar.gz" ]; then wget -q "https://github.com/openssl/openssl/releases/download/openssl-3.3.0/openssl-3.3.0.tar.gz" + fi + if [ ! -d "openssl-3.3.0" ]; then tar -xzf "openssl-3.3.0.tar.gz" + fi cd "openssl-3.3.0" @@ -242,7 +246,25 @@ for INDEX in "${ARCH_KEYS_INDEX[@]}"; do export ANDROID_NDK_ROOT="$ANDROID_NDK_HOME" + if [ "$ARCH_VERSION" = "armv7a" ]; then + + ./Configure --prefix="$SYS_ROOT/usr" no-asm no-tests no-shared "$OPENSSL_TARGET_ARCH" "-D__ANDROID_API__=$SDK_VERSION" + else ./Configure --prefix="$SYS_ROOT/usr" no-tests no-shared "$OPENSSL_TARGET_ARCH" "-D__ANDROID_API__=$SDK_VERSION" + fi + + make clean + + if [ "$ARCH_VERSION" = "armv7-a" ]; then + + # fix an compile time error since openssl 3.1.0 > + # see https://github.com/android/ndk/issues/1992 + # Apply patch that fixes the armcap instruction + + # sed -e '/[.]hidden.*OPENSSL_armcap_P/d; /[.]extern.*OPENSSL_armcap_P/ {p; s/extern/hidden/ }' -i -- crypto/*arm*pl crypto/*/asm/*arm*pl + sed -E -i '' -e '/[.]hidden.*OPENSSL_armcap_P/d' -e '/[.]extern.*OPENSSL_armcap_P/ {p; s/extern/hidden/; }' crypto/*arm*pl crypto/*/asm/*arm*pl + + fi make -j build_sw From 317d9b2c7bbb7a6c12ebd1996bb518685e53aa4b Mon Sep 17 00:00:00 2001 From: Totto16 Date: Wed, 15 May 2024 01:36:31 +0200 Subject: [PATCH 12/15] CI: android: - fix mpg123 error on x86, the reason it existed was: the assembly that was used was detecting features of the HOST platform and not the TARGET platform, so SSE code was generated for x86, which has no SSE --- platforms/build-android.sh | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/platforms/build-android.sh b/platforms/build-android.sh index 793708f0..24aba500 100755 --- a/platforms/build-android.sh +++ b/platforms/build-android.sh @@ -177,9 +177,13 @@ for INDEX in "${ARCH_KEYS_INDEX[@]}"; do cd "$BUILD_DIR_MPG123" - wget -q "https://www.mpg123.de/download/mpg123-1.32.6.tar.bz2" + if [ ! -e "mpg123-1.32.6.tar.bz2" ]; then + wget -q "https://www.mpg123.de/download/mpg123-1.32.6.tar.bz2" + fi - tar -xf "mpg123-1.32.6.tar.bz2" + if [ ! -d "mpg123-1.32.6" ]; then + tar -xf "mpg123-1.32.6.tar.bz2" + fi cd "mpg123-1.32.6" @@ -203,7 +207,8 @@ for INDEX in "${ARCH_KEYS_INDEX[@]}"; do cd "$BUILD_DIR_MPG123" - cmake .. --install-prefix "$SYS_ROOT/usr" "-DCMAKE_SYSROOT=$SYS_ROOT" -DOUTPUT_MODULES=dummy -DCMAKE_POSITION_INDEPENDENT_CODE=ON + cmake .. --install-prefix "$SYS_ROOT/usr" "-DCMAKE_SYSROOT=$SYS_ROOT" -DOUTPUT_MODULES=dummy -DCMAKE_POSITION_INDEPENDENT_CODE=ON "-DCMAKE_HOST_SYSTEM_PROCESSOR=$ARCH_VERSION" + cmake --build . cmake --install . @@ -233,11 +238,11 @@ for INDEX in "${ARCH_KEYS_INDEX[@]}"; do cd "$BUILD_DIR_OPENSSL" if [ ! -e "openssl-3.3.0.tar.gz" ]; then - wget -q "https://github.com/openssl/openssl/releases/download/openssl-3.3.0/openssl-3.3.0.tar.gz" + wget -q "https://github.com/openssl/openssl/releases/download/openssl-3.3.0/openssl-3.3.0.tar.gz" fi if [ ! -d "openssl-3.3.0" ]; then - tar -xzf "openssl-3.3.0.tar.gz" + tar -xzf "openssl-3.3.0.tar.gz" fi cd "openssl-3.3.0" @@ -250,7 +255,7 @@ for INDEX in "${ARCH_KEYS_INDEX[@]}"; do ./Configure --prefix="$SYS_ROOT/usr" no-asm no-tests no-shared "$OPENSSL_TARGET_ARCH" "-D__ANDROID_API__=$SDK_VERSION" else - ./Configure --prefix="$SYS_ROOT/usr" no-tests no-shared "$OPENSSL_TARGET_ARCH" "-D__ANDROID_API__=$SDK_VERSION" + ./Configure --prefix="$SYS_ROOT/usr" no-tests no-shared "$OPENSSL_TARGET_ARCH" "-D__ANDROID_API__=$SDK_VERSION" fi make clean From 4c746aecc46343244d4bfac96cc76cba481455e5 Mon Sep 17 00:00:00 2001 From: Totto16 Date: Wed, 15 May 2024 01:44:20 +0200 Subject: [PATCH 13/15] GCC 14 support: - also fix bug for header only fmt --- subprojects/packagefiles/fmt-10.2.0-gcc-bug.diff | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/subprojects/packagefiles/fmt-10.2.0-gcc-bug.diff b/subprojects/packagefiles/fmt-10.2.0-gcc-bug.diff index aaf3d4f5..ee5b67a3 100644 --- a/subprojects/packagefiles/fmt-10.2.0-gcc-bug.diff +++ b/subprojects/packagefiles/fmt-10.2.0-gcc-bug.diff @@ -1,5 +1,5 @@ diff --git a/meson.build b/meson.build -index 45cd1d1..a3ff1e6 100644 +index 45cd1d1..c648181 100644 --- a/meson.build +++ b/meson.build @@ -1,7 +1,10 @@ @@ -14,3 +14,12 @@ index 45cd1d1..a3ff1e6 100644 if get_option('default_library') == 'shared' fmt_private_cpp_args += ['-DFMT_LIB_EXPORT'] fmt_interface_cpp_args += ['-DFMT_SHARED'] +@@ -29,7 +32,7 @@ fmt_dep = declare_dependency( + + fmt_header_only_dep = declare_dependency( + include_directories: 'include', +- compile_args: '-DFMT_HEADER_ONLY', ++ compile_args: [cpp.get_supported_arguments('-Wno-tautological-compare'), '-DFMT_HEADER_ONLY'], + ) + + pkg_mod = import('pkgconfig') From 0170816140449d2ce55b6459356fec405fa9fe50 Mon Sep 17 00:00:00 2001 From: Totto16 Date: Wed, 15 May 2024 01:51:57 +0200 Subject: [PATCH 14/15] CI: android: -fix mpg123 build on x86 --- platforms/build-android.sh | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/platforms/build-android.sh b/platforms/build-android.sh index 24aba500..aaaab9e5 100755 --- a/platforms/build-android.sh +++ b/platforms/build-android.sh @@ -187,33 +187,23 @@ for INDEX in "${ARCH_KEYS_INDEX[@]}"; do cd "mpg123-1.32.6" - BUILDYSTEM="cmake" + cd ports/cmake/ - if [ $BUILDYSTEM = "autotools" ]; then + BUILD_DIR_MPG123="build-mpg123" - ./configure --prefix="$SYS_ROOT/usr" --oldincludedir="$SYS_ROOT/usr/include" --host="$ARM_NAME_TRIPLE" --with-sysroot="$SYS_ROOT" --with-audio="dummy" - - make + mkdir -p "$BUILD_DIR_MPG123" - make install + cd "$BUILD_DIR_MPG123" + if [ "$ARCH_VERSION" = "i686" ]; then + cmake .. --install-prefix "$SYS_ROOT/usr" "-DCMAKE_SYSROOT=$SYS_ROOT" -DOUTPUT_MODULES=dummy -DCMAKE_POSITION_INDEPENDENT_CODE=ON "-DCMAKE_SYSTEM_PROCESSOR=$ARCH_VERSION" -DCMAKE_TOOLCHAIN_FILE=../linux_i686.toolchain.cmake else + cmake .. --install-prefix "$SYS_ROOT/usr" "-DCMAKE_SYSROOT=$SYS_ROOT" -DOUTPUT_MODULES=dummy -DCMAKE_POSITION_INDEPENDENT_CODE=ON "-DCMAKE_SYSTEM_PROCESSOR=$ARCH_VERSION" + fi - cd ports/cmake/ - - BUILD_DIR_MPG123="build-mpg123" - - mkdir -p "$BUILD_DIR_MPG123" - - cd "$BUILD_DIR_MPG123" - - cmake .. --install-prefix "$SYS_ROOT/usr" "-DCMAKE_SYSROOT=$SYS_ROOT" -DOUTPUT_MODULES=dummy -DCMAKE_POSITION_INDEPENDENT_CODE=ON "-DCMAKE_HOST_SYSTEM_PROCESSOR=$ARCH_VERSION" - - cmake --build . - - cmake --install . + cmake --build . - fi + cmake --install . touch "$BUILD_MPG123_FILE" From 49c32e4ca0b532963ec02f416299065e6401a992 Mon Sep 17 00:00:00 2001 From: Totto16 Date: Wed, 15 May 2024 22:47:25 +0200 Subject: [PATCH 15/15] CI: android: -fix mpg123 build and use correct android cross compile arguments on all archs --- platforms/build-android.sh | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/platforms/build-android.sh b/platforms/build-android.sh index aaaab9e5..274aedef 100755 --- a/platforms/build-android.sh +++ b/platforms/build-android.sh @@ -105,10 +105,10 @@ for INDEX in "${ARCH_KEYS_INDEX[@]}"; do ARM_COMPILER_TRIPLE=$(echo "$RAW_JSON" | jq -M -r -c '."llvm_triple"') ARM_TOOL_TRIPLE=$(echo "$ARM_NAME_TRIPLE$SDK_VERSION" | sed s/$ARCH/$ARCH_VERSION/) - export SYM_LINK_PATH=sysroot_sym-$ARCH_VERSION + export SYM_LINK_PATH=sym-$ARCH_VERSION export HOST_ROOT="$BASE_PATH/toolchains/llvm/prebuilt/linux-x86_64" - export SYS_ROOT="${HOST_ROOT}/$SYM_LINK_PATH" + export SYS_ROOT="${HOST_ROOT}/$SYM_LINK_PATH/sysroot" export BIN_DIR="$HOST_ROOT/bin" export PATH="$BIN_DIR:$PATH" @@ -195,12 +195,20 @@ for INDEX in "${ARCH_KEYS_INDEX[@]}"; do cd "$BUILD_DIR_MPG123" + export MPG123_ANDROID_SSE_ENABLED="ON" + if [ "$ARCH_VERSION" = "i686" ]; then - cmake .. --install-prefix "$SYS_ROOT/usr" "-DCMAKE_SYSROOT=$SYS_ROOT" -DOUTPUT_MODULES=dummy -DCMAKE_POSITION_INDEPENDENT_CODE=ON "-DCMAKE_SYSTEM_PROCESSOR=$ARCH_VERSION" -DCMAKE_TOOLCHAIN_FILE=../linux_i686.toolchain.cmake - else - cmake .. --install-prefix "$SYS_ROOT/usr" "-DCMAKE_SYSROOT=$SYS_ROOT" -DOUTPUT_MODULES=dummy -DCMAKE_POSITION_INDEPENDENT_CODE=ON "-DCMAKE_SYSTEM_PROCESSOR=$ARCH_VERSION" + MPG123_ANDROID_SSE_ENABLED="OFF" fi + cmake .. --install-prefix "$SYS_ROOT/usr" "-DCMAKE_SYSROOT=$SYS_ROOT" -DOUTPUT_MODULES=dummy -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ + "-DCMAKE_SYSTEM_NAME=Android" \ + "-DCMAKE_SYSTEM_VERSION=$SDK_VERSION" \ + "-DCMAKE_ANDROID_ARCH_ABI=$KEY" \ + "-DCMAKE_ANDROID_NDK=$ANDROID_NDK" \ + "-DCMAKE_ANDROID_NDK_TOOLCHAIN_VERSION=clang" \ + "-DWITH_SSE=$MPG123_ANDROID_SSE_ENABLED" + cmake --build . cmake --install .