Commit 694d417

Nick Faro committed on
Enable Mac build
Finally at long last, the day is here.

Squashed commit of the following:

commit 8e40bb3d97e866a9c8e115adcbac7c39dec34691
Author: Nick Faro <[email protected]>
Date:   Sat Dec 30 16:31:32 2023 -0500

    Add info-zip for windows

commit 4909c862685687c2a5006e7b820d03157887ba60
Author: Nick Faro <[email protected]>
Date:   Sat Dec 30 16:16:47 2023 -0500

    Re-enable windows, zip correctly

commit f52b8cd5ba06fb213f1091a6aa499f586ebe0df4
Author: Nick Faro <[email protected]>
Date:   Sat Dec 30 15:56:35 2023 -0500

    Unscrew realpath

commit 42e96310188fb1edc1d2de7afecf075ef7d2ff07
Author: Nick Faro <[email protected]>
Date:   Sat Dec 30 15:45:07 2023 -0500

    Remove brew lame, maybe this will work

commit 2626de999deafdeb05d1d58e4c0e1c024f00a665
Author: Nick Faro <[email protected]>
Date:   Sat Dec 30 15:31:56 2023 -0500

    Remove wrong flags from ffmpeg, move to lame

commit f92cf80892cefc8454b29a8ad183a7f7d1fa89c3
Author: Nick Faro <[email protected]>
Date:   Sat Dec 30 15:29:15 2023 -0500

    Compile ffmpeg static hopefully

commit 2e82749c3a08eb7aaf1bf086dcf9932c0d4217e2
Author: Nick Faro <[email protected]>
Date:   Sat Dec 30 12:19:58 2023 -0500

    Fix small bug, place where forgot to update concatpaths

commit 9c2d35f81d1dcde450bd44c2cf78465b677ef9c9
Author: nick faro <[email protected]>
Date:   Sat Dec 30 12:00:39 2023 -0500

    Prompt user to install font

commit 182ae2ee0dcbde953e913df105d83c861e9c680e
Author: nick faro <[email protected]>
Date:   Sat Dec 30 11:36:30 2023 -0500

    Change debug level

commit f898d33d0e5a7b4727fd5363bbbd1d2ce16d3887
Author: Nick Faro <[email protected]>
Date:   Fri Dec 29 18:25:05 2023 -0500

    The executable bit..... and the waiting begins again

commit 22e34cc0fa157b3cec4528c2a79c3555880a32c4
Author: Nick Faro <[email protected]>
Date:   Fri Dec 29 18:17:08 2023 -0500

    Add back the ffmpeg deps

commit 55a8e95d1633598b694ef2a625a6bcb45a3d5d30
Author: Nick Faro <[email protected]>
Date:   Fri Dec 29 18:15:14 2023 -0500

    Update to Lazarus 3.0, hopefully build FFMPEG right now

commit 0cedf416339c2c9531ee8ed3080e00b9f73d4653
Author: Nick Faro <[email protected]>
Date:   Wed Dec 13 23:13:47 2023 -0500

    Github actions are busted

commit b3771adee2fa19e9c7fe02d5225ec7ca854b504d
Author: Nick Faro <[email protected]>
Date:   Wed Dec 13 22:30:42 2023 -0500

    Only build FFMpeg on Mac and Windows

commit aeca294c079688680d56eec4b6fa2cada2a8e286
Author: nick f <[email protected]>
Date:   Wed Dec 13 20:05:02 2023 -0800

    Do indeed debug with app bundle

commit c02c20b1698efe046a9e3190117671b0224ecaf5
Author: nick f <[email protected]>
Date:   Wed Dec 13 19:23:30 2023 -0800

    Don't debug with app bundle

commit 582b9a5aeb7ec774e14d123e8e8d63459a653dd4
Author: Nick Faro <[email protected]>
Date:   Wed Dec 13 21:39:48 2023 -0500

    Create directories properly, zip correctly

commit 5e0238af092688649235037c81acda6f4163258f
Author: Nick Faro <[email protected]>
Date:   Tue Dec 12 21:38:29 2023 -0500

    adjust static thing

commit 7b9cf1c20def7c91a8e7abda42c3e812a7967c74
Author: Nick Faro <[email protected]>
Date:   Tue Dec 12 21:25:11 2023 -0500

    Don't include sdl

