Skip to content

Commit

Permalink
Fix ARM64 code on WIndows
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthiasWM committed Feb 10, 2024
1 parent e0f53d2 commit 3ed195c
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 7 deletions.
44 changes: 40 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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' }}
Expand Down
13 changes: 10 additions & 3 deletions Emulator/TInterruptManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<KUInt32>(ticks_d);
return ticks;
} else
{
struct _timeb ft;
Expand Down Expand Up @@ -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)
// {
Expand Down

0 comments on commit 3ed195c

Please sign in to comment.