From 3ed195c0339e0df9cbcbdc0eed3535fbebee0589 Mon Sep 17 00:00:00 2001 From: MatthiasWM Date: Sat, 10 Feb 2024 13:55:36 +0100 Subject: [PATCH] Fix ARM64 code on WIndows --- .github/workflows/release.yml | 44 ++++++++++++++++++++++++++++++---- Emulator/TInterruptManager.cpp | 13 +++++++--- 2 files changed, 50 insertions(+), 7 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 13a91d90..448586b0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,7 +14,7 @@ on: #version_tag: # description: 'Release Version Tag' # required: true - # default: '2022.4.15' + # default: '2024.4.21' build-macos-universal-fltk: type: boolean description: Build macOS Universal FLTK @@ -27,15 +27,18 @@ on: type: boolean description: Build Windows x64 FLTK default: 'true' + build-windows-arm64-fltk: + type: boolean + description: Build Windows arm64 FLTK + default: 'true' build-macos-universal-cocoa: type: boolean description: Build macOS Universal Cocoa default: 'true' - # build-windows-arm64-fltk: # build-android # build-iOS -# Windows cmake build option for arm64 is -A ARM64 +# Windows cmake build option for arm64 is -A ARM64 # On Linux, we will have to do additional installs and set a bunch of environment variables jobs: @@ -115,7 +118,7 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} build-windows-x64-fltk: - runs-on: windows-2019 + runs-on: windows-latest if: ${{ github.event.inputs.build-windows-x64-fltk == 'true' }} steps: - name: Get sources @@ -147,6 +150,39 @@ jobs: tag: ${{ env.RELEASE_TAG }} token: ${{ secrets.GITHUB_TOKEN }} + build-windows-arm64-fltk: + runs-on: windows-latest + if: ${{ github.event.inputs.build-windows-arm64-fltk == 'true' }} + steps: + - name: Get sources + uses: actions/checkout@v4 + - name: Get Version + shell: pwsh + run: | + # Select-String -Path CMakeLists.txt -CaseSensitive -Pattern '"Einstein" VERSION' + $env:RELEASE_TAG2=(Select-String -Path CMakeLists.txt -CaseSensitive -Pattern '"Einstein" VERSION') + # gci env:RELEASE_TAG2 + $env:RELEASE_TAG=($env:RELEASE_TAG2 -replace '.* VERSION "', '' -replace '".*\)', '') + # gci env:RELEASE_TAG + echo "RELEASE_TAG=v$env:RELEASE_TAG" + echo "RELEASE_TAG=v$env:RELEASE_TAG" >> $env:GITHUB_ENV + - name: Compile Einstein + run: | + cmake -S . -B build -A ARM64 -D CMAKE_BUILD_TYPE=Release + cmake --build build --config Release --target Einstein + - name: Pack Einstein + run: | + mv build/Release/Einstein.exe . + cmake -E tar cf Einstein_windows_arm64_fltk_${{env.RELEASE_TAG}}.zip --format=zip Einstein.exe + - uses: ncipollo/release-action@v1 + with: + allowUpdates: 'true' + artifacts: Einstein_windows_arm64_fltk_${{env.RELEASE_TAG}}.zip + artifactContentType: application/zip + bodyFile: ReleaseText.md + tag: ${{ env.RELEASE_TAG }} + token: ${{ secrets.GITHUB_TOKEN }} + build-macos-universal-cocoa: runs-on: macos-latest if: ${{ github.event.inputs.build-macos-universal-cocoa == 'true' }} diff --git a/Emulator/TInterruptManager.cpp b/Emulator/TInterruptManager.cpp index 3edc13d6..1adc3ec5 100644 --- a/Emulator/TInterruptManager.cpp +++ b/Emulator/TInterruptManager.cpp @@ -750,19 +750,26 @@ TInterruptManager::GetTimeInTicks(void) checked = TRUE; LARGE_INTEGER f; found = QueryPerformanceFrequency(&f); + // 24000000 on Windows X11 ARM64 (24MHz) + // Ticks are running at 3.6864MHz + // if (found) { if (f.QuadPart == 0) found = FALSE; else - mult = 4000000.0 / ((double) f.QuadPart); + mult = 3686400.0 / ((double) f.QuadPart); } } if (found) { LARGE_INTEGER f; QueryPerformanceCounter(&f); - return (KUInt32) (((double) f.QuadPart) * mult); + double ticks_d = ((double)f.QuadPart) * mult; + if (ticks_d > 4294967295.0) // Max Value for KUInt32 + ticks_d = fmod(ticks_d, 4294967295.0); + KUInt32 ticks = static_cast(ticks_d); + return ticks; } else { struct _timeb ft; @@ -815,7 +822,7 @@ TInterruptManager::GetTimeInTicks(void) KUInt32 TInterruptManager::GetTimer(void) const { - // Get the time now and substract with the correction. + // Get the time now and subtract with the correction. KUInt32 theResult = GetTimeInTicks() - mTimerDelta; // if (mLog) // {