commit c55f39ac41ee1c0b5cb1f8db99366520130722d8
Author: Nick Faro <[email protected]>
Date:   Tue Dec 12 21:17:50 2023 -0500

    Tweak build script more

commit 5838008b4d45609fc6f3e464e9d03652530f0852
Author: Nick Faro <[email protected]>
Date:   Tue Dec 12 21:11:43 2023 -0500

    Install deps for ffmpeg on mac

commit 750c25ad24873eac9594e9761adaace0777a28c4
Author: Nick Faro <[email protected]>
Date:   Tue Dec 12 21:09:09 2023 -0500

    Tweak build file, try to find out why mac can't compile it

commit e4b0422bc322674f55b78421333751643e40abac
Author: Nick Faro <[email protected]>
Date:   Tue Dec 12 20:51:50 2023 -0500

    Duplicate the code like a moron

commit a3717a6ee1341578f88a6227ef4dc150b75de42c
Author: Nick Faro <[email protected]>
Date:   Tue Dec 12 20:45:51 2023 -0500

    Build script fixes

commit 9d34c3ddccddffee7e60703a2b63dbb797d2b5f4
Author: nick f <[email protected]>
Date:   Tue Dec 12 17:45:27 2023 -0800

    Path adjustment stuff

commit 13c9d1d2dd3a28f035e300728b0aeb3d044aff7a
Author: nick f <[email protected]>
Date:   Mon Dec 11 18:59:14 2023 -0800

    Restore resourcs dir

commit 3d98c2473eb7645ed4b3ab2acd8749daadbaf1b3
Author: nick f <[email protected]>
Date:   Mon Dec 11 18:58:08 2023 -0800

    Move rgbds to MacOS folder

commit 6a5490773c4e4c5d7e5a54790f81ef868878f141
Author: nick f <[email protected]>
Date:   Mon Dec 11 18:57:11 2023 -0800

    Add brew paths while debugging

commit 0863426f2aac8154ca276469ddfc41e73fba3e26
Author: nick f <[email protected]>
Date:   Mon Dec 11 18:42:27 2023 -0800

    Create dirs if they don't exist

commit 81dcc088813d09d8f18c5102a306cefee701925d
Author: Nick Faro <[email protected]>
Date:   Mon Dec 11 20:39:12 2023 -0500

    Build dammit

commit 0f63bf798fb6bb11899d568f0f93d9e58dc70374
Author: nick f <[email protected]>
Date:   Mon Dec 11 17:21:52 2023 -0800

    Silly mistake

commit 917791c6f27acfe48015d66c49b2aa7f3f69d4b1
Author: nick f <[email protected]>
Date:   Mon Dec 11 17:07:54 2023 -0800

    disable windows temporarily to speed up CI

commit 114a0d0cc5a398678d0e183137de94f8a297ad17
Author: nick f <[email protected]>
Date:   Mon Dec 11 17:05:32 2023 -0800

    Include rgbds, hopefully fix symlink issue

commit 7f1c5b29eae86debfd22e3caf92f6ed0cb617eb6
Author: Nick Faro <[email protected]>
Date:   Mon Dec 11 19:58:53 2023 -0500

    Setup dirs for mac bundle

commit 4ce0bce520b9f49d1bf219fbea6b43d696bab78a
Author: Nick Faro <[email protected]>
Date:   Mon Dec 11 18:40:30 2023 -0500

    Update build.yml

commit 6c3e1eb15eab4c867b226b1d6b3491620ab84521
Author: nick f <[email protected]>
Date:   Mon Dec 11 15:23:49 2023 -0800

    Update build script to package .app

commit 51958f99febb50662c67bf6049a3e5fcdbbbe40c
Author: nick f <[email protected]>
Date:   Sun Dec 10 18:52:20 2023 -0800

    Statically link SDL2

commit 9224e83172db8d3e4a2a6820c41f0321434bddc0
Author: nick f <[email protected]>
Date:   Sat Dec 9 20:02:58 2023 -0800

    Build for mac

commit 06b643adab04be39323fc00880ea09d42617d6d8
Author: nick f <[email protected]>
Date:   Sat Dec 9 19:57:12 2023 -0800

    Tweaking stuff to work better on mac
commit 694d417b795bd168cd3d83fdfc617790c84f3cb2 parent f019aaf
12 changed files +182−48
Added.github/brew/lazarus.rb +28−0
@@ -0,0 +1,28 @@
1 cask "lazarus" do
2 version "3.0"
3 sha256 "71d77f4c6491265181078adf0e410dcb6176e8237e958c3aea9217bb5499f661"
4
5 url "https://gigenet.dl.sourceforge.net/project/lazarus/Lazarus%20macOS%20x86-64/Lazarus%203.0/Lazarus-3.0-macosx-x86_64.pkg",
6 verified: "sourceforge.net/lazarus/"
7 name "Lazarus"
8 desc "IDE for rapid application development"
9 homepage "https://www.lazarus-ide.org/"
10
11 livecheck do
12 url :homepage
13 regex(%r{href=.*?macOS%20x86-64/Lazarus%20v?(\d+(?:\.\d+)+)/}i)
14 end
15
16 depends_on cask: "fpc-laz"
17 depends_on cask: "fpc-src-laz"
18
19 pkg "Lazarus-3.0-macosx-x86_64.pkg"
20
21 uninstall pkgutil: [
22 "org.freepascal.pkg.fpcsrc-320-laz",
23 "org.lazarus-ide.pkg.LazarusIDE",
24 ],
25 delete: "/Applications/Lazarus.app"
26
27 zap trash: "~/.lazarus"
28 end
Added.github/scripts/build-ffmpeg.sh +24−0
@@ -0,0 +1,24 @@
1 set -x
2
3 curl -Lo lame.tar.gz 'https://downloads.sourceforge.net/project/lame/lame/3.100/lame-3.100.tar.gz'
4 tar xf lame.tar.gz
5 pushd lame-3.100
6 ./configure --prefix="`realpath ..`/lame-install" --disable-dependency-tracking \
7 --enable-static --disable-shared --enable-nasm --disable-gtktest \
8 --disable-decoder --disable-frontend
9 make
10 make install
11 popd
12
13 curl -Lo ffmpeg.tar.xz 'http://ffmpeg.org/releases/ffmpeg-4.4.tar.xz'
14 tar xf ffmpeg.tar.xz
15 cd ffmpeg-4.4
16 ./configure --pkg-config-flags=--static \
17 --disable-debug --enable-lto --disable-programs --enable-ffmpeg \
18 --disable-doc --disable-everything --enable-protocol=pipe --enable-protocol=file \
19 --enable-filter=aresample --enable-decoder=pcm_f32le --enable-demuxer=pcm_f32le \
20 --enable-encoder=flac --enable-muxer=ogg --enable-muxer=flac --enable-encoder=pcm_s16le \
21 --enable-muxer=wav --enable-libmp3lame --enable-encoder=libmp3lame --enable-muxer=mp3 \
22 --extra-cflags="-I`realpath ../lame-install/include`" \
23 --extra-ldflags="-L`realpath ../lame-install/lib`" || cat ffbuild/config.log
24 make
Modified.github/workflows/build.yml +65−32
@@ -10,18 +10,25 @@ jobs:
10 matrix: 10 matrix:
11 os: 11 os:
12 - ubuntu-20.04 12 - ubuntu-20.04
13 # - macos-12 13 - macos-13
14 - windows-2019 14 - windows-2019
15 include: 15 include:
16 - os: ubuntu-20.04 16 - os: ubuntu-20.04
17 name: Linux 17 name: Linux
18 # - os: macos-12 18 - os: macos-13
19 # name: Mac 19 name: Mac
20 - os: windows-2019 20 - os: windows-2019
21 name: Windows 21 name: Windows
22 fail-fast: false 22 fail-fast: false
23 runs-on: ${{ matrix.os }} 23 runs-on: ${{ matrix.os }}
24 steps: 24 steps:
25 - name: Check out hUGETracker
26 uses: actions/checkout@v4
27 with:
28 fetch-depth: 0
29 path: hUGETracker
30 submodules: true # This is intentionally not "recursive", change if needed
31
25 - name: Install Ubuntu dependencies 32 - name: Install Ubuntu dependencies
26 if: matrix.name == 'Linux' 33 if: matrix.name == 'Linux'
27 run: | 34 run: |
@@ -32,17 +39,30 @@ jobs:
32 cd rgbds 39 cd rgbds
33 make -j4 rgbasm rgblink rgbfix Q= 40 make -j4 rgbasm rgblink rgbfix Q=
34 41
35 wget https://tenet.dl.sourceforge.net/project/lazarus/Lazarus%20Linux%20amd64%20DEB/Lazarus%202.2.6/lazarus-project_2.2.6-0_amd64.deb 42 wget https://netactuate.dl.sourceforge.net/project/lazarus/Lazarus%20Linux%20amd64%20DEB/Lazarus%203.0/lazarus-project_3.0.0-0_amd64.deb
36 wget https://tenet.dl.sourceforge.net/project/lazarus/Lazarus%20Linux%20amd64%20DEB/Lazarus%202.2.6/fpc-laz_3.2.2-210709_amd64.deb 43 wget https://cytranet.dl.sourceforge.net/project/lazarus/Lazarus%20Linux%20amd64%20DEB/Lazarus%203.0/fpc-laz_3.2.2-210709_amd64.deb
37 wget https://tenet.dl.sourceforge.net/project/lazarus/Lazarus%20Linux%20amd64%20DEB/Lazarus%202.2.6/fpc-src_3.2.2-210709_amd64.deb 44 wget https://versaweb.dl.sourceforge.net/project/lazarus/Lazarus%20Linux%20amd64%20DEB/Lazarus%203.0/fpc-src_3.2.2-210709_amd64.deb
38 45
39 sudo apt install -yq ./fpc-laz_3.2.2-210709_amd64.deb ./fpc-src_3.2.2-210709_amd64.deb ./lazarus-project_2.2.6-0_amd64.deb 46 sudo apt install -yq ./fpc-laz_3.2.2-210709_amd64.deb ./fpc-src_3.2.2-210709_amd64.deb ./lazarus-project_3.0.0-0_amd64.deb
40 47
41 - name: Install macOS dependencies 48 - name: Install macOS dependencies
42 if: matrix.name == 'Mac' 49 if: matrix.name == 'Mac'
43 run: | 50 run: |
44 brew install --cask lazarus 51 brew install --cask hUGETracker/.github/brew/lazarus.rb
45 brew install sdl2 rgbds 52 brew install rgbds
53 brew install automake libtool shtool wget yasm
54
55 curl -Lo 'sdl2.tgz' https://github.com/libsdl-org/SDL/archive/refs/tags/release-2.28.5.tar.gz
56 tar xzf sdl2.tgz
57 pushd SDL-release-2.28.5
58 ./configure --disable-video --disable-render --disable-haptic --disable-joystick \
59 --disable-power --disable-hidapi --disable-sensor --disable-filesystem \
60 --disable-timers --disable-atomic --disable-file --disable-misc \
61 --disable-locale --disable-loadso --disable-cpuinfo
62 make
63 cp build/.libs/libSDL2.a /usr/local/lib
64 popd
65
46 mkdir rgbds 66 mkdir rgbds
47 for f in asm link fix; do ln -s `which rgb$f` rgbds/rgb$f; done 67 for f in asm link fix; do ln -s `which rgb$f` rgbds/rgb$f; done
48 68
@@ -50,8 +70,8 @@ jobs:
50 if: matrix.name == 'Windows' 70 if: matrix.name == 'Windows'
51 shell: bash 71 shell: bash
52 run: | 72 run: |
53 choco install lazarus 73 choco install lazarus zip
54 curl -Lo 'sdl2.zip' 'https://github.com/libsdl-org/SDL/releases/download/release-2.26.2/SDL2-2.26.2-win32-x64.zip' 74 curl -Lo 'sdl2.zip' 'https://github.com/libsdl-org/SDL/releases/download/release-2.28.5/SDL2-2.28.5-win32-x64.zip'
55 curl -Lo 'rgbds.zip' 'https://github.com/gbdev/rgbds/releases/download/v0.6.1/rgbds-0.6.1-win64.zip' 75 curl -Lo 'rgbds.zip' 'https://github.com/gbdev/rgbds/releases/download/v0.6.1/rgbds-0.6.1-win64.zip'
56 unzip -d rgbds rgbds.zip rgb{asm,link,fix}.exe 76 unzip -d rgbds rgbds.zip rgb{asm,link,fix}.exe
57 77
@@ -68,29 +88,15 @@ jobs:
68 mingw-w64-x86_64-toolchain 88 mingw-w64-x86_64-toolchain
69 yasm 89 yasm
70 90
71 - name: Compile FFmpeg 91 - name: Compile FFmpeg (Windows)
72 if: matrix.name == 'Windows' 92 if: matrix.name == 'Windows'
73 shell: msys2 {0} 93 shell: msys2 {0}
74 run: | 94 run: ./hUGETracker/.github/scripts/build-ffmpeg.sh
75 curl -Lo lame.tar.gz 'https://downloads.sourceforge.net/project/lame/lame/3.100/lame-3.100.tar.gz'
76 tar xf lame.tar.gz
77 pushd lame-3.100
78 ./configure --prefix="`realpath ..`/lame-install" --disable-dependency-tracking --disable-shared --enable-nasm --disable-gtktest --disable-decoder --disable-frontend
79 make
80 make install
81 popd
82 curl -Lo ffmpeg.tar.xz 'http://ffmpeg.org/releases/ffmpeg-4.4.tar.xz'
83 tar xf ffmpeg.tar.xz
84 cd ffmpeg-4.4
85 ./configure --extra-ldflags="-static" --disable-debug --enable-lto --disable-programs --enable-ffmpeg --disable-doc --disable-everything --enable-protocol=pipe --enable-protocol=file --enable-filter=aresample --enable-decoder=pcm_f32le --enable-demuxer=pcm_f32le --enable-encoder=flac --enable-muxer=ogg --enable-muxer=flac --enable-encoder=pcm_s16le --enable-muxer=wav --enable-libmp3lame --enable-encoder=libmp3lame --enable-muxer=mp3 --extra-cflags="-I`realpath ../lame-install/include`" --extra-ldflags="-L`realpath ../lame-install/lib`"
86 make
87 95
88 - name: Check out hUGETracker 96 - name: Compile FFmpeg (Mac)
89 uses: actions/checkout@v4 97 if: matrix.name == 'Mac'
90 with: 98 shell: bash
91 fetch-depth: 0 99 run: ./hUGETracker/.github/scripts/build-ffmpeg.sh
92 path: hUGETracker
93 submodules: true # This is intentionally not "recursive", change if needed
94 100
95 - name: Build release 101 - name: Build release
96 shell: bash 102 shell: bash
@@ -129,8 +135,35 @@ jobs:
129 unzip -d packaging sdl2.zip SDL2.dll 135 unzip -d packaging sdl2.zip SDL2.dll
130 cp -v ffmpeg-4.4/ffmpeg.exe rgbds/* packaging 136 cp -v ffmpeg-4.4/ffmpeg.exe rgbds/* packaging
131 137
138 - name: Extra Mac packaging
139 if: matrix.name == 'Mac'
140 shell: bash
141 run: |
142 cp -Rpv hUGETracker/src/Release/hUGETracker.app packaging
143 cp -v hUGETracker/graphics/hUGETracker.icns packaging/hUGETracker.app/Contents/Resources
144 mv packaging/{halt.gb,halt.sym,hUGEDriver,PixeliteTTF.ttf} packaging/hUGETracker.app/Contents/Resources
145 for f in asm link fix; do ln -s `which rgb$f` packaging/hUGETracker.app/Contents/MacOS/rgb$f; done
146 cp -v ffmpeg-4.4/ffmpeg packaging/hUGETracker.app/Contents/MacOS
147
148 # Hacky, but unlikely to break any time soon.
149 ed packaging/hUGETracker.app/Contents/Info.plist << END
150 5i
151 <key>CFBundleIconFile</key>
152 <string>hUGETracker.icns</string>
153 .
154 w
155 q
156 END
157
158 - name: Zip files (preserving permissions)
159 shell: bash
160 run: |
161 pushd packaging
162 zip -r ../build.zip *
163 popd
164
132 - name: Store build 165 - name: Store build
133 uses: actions/upload-artifact@v2 166 uses: actions/upload-artifact@v2
134 with: 167 with:
135 name: ${{ matrix.name }} build 168 name: ${{ matrix.name }} build
136 path: packaging/ 169 path: build.zip
Modified.gitignore +1−0
@@ -1,6 +1,7 @@
1 AutomaticConversion.log 1 AutomaticConversion.log
2 backup 2 backup
3 ConverterBackup 3 ConverterBackup
4 .DS_Store
4 **/backup 5 **/backup
5 lib 6 lib
6 *.zip 7 *.zip
Addedsetup-mac.sh +17−0
@@ -0,0 +1,17 @@
1 set -x
2
3 BUILD_DIR=src/lib/Development/x86_64-darwin
4
5 mkdir -p $BUILD_DIR
6
7 # Copy font
8 cp fonts/PixeliteTTF.ttf $BUILD_DIR/
9
10 # Compile halt.gb
11 rgbasm -H -E -I src/hUGEDriver -o hUGEDriver.obj src/hUGEDriver/hUGEDriver.asm
12 rgbasm -H -I src/hUGEDriver/include -o halt.obj src/halt.asm
13 rgblink -o $BUILD_DIR/halt.gb -n $BUILD_DIR/halt.sym halt.obj hUGEDriver.obj
14 rgbfix -vp0xFF $BUILD_DIR/halt.gb
15
16 # Link the hUGEDriver directory
17 ln -s "$PWD/src/hUGEDriver" "$PWD/$BUILD_DIR/hUGEDriver"
Modifiedsrc/codegen.pas +1−1
@@ -679,7 +679,7 @@ begin
679 ConcatPaths([RuntimeDir, 'hUGEDriver', 'hUGEDriver.asm']), 679 ConcatPaths([RuntimeDir, 'hUGEDriver', 'hUGEDriver.asm']),
680 ['PREVIEW_MODE']) <> 0 then Die; 680 ['PREVIEW_MODE']) <> 0 then Die;
681 end 681 end
682 else if Assemble(Filename + '_driver.obj', 'hUGEDriver/hUGEDriver.asm', []) <> 0 then Die; 682 else if Assemble(Filename + '_driver.obj', ConcatPaths([RuntimeDir, 'hUGEDriver', 'hUGEDriver.asm']), []) <> 0 then Die;
683 683
684 if Assemble(Filename + '_song.obj', 684 if Assemble(Filename + '_song.obj',
685 ConcatPaths([RuntimeDir, 'hUGEDriver', 'song.asm']), 685 ConcatPaths([RuntimeDir, 'hUGEDriver', 'song.asm']),
Modifiedsrc/hUGETracker.lpi +1−7
@@ -150,14 +150,11 @@
150 <SmartLinkUnit Value="True"/> 150 <SmartLinkUnit Value="True"/>
151 <RelocatableUnit Value="True"/> 151 <RelocatableUnit Value="True"/>
152 <TargetOS Value="darwin"/> 152 <TargetOS Value="darwin"/>
153 <Optimizations>
154 <OptimizationLevel Value="3"/>
155 </Optimizations>
156 </CodeGeneration> 153 </CodeGeneration>
157 <Linking> 154 <Linking>
158 <Debugging> 155 <Debugging>
159 <GenerateDebugInfo Value="False"/> 156 <GenerateDebugInfo Value="False"/>
160 <UseLineInfoUnit Value="False"/> 157 <DebugInfoType Value="dsDwarf2Set"/>
161 <StripSymbols Value="True"/> 158 <StripSymbols Value="True"/>
162 </Debugging> 159 </Debugging>
163 <LinkSmart Value="True"/> 160 <LinkSmart Value="True"/>
@@ -188,9 +185,6 @@
188 </PublishOptions> 185 </PublishOptions>
189 <RunParams> 186 <RunParams>
190 <FormatVersion Value="2"/> 187 <FormatVersion Value="2"/>
191 <Modes Count="1">
192 <Mode0 Name="default"/>
193 </Modes>
194 </RunParams> 188 </RunParams>
195 <RequiredPackages Count="5"> 189 <RequiredPackages Count="5">
196 <Item1> 190 <Item1>
Modifiedsrc/hUGETracker.lpr +14−3
@@ -3,7 +3,9 @@ program hUGETracker;
3 {$MODE Delphi} 3 {$MODE Delphi}
4 4
5 {$ifdef DARWIN} 5 {$ifdef DARWIN}
6 {$linklib SDL2} 6 {$link /usr/local/lib/libSDL2.a}
7 {$linkframework CoreAudio}
8 {$linkframework AudioToolbox}
7 {$endif} 9 {$endif}
8 10
9 uses 11 uses
@@ -16,7 +18,7 @@ uses
16 {$ifdef LCLQT5} 18 {$ifdef LCLQT5}
17 qt5, 19 qt5,
18 {$endif} 20 {$endif}
19 FileUtil, 21 FileUtil, Dialogs,
20 SysUtils, 22 SysUtils,
21 Forms, 23 Forms,
22 Interfaces, 24 Interfaces,
@@ -43,7 +45,7 @@ var
43 PixelitePath: WideString; 45 PixelitePath: WideString;
44 begin 46 begin
45 ReturnNilIfGrowHeapFails := False; 47 ReturnNilIfGrowHeapFails := False;
46 48 ChDir(ExtractFileDir(ParamStr(0)));
47 InitializeTrackerSettings; 49 InitializeTrackerSettings;
48 50
49 {$if declared(useHeapTrace)} 51 {$if declared(useHeapTrace)}
@@ -72,6 +74,15 @@ begin
72 PangoFcFontMapConfigChanged(PangoCairoFontMapGetDefault); 74 PangoFcFontMapConfigChanged(PangoCairoFontMapGetDefault);
73 {$endif} 75 {$endif}
74 76
77 {$ifdef DARWIN}
78 if not FileExists(ConcatPaths([GetUserDir, 'Library', 'Fonts', 'Pixelite.ttf'])) then begin
79 ForceDirectories(ConcatPaths([GetUserDir, 'Library', 'Fonts']));
80 CopyFile(ConcatPaths([RuntimeDir, 'PixeliteTTF.ttf']), ConcatPaths([GetUserDir, 'Library', 'Fonts', 'Pixelite.ttf']));
81 ShowMessage('Successfully loaded required fonts for the first time. Please restart hUGETracker!');
82 Halt;
83 end;
84 {$endif}
85
75 {$ifdef LCLQT5} 86 {$ifdef LCLQT5}
76 PixelitePath := WideString(ConcatPaths([RuntimeDir, 'PixeliteTTF.ttf'])); 87 PixelitePath := WideString(ConcatPaths([RuntimeDir, 'PixeliteTTF.ttf']));
77 QFontDatabase_addApplicationFont(@PixelitePath); 88 QFontDatabase_addApplicationFont(@PixelitePath);
Modifiedsrc/hugesettings.pas +22−5
@@ -71,7 +71,7 @@ end;
71 71
72 procedure InitializeTrackerSettings; 72 procedure InitializeTrackerSettings;
73 var 73 var
74 XDGConfigDir, XDGCacheDir: String; 74 XDGConfigDir, XDGCacheDir, MacConfigDir, MacCacheDir: String;
75 begin 75 begin
76 {$ifdef MSWINDOWS} 76 {$ifdef MSWINDOWS}
77 SetupDirectoryParameter('conf_dir', '.', ConfDir); 77 SetupDirectoryParameter('conf_dir', '.', ConfDir);
@@ -82,20 +82,37 @@ begin
82 {$if defined(LINUX) or defined(FREEBSD) or defined(OPENBSD)} 82 {$if defined(LINUX) or defined(FREEBSD) or defined(OPENBSD)}
83 XDGConfigDir := GetEnvironmentVariable('XDG_CONFIG_HOME'); 83 XDGConfigDir := GetEnvironmentVariable('XDG_CONFIG_HOME');
84 if XDGConfigDir = '' then 84 if XDGConfigDir = '' then
85 XDGConfigDir := ConcatPaths([GetEnvironmentVariable('HOME'), '.config', 'hUGETracker']); 85 XDGConfigDir := ConcatPaths([GetUserDir, '.config', 'hUGETracker']);
86 86
87 XDGCacheDir := GetEnvironmentVariable('XDG_CACHE_HOME'); 87 XDGCacheDir := GetEnvironmentVariable('XDG_CACHE_HOME');
88 if XDGCacheDir = '' then 88 if XDGCacheDir = '' then
89 XDGCacheDir := ConcatPaths([GetEnvironmentVariable('HOME'), '.cache', 'hUGETracker']); 89 XDGCacheDir := ConcatPaths([GetUserDir, '.cache', 'hUGETracker']);
90 90
91 if not DirectoryExists(XDGConfigDir) then CreateDir(XDGConfigDir); 91 if not DirectoryExists(XDGConfigDir) then ForceDirectories(XDGConfigDir);
92 if not DirectoryExists(XDGCacheDir) then CreateDir(XDGCacheDir); 92 if not DirectoryExists(XDGCacheDir) then ForceDirectories(XDGCacheDir);
93 93
94 SetupDirectoryParameter('conf_dir', XDGConfigDir, ConfDir); 94 SetupDirectoryParameter('conf_dir', XDGConfigDir, ConfDir);
95 SetupDirectoryParameter('cache_dir', XDGCacheDir, CacheDir); 95 SetupDirectoryParameter('cache_dir', XDGCacheDir, CacheDir);
96 SetupDirectoryParameter('runtime_dir', '.', RuntimeDir); 96 SetupDirectoryParameter('runtime_dir', '.', RuntimeDir);
97 {$endif} 97 {$endif}
98 98
99 {$ifdef DARWIN}
100 MacConfigDir := ConcatPaths([GetUserDir, '.config', 'hUGETracker']);
101 MacCacheDir := ConcatPaths([GetUserDir, '.cache', 'hUGETracker']);
102
103 if not DirectoryExists(MacConfigDir) then ForceDirectories(MacConfigDir);
104 if not DirectoryExists(MacCacheDir) then ForceDirectories(MacCacheDir);
105
106 SetupDirectoryParameter('conf_dir', MacConfigDir, ConfDir);
107 SetupDirectoryParameter('cache_dir', MacCacheDir, CacheDir);
108
109 {$ifdef DEVELOPMENT}
110 SetupDirectoryParameter('runtime_dir', '../../..', RuntimeDir);
111 {$else}
112 SetupDirectoryParameter('runtime_dir', '../Resources', RuntimeDir);
113 {$endif}
114 {$endif}
115
99 TrackerSettings := TTrackerSettings.Create; 116 TrackerSettings := TTrackerSettings.Create;
100 end; 117 end;
101 118
Modifiedsrc/tracker.pas +3−0
@@ -728,6 +728,9 @@ var
728 I: Integer; 728 I: Integer;
729 W, H, V, S, L: Integer; 729 W, H, V, S, L: Integer;
730 begin 730 begin
731 // For some reason, this gets called on MacOS with CurrentInstrument = nil.
732 if not Assigned(CurrentInstrument) then Exit;
733
731 W := PB.Width; 734 W := PB.Width;
732 H := PB.Height-3; 735 H := PB.Height-3;
733 V := Min(CurrentInstrument^.InitialVolume,15); 736 V := Min(CurrentInstrument^.InitialVolume,15);
Modifiedsrc/trackergrid.pas +6−0
@@ -826,8 +826,14 @@ procedure TTrackerGrid.RenderSelectedArea;
826 begin 826 begin
827 Canvas.Pen.Width := 1; 827 Canvas.Pen.Width := 1;
828 Canvas.Pen.Color := clBlack; 828 Canvas.Pen.Color := clBlack;
829
830 // TODO: Seems like the Cocoa backend doesn't support pmXOR.
831 // For now, just don't set it, and draw a black box around the thing.
832 {$ifndef DARWIN}
829 Canvas.Brush.Color := clWhite; 833 Canvas.Brush.Color := clWhite;
830 Canvas.Pen.Mode := pmXOR; 834 Canvas.Pen.Mode := pmXOR;
835 {$endif}
836
831 Canvas.Rectangle(SelectionsToRect(Cursor, Other)); 837 Canvas.Rectangle(SelectionsToRect(Cursor, Other));
832 Canvas.Pen.Mode := pmCopy; 838 Canvas.Pen.Mode := pmCopy;
833 end; 839 end;