mirror of
https://github.com/PrismLauncher/PrismLauncher.git
synced 2025-04-30 06:34:27 +02:00
Compare commits
245 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
385bb500b9 | ||
![]() |
39a7021419 | ||
![]() |
6067ef1d86 | ||
![]() |
5598b6b12e | ||
![]() |
98ae412305 | ||
![]() |
de78947fec | ||
![]() |
084dcd4e77 | ||
![]() |
879495942a | ||
![]() |
f7dbdb79be | ||
![]() |
71dc114a09 | ||
![]() |
1e201beb41 | ||
![]() |
feefeecea9 | ||
![]() |
be2d144b40 | ||
![]() |
8fe7975ab8 | ||
![]() |
e7eada9002 | ||
![]() |
dc799cf87b | ||
![]() |
ce0a730531 | ||
![]() |
f00226f797 | ||
![]() |
a96a915d79 | ||
![]() |
83f79c93f8 | ||
![]() |
b228800de1 | ||
![]() |
e8bdc72476 | ||
![]() |
da9c359184 | ||
![]() |
b02718ee57 | ||
![]() |
ddcd61c808 | ||
![]() |
760fbdf54f | ||
![]() |
5c4bd3db52 | ||
![]() |
87c5b6cc83 | ||
![]() |
80ff62c96d | ||
![]() |
b5fc23952e | ||
![]() |
5c8ef3a003 | ||
![]() |
b0ee4f6e58 | ||
![]() |
25ce20a877 | ||
![]() |
2952b1d6b6 | ||
![]() |
416495cda7 | ||
![]() |
6de8ed91a3 | ||
![]() |
f9ab98f2cf | ||
![]() |
fcc1e80237 | ||
![]() |
1a56396e2e | ||
![]() |
0f21e01b46 | ||
![]() |
88109eaa71 | ||
![]() |
1425c9801e | ||
![]() |
1a06e34fe4 | ||
![]() |
d0a77df703 | ||
![]() |
57120e0c9d | ||
![]() |
57981a070f | ||
![]() |
be1a1baba4 | ||
![]() |
9686a3c81c | ||
![]() |
b348114dee | ||
![]() |
07604c9271 | ||
![]() |
b49e9763bf | ||
![]() |
b9d15a4781 | ||
![]() |
190d17acd3 | ||
![]() |
5de91076ea | ||
![]() |
299cbf8009 | ||
![]() |
70ca7af205 | ||
![]() |
19aaaa9988 | ||
![]() |
fc639c0902 | ||
![]() |
2bb094a90b | ||
![]() |
c206064976 | ||
![]() |
d8f51e900a | ||
![]() |
b85e53eaf9 | ||
![]() |
0073d82863 | ||
![]() |
70db5a2f92 | ||
![]() |
07010f226e | ||
![]() |
d75b23c092 | ||
![]() |
748b92571c | ||
![]() |
97180324ee | ||
![]() |
ec7aaaadf3 | ||
![]() |
7d786987ad | ||
![]() |
1ab6ce42b5 | ||
![]() |
05bf9c3689 | ||
![]() |
f760f08df6 | ||
![]() |
9456140155 | ||
![]() |
159771f283 | ||
![]() |
9616d898d4 | ||
![]() |
e2526c80c8 | ||
![]() |
a37cac6f9b | ||
![]() |
2f889429da | ||
![]() |
c7831fd697 | ||
![]() |
b4c3123957 | ||
![]() |
ae3e1a262e | ||
![]() |
f8dc58665b | ||
![]() |
19247bad14 | ||
![]() |
4371933a84 | ||
![]() |
dd90049b30 | ||
![]() |
18170cc900 | ||
![]() |
71eced3e61 | ||
![]() |
cb49b27513 | ||
![]() |
7b502fe8c9 | ||
![]() |
55578bf949 | ||
![]() |
ee33bf50c2 | ||
![]() |
702db71f61 | ||
![]() |
8e8efc304f | ||
![]() |
2b204c8169 | ||
![]() |
ed2eddc258 | ||
![]() |
855e49bda0 | ||
![]() |
bbde47842b | ||
![]() |
0508bbd05f | ||
![]() |
808978080e | ||
![]() |
ea0d710aaf | ||
![]() |
02e1988779 | ||
![]() |
fdab044c04 | ||
![]() |
e77ac36c3f | ||
![]() |
0d06fae7ae | ||
![]() |
a0c4cc59ac | ||
![]() |
bd7371dbf1 | ||
![]() |
d7756d29dc | ||
![]() |
0a7325ac12 | ||
![]() |
ed2b5d4b0e | ||
![]() |
9f199a470c | ||
![]() |
1a98ef8bb7 | ||
![]() |
d25d0d7ee6 | ||
![]() |
beac093d62 | ||
![]() |
81318d4953 | ||
![]() |
8c6602147b | ||
![]() |
9d8c3f251f | ||
![]() |
c787e65ed4 | ||
![]() |
ae84a78470 | ||
![]() |
820b9e3fd0 | ||
![]() |
c8c3370d36 | ||
![]() |
cffa9a2da0 | ||
![]() |
01397896eb | ||
![]() |
3048e43900 | ||
![]() |
417bb2fce6 | ||
![]() |
e234c66818 | ||
![]() |
589ee73bfd | ||
![]() |
0cb5ac7a06 | ||
![]() |
db35f47105 | ||
![]() |
cf8a82e78a | ||
![]() |
15887c2d92 | ||
![]() |
b7b5630588 | ||
![]() |
43834e2148 | ||
![]() |
feb275a580 | ||
![]() |
759db0c90f | ||
![]() |
b2c75dde95 | ||
![]() |
62ed3f8406 | ||
![]() |
5e227ceaae | ||
![]() |
a739db8bdb | ||
![]() |
fdfdf2eef1 | ||
![]() |
bbfa5a5ed1 | ||
![]() |
43dc330e55 | ||
![]() |
0c962dff59 | ||
![]() |
ca0dd583ba | ||
![]() |
7bb686c85b | ||
![]() |
f8d3d8399d | ||
![]() |
9cb2a3ab2d | ||
![]() |
072c495ec6 | ||
![]() |
335941fb46 | ||
![]() |
ebeff36da5 | ||
![]() |
1d29f63bec | ||
![]() |
87dc1bb6a6 | ||
![]() |
a85720b8d6 | ||
![]() |
4c28a94de1 | ||
![]() |
344ae87f25 | ||
![]() |
577999bd35 | ||
![]() |
887db29f35 | ||
![]() |
7865b8128e | ||
![]() |
a58f125535 | ||
![]() |
d1a05d312d | ||
![]() |
bbf21e5824 | ||
![]() |
73b4223b61 | ||
![]() |
686e0b7b18 | ||
![]() |
189878e7e3 | ||
![]() |
af74d5f410 | ||
![]() |
cdfd0b1002 | ||
![]() |
9791c306dc | ||
![]() |
e7e9265c40 | ||
![]() |
e0c323a190 | ||
![]() |
a914747416 | ||
![]() |
d453240a94 | ||
![]() |
4c4017d7ca | ||
![]() |
2a4c4ed8ea | ||
![]() |
947fbf7d64 | ||
![]() |
1c94a3e3e5 | ||
![]() |
eefeb5799d | ||
![]() |
6c6a4625ab | ||
![]() |
6d2a96f6a7 | ||
![]() |
ea9029d7b6 | ||
![]() |
76602391f4 | ||
![]() |
509f8c7307 | ||
![]() |
984daa450b | ||
![]() |
04e1a97d59 | ||
![]() |
1dce1360bd | ||
![]() |
87d5b96760 | ||
![]() |
7f074ca7b9 | ||
![]() |
c0394c52b7 | ||
![]() |
53bc20f13f | ||
![]() |
40af3cf3d2 | ||
![]() |
3977918c5b | ||
![]() |
484d90899f | ||
![]() |
0f5eb03839 | ||
![]() |
d21cda1880 | ||
![]() |
52a321b93b | ||
![]() |
dd8dec8be8 | ||
![]() |
23d6f8aaed | ||
![]() |
d105d76f2a | ||
![]() |
698a838b56 | ||
![]() |
1129b4160c | ||
![]() |
63a6f823fd | ||
![]() |
db32b2ad99 | ||
![]() |
c3cf5d31da | ||
![]() |
1e696328bb | ||
![]() |
1d9c97803a | ||
![]() |
3d55236fdf | ||
![]() |
42190819ae | ||
![]() |
130714a9ab | ||
![]() |
bf57d77075 | ||
![]() |
98fe035442 | ||
![]() |
8e4994590b | ||
![]() |
0722dba820 | ||
![]() |
9560447c92 | ||
![]() |
4d89512ca1 | ||
![]() |
42a6bd1151 | ||
![]() |
f06505b138 | ||
![]() |
d854087089 | ||
![]() |
31031ec923 | ||
![]() |
5f06517b62 | ||
![]() |
dde5fc47d3 | ||
![]() |
76d5f632dc | ||
![]() |
27c6596bcb | ||
![]() |
e2f5fb27a6 | ||
![]() |
98819a0d02 | ||
![]() |
2dde2c4bec | ||
![]() |
008d69e5e5 | ||
![]() |
a839258c07 | ||
![]() |
89041531e1 | ||
![]() |
729cec5f45 | ||
![]() |
80d675d2e6 | ||
![]() |
fb7d19941f | ||
![]() |
877ab62c2f | ||
![]() |
b983ae0fb0 | ||
![]() |
85422427b9 | ||
![]() |
51a71d0471 | ||
![]() |
25eaa4eba6 | ||
![]() |
6da14d66bb | ||
![]() |
199c5497d3 | ||
![]() |
740db2db02 | ||
![]() |
577f8074e1 | ||
![]() |
c5e7bb90c5 | ||
![]() |
1cf91fa5d9 | ||
![]() |
3bf4fbf8f4 | ||
![]() |
ff97affa72 | ||
![]() |
e8c9722a53 | ||
![]() |
9a810dfa6e |
132
.github/workflows/build.yml
vendored
132
.github/workflows/build.yml
vendored
@ -39,9 +39,6 @@ on:
|
||||
APPLE_NOTARIZE_PASSWORD:
|
||||
description: Password used for notarizing macOS builds
|
||||
required: false
|
||||
CACHIX_AUTH_TOKEN:
|
||||
description: Private token for authenticating against Cachix cache
|
||||
required: false
|
||||
GPG_PRIVATE_KEY:
|
||||
description: Private key for AppImage signing
|
||||
required: false
|
||||
@ -59,15 +56,18 @@ jobs:
|
||||
qt_ver: 5
|
||||
qt_host: linux
|
||||
qt_arch: ""
|
||||
qt_version: "5.12.8"
|
||||
qt_version: "5.15.2"
|
||||
qt_modules: "qtnetworkauth"
|
||||
|
||||
- os: ubuntu-20.04
|
||||
- os: ubuntu-22.04
|
||||
qt_ver: 6
|
||||
qt_host: linux
|
||||
qt_arch: ""
|
||||
qt_version: "6.2.4"
|
||||
qt_version: "6.5.3"
|
||||
qt_modules: "qt5compat qtimageformats qtnetworkauth"
|
||||
linuxdeploy_hash: "4648f278ab3ef31f819e67c30d50f462640e5365a77637d7e6f2ad9fd0b4522a linuxdeploy-x86_64.AppImage"
|
||||
linuxdeploy_qt_hash: "15106be885c1c48a021198e7e1e9a48ce9d02a86dd0a1848f00bdbf3c1c92724 linuxdeploy-plugin-qt-x86_64.AppImage"
|
||||
appimageupdate_hash: "f1747cf60058e99f1bb9099ee9787d16c10241313b7acec81810ea1b1e568c11 AppImageUpdate-x86_64.AppImage"
|
||||
|
||||
- os: windows-2022
|
||||
name: "Windows-MinGW-w64"
|
||||
@ -80,9 +80,9 @@ jobs:
|
||||
architecture: "x64"
|
||||
vcvars_arch: "amd64"
|
||||
qt_ver: 6
|
||||
qt_host: windows
|
||||
qt_arch: ""
|
||||
qt_version: "6.7.3"
|
||||
qt_host: "windows"
|
||||
qt_arch: "win64_msvc2022_64"
|
||||
qt_version: "6.8.1"
|
||||
qt_modules: "qt5compat qtimageformats qtnetworkauth"
|
||||
nscurl_tag: "v24.9.26.122"
|
||||
nscurl_sha256: "AEE6C4BE3CB6455858E9C1EE4B3AFE0DB9960FA03FE99CCDEDC28390D57CCBB0"
|
||||
@ -93,9 +93,9 @@ jobs:
|
||||
architecture: "arm64"
|
||||
vcvars_arch: "amd64_arm64"
|
||||
qt_ver: 6
|
||||
qt_host: windows
|
||||
qt_arch: "win64_msvc2019_arm64"
|
||||
qt_version: "6.7.3"
|
||||
qt_host: "windows"
|
||||
qt_arch: "win64_msvc2022_arm64_cross_compiled"
|
||||
qt_version: "6.8.1"
|
||||
qt_modules: "qt5compat qtimageformats qtnetworkauth"
|
||||
nscurl_tag: "v24.9.26.122"
|
||||
nscurl_sha256: "AEE6C4BE3CB6455858E9C1EE4B3AFE0DB9960FA03FE99CCDEDC28390D57CCBB0"
|
||||
@ -173,7 +173,7 @@ jobs:
|
||||
|
||||
- name: Retrieve ccache cache (Windows MinGW-w64)
|
||||
if: runner.os == 'Windows' && matrix.msystem != '' && inputs.build_type == 'Debug'
|
||||
uses: actions/cache@v4.1.1
|
||||
uses: actions/cache@v4.2.0
|
||||
with:
|
||||
path: '${{ github.workspace }}\.ccache'
|
||||
key: ${{ matrix.os }}-mingw-w64-ccache-${{ github.run_id }}
|
||||
@ -206,7 +206,7 @@ jobs:
|
||||
if: runner.os == 'Linux'
|
||||
run: |
|
||||
sudo apt-get -y update
|
||||
sudo apt-get -y install ninja-build extra-cmake-modules scdoc appstream
|
||||
sudo apt-get -y install ninja-build extra-cmake-modules scdoc appstream libxcb-cursor-dev
|
||||
|
||||
- name: Install Dependencies (macOS)
|
||||
if: runner.os == 'macOS'
|
||||
@ -216,14 +216,14 @@ jobs:
|
||||
|
||||
- name: Install host Qt (Windows MSVC arm64)
|
||||
if: runner.os == 'Windows' && matrix.architecture == 'arm64'
|
||||
uses: jurplel/install-qt-action@v3
|
||||
uses: jurplel/install-qt-action@v4
|
||||
with:
|
||||
aqtversion: "==3.1.*"
|
||||
py7zrversion: ">=0.20.2"
|
||||
version: ${{ matrix.qt_version }}
|
||||
host: "windows"
|
||||
target: "desktop"
|
||||
arch: ""
|
||||
arch: ${{ matrix.qt_arch }}
|
||||
modules: ${{ matrix.qt_modules }}
|
||||
cache: ${{ inputs.is_qt_cached }}
|
||||
cache-key-prefix: host-qt-arm64-windows
|
||||
@ -232,7 +232,7 @@ jobs:
|
||||
|
||||
- name: Install Qt (macOS, Linux & Windows MSVC)
|
||||
if: matrix.msystem == ''
|
||||
uses: jurplel/install-qt-action@v3
|
||||
uses: jurplel/install-qt-action@v4
|
||||
with:
|
||||
aqtversion: "==3.1.*"
|
||||
py7zrversion: ">=0.20.2"
|
||||
@ -252,19 +252,26 @@ jobs:
|
||||
|
||||
- name: Prepare AppImage (Linux)
|
||||
if: runner.os == 'Linux' && matrix.qt_ver != 5
|
||||
env:
|
||||
APPIMAGEUPDATE_HASH: ${{ matrix.appimageupdate_hash }}
|
||||
LINUXDEPLOY_HASH: ${{ matrix.linuxdeploy_hash }}
|
||||
LINUXDEPLOY_QT_HASH: ${{ matrix.linuxdeploy_qt_hash }}
|
||||
run: |
|
||||
wget "https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage"
|
||||
wget "https://github.com/linuxdeploy/linuxdeploy-plugin-appimage/releases/download/continuous/linuxdeploy-plugin-appimage-x86_64.AppImage"
|
||||
wget "https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage"
|
||||
wget "https://github.com/linuxdeploy/linuxdeploy/releases/download/1-alpha-20250213-2/linuxdeploy-x86_64.AppImage"
|
||||
wget "https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/1-alpha-20250213-1/linuxdeploy-plugin-qt-x86_64.AppImage"
|
||||
|
||||
wget "https://github.com/AppImageCommunity/AppImageUpdate/releases/download/continuous/AppImageUpdate-x86_64.AppImage"
|
||||
wget "https://github.com/AppImageCommunity/AppImageUpdate/releases/download/2.0.0-alpha-1-20241225/AppImageUpdate-x86_64.AppImage"
|
||||
|
||||
sha256sum -c - <<< "$LINUXDEPLOY_HASH"
|
||||
sha256sum -c - <<< "$LINUXDEPLOY_QT_HASH"
|
||||
sha256sum -c - <<< "$APPIMAGEUPDATE_HASH"
|
||||
|
||||
sudo apt install libopengl0
|
||||
|
||||
- name: Add QT_HOST_PATH var (Windows MSVC arm64)
|
||||
if: runner.os == 'Windows' && matrix.architecture == 'arm64'
|
||||
run: |
|
||||
echo "QT_HOST_PATH=${{ github.workspace }}\HostQt\Qt\${{ matrix.qt_version }}\msvc2019_64" >> $env:GITHUB_ENV
|
||||
echo "QT_HOST_PATH=${{ github.workspace }}\HostQt\Qt\${{ matrix.qt_version }}\msvc2022_64" >> $env:GITHUB_ENV
|
||||
|
||||
- name: Setup java (macOS)
|
||||
if: runner.os == 'macOS'
|
||||
@ -410,9 +417,8 @@ jobs:
|
||||
if: matrix.name == 'macOS'
|
||||
run: |
|
||||
if [ '${{ secrets.SPARKLE_ED25519_KEY }}' != '' ]; then
|
||||
brew install openssl@3
|
||||
echo '${{ secrets.SPARKLE_ED25519_KEY }}' > ed25519-priv.pem
|
||||
signature=$(/usr/local/opt/openssl@3/bin/openssl pkeyutl -sign -rawin -in ${{ github.workspace }}/PrismLauncher.zip -inkey ed25519-priv.pem | openssl base64 | tr -d \\n)
|
||||
signature=$(/opt/homebrew/opt/openssl@3/bin/openssl pkeyutl -sign -rawin -in ${{ github.workspace }}/PrismLauncher.zip -inkey ed25519-priv.pem | openssl base64 | tr -d \\n)
|
||||
rm ed25519-priv.pem
|
||||
cat >> $GITHUB_STEP_SUMMARY << EOF
|
||||
### Artifact Information :information_source:
|
||||
@ -520,8 +526,8 @@ jobs:
|
||||
|
||||
cp -r ${{ runner.workspace }}/Qt/${{ matrix.qt_version }}/gcc_64/plugins/iconengines/* ${{ env.INSTALL_APPIMAGE_DIR }}/usr/plugins/iconengines
|
||||
|
||||
cp /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1 ${{ env.INSTALL_APPIMAGE_DIR }}/usr/lib/
|
||||
cp /usr/lib/x86_64-linux-gnu/libssl.so.1.1 ${{ env.INSTALL_APPIMAGE_DIR }}/usr/lib/
|
||||
cp /usr/lib/x86_64-linux-gnu/libcrypto.so.* ${{ env.INSTALL_APPIMAGE_DIR }}/usr/lib/
|
||||
cp /usr/lib/x86_64-linux-gnu/libssl.so.* ${{ env.INSTALL_APPIMAGE_DIR }}/usr/lib/
|
||||
cp /usr/lib/x86_64-linux-gnu/libOpenGL.so.0* ${{ env.INSTALL_APPIMAGE_DIR }}/usr/lib/
|
||||
|
||||
LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${{ env.INSTALL_APPIMAGE_DIR }}/usr/lib"
|
||||
@ -556,9 +562,9 @@ jobs:
|
||||
mkdir ${{ env.INSTALL_PORTABLE_DIR }}/lib
|
||||
cp /lib/x86_64-linux-gnu/libbz2.so.1.0 ${{ env.INSTALL_PORTABLE_DIR }}/lib
|
||||
cp /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0 ${{ env.INSTALL_PORTABLE_DIR }}/lib
|
||||
cp /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1 ${{ env.INSTALL_PORTABLE_DIR }}/lib
|
||||
cp /usr/lib/x86_64-linux-gnu/libssl.so.1.1 ${{ env.INSTALL_PORTABLE_DIR }}/lib
|
||||
cp /usr/lib/x86_64-linux-gnu/libffi.so.7 ${{ env.INSTALL_PORTABLE_DIR }}/lib
|
||||
cp /usr/lib/x86_64-linux-gnu/libcrypto.so.* ${{ env.INSTALL_PORTABLE_DIR }}/lib
|
||||
cp /usr/lib/x86_64-linux-gnu/libssl.so.* ${{ env.INSTALL_PORTABLE_DIR }}/lib
|
||||
cp /usr/lib/x86_64-linux-gnu/libffi.so.*.* ${{ env.INSTALL_PORTABLE_DIR }}/lib
|
||||
mv ${{ env.INSTALL_PORTABLE_DIR }}/bin/*.so* ${{ env.INSTALL_PORTABLE_DIR }}/lib
|
||||
|
||||
for l in $(find ${{ env.INSTALL_PORTABLE_DIR }} -type f); do l=${l#$(pwd)/}; l=${l#${{ env.INSTALL_PORTABLE_DIR }}/}; l=${l#./}; echo $l; done > ${{ env.INSTALL_PORTABLE_DIR }}/manifest.txt
|
||||
@ -630,71 +636,3 @@ jobs:
|
||||
shell: msys2 {0}
|
||||
run: |
|
||||
ccache -s
|
||||
|
||||
flatpak:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: bilelmoussaoui/flatpak-github-actions:kde-6.7
|
||||
options: --privileged
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
if: inputs.build_type == 'Debug'
|
||||
with:
|
||||
submodules: "true"
|
||||
- name: Build Flatpak (Linux)
|
||||
if: inputs.build_type == 'Debug'
|
||||
uses: flatpak/flatpak-github-actions/flatpak-builder@v6
|
||||
with:
|
||||
bundle: "Prism Launcher.flatpak"
|
||||
manifest-path: flatpak/org.prismlauncher.PrismLauncher.yml
|
||||
|
||||
nix:
|
||||
name: Nix (${{ matrix.system }})
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- os: ubuntu-22.04
|
||||
system: x86_64-linux
|
||||
|
||||
- os: macos-13
|
||||
system: x86_64-darwin
|
||||
|
||||
- os: macos-14
|
||||
system: aarch64-darwin
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install Nix
|
||||
uses: cachix/install-nix-action@v30
|
||||
|
||||
# For PRs
|
||||
- name: Setup Nix Magic Cache
|
||||
uses: DeterminateSystems/magic-nix-cache-action@v8
|
||||
|
||||
# For in-tree builds
|
||||
- name: Setup Cachix
|
||||
uses: cachix/cachix-action@v15
|
||||
with:
|
||||
name: prismlauncher
|
||||
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
|
||||
|
||||
- name: Run flake checks
|
||||
run: |
|
||||
nix flake check --print-build-logs --show-trace
|
||||
|
||||
- name: Build debug package
|
||||
if: ${{ inputs.build_type == 'Debug' }}
|
||||
run: |
|
||||
nix build --print-build-logs .#prismlauncher-debug
|
||||
|
||||
- name: Build release package
|
||||
if: ${{ inputs.build_type != 'Debug' }}
|
||||
run: |
|
||||
nix build --print-build-logs .#prismlauncher
|
||||
|
62
.github/workflows/flatpak.yml
vendored
Normal file
62
.github/workflows/flatpak.yml
vendored
Normal file
@ -0,0 +1,62 @@
|
||||
name: Flatpak
|
||||
|
||||
on:
|
||||
push:
|
||||
paths-ignore:
|
||||
- "**.md"
|
||||
- "**/LICENSE"
|
||||
- ".github/ISSUE_TEMPLATE/**"
|
||||
- ".markdownlint**"
|
||||
- "nix/**"
|
||||
# We don't do anything with these artifacts on releases. They go to Flathub
|
||||
tags-ignore:
|
||||
- "*"
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- "**.md"
|
||||
- "**/LICENSE"
|
||||
- ".github/ISSUE_TEMPLATE/**"
|
||||
- ".markdownlint**"
|
||||
- "nix/**"
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build (${{ matrix.arch }})
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- os: ubuntu-22.04
|
||||
arch: x86_64
|
||||
|
||||
- os: ubuntu-22.04-arm
|
||||
arch: aarch64
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
container:
|
||||
image: ghcr.io/flathub-infra/flatpak-github-actions:kde-6.8
|
||||
options: --privileged
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
- name: Set short version
|
||||
shell: bash
|
||||
run: |
|
||||
echo "VERSION=${GITHUB_SHA::7}" >> "$GITHUB_ENV"
|
||||
|
||||
- name: Build Flatpak
|
||||
uses: flatpak/flatpak-github-actions/flatpak-builder@v6
|
||||
with:
|
||||
bundle: PrismLauncher-${{ runner.os }}-${{ env.VERSION }}-Flatpak.flatpak
|
||||
manifest-path: flatpak/org.prismlauncher.PrismLauncher.yml
|
||||
arch: ${{ matrix.arch }}
|
103
.github/workflows/nix.yml
vendored
Normal file
103
.github/workflows/nix.yml
vendored
Normal file
@ -0,0 +1,103 @@
|
||||
name: Nix
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "*"
|
||||
paths-ignore:
|
||||
- ".github/**"
|
||||
- "!.github/workflows/nix.yml"
|
||||
- "flatpak/"
|
||||
- "scripts/"
|
||||
|
||||
- ".git*"
|
||||
- ".envrc"
|
||||
- "**.md"
|
||||
- "!COPYING.md"
|
||||
- "renovate.json"
|
||||
pull_request_target:
|
||||
paths-ignore:
|
||||
- ".github/**"
|
||||
- "flatpak/"
|
||||
- "scripts/"
|
||||
|
||||
- ".git*"
|
||||
- ".envrc"
|
||||
- "**.md"
|
||||
- "!COPYING.md"
|
||||
- "renovate.json"
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
env:
|
||||
DEBUG: ${{ github.ref_type != 'tag' }}
|
||||
USE_DETERMINATE: ${{ github.event_name == 'pull_request' }}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build (${{ matrix.system }})
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- os: ubuntu-22.04
|
||||
system: x86_64-linux
|
||||
|
||||
- os: ubuntu-22.04-arm
|
||||
system: aarch64-linux
|
||||
|
||||
- os: macos-13
|
||||
system: x86_64-darwin
|
||||
|
||||
- os: macos-14
|
||||
system: aarch64-darwin
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
permissions:
|
||||
id-token: write
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install Nix
|
||||
uses: DeterminateSystems/nix-installer-action@v16
|
||||
with:
|
||||
determinate: ${{ env.USE_DETERMINATE }}
|
||||
|
||||
# For PRs
|
||||
- name: Setup Nix Magic Cache
|
||||
if: ${{ env.USE_DETERMINATE == 'true' }}
|
||||
uses: DeterminateSystems/flakehub-cache-action@v1
|
||||
|
||||
# For in-tree builds
|
||||
- name: Setup Cachix
|
||||
if: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }}
|
||||
uses: cachix/cachix-action@v15
|
||||
with:
|
||||
name: prismlauncher
|
||||
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
|
||||
|
||||
- name: Run Flake checks
|
||||
run: |
|
||||
nix flake check --print-build-logs --show-trace
|
||||
|
||||
- name: Build debug package
|
||||
if: ${{ env.DEBUG == 'true' }}
|
||||
run: |
|
||||
nix build --print-build-logs .#prismlauncher-debug
|
||||
|
||||
- name: Build release package
|
||||
if: ${{ env.DEBUG == 'false' }}
|
||||
env:
|
||||
TAG: ${{ github.ref_name }}
|
||||
SYSTEM: ${{ matrix.system }}
|
||||
run: |
|
||||
nix build --print-build-logs .#prismlauncher
|
||||
nix build --no-link --print-out-paths .#prismlauncher \
|
||||
| tee -a "$GITHUB_STEP_SUMMARY" \
|
||||
| xargs cachix pin prismlauncher "$TAG"-"$SYSTEM"
|
@ -1,13 +1,21 @@
|
||||
name: Publish to WinGet
|
||||
name: Publish
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [released]
|
||||
types: [ released ]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
winget:
|
||||
name: Winget
|
||||
|
||||
runs-on: windows-latest
|
||||
|
||||
steps:
|
||||
- uses: vedantmgoyal2009/winget-releaser@v2
|
||||
- name: Publish on Winget
|
||||
uses: vedantmgoyal2009/winget-releaser@v2
|
||||
with:
|
||||
identifier: PrismLauncher.PrismLauncher
|
||||
version: ${{ github.event.release.tag_name }}
|
1
.github/workflows/trigger_builds.yml
vendored
1
.github/workflows/trigger_builds.yml
vendored
@ -38,6 +38,5 @@ jobs:
|
||||
APPLE_NOTARIZE_APPLE_ID: ${{ secrets.APPLE_NOTARIZE_APPLE_ID }}
|
||||
APPLE_NOTARIZE_TEAM_ID: ${{ secrets.APPLE_NOTARIZE_TEAM_ID }}
|
||||
APPLE_NOTARIZE_PASSWORD: ${{ secrets.APPLE_NOTARIZE_PASSWORD }}
|
||||
CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }}
|
||||
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
|
||||
GPG_PRIVATE_KEY_ID: ${{ secrets.GPG_PRIVATE_KEY_ID }}
|
||||
|
1
.github/workflows/trigger_release.yml
vendored
1
.github/workflows/trigger_release.yml
vendored
@ -22,7 +22,6 @@ jobs:
|
||||
APPLE_NOTARIZE_APPLE_ID: ${{ secrets.APPLE_NOTARIZE_APPLE_ID }}
|
||||
APPLE_NOTARIZE_TEAM_ID: ${{ secrets.APPLE_NOTARIZE_TEAM_ID }}
|
||||
APPLE_NOTARIZE_PASSWORD: ${{ secrets.APPLE_NOTARIZE_PASSWORD }}
|
||||
CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }}
|
||||
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
|
||||
GPG_PRIVATE_KEY_ID: ${{ secrets.GPG_PRIVATE_KEY_ID }}
|
||||
|
||||
|
6
.gitignore
vendored
6
.gitignore
vendored
@ -47,8 +47,12 @@ run/
|
||||
|
||||
# Nix/NixOS
|
||||
.direnv/
|
||||
.pre-commit-config.yaml
|
||||
## Used when manually invoking stdenv phases
|
||||
outputs/
|
||||
## Regular artifacts
|
||||
result
|
||||
result-*
|
||||
repl-result-*
|
||||
|
||||
# Flatpak
|
||||
.flatpak-builder
|
||||
|
@ -78,6 +78,13 @@ else()
|
||||
# ATL's pack list needs more than the default 1 Mib stack on windows
|
||||
if(WIN32)
|
||||
set(CMAKE_EXE_LINKER_FLAGS "-Wl,--stack,8388608 ${CMAKE_EXE_LINKER_FLAGS}")
|
||||
|
||||
# -ffunction-sections and -fdata-sections help reduce binary size
|
||||
# -mguard=cf enables Control Flow Guard
|
||||
# TODO: Look into -gc-sections to further reduce binary size
|
||||
foreach(lang C CXX)
|
||||
set("CMAKE_${lang}_FLAGS_RELEASE" "-ffunction-sections -fdata-sections -mguard=cf")
|
||||
endforeach()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@ -106,14 +113,14 @@ if ((CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebI
|
||||
else()
|
||||
# AppleClang and Clang
|
||||
message(STATUS "Address Sanitizer available on Clang")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address -fno-omit-frame-pointer")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer -fsanitize=undefined -fno-sanitize-recover=null")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address -fno-omit-frame-pointer -fsanitize=undefined -fno-sanitize-recover=null")
|
||||
endif()
|
||||
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||
# GCC
|
||||
message(STATUS "Address Sanitizer available on GCC")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address -fno-omit-frame-pointer")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer -fsanitize=undefined -fno-sanitize-recover")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address -fno-omit-frame-pointer -fsanitize=undefined -fno-sanitize-recover")
|
||||
link_libraries("asan")
|
||||
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
|
||||
message(STATUS "Address Sanitizer available on MSVC")
|
||||
@ -181,7 +188,7 @@ set(Launcher_FMLLIBS_BASE_URL "https://files.prismlauncher.org/fmllibs/" CACHE S
|
||||
|
||||
######## Set version numbers ########
|
||||
set(Launcher_VERSION_MAJOR 9)
|
||||
set(Launcher_VERSION_MINOR 0)
|
||||
set(Launcher_VERSION_MINOR 4)
|
||||
|
||||
set(Launcher_VERSION_NAME "${Launcher_VERSION_MAJOR}.${Launcher_VERSION_MINOR}")
|
||||
set(Launcher_VERSION_NAME4 "${Launcher_VERSION_MAJOR}.${Launcher_VERSION_MINOR}.0.0")
|
||||
@ -397,8 +404,8 @@ if(UNIX AND APPLE)
|
||||
set(MACOSX_SPARKLE_UPDATE_PUBLIC_KEY "v55ZWWD6QlPoXGV6VLzOTZxZUggWeE51X8cRQyQh6vA=" CACHE STRING "Public key for Sparkle update feed")
|
||||
set(MACOSX_SPARKLE_UPDATE_FEED_URL "https://prismlauncher.org/feed/appcast.xml" CACHE STRING "URL for Sparkle update feed")
|
||||
|
||||
set(MACOSX_SPARKLE_DOWNLOAD_URL "https://github.com/sparkle-project/Sparkle/releases/download/2.5.2/Sparkle-2.5.2.tar.xz" CACHE STRING "URL to Sparkle release archive")
|
||||
set(MACOSX_SPARKLE_SHA256 "572dd67ae398a466f19f343a449e1890bac1ef74885b4739f68f979a8a89884b" CACHE STRING "SHA256 checksum for Sparkle release archive")
|
||||
set(MACOSX_SPARKLE_DOWNLOAD_URL "https://github.com/sparkle-project/Sparkle/releases/download/2.6.4/Sparkle-2.6.4.tar.xz" CACHE STRING "URL to Sparkle release archive")
|
||||
set(MACOSX_SPARKLE_SHA256 "50612a06038abc931f16011d7903b8326a362c1074dabccb718404ce8e585f0b" CACHE STRING "SHA256 checksum for Sparkle release archive")
|
||||
set(MACOSX_SPARKLE_DIR "${CMAKE_BINARY_DIR}/frameworks/Sparkle")
|
||||
|
||||
# directories to look for dependencies
|
||||
|
@ -1,7 +1,7 @@
|
||||
## Prism Launcher
|
||||
|
||||
Prism Launcher - Minecraft Launcher
|
||||
Copyright (C) 2022-2024 Prism Launcher Contributors
|
||||
Copyright (C) 2022-2025 Prism Launcher Contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -8,6 +8,8 @@
|
||||
<string>A Minecraft mod wants to access your microphone.</string>
|
||||
<key>NSDownloadsFolderUsageDescription</key>
|
||||
<string>Prism uses access to your Downloads folder to help you more quickly add mods that can't be automatically downloaded to your instance. You can change where Prism scans for downloaded mods in Settings or the prompt that appears.</string>
|
||||
<key>NSLocalNetworkUsageDescription</key>
|
||||
<string>Minecraft uses the local network to find and connect to LAN servers.</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string>NSApplication</string>
|
||||
<key>NSHighResolutionCapable</key>
|
||||
|
13
default.nix
13
default.nix
@ -1,9 +1,4 @@
|
||||
(import (
|
||||
let
|
||||
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
|
||||
in
|
||||
fetchTarball {
|
||||
url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
|
||||
sha256 = lock.nodes.flake-compat.locked.narHash;
|
||||
}
|
||||
) { src = ./.; }).defaultNix
|
||||
(import (fetchTarball {
|
||||
url = "https://github.com/edolstra/flake-compat/archive/ff81ac966bb2cae68946d5ed5fc4994f96d0ffec.tar.gz";
|
||||
sha256 = "sha256-NeCCThCEP3eCl2l/+27kNNK7QrwZB1IJCrXfrbv5oqU=";
|
||||
}) { src = ./.; }).defaultNix
|
||||
|
39
flake.lock
generated
39
flake.lock
generated
@ -1,21 +1,5 @@
|
||||
{
|
||||
"nodes": {
|
||||
"flake-compat": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1696426674,
|
||||
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"libnbtplusplus": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
@ -32,28 +16,13 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nix-filter": {
|
||||
"locked": {
|
||||
"lastModified": 1710156097,
|
||||
"narHash": "sha256-1Wvk8UP7PXdf8bCCaEoMnOT1qe5/Duqgj+rL8sRQsSM=",
|
||||
"owner": "numtide",
|
||||
"repo": "nix-filter",
|
||||
"rev": "3342559a24e85fc164b295c3444e8a139924675b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "nix-filter",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1729256560,
|
||||
"narHash": "sha256-/uilDXvCIEs3C9l73JTACm4quuHUsIHcns1c+cHUJwA=",
|
||||
"lastModified": 1743583204,
|
||||
"narHash": "sha256-F7n4+KOIfWrwoQjXrL2wD9RhFYLs2/GGe/MQY1sSdlE=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "4c2fcb090b1f3e5b47eaa7bd33913b574a11e0a0",
|
||||
"rev": "2c8d3f48d33929642c1c12cd243df4cc7d2ce434",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@ -65,9 +34,7 @@
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-compat": "flake-compat",
|
||||
"libnbtplusplus": "libnbtplusplus",
|
||||
"nix-filter": "nix-filter",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
|
175
flake.nix
175
flake.nix
@ -15,28 +15,6 @@
|
||||
url = "github:PrismLauncher/libnbtplusplus";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
nix-filter.url = "github:numtide/nix-filter";
|
||||
|
||||
/*
|
||||
Inputs below this are optional and can be removed
|
||||
|
||||
```
|
||||
{
|
||||
inputs.prismlauncher = {
|
||||
url = "github:PrismLauncher/PrismLauncher";
|
||||
inputs = {
|
||||
flake-compat.follows = "";
|
||||
};
|
||||
};
|
||||
}
|
||||
```
|
||||
*/
|
||||
|
||||
flake-compat = {
|
||||
url = "github:edolstra/flake-compat";
|
||||
flake = false;
|
||||
};
|
||||
};
|
||||
|
||||
outputs =
|
||||
@ -44,9 +22,8 @@
|
||||
self,
|
||||
nixpkgs,
|
||||
libnbtplusplus,
|
||||
nix-filter,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
inherit (nixpkgs) lib;
|
||||
|
||||
@ -58,53 +35,148 @@
|
||||
forAllSystems = lib.genAttrs systems;
|
||||
nixpkgsFor = forAllSystems (system: nixpkgs.legacyPackages.${system});
|
||||
in
|
||||
|
||||
{
|
||||
checks = forAllSystems (
|
||||
system:
|
||||
|
||||
let
|
||||
checks' = nixpkgsFor.${system}.callPackage ./nix/checks.nix { inherit self; };
|
||||
pkgs = nixpkgsFor.${system};
|
||||
llvm = pkgs.llvmPackages_19;
|
||||
in
|
||||
lib.filterAttrs (_: lib.isDerivation) checks'
|
||||
|
||||
{
|
||||
formatting =
|
||||
pkgs.runCommand "check-formatting"
|
||||
{
|
||||
nativeBuildInputs = with pkgs; [
|
||||
deadnix
|
||||
llvm.clang-tools
|
||||
markdownlint-cli
|
||||
nixfmt-rfc-style
|
||||
statix
|
||||
];
|
||||
}
|
||||
''
|
||||
cd ${self}
|
||||
|
||||
echo "Running clang-format...."
|
||||
clang-format --dry-run --style='file' --Werror */**.{c,cc,cpp,h,hh,hpp}
|
||||
|
||||
echo "Running deadnix..."
|
||||
deadnix --fail
|
||||
|
||||
echo "Running markdownlint..."
|
||||
markdownlint --dot .
|
||||
|
||||
echo "Running nixfmt..."
|
||||
find -type f -name '*.nix' -exec nixfmt --check {} +
|
||||
|
||||
echo "Running statix"
|
||||
statix check .
|
||||
|
||||
touch $out
|
||||
'';
|
||||
}
|
||||
);
|
||||
|
||||
devShells = forAllSystems (
|
||||
system:
|
||||
|
||||
let
|
||||
pkgs = nixpkgsFor.${system};
|
||||
llvm = pkgs.llvmPackages_19;
|
||||
|
||||
packages' = self.packages.${system};
|
||||
|
||||
welcomeMessage = ''
|
||||
Welcome to the Prism Launcher repository! 🌈
|
||||
|
||||
We just set some things up for you. To get building, you can run:
|
||||
|
||||
```
|
||||
$ cd "$cmakeBuildDir"
|
||||
$ ninjaBuildPhase
|
||||
$ ninjaInstallPhase
|
||||
```
|
||||
|
||||
Feel free to ask any questions in our Discord server or Matrix space:
|
||||
- https://prismlauncher.org/discord
|
||||
- https://matrix.to/#/#prismlauncher:matrix.org
|
||||
|
||||
And thanks for helping out :)
|
||||
'';
|
||||
|
||||
# Re-use our package wrapper to wrap our development environment
|
||||
qt-wrapper-env = packages'.prismlauncher.overrideAttrs (old: {
|
||||
name = "qt-wrapper-env";
|
||||
|
||||
# Required to use script-based makeWrapper below
|
||||
strictDeps = true;
|
||||
|
||||
# We don't need/want the unwrapped Prism package
|
||||
paths = [ ];
|
||||
|
||||
nativeBuildInputs = old.nativeBuildInputs or [ ] ++ [
|
||||
# Ensure the wrapper is script based so it can be sourced
|
||||
pkgs.makeWrapper
|
||||
];
|
||||
|
||||
# Inspired by https://discourse.nixos.org/t/python-qt-woes/11808/10
|
||||
buildCommand = ''
|
||||
makeQtWrapper ${lib.getExe pkgs.runtimeShellPackage} "$out"
|
||||
sed -i '/^exec/d' "$out"
|
||||
'';
|
||||
});
|
||||
in
|
||||
|
||||
{
|
||||
default = pkgs.mkShell {
|
||||
inputsFrom = [ self.packages.${system}.prismlauncher-unwrapped ];
|
||||
buildInputs = with pkgs; [
|
||||
inputsFrom = [ packages'.prismlauncher-unwrapped ];
|
||||
|
||||
packages = with pkgs; [
|
||||
ccache
|
||||
ninja
|
||||
llvm.clang-tools
|
||||
];
|
||||
|
||||
cmakeBuildType = "Debug";
|
||||
cmakeFlags = [ "-GNinja" ] ++ packages'.prismlauncher.cmakeFlags;
|
||||
dontFixCmake = true;
|
||||
|
||||
shellHook = ''
|
||||
echo "Sourcing ${qt-wrapper-env}"
|
||||
source ${qt-wrapper-env}
|
||||
|
||||
git submodule update --init --force
|
||||
|
||||
if [ ! -f compile_commands.json ]; then
|
||||
cmakeConfigurePhase
|
||||
cd ..
|
||||
ln -s "$cmakeBuildDir"/compile_commands.json compile_commands.json
|
||||
fi
|
||||
|
||||
echo ${lib.escapeShellArg welcomeMessage}
|
||||
'';
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
formatter = forAllSystems (system: nixpkgsFor.${system}.nixfmt-rfc-style);
|
||||
|
||||
overlays.default =
|
||||
final: prev:
|
||||
let
|
||||
version = builtins.substring 0 8 self.lastModifiedDate or "dirty";
|
||||
in
|
||||
{
|
||||
prismlauncher-unwrapped = prev.callPackage ./nix/unwrapped.nix {
|
||||
inherit
|
||||
libnbtplusplus
|
||||
nix-filter
|
||||
self
|
||||
version
|
||||
;
|
||||
};
|
||||
|
||||
prismlauncher = final.callPackage ./nix/wrapper.nix { };
|
||||
overlays.default = final: prev: {
|
||||
prismlauncher-unwrapped = prev.callPackage ./nix/unwrapped.nix {
|
||||
inherit
|
||||
libnbtplusplus
|
||||
self
|
||||
;
|
||||
};
|
||||
|
||||
prismlauncher = final.callPackage ./nix/wrapper.nix { };
|
||||
};
|
||||
|
||||
packages = forAllSystems (
|
||||
system:
|
||||
|
||||
let
|
||||
pkgs = nixpkgsFor.${system};
|
||||
|
||||
@ -117,6 +189,7 @@
|
||||
default = prismPackages.prismlauncher;
|
||||
};
|
||||
in
|
||||
|
||||
# Only output them if they're available on the current system
|
||||
lib.filterAttrs (_: lib.meta.availableOn pkgs.stdenv.hostPlatform) packages
|
||||
);
|
||||
@ -124,16 +197,18 @@
|
||||
# We put these under legacyPackages as they are meant for CI, not end user consumption
|
||||
legacyPackages = forAllSystems (
|
||||
system:
|
||||
|
||||
let
|
||||
prismPackages = self.packages.${system};
|
||||
legacyPackages = self.legacyPackages.${system};
|
||||
packages' = self.packages.${system};
|
||||
legacyPackages' = self.legacyPackages.${system};
|
||||
in
|
||||
|
||||
{
|
||||
prismlauncher-debug = prismPackages.prismlauncher.override {
|
||||
prismlauncher-unwrapped = legacyPackages.prismlauncher-unwrapped-debug;
|
||||
prismlauncher-debug = packages'.prismlauncher.override {
|
||||
prismlauncher-unwrapped = legacyPackages'.prismlauncher-unwrapped-debug;
|
||||
};
|
||||
|
||||
prismlauncher-unwrapped-debug = prismPackages.prismlauncher-unwrapped.overrideAttrs {
|
||||
prismlauncher-unwrapped-debug = packages'.prismlauncher-unwrapped.overrideAttrs {
|
||||
cmakeBuildType = "Debug";
|
||||
dontStrip = true;
|
||||
};
|
||||
|
20
flatpak/flite.json
Normal file
20
flatpak/flite.json
Normal file
@ -0,0 +1,20 @@
|
||||
{
|
||||
"name": "flite",
|
||||
"config-opts": [
|
||||
"--enable-shared",
|
||||
"--with-audio=pulseaudio"
|
||||
],
|
||||
"no-parallel-make": true,
|
||||
"sources": [
|
||||
{
|
||||
"type": "git",
|
||||
"url": "https://github.com/festvox/flite.git",
|
||||
"tag": "v2.2",
|
||||
"commit": "e9e2e37c329dbe98bfeb27a1828ef9a71fa84f88",
|
||||
"x-checker-data": {
|
||||
"type": "git",
|
||||
"tag-pattern": "^v([\\d.]+)$"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
@ -1,22 +1,18 @@
|
||||
{
|
||||
"name": "libdecor",
|
||||
"buildsystem": "meson",
|
||||
"config-opts": [
|
||||
"-Ddemo=false"
|
||||
],
|
||||
"sources": [
|
||||
{
|
||||
"type": "git",
|
||||
"url": "https://gitlab.freedesktop.org/libdecor/libdecor.git",
|
||||
"commit": "73260393a97291c887e1074ab7f318e031be0ac6"
|
||||
},
|
||||
{
|
||||
"type": "patch",
|
||||
"path": "patches/weird_libdecor.patch"
|
||||
}
|
||||
],
|
||||
"cleanup": [
|
||||
"/include",
|
||||
"/lib/pkgconfig"
|
||||
]
|
||||
"name": "libdecor",
|
||||
"buildsystem": "meson",
|
||||
"config-opts": [
|
||||
"-Ddemo=false"
|
||||
],
|
||||
"sources": [
|
||||
{
|
||||
"type": "git",
|
||||
"url": "https://gitlab.freedesktop.org/libdecor/libdecor.git",
|
||||
"commit": "c2bd8ad6fa42c0cb17553ce77ad8a87d1f543b1f"
|
||||
}
|
||||
],
|
||||
"cleanup": [
|
||||
"/include",
|
||||
"/lib/pkgconfig"
|
||||
]
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
id: org.prismlauncher.PrismLauncher
|
||||
runtime: org.kde.Platform
|
||||
runtime-version: 6.7
|
||||
runtime-version: '6.8'
|
||||
sdk: org.kde.Sdk
|
||||
sdk-extensions:
|
||||
- org.freedesktop.Sdk.Extension.openjdk17
|
||||
@ -19,6 +19,12 @@ finish-args:
|
||||
- --filesystem=xdg-download:ro
|
||||
# FTBApp import
|
||||
- --filesystem=~/.ftba:ro
|
||||
# Userspace visibility for manual hugepages configuration
|
||||
# Required for -XX:+UseLargePages
|
||||
- --filesystem=/sys/kernel/mm/hugepages:ro
|
||||
# Userspace visibility for transparent hugepages configuration
|
||||
# Required for -XX:+UseTransparentHugePages
|
||||
- --filesystem=/sys/kernel/mm/transparent_hugepage:ro
|
||||
|
||||
modules:
|
||||
# Might be needed by some Controller mods (see https://github.com/isXander/Controlify/issues/31)
|
||||
@ -27,11 +33,16 @@ modules:
|
||||
# Needed for proper Wayland support
|
||||
- libdecor.json
|
||||
|
||||
# Text to Speech in the game
|
||||
- flite.json
|
||||
|
||||
- name: prismlauncher
|
||||
buildsystem: cmake-ninja
|
||||
builddir: true
|
||||
config-opts:
|
||||
- -DLauncher_BUILD_PLATFORM=flatpak
|
||||
# This allows us to manage and update Java independently of this Flatpak
|
||||
- -DLauncher_ENABLE_JAVA_DOWNLOADER=ON
|
||||
- -DCMAKE_BUILD_TYPE=RelWithDebInfo
|
||||
build-options:
|
||||
env:
|
||||
@ -47,18 +58,14 @@ modules:
|
||||
config-opts:
|
||||
- -DCMAKE_BUILD_TYPE=RelWithDebInfo
|
||||
- -DBUILD_SHARED_LIBS:BOOL=ON
|
||||
- -DGLFW_USE_WAYLAND:BOOL=ON
|
||||
- -DGLFW_BUILD_WAYLAND:BOOL=ON
|
||||
- -DGLFW_BUILD_DOCS:BOOL=OFF
|
||||
sources:
|
||||
- type: git
|
||||
url: https://github.com/glfw/glfw.git
|
||||
commit: 3fa2360720eeba1964df3c0ecf4b5df8648a8e52
|
||||
commit: 7b6aead9fb88b3623e3b3725ebb42670cbe4c579 # 3.4
|
||||
- type: patch
|
||||
path: patches/0003-Don-t-crash-on-calls-to-focus-or-icon.patch
|
||||
- type: patch
|
||||
path: patches/0005-Add-warning-about-being-an-unofficial-patch.patch
|
||||
- type: patch
|
||||
path: patches/0007-Platform-Prefer-Wayland-over-X11.patch
|
||||
path: patches/0009-Defer-setting-cursor-position-until-the-cursor-is-lo.patch
|
||||
cleanup:
|
||||
- /include
|
||||
- /lib/cmake
|
||||
@ -68,8 +75,8 @@ modules:
|
||||
buildsystem: autotools
|
||||
sources:
|
||||
- type: archive
|
||||
url: https://xorg.freedesktop.org/archive/individual/app/xrandr-1.5.2.tar.xz
|
||||
sha256: c8bee4790d9058bacc4b6246456c58021db58a87ddda1a9d0139bf5f18f1f240
|
||||
url: https://xorg.freedesktop.org/archive/individual/app/xrandr-1.5.3.tar.xz
|
||||
sha256: f8dd7566adb74147fab9964680b6bbadee87cf406a7fcff51718a5e6949b841c
|
||||
x-checker-data:
|
||||
type: anitya
|
||||
project-id: 14957
|
||||
@ -91,8 +98,8 @@ modules:
|
||||
sources:
|
||||
- type: archive
|
||||
dest-filename: gamemode.tar.gz
|
||||
url: https://api.github.com/repos/FeralInteractive/gamemode/tarball/1.8.1
|
||||
sha256: 969cf85b5ca3944f3e315cd73a0ee9bea4f9c968cd7d485e9f4745bc1e679c4e
|
||||
url: https://api.github.com/repos/FeralInteractive/gamemode/tarball/1.8.2
|
||||
sha256: 2886d4ce543c78bd2a364316d5e7fd59ef06b71de63f896b37c6d3dc97658f60
|
||||
x-checker-data:
|
||||
type: json
|
||||
url: https://api.github.com/repos/FeralInteractive/gamemode/releases/latest
|
||||
|
@ -1,24 +0,0 @@
|
||||
diff --git a/src/wl_window.c b/src/wl_window.c
|
||||
index 52d3b9eb..4ac4eb5d 100644
|
||||
--- a/src/wl_window.c
|
||||
+++ b/src/wl_window.c
|
||||
@@ -2117,8 +2117,7 @@ void _glfwSetWindowTitleWayland(_GLFWwindow* window, const char* title)
|
||||
void _glfwSetWindowIconWayland(_GLFWwindow* window,
|
||||
int count, const GLFWimage* images)
|
||||
{
|
||||
- _glfwInputError(GLFW_FEATURE_UNAVAILABLE,
|
||||
- "Wayland: The platform does not support setting the window icon");
|
||||
+ fprintf(stderr, "!!! Ignoring Error: Wayland: The platform does not support setting the window icon\n");
|
||||
}
|
||||
|
||||
void _glfwGetWindowPosWayland(_GLFWwindow* window, int* xpos, int* ypos)
|
||||
@@ -2361,8 +2360,7 @@ void _glfwRequestWindowAttentionWayland(_GLFWwindow* window)
|
||||
|
||||
void _glfwFocusWindowWayland(_GLFWwindow* window)
|
||||
{
|
||||
- _glfwInputError(GLFW_FEATURE_UNAVAILABLE,
|
||||
- "Wayland: The platform does not support setting the input focus");
|
||||
+ fprintf(stderr, "!!! Ignoring Error: Wayland: The platform does not support setting the input focus\n");
|
||||
}
|
||||
|
||||
void _glfwSetWindowMonitorWayland(_GLFWwindow* window,
|
@ -1,17 +0,0 @@
|
||||
diff --git a/src/init.c b/src/init.c
|
||||
index 06dbb3f2..a7c6da86 100644
|
||||
--- a/src/init.c
|
||||
+++ b/src/init.c
|
||||
@@ -449,6 +449,12 @@ GLFWAPI int glfwInit(void)
|
||||
_glfw.initialized = GLFW_TRUE;
|
||||
|
||||
glfwDefaultWindowHints();
|
||||
+
|
||||
+ fprintf(stderr, "!!! Patched GLFW from https://github.com/Admicos/minecraft-wayland\n"
|
||||
+ "!!! If any issues with the window, or some issues with rendering, occur, "
|
||||
+ "first try with the built-in GLFW, and if that solves the issue, report there first.\n"
|
||||
+ "!!! Use outside Minecraft is untested, and things might break.\n");
|
||||
+
|
||||
return GLFW_TRUE;
|
||||
}
|
||||
|
@ -1,20 +0,0 @@
|
||||
diff --git a/src/platform.c b/src/platform.c
|
||||
index c5966ae7..3e7442f9 100644
|
||||
--- a/src/platform.c
|
||||
+++ b/src/platform.c
|
||||
@@ -49,12 +49,12 @@ static const struct
|
||||
#if defined(_GLFW_COCOA)
|
||||
{ GLFW_PLATFORM_COCOA, _glfwConnectCocoa },
|
||||
#endif
|
||||
-#if defined(_GLFW_X11)
|
||||
- { GLFW_PLATFORM_X11, _glfwConnectX11 },
|
||||
-#endif
|
||||
#if defined(_GLFW_WAYLAND)
|
||||
{ GLFW_PLATFORM_WAYLAND, _glfwConnectWayland },
|
||||
#endif
|
||||
+#if defined(_GLFW_X11)
|
||||
+ { GLFW_PLATFORM_X11, _glfwConnectX11 },
|
||||
+#endif
|
||||
};
|
||||
|
||||
GLFWbool _glfwSelectPlatform(int desiredID, _GLFWplatform* platform)
|
@ -0,0 +1,59 @@
|
||||
From 9997ae55a47de469ea26f8437c30b51483abda5f Mon Sep 17 00:00:00 2001
|
||||
From: Dan Klishch <danilklishch@gmail.com>
|
||||
Date: Sat, 30 Sep 2023 23:38:05 -0400
|
||||
Subject: Defer setting cursor position until the cursor is locked
|
||||
|
||||
---
|
||||
src/wl_platform.h | 3 +++
|
||||
src/wl_window.c | 14 ++++++++++++--
|
||||
2 files changed, 15 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/wl_platform.h b/src/wl_platform.h
|
||||
index ca34f66e..cd1f227f 100644
|
||||
--- a/src/wl_platform.h
|
||||
+++ b/src/wl_platform.h
|
||||
@@ -403,6 +403,9 @@ typedef struct _GLFWwindowWayland
|
||||
int scaleSize;
|
||||
int compositorPreferredScale;
|
||||
|
||||
+ double askedCursorPosX, askedCursorPosY;
|
||||
+ GLFWbool didAskForSetCursorPos;
|
||||
+
|
||||
struct zwp_relative_pointer_v1* relativePointer;
|
||||
struct zwp_locked_pointer_v1* lockedPointer;
|
||||
struct zwp_confined_pointer_v1* confinedPointer;
|
||||
diff --git a/src/wl_window.c b/src/wl_window.c
|
||||
index 1de26558..0df16747 100644
|
||||
--- a/src/wl_window.c
|
||||
+++ b/src/wl_window.c
|
||||
@@ -2586,8 +2586,9 @@ void _glfwGetCursorPosWayland(_GLFWwindow* window, double* xpos, double* ypos)
|
||||
|
||||
void _glfwSetCursorPosWayland(_GLFWwindow* window, double x, double y)
|
||||
{
|
||||
- _glfwInputError(GLFW_FEATURE_UNAVAILABLE,
|
||||
- "Wayland: The platform does not support setting the cursor position");
|
||||
+ window->wl.didAskForSetCursorPos = true;
|
||||
+ window->wl.askedCursorPosX = x;
|
||||
+ window->wl.askedCursorPosY = y;
|
||||
}
|
||||
|
||||
void _glfwSetCursorModeWayland(_GLFWwindow* window, int mode)
|
||||
@@ -2819,6 +2820,15 @@ static const struct zwp_relative_pointer_v1_listener relativePointerListener =
|
||||
static void lockedPointerHandleLocked(void* userData,
|
||||
struct zwp_locked_pointer_v1* lockedPointer)
|
||||
{
|
||||
+ _GLFWwindow* window = userData;
|
||||
+
|
||||
+ if (window->wl.didAskForSetCursorPos)
|
||||
+ {
|
||||
+ window->wl.didAskForSetCursorPos = false;
|
||||
+ zwp_locked_pointer_v1_set_cursor_position_hint(window->wl.lockedPointer,
|
||||
+ wl_fixed_from_double(window->wl.askedCursorPosX),
|
||||
+ wl_fixed_from_double(window->wl.askedCursorPosY));
|
||||
+ }
|
||||
}
|
||||
|
||||
static void lockedPointerHandleUnlocked(void* userData,
|
||||
--
|
||||
2.42.0
|
||||
|
@ -1,40 +0,0 @@
|
||||
diff --git a/src/libdecor.c b/src/libdecor.c
|
||||
index a9c1106..1aa38b3 100644
|
||||
--- a/src/libdecor.c
|
||||
+++ b/src/libdecor.c
|
||||
@@ -1391,22 +1391,32 @@ calculate_priority(const struct libdecor_plugin_description *plugin_description)
|
||||
static bool
|
||||
check_symbol_conflicts(const struct libdecor_plugin_description *plugin_description)
|
||||
{
|
||||
+ bool ret = true;
|
||||
char * const *symbol;
|
||||
+ void* main_prog = dlopen(NULL, RTLD_LAZY);
|
||||
+ if (!main_prog) {
|
||||
+ fprintf(stderr, "Plugin \"%s\" couldn't check conflicting symbols: \"%s\".\n",
|
||||
+ plugin_description->description, dlerror());
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
|
||||
symbol = plugin_description->conflicting_symbols;
|
||||
while (*symbol) {
|
||||
dlerror();
|
||||
- dlsym (RTLD_DEFAULT, *symbol);
|
||||
+ dlsym (main_prog, *symbol);
|
||||
if (!dlerror()) {
|
||||
fprintf(stderr, "Plugin \"%s\" uses conflicting symbol \"%s\".\n",
|
||||
plugin_description->description, *symbol);
|
||||
- return false;
|
||||
+ ret = false;
|
||||
+ break;
|
||||
}
|
||||
|
||||
symbol++;
|
||||
}
|
||||
|
||||
- return true;
|
||||
+ dlclose(main_prog);
|
||||
+ return ret;
|
||||
}
|
||||
|
||||
static struct plugin_loader *
|
@ -1 +1 @@
|
||||
Subproject commit f2b0c16a2a217a1822ce5a6538ba8f755ed1dd32
|
||||
Subproject commit f5d368a31d6ef046eb2955c74ec6f54f32ed5c4e
|
@ -48,6 +48,7 @@
|
||||
#include "net/PasteUpload.h"
|
||||
#include "pathmatcher/MultiMatcher.h"
|
||||
#include "pathmatcher/SimplePrefixMatcher.h"
|
||||
#include "tasks/Task.h"
|
||||
#include "tools/GenericProfiler.h"
|
||||
#include "ui/InstanceWindow.h"
|
||||
#include "ui/MainWindow.h"
|
||||
@ -155,6 +156,7 @@
|
||||
|
||||
#if defined Q_OS_WIN32
|
||||
#include <windows.h>
|
||||
#include <QStyleHints>
|
||||
#include "WindowsConsole.h"
|
||||
#endif
|
||||
|
||||
@ -226,7 +228,7 @@ Application::Application(int& argc, char** argv) : QApplication(argc, argv)
|
||||
setApplicationDisplayName(QString("%1 %2").arg(BuildConfig.LAUNCHER_DISPLAYNAME, BuildConfig.printableVersionString()));
|
||||
setApplicationVersion(BuildConfig.printableVersionString() + "\n" + BuildConfig.GIT_COMMIT);
|
||||
setDesktopFileName(BuildConfig.LAUNCHER_DESKTOPFILENAME);
|
||||
startTime = QDateTime::currentDateTime();
|
||||
m_startTime = QDateTime::currentDateTime();
|
||||
|
||||
// Don't quit on hiding the last window
|
||||
this->setQuitOnLastWindowClosed(false);
|
||||
@ -1071,6 +1073,9 @@ Application::Application(int& argc, char** argv) : QApplication(argc, argv)
|
||||
bool Application::createSetupWizard()
|
||||
{
|
||||
bool javaRequired = [&]() {
|
||||
if (BuildConfig.JAVA_DOWNLOADER_ENABLED && m_settings->get("AutomaticJavaDownload").toBool()) {
|
||||
return false;
|
||||
}
|
||||
bool ignoreJavaWizard = m_settings->get("IgnoreJavaWizard").toBool();
|
||||
if (ignoreJavaWizard) {
|
||||
return false;
|
||||
@ -1083,10 +1088,7 @@ bool Application::createSetupWizard()
|
||||
}
|
||||
QString currentJavaPath = settings()->get("JavaPath").toString();
|
||||
QString actualPath = FS::ResolveExecutable(currentJavaPath);
|
||||
if (actualPath.isNull()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return actualPath.isNull();
|
||||
}();
|
||||
bool askjava = BuildConfig.JAVA_DOWNLOADER_ENABLED && !javaRequired && !m_settings->get("AutomaticJavaDownload").toBool() &&
|
||||
!m_settings->get("AutomaticJavaSwitch").toBool() && !m_settings->get("UserAskedAboutAutomaticJavaDownload").toBool();
|
||||
@ -1101,8 +1103,16 @@ bool Application::createSetupWizard()
|
||||
// set default theme after going into theme wizard
|
||||
if (!validIcons)
|
||||
settings()->set("IconTheme", QString("pe_colored"));
|
||||
if (!validWidgets)
|
||||
settings()->set("ApplicationTheme", QString("system"));
|
||||
if (!validWidgets) {
|
||||
#if defined(Q_OS_WIN32) && QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
|
||||
const QString style =
|
||||
QGuiApplication::styleHints()->colorScheme() == Qt::ColorScheme::Dark ? QStringLiteral("dark") : QStringLiteral("bright");
|
||||
#else
|
||||
const QString style = QStringLiteral("system");
|
||||
#endif
|
||||
|
||||
settings()->set("ApplicationTheme", style);
|
||||
}
|
||||
|
||||
m_themeManager->applyCurrentlySelectedTheme(true);
|
||||
|
||||
@ -1169,6 +1179,9 @@ bool Application::event(QEvent* event)
|
||||
#endif
|
||||
|
||||
if (event->type() == QEvent::FileOpen) {
|
||||
if (!m_mainWindow) {
|
||||
showMainWindow(false);
|
||||
}
|
||||
auto ev = static_cast<QFileOpenEvent*>(event);
|
||||
m_mainWindow->processURLs({ ev->url() });
|
||||
}
|
||||
@ -1302,6 +1315,9 @@ void Application::messageReceived(const QByteArray& message)
|
||||
qWarning() << "Received" << command << "message without a zip path/URL.";
|
||||
return;
|
||||
}
|
||||
if (!m_mainWindow) {
|
||||
showMainWindow(false);
|
||||
}
|
||||
m_mainWindow->processURLs({ normalizeImportUrl(url) });
|
||||
} else if (command == "launch") {
|
||||
QString id = received.args["id"];
|
||||
@ -1380,6 +1396,7 @@ bool Application::launch(InstancePtr instance, bool online, bool demo, Minecraft
|
||||
if (m_updateRunning) {
|
||||
qDebug() << "Cannot launch instances while an update is running. Please try again when updates are completed.";
|
||||
} else if (instance->canLaunch()) {
|
||||
QMutexLocker locker(&m_instanceExtrasMutex);
|
||||
auto& extras = m_instanceExtras[instance->id()];
|
||||
auto window = extras.window;
|
||||
if (window) {
|
||||
@ -1404,7 +1421,7 @@ bool Application::launch(InstancePtr instance, bool online, bool demo, Minecraft
|
||||
connect(controller.get(), &LaunchController::failed, this, &Application::controllerFailed);
|
||||
connect(controller.get(), &LaunchController::aborted, this, [this] { controllerFailed(tr("Aborted")); });
|
||||
addRunningInstance();
|
||||
controller->start();
|
||||
QMetaObject::invokeMethod(controller.get(), &Task::start, Qt::QueuedConnection);
|
||||
return true;
|
||||
} else if (instance->isRunning()) {
|
||||
showInstanceWindow(instance, "console");
|
||||
@ -1422,9 +1439,11 @@ bool Application::kill(InstancePtr instance)
|
||||
qWarning() << "Attempted to kill instance" << instance->id() << ", which isn't running.";
|
||||
return false;
|
||||
}
|
||||
QMutexLocker locker(&m_instanceExtrasMutex);
|
||||
auto& extras = m_instanceExtras[instance->id()];
|
||||
// NOTE: copy of the shared pointer keeps it alive
|
||||
auto controller = extras.controller;
|
||||
locker.unlock();
|
||||
if (controller) {
|
||||
return controller->abort();
|
||||
}
|
||||
@ -1478,12 +1497,14 @@ void Application::controllerSucceeded()
|
||||
if (!controller)
|
||||
return;
|
||||
auto id = controller->id();
|
||||
|
||||
QMutexLocker locker(&m_instanceExtrasMutex);
|
||||
auto& extras = m_instanceExtras[id];
|
||||
|
||||
// on success, do...
|
||||
if (controller->instance()->settings()->get("AutoCloseConsole").toBool()) {
|
||||
if (extras.window) {
|
||||
extras.window->close();
|
||||
QMetaObject::invokeMethod(extras.window, &QWidget::close, Qt::QueuedConnection);
|
||||
}
|
||||
}
|
||||
extras.controller.reset();
|
||||
@ -1503,6 +1524,7 @@ void Application::controllerFailed(const QString& error)
|
||||
if (!controller)
|
||||
return;
|
||||
auto id = controller->id();
|
||||
QMutexLocker locker(&m_instanceExtrasMutex);
|
||||
auto& extras = m_instanceExtras[id];
|
||||
|
||||
// on failure, do... nothing
|
||||
@ -1560,6 +1582,7 @@ InstanceWindow* Application::showInstanceWindow(InstancePtr instance, QString pa
|
||||
if (!instance)
|
||||
return nullptr;
|
||||
auto id = instance->id();
|
||||
QMutexLocker locker(&m_instanceExtrasMutex);
|
||||
auto& extras = m_instanceExtras[id];
|
||||
auto& window = extras.window;
|
||||
|
||||
@ -1597,6 +1620,7 @@ void Application::on_windowClose()
|
||||
m_openWindows--;
|
||||
auto instWindow = qobject_cast<InstanceWindow*>(QObject::sender());
|
||||
if (instWindow) {
|
||||
QMutexLocker locker(&m_instanceExtrasMutex);
|
||||
auto& extras = m_instanceExtras[instWindow->instanceId()];
|
||||
extras.window = nullptr;
|
||||
if (extras.controller) {
|
||||
@ -1844,7 +1868,7 @@ bool Application::handleDataMigration(const QString& currentData,
|
||||
matcher->add(std::make_shared<SimplePrefixMatcher>("themes/"));
|
||||
|
||||
ProgressDialog diag;
|
||||
DataMigrationTask task(nullptr, oldData, currentData, matcher);
|
||||
DataMigrationTask task(oldData, currentData, matcher);
|
||||
if (diag.execWithTask(&task)) {
|
||||
qDebug() << "<> Migration succeeded";
|
||||
setDoNotMigrate();
|
||||
@ -1883,3 +1907,31 @@ const QString Application::javaPath()
|
||||
{
|
||||
return m_settings->get("JavaDir").toString();
|
||||
}
|
||||
|
||||
void Application::addQSavePath(QString path)
|
||||
{
|
||||
QMutexLocker locker(&m_qsaveResourcesMutex);
|
||||
m_qsaveResources[path] = m_qsaveResources.value(path, 0) + 1;
|
||||
}
|
||||
|
||||
void Application::removeQSavePath(QString path)
|
||||
{
|
||||
QMutexLocker locker(&m_qsaveResourcesMutex);
|
||||
auto count = m_qsaveResources.value(path, 0) - 1;
|
||||
if (count <= 0) {
|
||||
m_qsaveResources.remove(path);
|
||||
} else {
|
||||
m_qsaveResources[path] = count;
|
||||
}
|
||||
}
|
||||
|
||||
bool Application::checkQSavePath(QString path)
|
||||
{
|
||||
QMutexLocker locker(&m_qsaveResourcesMutex);
|
||||
for (auto partialPath : m_qsaveResources.keys()) {
|
||||
if (path.startsWith(partialPath) && m_qsaveResources.value(partialPath, 0) > 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
@ -42,6 +42,7 @@
|
||||
#include <QDebug>
|
||||
#include <QFlag>
|
||||
#include <QIcon>
|
||||
#include <QMutex>
|
||||
#include <QUrl>
|
||||
#include <memory>
|
||||
|
||||
@ -111,7 +112,7 @@ class Application : public QApplication {
|
||||
|
||||
std::shared_ptr<SettingsObject> settings() const { return m_settings; }
|
||||
|
||||
qint64 timeSinceStart() const { return startTime.msecsTo(QDateTime::currentDateTime()); }
|
||||
qint64 timeSinceStart() const { return m_startTime.msecsTo(QDateTime::currentDateTime()); }
|
||||
|
||||
QIcon getThemedIcon(const QString& name);
|
||||
|
||||
@ -235,7 +236,7 @@ class Application : public QApplication {
|
||||
bool shouldExitNow() const;
|
||||
|
||||
private:
|
||||
QDateTime startTime;
|
||||
QDateTime m_startTime;
|
||||
|
||||
shared_qobject_ptr<QNetworkAccessManager> m_network;
|
||||
|
||||
@ -278,6 +279,7 @@ class Application : public QApplication {
|
||||
shared_qobject_ptr<LaunchController> controller;
|
||||
};
|
||||
std::map<QString, InstanceXtras> m_instanceExtras;
|
||||
mutable QMutex m_instanceExtrasMutex;
|
||||
|
||||
// main state variables
|
||||
size_t m_openWindows = 0;
|
||||
@ -303,4 +305,13 @@ class Application : public QApplication {
|
||||
QList<QUrl> m_urlsToImport;
|
||||
QString m_instanceIdToShowWindowOf;
|
||||
std::unique_ptr<QFile> logFile;
|
||||
|
||||
public:
|
||||
void addQSavePath(QString);
|
||||
void removeQSavePath(QString);
|
||||
bool checkQSavePath(QString);
|
||||
|
||||
private:
|
||||
QHash<QString, int> m_qsaveResources;
|
||||
mutable QMutex m_qsaveResourcesMutex;
|
||||
};
|
||||
|
@ -30,6 +30,7 @@ set(CORE_SOURCES
|
||||
StringUtils.cpp
|
||||
QVariantUtils.h
|
||||
RuntimeContext.h
|
||||
PSaveFile.h
|
||||
|
||||
# Basic instance manipulation tasks (derived from InstanceTask)
|
||||
InstanceCreationTask.h
|
||||
@ -1030,8 +1031,6 @@ SET(LAUNCHER_SOURCES
|
||||
ui/dialogs/CopyInstanceDialog.h
|
||||
ui/dialogs/CustomMessageBox.cpp
|
||||
ui/dialogs/CustomMessageBox.h
|
||||
ui/dialogs/EditAccountDialog.cpp
|
||||
ui/dialogs/EditAccountDialog.h
|
||||
ui/dialogs/ExportInstanceDialog.cpp
|
||||
ui/dialogs/ExportInstanceDialog.h
|
||||
ui/dialogs/ExportPackDialog.cpp
|
||||
@ -1217,7 +1216,6 @@ qt_wrap_ui(LAUNCHER_UI
|
||||
ui/dialogs/MSALoginDialog.ui
|
||||
ui/dialogs/OfflineLoginDialog.ui
|
||||
ui/dialogs/AboutDialog.ui
|
||||
ui/dialogs/EditAccountDialog.ui
|
||||
ui/dialogs/ReviewMessageBox.ui
|
||||
ui/dialogs/ScrollMessageBox.ui
|
||||
ui/dialogs/BlockedModsDialog.ui
|
||||
|
@ -12,11 +12,8 @@
|
||||
|
||||
#include <QtConcurrent>
|
||||
|
||||
DataMigrationTask::DataMigrationTask(QObject* parent,
|
||||
const QString& sourcePath,
|
||||
const QString& targetPath,
|
||||
const IPathMatcher::Ptr pathMatcher)
|
||||
: Task(parent), m_sourcePath(sourcePath), m_targetPath(targetPath), m_pathMatcher(pathMatcher), m_copy(sourcePath, targetPath)
|
||||
DataMigrationTask::DataMigrationTask(const QString& sourcePath, const QString& targetPath, const IPathMatcher::Ptr pathMatcher)
|
||||
: Task(), m_sourcePath(sourcePath), m_targetPath(targetPath), m_pathMatcher(pathMatcher), m_copy(sourcePath, targetPath)
|
||||
{
|
||||
m_copy.matcher(m_pathMatcher.get()).whitelist(true);
|
||||
}
|
||||
|
@ -18,7 +18,7 @@
|
||||
class DataMigrationTask : public Task {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit DataMigrationTask(QObject* parent, const QString& sourcePath, const QString& targetPath, IPathMatcher::Ptr pathmatcher);
|
||||
explicit DataMigrationTask(const QString& sourcePath, const QString& targetPath, IPathMatcher::Ptr pathmatcher);
|
||||
~DataMigrationTask() override = default;
|
||||
|
||||
protected:
|
||||
|
@ -45,7 +45,6 @@
|
||||
#include <QDirIterator>
|
||||
#include <QFile>
|
||||
#include <QFileInfo>
|
||||
#include <QSaveFile>
|
||||
#include <QStandardPaths>
|
||||
#include <QStorageInfo>
|
||||
#include <QTextStream>
|
||||
@ -54,6 +53,7 @@
|
||||
#include <system_error>
|
||||
|
||||
#include "DesktopServices.h"
|
||||
#include "PSaveFile.h"
|
||||
#include "StringUtils.h"
|
||||
|
||||
#if defined Q_OS_WIN32
|
||||
@ -191,8 +191,8 @@ void ensureExists(const QDir& dir)
|
||||
void write(const QString& filename, const QByteArray& data)
|
||||
{
|
||||
ensureExists(QFileInfo(filename).dir());
|
||||
QSaveFile file(filename);
|
||||
if (!file.open(QSaveFile::WriteOnly)) {
|
||||
PSaveFile file(filename);
|
||||
if (!file.open(PSaveFile::WriteOnly)) {
|
||||
throw FileSystemException("Couldn't open " + filename + " for writing: " + file.errorString());
|
||||
}
|
||||
if (data.size() != file.write(data)) {
|
||||
@ -213,8 +213,8 @@ void appendSafe(const QString& filename, const QByteArray& data)
|
||||
buffer = QByteArray();
|
||||
}
|
||||
buffer.append(data);
|
||||
QSaveFile file(filename);
|
||||
if (!file.open(QSaveFile::WriteOnly)) {
|
||||
PSaveFile file(filename);
|
||||
if (!file.open(PSaveFile::WriteOnly)) {
|
||||
throw FileSystemException("Couldn't open " + filename + " for writing: " + file.errorString());
|
||||
}
|
||||
if (buffer.size() != file.write(buffer)) {
|
||||
@ -971,8 +971,7 @@ bool createShortcut(QString destination, QString target, QStringList args, QStri
|
||||
if (!args.empty())
|
||||
argstring = " \"" + args.join("\" \"") + "\"";
|
||||
|
||||
stream << "#!/bin/bash"
|
||||
<< "\n";
|
||||
stream << "#!/bin/bash" << "\n";
|
||||
stream << "\"" << target << "\" " << argstring << "\n";
|
||||
|
||||
stream.flush();
|
||||
@ -1016,12 +1015,9 @@ bool createShortcut(QString destination, QString target, QStringList args, QStri
|
||||
if (!args.empty())
|
||||
argstring = " '" + args.join("' '") + "'";
|
||||
|
||||
stream << "[Desktop Entry]"
|
||||
<< "\n";
|
||||
stream << "Type=Application"
|
||||
<< "\n";
|
||||
stream << "Categories=Game;ActionGame;AdventureGame;Simulation"
|
||||
<< "\n";
|
||||
stream << "[Desktop Entry]" << "\n";
|
||||
stream << "Type=Application" << "\n";
|
||||
stream << "Categories=Game;ActionGame;AdventureGame;Simulation" << "\n";
|
||||
stream << "Exec=\"" << target.toLocal8Bit() << "\"" << argstring.toLocal8Bit() << "\n";
|
||||
stream << "Name=" << name.toLocal8Bit() << "\n";
|
||||
if (!icon.isEmpty()) {
|
||||
|
@ -61,6 +61,6 @@ void InstanceCreationTask::executeTask()
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
emitSucceeded();
|
||||
if (!m_abort)
|
||||
emitSucceeded();
|
||||
}
|
||||
|
@ -69,9 +69,11 @@ bool InstanceImportTask::abort()
|
||||
if (!canAbort())
|
||||
return false;
|
||||
|
||||
if (task)
|
||||
task->abort();
|
||||
return Task::abort();
|
||||
bool wasAborted = false;
|
||||
if (m_task)
|
||||
wasAborted = m_task->abort();
|
||||
Task::abort();
|
||||
return wasAborted;
|
||||
}
|
||||
|
||||
void InstanceImportTask::executeTask()
|
||||
@ -104,7 +106,7 @@ void InstanceImportTask::downloadFromUrl()
|
||||
connect(filesNetJob.get(), &NetJob::stepProgress, this, &InstanceImportTask::propagateStepProgress);
|
||||
connect(filesNetJob.get(), &NetJob::failed, this, &InstanceImportTask::emitFailed);
|
||||
connect(filesNetJob.get(), &NetJob::aborted, this, &InstanceImportTask::emitAborted);
|
||||
task.reset(filesNetJob);
|
||||
m_task.reset(filesNetJob);
|
||||
filesNetJob->start();
|
||||
}
|
||||
|
||||
@ -193,7 +195,7 @@ void InstanceImportTask::processZipPack()
|
||||
stepProgress(*progressStep);
|
||||
});
|
||||
|
||||
connect(zipTask.get(), &Task::succeeded, this, &InstanceImportTask::extractFinished);
|
||||
connect(zipTask.get(), &Task::succeeded, this, &InstanceImportTask::extractFinished, Qt::QueuedConnection);
|
||||
connect(zipTask.get(), &Task::aborted, this, &InstanceImportTask::emitAborted);
|
||||
connect(zipTask.get(), &Task::failed, this, [this, progressStep](QString reason) {
|
||||
progressStep->state = TaskStepState::Failed;
|
||||
@ -210,12 +212,13 @@ void InstanceImportTask::processZipPack()
|
||||
progressStep->status = status;
|
||||
stepProgress(*progressStep);
|
||||
});
|
||||
task.reset(zipTask);
|
||||
m_task.reset(zipTask);
|
||||
zipTask->start();
|
||||
}
|
||||
|
||||
void InstanceImportTask::extractFinished()
|
||||
{
|
||||
setAbortable(false);
|
||||
QDir extractDir(m_stagingPath);
|
||||
|
||||
qDebug() << "Fixing permissions for extracted pack files...";
|
||||
@ -289,8 +292,11 @@ void InstanceImportTask::processFlame()
|
||||
inst_creation_task->setGroup(m_instGroup);
|
||||
inst_creation_task->setConfirmUpdate(shouldConfirmUpdate());
|
||||
|
||||
connect(inst_creation_task.get(), &Task::succeeded, this, [this, inst_creation_task] {
|
||||
setOverride(inst_creation_task->shouldOverride(), inst_creation_task->originalInstanceID());
|
||||
auto weak = inst_creation_task.toWeakRef();
|
||||
connect(inst_creation_task.get(), &Task::succeeded, this, [this, weak] {
|
||||
if (auto sp = weak.lock()) {
|
||||
setOverride(sp->shouldOverride(), sp->originalInstanceID());
|
||||
}
|
||||
emitSucceeded();
|
||||
});
|
||||
connect(inst_creation_task.get(), &Task::failed, this, &InstanceImportTask::emitFailed);
|
||||
@ -299,11 +305,12 @@ void InstanceImportTask::processFlame()
|
||||
connect(inst_creation_task.get(), &Task::status, this, &InstanceImportTask::setStatus);
|
||||
connect(inst_creation_task.get(), &Task::details, this, &InstanceImportTask::setDetails);
|
||||
|
||||
connect(this, &Task::aborted, inst_creation_task.get(), &InstanceCreationTask::abort);
|
||||
connect(inst_creation_task.get(), &Task::aborted, this, &Task::abort);
|
||||
connect(inst_creation_task.get(), &Task::abortStatusChanged, this, &Task::setAbortable);
|
||||
|
||||
inst_creation_task->start();
|
||||
m_task.reset(inst_creation_task);
|
||||
setAbortable(true);
|
||||
m_task->start();
|
||||
}
|
||||
|
||||
void InstanceImportTask::processTechnic()
|
||||
@ -350,7 +357,7 @@ void InstanceImportTask::processMultiMC()
|
||||
|
||||
void InstanceImportTask::processModrinth()
|
||||
{
|
||||
ModrinthCreationTask* inst_creation_task = nullptr;
|
||||
shared_qobject_ptr<ModrinthCreationTask> inst_creation_task = nullptr;
|
||||
if (!m_extra_info.isEmpty()) {
|
||||
auto pack_id_it = m_extra_info.constFind("pack_id");
|
||||
Q_ASSERT(pack_id_it != m_extra_info.constEnd());
|
||||
@ -367,7 +374,7 @@ void InstanceImportTask::processModrinth()
|
||||
original_instance_id = original_instance_id_it.value();
|
||||
|
||||
inst_creation_task =
|
||||
new ModrinthCreationTask(m_stagingPath, m_globalSettings, m_parent, pack_id, pack_version_id, original_instance_id);
|
||||
makeShared<ModrinthCreationTask>(m_stagingPath, m_globalSettings, m_parent, pack_id, pack_version_id, original_instance_id);
|
||||
} else {
|
||||
QString pack_id;
|
||||
if (!m_sourceUrl.isEmpty()) {
|
||||
@ -376,7 +383,7 @@ void InstanceImportTask::processModrinth()
|
||||
}
|
||||
|
||||
// FIXME: Find a way to get the ID in directly imported ZIPs
|
||||
inst_creation_task = new ModrinthCreationTask(m_stagingPath, m_globalSettings, m_parent, pack_id);
|
||||
inst_creation_task = makeShared<ModrinthCreationTask>(m_stagingPath, m_globalSettings, m_parent, pack_id);
|
||||
}
|
||||
|
||||
inst_creation_task->setName(*this);
|
||||
@ -384,20 +391,23 @@ void InstanceImportTask::processModrinth()
|
||||
inst_creation_task->setGroup(m_instGroup);
|
||||
inst_creation_task->setConfirmUpdate(shouldConfirmUpdate());
|
||||
|
||||
connect(inst_creation_task, &Task::succeeded, this, [this, inst_creation_task] {
|
||||
setOverride(inst_creation_task->shouldOverride(), inst_creation_task->originalInstanceID());
|
||||
auto weak = inst_creation_task.toWeakRef();
|
||||
connect(inst_creation_task.get(), &Task::succeeded, this, [this, weak] {
|
||||
if (auto sp = weak.lock()) {
|
||||
setOverride(sp->shouldOverride(), sp->originalInstanceID());
|
||||
}
|
||||
emitSucceeded();
|
||||
});
|
||||
connect(inst_creation_task, &Task::failed, this, &InstanceImportTask::emitFailed);
|
||||
connect(inst_creation_task, &Task::progress, this, &InstanceImportTask::setProgress);
|
||||
connect(inst_creation_task, &Task::stepProgress, this, &InstanceImportTask::propagateStepProgress);
|
||||
connect(inst_creation_task, &Task::status, this, &InstanceImportTask::setStatus);
|
||||
connect(inst_creation_task, &Task::details, this, &InstanceImportTask::setDetails);
|
||||
connect(inst_creation_task, &Task::finished, inst_creation_task, &InstanceCreationTask::deleteLater);
|
||||
connect(inst_creation_task.get(), &Task::failed, this, &InstanceImportTask::emitFailed);
|
||||
connect(inst_creation_task.get(), &Task::progress, this, &InstanceImportTask::setProgress);
|
||||
connect(inst_creation_task.get(), &Task::stepProgress, this, &InstanceImportTask::propagateStepProgress);
|
||||
connect(inst_creation_task.get(), &Task::status, this, &InstanceImportTask::setStatus);
|
||||
connect(inst_creation_task.get(), &Task::details, this, &InstanceImportTask::setDetails);
|
||||
|
||||
connect(this, &Task::aborted, inst_creation_task, &InstanceCreationTask::abort);
|
||||
connect(inst_creation_task, &Task::aborted, this, &Task::abort);
|
||||
connect(inst_creation_task, &Task::abortStatusChanged, this, &Task::setAbortable);
|
||||
connect(inst_creation_task.get(), &Task::aborted, this, &Task::abort);
|
||||
connect(inst_creation_task.get(), &Task::abortStatusChanged, this, &Task::setAbortable);
|
||||
|
||||
inst_creation_task->start();
|
||||
m_task.reset(inst_creation_task);
|
||||
setAbortable(true);
|
||||
m_task->start();
|
||||
}
|
||||
|
@ -40,16 +40,13 @@
|
||||
#include <QUrl>
|
||||
#include "InstanceTask.h"
|
||||
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
|
||||
class QuaZip;
|
||||
|
||||
class InstanceImportTask : public InstanceTask {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit InstanceImportTask(const QUrl& sourceUrl, QWidget* parent = nullptr, QMap<QString, QString>&& extra_info = {});
|
||||
|
||||
virtual ~InstanceImportTask() = default;
|
||||
bool abort() override;
|
||||
|
||||
protected:
|
||||
@ -70,7 +67,7 @@ class InstanceImportTask : public InstanceTask {
|
||||
private: /* data */
|
||||
QUrl m_sourceUrl;
|
||||
QString m_archivePath;
|
||||
Task::Ptr task;
|
||||
Task::Ptr m_task;
|
||||
enum class ModpackType {
|
||||
Unknown,
|
||||
MultiMC,
|
||||
|
@ -116,7 +116,7 @@ void JavaCommon::TestCheck::run()
|
||||
emit finished();
|
||||
return;
|
||||
}
|
||||
checker.reset(new JavaChecker(m_path, "", 0, 0, 0, 0, this));
|
||||
checker.reset(new JavaChecker(m_path, "", 0, 0, 0, 0));
|
||||
connect(checker.get(), &JavaChecker::checkFinished, this, &JavaCommon::TestCheck::checkFinished);
|
||||
checker->start();
|
||||
}
|
||||
@ -128,7 +128,7 @@ void JavaCommon::TestCheck::checkFinished(const JavaChecker::Result& result)
|
||||
emit finished();
|
||||
return;
|
||||
}
|
||||
checker.reset(new JavaChecker(m_path, m_args, m_maxMem, m_maxMem, result.javaVersion.requiresPermGen() ? m_permGen : 0, 0, this));
|
||||
checker.reset(new JavaChecker(m_path, m_args, m_maxMem, m_maxMem, result.javaVersion.requiresPermGen() ? m_permGen : 0, 0));
|
||||
connect(checker.get(), &JavaChecker::checkFinished, this, &JavaCommon::TestCheck::checkFinishedWithArgs);
|
||||
checker->start();
|
||||
}
|
||||
|
@ -61,7 +61,7 @@
|
||||
#include "launch/steps/TextPrint.h"
|
||||
#include "tasks/Task.h"
|
||||
|
||||
LaunchController::LaunchController(QObject* parent) : Task(parent) {}
|
||||
LaunchController::LaunchController() : Task() {}
|
||||
|
||||
void LaunchController::executeTask()
|
||||
{
|
||||
|
@ -47,7 +47,7 @@ class LaunchController : public Task {
|
||||
public:
|
||||
void executeTask() override;
|
||||
|
||||
LaunchController(QObject* parent = nullptr);
|
||||
LaunchController();
|
||||
virtual ~LaunchController() = default;
|
||||
|
||||
void setInstance(InstancePtr instance) { m_instance = instance; }
|
||||
|
@ -39,8 +39,16 @@ if [ "x$DEPS_LIST" = "x" ]; then
|
||||
# Just to be sure...
|
||||
chmod +x "${LAUNCHER_DIR}/bin/${LAUNCHER_NAME}"
|
||||
|
||||
ARGS=("${LAUNCHER_DIR}/${LAUNCHER_NAME}" "${LAUNCHER_DIR}/bin/${LAUNCHER_NAME}")
|
||||
|
||||
if [ -f portable.txt ]; then
|
||||
ARGS+=("-d" "${LAUNCHER_DIR}")
|
||||
fi
|
||||
|
||||
ARGS+=("$@")
|
||||
|
||||
# Run the launcher
|
||||
exec -a "${LAUNCHER_DIR}/${LAUNCHER_NAME}" "${LAUNCHER_DIR}/bin/${LAUNCHER_NAME}" -d "${LAUNCHER_DIR}" "$@"
|
||||
exec -a "${ARGS[@]}"
|
||||
|
||||
# Run the launcher in valgrind
|
||||
# valgrind --log-file="valgrind.log" --leak-check=full --track-origins=yes "${LAUNCHER_DIR}/bin/${LAUNCHER_NAME}" -d "${LAUNCHER_DIR}" "$@"
|
||||
|
@ -378,7 +378,7 @@ std::optional<QStringList> extractDir(QString fileCompressed, QString dir)
|
||||
if (fileInfo.size() == 22) {
|
||||
return QStringList();
|
||||
}
|
||||
qWarning() << "Could not open archive for unzipping:" << fileCompressed << "Error:" << zip.getZipError();
|
||||
qWarning() << "Could not open archive for unpacking:" << fileCompressed << "Error:" << zip.getZipError();
|
||||
;
|
||||
return std::nullopt;
|
||||
}
|
||||
@ -395,7 +395,7 @@ std::optional<QStringList> extractDir(QString fileCompressed, QString subdir, QS
|
||||
if (fileInfo.size() == 22) {
|
||||
return QStringList();
|
||||
}
|
||||
qWarning() << "Could not open archive for unzipping:" << fileCompressed << "Error:" << zip.getZipError();
|
||||
qWarning() << "Could not open archive for unpacking:" << fileCompressed << "Error:" << zip.getZipError();
|
||||
;
|
||||
return std::nullopt;
|
||||
}
|
||||
@ -412,7 +412,7 @@ bool extractFile(QString fileCompressed, QString file, QString target)
|
||||
if (fileInfo.size() == 22) {
|
||||
return true;
|
||||
}
|
||||
qWarning() << "Could not open archive for unzipping:" << fileCompressed << "Error:" << zip.getZipError();
|
||||
qWarning() << "Could not open archive for unpacking:" << fileCompressed << "Error:" << zip.getZipError();
|
||||
return false;
|
||||
}
|
||||
return extractRelFile(&zip, file, target);
|
||||
@ -577,7 +577,7 @@ auto ExtractZipTask::extractZip() -> ZipResult
|
||||
|
||||
auto relative_file_name = QDir::fromNativeSeparators(file_name.mid(m_subdirectory.size()));
|
||||
auto original_name = relative_file_name;
|
||||
setStatus("Unziping: " + relative_file_name);
|
||||
setStatus("Unpacking: " + relative_file_name);
|
||||
|
||||
// Fix subdirs/files ending with a / getting transformed into absolute paths
|
||||
if (relative_file_name.startsWith('/'))
|
||||
|
71
launcher/PSaveFile.h
Normal file
71
launcher/PSaveFile.h
Normal file
@ -0,0 +1,71 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
/*
|
||||
* Prism Launcher - Minecraft Launcher
|
||||
* Copyright (c) 2023-2024 Trial97 <alexandru.tripon97@gmail.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <QFileInfo>
|
||||
#include <QSaveFile>
|
||||
#include "Application.h"
|
||||
|
||||
#if defined(LAUNCHER_APPLICATION)
|
||||
|
||||
/* PSaveFile
|
||||
* A class that mimics QSaveFile for Windows.
|
||||
*
|
||||
* When reading resources, we need to avoid accessing temporary files
|
||||
* generated by QSaveFile. If we start reading such a file, we may
|
||||
* inadvertently keep it open while QSaveFile is trying to remove it,
|
||||
* or we might detect the file just before it is removed, leading to
|
||||
* race conditions and errors.
|
||||
*
|
||||
* Unfortunately, QSaveFile doesn't provide a way to retrieve the
|
||||
* temporary file name or to set a specific template for the temporary
|
||||
* file name it uses. By default, QSaveFile appends a `.XXXXXX` suffix
|
||||
* to the original file name, where the `XXXXXX` part is dynamically
|
||||
* generated to ensure uniqueness.
|
||||
*
|
||||
* This class acts like a lock by adding and removing the target file
|
||||
* name into/from a global string set, helping to manage access to
|
||||
* files during critical operations.
|
||||
*
|
||||
* Note: Please do not use the `setFileName` function directly, as it
|
||||
* is not virtual and cannot be overridden.
|
||||
*/
|
||||
class PSaveFile : public QSaveFile {
|
||||
public:
|
||||
PSaveFile(const QString& name) : QSaveFile(name) { addPath(name); }
|
||||
PSaveFile(const QString& name, QObject* parent) : QSaveFile(name, parent) { addPath(name); }
|
||||
virtual ~PSaveFile()
|
||||
{
|
||||
if (auto app = APPLICATION_DYN) {
|
||||
app->removeQSavePath(m_absoluteFilePath);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
void addPath(const QString& path)
|
||||
{
|
||||
m_absoluteFilePath = QFileInfo(path).absoluteFilePath() + "."; // add dot for tmp files only
|
||||
if (auto app = APPLICATION_DYN) {
|
||||
app->addQSavePath(m_absoluteFilePath);
|
||||
}
|
||||
}
|
||||
QString m_absoluteFilePath;
|
||||
};
|
||||
#else
|
||||
#define PSaveFile QSaveFile
|
||||
#endif
|
@ -81,9 +81,9 @@ QString getSupportedJavaArchitecture()
|
||||
if (arch == "arm64")
|
||||
return "mac-os-arm64";
|
||||
if (arch.contains("64"))
|
||||
return "mac-os-64";
|
||||
return "mac-os-x64";
|
||||
if (arch.contains("86"))
|
||||
return "mac-os-86";
|
||||
return "mac-os-x86";
|
||||
// Unknown, maybe something new, appending arch
|
||||
return "mac-os-" + arch;
|
||||
} else if (sys == "linux") {
|
||||
|
@ -307,6 +307,7 @@ void VersionProxyModel::setSourceModel(QAbstractItemModel* replacingRaw)
|
||||
if (!replacing) {
|
||||
roles.clear();
|
||||
filterModel->setSourceModel(replacing);
|
||||
endResetModel();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -44,8 +44,8 @@
|
||||
#include "FileSystem.h"
|
||||
#include "java/JavaUtils.h"
|
||||
|
||||
JavaChecker::JavaChecker(QString path, QString args, int minMem, int maxMem, int permGen, int id, QObject* parent)
|
||||
: Task(parent), m_path(path), m_args(args), m_minMem(minMem), m_maxMem(maxMem), m_permGen(permGen), m_id(id)
|
||||
JavaChecker::JavaChecker(QString path, QString args, int minMem, int maxMem, int permGen, int id)
|
||||
: Task(), m_path(path), m_args(args), m_minMem(minMem), m_maxMem(maxMem), m_permGen(permGen), m_id(id)
|
||||
{}
|
||||
|
||||
void JavaChecker::executeTask()
|
||||
@ -171,7 +171,7 @@ void JavaChecker::finished(int exitcode, QProcess::ExitStatus status)
|
||||
auto os_arch = results["os.arch"];
|
||||
auto java_version = results["java.version"];
|
||||
auto java_vendor = results["java.vendor"];
|
||||
bool is_64 = os_arch == "x86_64" || os_arch == "amd64" || os_arch == "aarch64" || os_arch == "arm64";
|
||||
bool is_64 = os_arch == "x86_64" || os_arch == "amd64" || os_arch == "aarch64" || os_arch == "arm64" || os_arch == "riscv64";
|
||||
|
||||
result.validity = Result::Validity::Valid;
|
||||
result.is_64bit = is_64;
|
||||
|
@ -1,7 +1,6 @@
|
||||
#pragma once
|
||||
#include <QProcess>
|
||||
#include <QTimer>
|
||||
#include <memory>
|
||||
|
||||
#include "JavaVersion.h"
|
||||
#include "QObjectPtr.h"
|
||||
@ -26,7 +25,7 @@ class JavaChecker : public Task {
|
||||
enum class Validity { Errored, ReturnedInvalidData, Valid } validity = Validity::Errored;
|
||||
};
|
||||
|
||||
explicit JavaChecker(QString path, QString args, int minMem = 0, int maxMem = 0, int permGen = 0, int id = 0, QObject* parent = 0);
|
||||
explicit JavaChecker(QString path, QString args, int minMem = 0, int maxMem = 0, int permGen = 0, int id = 0);
|
||||
|
||||
signals:
|
||||
void checkFinished(const Result& result);
|
||||
|
@ -163,7 +163,7 @@ void JavaListLoadTask::executeTask()
|
||||
JavaUtils ju;
|
||||
QList<QString> candidate_paths = m_only_managed_versions ? getPrismJavaBundle() : ju.FindJavaPaths();
|
||||
|
||||
ConcurrentTask::Ptr job(new ConcurrentTask(this, "Java detection", APPLICATION->settings()->get("NumberOfConcurrentTasks").toInt()));
|
||||
ConcurrentTask::Ptr job(new ConcurrentTask("Java detection", APPLICATION->settings()->get("NumberOfConcurrentTasks").toInt()));
|
||||
m_job.reset(job);
|
||||
connect(m_job.get(), &Task::finished, this, &JavaListLoadTask::javaCheckerFinished);
|
||||
connect(m_job.get(), &Task::progress, this, &Task::setProgress);
|
||||
@ -171,7 +171,7 @@ void JavaListLoadTask::executeTask()
|
||||
qDebug() << "Probing the following Java paths: ";
|
||||
int id = 0;
|
||||
for (QString candidate : candidate_paths) {
|
||||
auto checker = new JavaChecker(candidate, "", 0, 0, 0, id, this);
|
||||
auto checker = new JavaChecker(candidate, "", 0, 0, 0, id);
|
||||
connect(checker, &JavaChecker::checkFinished, [this](const JavaChecker::Result& result) { m_results << result; });
|
||||
job->addTask(Task::Ptr(checker));
|
||||
id++;
|
||||
|
@ -102,6 +102,8 @@ QProcessEnvironment CleanEnviroment()
|
||||
QString newValue = stripVariableEntries(key, value, rawenv.value("LAUNCHER_" + key));
|
||||
|
||||
qDebug() << "Env: stripped" << key << value << "to" << newValue;
|
||||
|
||||
value = newValue;
|
||||
}
|
||||
#if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD) || defined(Q_OS_OPENBSD)
|
||||
// Strip IBus
|
||||
|
@ -86,11 +86,10 @@ void ManifestDownloadTask::downloadJava(const QJsonDocument& doc)
|
||||
if (type == "directory") {
|
||||
FS::ensureFolderPathExists(file);
|
||||
} else if (type == "link") {
|
||||
// this is linux only !
|
||||
// this is *nix only !
|
||||
auto path = Json::ensureString(meta, "target");
|
||||
if (!path.isEmpty()) {
|
||||
auto target = FS::PathCombine(file, "../" + path);
|
||||
QFile(target).link(file);
|
||||
QFile::link(path, file);
|
||||
}
|
||||
} else if (type == "file") {
|
||||
// TODO download compressed version if it exists ?
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include "LaunchStep.h"
|
||||
#include "LaunchTask.h"
|
||||
|
||||
LaunchStep::LaunchStep(LaunchTask* parent) : Task(parent), m_parent(parent)
|
||||
LaunchStep::LaunchStep(LaunchTask* parent) : Task(), m_parent(parent)
|
||||
{
|
||||
connect(this, &LaunchStep::readyForLaunch, parent, &LaunchTask::onReadyForLaunch);
|
||||
connect(this, &LaunchStep::logLine, parent, &LaunchTask::onLogLine);
|
||||
|
@ -254,20 +254,60 @@ void LaunchTask::emitFailed(QString reason)
|
||||
Task::emitFailed(reason);
|
||||
}
|
||||
|
||||
void LaunchTask::substituteVariables(QStringList& args) const
|
||||
QString expandVariables(const QString& input, QProcessEnvironment dict)
|
||||
{
|
||||
auto env = m_instance->createEnvironment();
|
||||
QString result = input;
|
||||
|
||||
for (auto key : env.keys()) {
|
||||
args.replaceInStrings("$" + key, env.value(key));
|
||||
enum { base, maybeBrace, variable, brace } state = base;
|
||||
int startIdx = -1;
|
||||
for (int i = 0; i < result.length();) {
|
||||
QChar c = result.at(i++);
|
||||
switch (state) {
|
||||
case base:
|
||||
if (c == '$')
|
||||
state = maybeBrace;
|
||||
break;
|
||||
case maybeBrace:
|
||||
if (c == '{') {
|
||||
state = brace;
|
||||
startIdx = i;
|
||||
} else if (c.isLetterOrNumber() || c == '_') {
|
||||
state = variable;
|
||||
startIdx = i - 1;
|
||||
} else {
|
||||
state = base;
|
||||
}
|
||||
break;
|
||||
case brace:
|
||||
if (c == '}') {
|
||||
const auto res = dict.value(result.mid(startIdx, i - 1 - startIdx), "");
|
||||
if (!res.isEmpty()) {
|
||||
result.replace(startIdx - 2, i - startIdx + 2, res);
|
||||
i = startIdx - 2 + res.length();
|
||||
}
|
||||
state = base;
|
||||
}
|
||||
break;
|
||||
case variable:
|
||||
if (!c.isLetterOrNumber() && c != '_') {
|
||||
const auto res = dict.value(result.mid(startIdx, i - startIdx - 1), "");
|
||||
if (!res.isEmpty()) {
|
||||
result.replace(startIdx - 1, i - startIdx, res);
|
||||
i = startIdx - 1 + res.length();
|
||||
}
|
||||
state = base;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (state == variable) {
|
||||
if (const auto res = dict.value(result.mid(startIdx), ""); !res.isEmpty())
|
||||
result.replace(startIdx - 1, result.length() - startIdx + 1, res);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void LaunchTask::substituteVariables(QString& cmd) const
|
||||
QString LaunchTask::substituteVariables(QString& cmd, bool isLaunch) const
|
||||
{
|
||||
auto env = m_instance->createEnvironment();
|
||||
|
||||
for (auto key : env.keys()) {
|
||||
cmd.replace("$" + key, env.value(key));
|
||||
}
|
||||
return expandVariables(cmd, isLaunch ? m_instance->createLaunchEnvironment() : m_instance->createEnvironment());
|
||||
}
|
||||
|
@ -87,8 +87,7 @@ class LaunchTask : public Task {
|
||||
shared_qobject_ptr<LogModel> getLogModel();
|
||||
|
||||
public:
|
||||
void substituteVariables(QStringList& args) const;
|
||||
void substituteVariables(QString& cmd) const;
|
||||
QString substituteVariables(QString& cmd, bool isLaunch = false) const;
|
||||
QString censorPrivateInfo(QString in);
|
||||
|
||||
protected: /* methods */
|
||||
|
@ -32,7 +32,7 @@ class LogModel : public QAbstractListModel {
|
||||
|
||||
private /* types */:
|
||||
struct entry {
|
||||
MessageLevel::Enum level;
|
||||
MessageLevel::Enum level = MessageLevel::Enum::Unknown;
|
||||
QString line;
|
||||
};
|
||||
|
||||
|
@ -94,7 +94,7 @@ void CheckJava::executeTask()
|
||||
// if timestamps are not the same, or something is missing, check!
|
||||
if (m_javaSignature != storedSignature || storedVersion.size() == 0 || storedArchitecture.size() == 0 ||
|
||||
storedRealArchitecture.size() == 0 || storedVendor.size() == 0) {
|
||||
m_JavaChecker.reset(new JavaChecker(realJavaPath, "", 0, 0, 0, 0, this));
|
||||
m_JavaChecker.reset(new JavaChecker(realJavaPath, "", 0, 0, 0, 0));
|
||||
emit logLine(QString("Checking Java version..."), MessageLevel::Launcher);
|
||||
connect(m_JavaChecker.get(), &JavaChecker::checkFinished, this, &CheckJava::checkJavaFinished);
|
||||
m_JavaChecker->start();
|
||||
|
@ -47,19 +47,15 @@ PostLaunchCommand::PostLaunchCommand(LaunchTask* parent) : LaunchStep(parent)
|
||||
|
||||
void PostLaunchCommand::executeTask()
|
||||
{
|
||||
// FIXME: where to put this?
|
||||
auto cmd = m_parent->substituteVariables(m_command);
|
||||
emit logLine(tr("Running Post-Launch command: %1").arg(cmd), MessageLevel::Launcher);
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
|
||||
auto args = QProcess::splitCommand(m_command);
|
||||
m_parent->substituteVariables(args);
|
||||
auto args = QProcess::splitCommand(cmd);
|
||||
|
||||
emit logLine(tr("Running Post-Launch command: %1").arg(args.join(' ')), MessageLevel::Launcher);
|
||||
const QString program = args.takeFirst();
|
||||
m_process.start(program, args);
|
||||
#else
|
||||
m_parent->substituteVariables(m_command);
|
||||
|
||||
emit logLine(tr("Running Post-Launch command: %1").arg(m_command), MessageLevel::Launcher);
|
||||
m_process.start(m_command);
|
||||
m_process.start(cmd);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -47,19 +47,14 @@ PreLaunchCommand::PreLaunchCommand(LaunchTask* parent) : LaunchStep(parent)
|
||||
|
||||
void PreLaunchCommand::executeTask()
|
||||
{
|
||||
// FIXME: where to put this?
|
||||
auto cmd = m_parent->substituteVariables(m_command);
|
||||
emit logLine(tr("Running Pre-Launch command: %1").arg(cmd), MessageLevel::Launcher);
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
|
||||
auto args = QProcess::splitCommand(m_command);
|
||||
m_parent->substituteVariables(args);
|
||||
|
||||
emit logLine(tr("Running Pre-Launch command: %1").arg(args.join(' ')), MessageLevel::Launcher);
|
||||
auto args = QProcess::splitCommand(cmd);
|
||||
const QString program = args.takeFirst();
|
||||
m_process.start(program, args);
|
||||
#else
|
||||
m_parent->substituteVariables(m_command);
|
||||
|
||||
emit logLine(tr("Running Pre-Launch command: %1").arg(m_command), MessageLevel::Launcher);
|
||||
m_process.start(m_command);
|
||||
m_process.start(cmd);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -140,8 +140,8 @@ Task::Ptr Index::loadVersion(const QString& uid, const QString& version, Net::Mo
|
||||
}
|
||||
|
||||
auto versionList = get(uid);
|
||||
auto loadTask = makeShared<SequentialTask>(
|
||||
this, tr("Load meta for %1:%2", "This is for the task name that loads the meta index.").arg(uid, version));
|
||||
auto loadTask =
|
||||
makeShared<SequentialTask>(tr("Load meta for %1:%2", "This is for the task name that loads the meta index.").arg(uid, version));
|
||||
if (status() != BaseEntity::LoadStatus::Remote || force) {
|
||||
loadTask->addTask(this->loadTask(mode));
|
||||
}
|
||||
|
@ -34,8 +34,7 @@ VersionList::VersionList(const QString& uid, QObject* parent) : BaseVersionList(
|
||||
|
||||
Task::Ptr VersionList::getLoadTask()
|
||||
{
|
||||
auto loadTask =
|
||||
makeShared<SequentialTask>(this, tr("Load meta for %1", "This is for the task name that loads the meta index.").arg(m_uid));
|
||||
auto loadTask = makeShared<SequentialTask>(tr("Load meta for %1", "This is for the task name that loads the meta index.").arg(m_uid));
|
||||
loadTask->addTask(APPLICATION->metadataIndex()->loadTask(Net::Mode::Online));
|
||||
loadTask->addTask(this->loadTask(Net::Mode::Online));
|
||||
return loadTask;
|
||||
|
@ -222,11 +222,12 @@ bool Component::isMoveable()
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Component::isVersionChangeable()
|
||||
bool Component::isVersionChangeable(bool wait)
|
||||
{
|
||||
auto list = getVersionList();
|
||||
if (list) {
|
||||
list->waitToLoad();
|
||||
if (wait)
|
||||
list->waitToLoad();
|
||||
return list->count() != 0;
|
||||
}
|
||||
return false;
|
||||
|
@ -72,7 +72,7 @@ class Component : public QObject, public ProblemProvider {
|
||||
bool isRevertible();
|
||||
bool isRemovable();
|
||||
bool isCustom();
|
||||
bool isVersionChangeable();
|
||||
bool isVersionChangeable(bool wait = true);
|
||||
bool isKnownModloader();
|
||||
QStringList knownConflictingComponents();
|
||||
|
||||
|
@ -38,7 +38,7 @@
|
||||
* If the component list changes, start over.
|
||||
*/
|
||||
|
||||
ComponentUpdateTask::ComponentUpdateTask(Mode mode, Net::Mode netmode, PackProfile* list, QObject* parent) : Task(parent)
|
||||
ComponentUpdateTask::ComponentUpdateTask(Mode mode, Net::Mode netmode, PackProfile* list) : Task()
|
||||
{
|
||||
d.reset(new ComponentUpdateTaskData);
|
||||
d->m_profile = list;
|
||||
|
@ -14,7 +14,7 @@ class ComponentUpdateTask : public Task {
|
||||
enum class Mode { Launch, Resolution };
|
||||
|
||||
public:
|
||||
explicit ComponentUpdateTask(Mode mode, Net::Mode netmode, PackProfile* list, QObject* parent = 0);
|
||||
explicit ComponentUpdateTask(Mode mode, Net::Mode netmode, PackProfile* list);
|
||||
virtual ~ComponentUpdateTask();
|
||||
|
||||
protected:
|
||||
|
@ -606,6 +606,7 @@ QProcessEnvironment MinecraftInstance::createLaunchEnvironment()
|
||||
// dlsym variant is only needed for OpenGL and not included in the vulkan layer
|
||||
appendLib("libMangoHud_dlsym.so");
|
||||
appendLib("libMangoHud_opengl.so");
|
||||
appendLib("libMangoHud_shim.so");
|
||||
preloadList << mangoHudLibString;
|
||||
}
|
||||
|
||||
@ -1083,17 +1084,10 @@ shared_qobject_ptr<LaunchTask> MinecraftInstance::createLaunchTask(AuthSessionPt
|
||||
process->appendStep(step);
|
||||
}
|
||||
|
||||
// run pre-launch command if that's needed
|
||||
if (getPreLaunchCommand().size()) {
|
||||
auto step = makeShared<PreLaunchCommand>(pptr);
|
||||
step->setWorkingDirectory(gameRoot());
|
||||
process->appendStep(step);
|
||||
}
|
||||
|
||||
// load meta
|
||||
{
|
||||
auto mode = session->status != AuthSession::PlayableOffline ? Net::Mode::Online : Net::Mode::Offline;
|
||||
process->appendStep(makeShared<TaskStepWrapper>(pptr, makeShared<MinecraftLoadAndCheck>(this, mode, pptr)));
|
||||
process->appendStep(makeShared<TaskStepWrapper>(pptr, makeShared<MinecraftLoadAndCheck>(this, mode)));
|
||||
}
|
||||
|
||||
// check java
|
||||
@ -1102,6 +1096,13 @@ shared_qobject_ptr<LaunchTask> MinecraftInstance::createLaunchTask(AuthSessionPt
|
||||
process->appendStep(makeShared<CheckJava>(pptr));
|
||||
}
|
||||
|
||||
// run pre-launch command if that's needed
|
||||
if (getPreLaunchCommand().size()) {
|
||||
auto step = makeShared<PreLaunchCommand>(pptr);
|
||||
step->setWorkingDirectory(gameRoot());
|
||||
process->appendStep(step);
|
||||
}
|
||||
|
||||
// if we aren't in offline mode,.
|
||||
if (session->status != AuthSession::PlayableOffline) {
|
||||
if (!session->demo) {
|
||||
|
@ -2,15 +2,16 @@
|
||||
#include "MinecraftInstance.h"
|
||||
#include "PackProfile.h"
|
||||
|
||||
MinecraftLoadAndCheck::MinecraftLoadAndCheck(MinecraftInstance* inst, Net::Mode netmode, QObject* parent)
|
||||
: Task(parent), m_inst(inst), m_netmode(netmode)
|
||||
{}
|
||||
MinecraftLoadAndCheck::MinecraftLoadAndCheck(MinecraftInstance* inst, Net::Mode netmode) : m_inst(inst), m_netmode(netmode) {}
|
||||
|
||||
void MinecraftLoadAndCheck::executeTask()
|
||||
{
|
||||
// add offline metadata load task
|
||||
auto components = m_inst->getPackProfile();
|
||||
components->reload(m_netmode);
|
||||
if (auto result = components->reload(m_netmode); !result) {
|
||||
emitFailed(result.error);
|
||||
return;
|
||||
}
|
||||
m_task = components->getCurrentTask();
|
||||
|
||||
if (!m_task) {
|
||||
|
@ -23,7 +23,7 @@ class MinecraftInstance;
|
||||
class MinecraftLoadAndCheck : public Task {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit MinecraftLoadAndCheck(MinecraftInstance* inst, Net::Mode netmode, QObject* parent = nullptr);
|
||||
explicit MinecraftLoadAndCheck(MinecraftInstance* inst, Net::Mode netmode);
|
||||
virtual ~MinecraftLoadAndCheck() = default;
|
||||
void executeTask() override;
|
||||
|
||||
|
@ -173,29 +173,32 @@ static bool savePackProfile(const QString& filename, const ComponentContainer& c
|
||||
}
|
||||
|
||||
// Read the given file into component containers
|
||||
static bool loadPackProfile(PackProfile* parent,
|
||||
const QString& filename,
|
||||
const QString& componentJsonPattern,
|
||||
ComponentContainer& container)
|
||||
static PackProfile::Result loadPackProfile(PackProfile* parent,
|
||||
const QString& filename,
|
||||
const QString& componentJsonPattern,
|
||||
ComponentContainer& container)
|
||||
{
|
||||
QFile componentsFile(filename);
|
||||
if (!componentsFile.exists()) {
|
||||
qCWarning(instanceProfileC) << "Components file" << filename << "doesn't exist. This should never happen.";
|
||||
return false;
|
||||
auto message = QObject::tr("Components file %1 doesn't exist. This should never happen.").arg(filename);
|
||||
qCWarning(instanceProfileC) << message;
|
||||
return PackProfile::Result::Error(message);
|
||||
}
|
||||
if (!componentsFile.open(QFile::ReadOnly)) {
|
||||
qCCritical(instanceProfileC) << "Couldn't open" << componentsFile.fileName() << " for reading:" << componentsFile.errorString();
|
||||
auto message = QObject::tr("Couldn't open %1 for reading: %2").arg(componentsFile.fileName(), componentsFile.errorString());
|
||||
qCCritical(instanceProfileC) << message;
|
||||
qCWarning(instanceProfileC) << "Ignoring overridden order";
|
||||
return false;
|
||||
return PackProfile::Result::Error(message);
|
||||
}
|
||||
|
||||
// and it's valid JSON
|
||||
QJsonParseError error;
|
||||
QJsonDocument doc = QJsonDocument::fromJson(componentsFile.readAll(), &error);
|
||||
if (error.error != QJsonParseError::NoError) {
|
||||
qCCritical(instanceProfileC) << "Couldn't parse" << componentsFile.fileName() << ":" << error.errorString();
|
||||
auto message = QObject::tr("Couldn't parse %1 as json: %2").arg(componentsFile.fileName(), error.errorString());
|
||||
qCCritical(instanceProfileC) << message;
|
||||
qCWarning(instanceProfileC) << "Ignoring overridden order";
|
||||
return false;
|
||||
return PackProfile::Result::Error(message);
|
||||
}
|
||||
|
||||
// and then read it and process it if all above is true.
|
||||
@ -212,11 +215,13 @@ static bool loadPackProfile(PackProfile* parent,
|
||||
container.append(componentFromJsonV1(parent, componentJsonPattern, comp_obj));
|
||||
}
|
||||
} catch ([[maybe_unused]] const JSONValidationError& err) {
|
||||
qCCritical(instanceProfileC) << "Couldn't parse" << componentsFile.fileName() << ": bad file format";
|
||||
auto message = QObject::tr("Couldn't parse %1 : bad file format").arg(componentsFile.fileName());
|
||||
qCCritical(instanceProfileC) << message;
|
||||
qCWarning(instanceProfileC) << "error:" << err.what();
|
||||
container.clear();
|
||||
return false;
|
||||
return PackProfile::Result::Error(message);
|
||||
}
|
||||
return true;
|
||||
return PackProfile::Result::Success();
|
||||
}
|
||||
|
||||
// END: component file format
|
||||
@ -283,44 +288,43 @@ void PackProfile::save_internal()
|
||||
d->dirty = false;
|
||||
}
|
||||
|
||||
bool PackProfile::load()
|
||||
PackProfile::Result PackProfile::load()
|
||||
{
|
||||
auto filename = componentsFilePath();
|
||||
|
||||
// load the new component list and swap it with the current one...
|
||||
ComponentContainer newComponents;
|
||||
if (!loadPackProfile(this, filename, patchesPattern(), newComponents)) {
|
||||
if (auto result = loadPackProfile(this, filename, patchesPattern(), newComponents); !result) {
|
||||
qCritical() << d->m_instance->name() << "|" << "Failed to load the component config";
|
||||
return false;
|
||||
} else {
|
||||
// FIXME: actually use fine-grained updates, not this...
|
||||
beginResetModel();
|
||||
// disconnect all the old components
|
||||
for (auto component : d->components) {
|
||||
disconnect(component.get(), &Component::dataChanged, this, &PackProfile::componentDataChanged);
|
||||
}
|
||||
d->components.clear();
|
||||
d->componentIndex.clear();
|
||||
for (auto component : newComponents) {
|
||||
if (d->componentIndex.contains(component->m_uid)) {
|
||||
qWarning() << d->m_instance->name() << "|" << "Ignoring duplicate component entry" << component->m_uid;
|
||||
continue;
|
||||
}
|
||||
connect(component.get(), &Component::dataChanged, this, &PackProfile::componentDataChanged);
|
||||
d->components.append(component);
|
||||
d->componentIndex[component->m_uid] = component;
|
||||
}
|
||||
endResetModel();
|
||||
d->loaded = true;
|
||||
return true;
|
||||
return result;
|
||||
}
|
||||
// FIXME: actually use fine-grained updates, not this...
|
||||
beginResetModel();
|
||||
// disconnect all the old components
|
||||
for (auto component : d->components) {
|
||||
disconnect(component.get(), &Component::dataChanged, this, &PackProfile::componentDataChanged);
|
||||
}
|
||||
d->components.clear();
|
||||
d->componentIndex.clear();
|
||||
for (auto component : newComponents) {
|
||||
if (d->componentIndex.contains(component->m_uid)) {
|
||||
qWarning() << d->m_instance->name() << "|" << "Ignoring duplicate component entry" << component->m_uid;
|
||||
continue;
|
||||
}
|
||||
connect(component.get(), &Component::dataChanged, this, &PackProfile::componentDataChanged);
|
||||
d->components.append(component);
|
||||
d->componentIndex[component->m_uid] = component;
|
||||
}
|
||||
endResetModel();
|
||||
d->loaded = true;
|
||||
return Result::Success();
|
||||
}
|
||||
|
||||
void PackProfile::reload(Net::Mode netmode)
|
||||
PackProfile::Result PackProfile::reload(Net::Mode netmode)
|
||||
{
|
||||
// Do not reload when the update/resolve task is running. It is in control.
|
||||
if (d->m_updateTask) {
|
||||
return;
|
||||
return Result::Success();
|
||||
}
|
||||
|
||||
// flush any scheduled saves to not lose state
|
||||
@ -329,9 +333,11 @@ void PackProfile::reload(Net::Mode netmode)
|
||||
// FIXME: differentiate when a reapply is required by propagating state from components
|
||||
invalidateLaunchProfile();
|
||||
|
||||
if (load()) {
|
||||
resolve(netmode);
|
||||
if (auto result = load(); !result) {
|
||||
return result;
|
||||
}
|
||||
resolve(netmode);
|
||||
return Result::Success();
|
||||
}
|
||||
|
||||
Task::Ptr PackProfile::getCurrentTask()
|
||||
|
@ -62,6 +62,19 @@ class PackProfile : public QAbstractListModel {
|
||||
public:
|
||||
enum Columns { NameColumn = 0, VersionColumn, NUM_COLUMNS };
|
||||
|
||||
struct Result {
|
||||
bool success;
|
||||
QString error;
|
||||
|
||||
// Implicit conversion to bool
|
||||
operator bool() const { return success; }
|
||||
|
||||
// Factory methods for convenience
|
||||
static Result Success() { return { true, "" }; }
|
||||
|
||||
static Result Error(const QString& errorMessage) { return { false, errorMessage }; }
|
||||
};
|
||||
|
||||
explicit PackProfile(MinecraftInstance* instance);
|
||||
virtual ~PackProfile();
|
||||
|
||||
@ -102,7 +115,7 @@ class PackProfile : public QAbstractListModel {
|
||||
bool revertToBase(int index);
|
||||
|
||||
/// reload the list, reload all components, resolve dependencies
|
||||
void reload(Net::Mode netmode);
|
||||
Result reload(Net::Mode netmode);
|
||||
|
||||
// reload all components, resolve dependencies
|
||||
void resolve(Net::Mode netmode);
|
||||
@ -169,7 +182,7 @@ class PackProfile : public QAbstractListModel {
|
||||
void disableInteraction(bool disable);
|
||||
|
||||
private:
|
||||
bool load();
|
||||
Result load();
|
||||
bool installJarMods_internal(QStringList filepaths);
|
||||
bool installCustomJar_internal(QString filepath);
|
||||
bool installAgents_internal(QStringList filepaths);
|
||||
|
@ -38,7 +38,6 @@
|
||||
#include <QDebug>
|
||||
#include <QDir>
|
||||
#include <QDirIterator>
|
||||
#include <QSaveFile>
|
||||
#include <QString>
|
||||
|
||||
#include <FileSystem.h>
|
||||
@ -57,6 +56,7 @@
|
||||
#include <optional>
|
||||
|
||||
#include "FileSystem.h"
|
||||
#include "PSaveFile.h"
|
||||
|
||||
using std::nullopt;
|
||||
using std::optional;
|
||||
@ -183,7 +183,7 @@ bool putLevelDatDataToFS(const QFileInfo& file, QByteArray& data)
|
||||
if (fullFilePath.isNull()) {
|
||||
return false;
|
||||
}
|
||||
QSaveFile f(fullFilePath);
|
||||
PSaveFile f(fullFilePath);
|
||||
if (!f.open(QIODevice::WriteOnly)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
#include <Application.h>
|
||||
|
||||
AuthFlow::AuthFlow(AccountData* data, Action action, QObject* parent) : Task(parent), m_data(data)
|
||||
AuthFlow::AuthFlow(AccountData* data, Action action) : Task(), m_data(data)
|
||||
{
|
||||
if (data->type == AccountType::MSA) {
|
||||
if (action == Action::DeviceCode) {
|
||||
|
@ -17,7 +17,7 @@ class AuthFlow : public Task {
|
||||
public:
|
||||
enum class Action { Refresh, Login, DeviceCode };
|
||||
|
||||
explicit AuthFlow(AccountData* data, Action action = Action::Refresh, QObject* parent = 0);
|
||||
explicit AuthFlow(AccountData* data, Action action = Action::Refresh);
|
||||
virtual ~AuthFlow() = default;
|
||||
|
||||
void executeTask() override;
|
||||
|
@ -121,7 +121,7 @@ shared_qobject_ptr<AuthFlow> MinecraftAccount::login(bool useDeviceCode)
|
||||
{
|
||||
Q_ASSERT(m_currentTask.get() == nullptr);
|
||||
|
||||
m_currentTask.reset(new AuthFlow(&data, useDeviceCode ? AuthFlow::Action::DeviceCode : AuthFlow::Action::Login, this));
|
||||
m_currentTask.reset(new AuthFlow(&data, useDeviceCode ? AuthFlow::Action::DeviceCode : AuthFlow::Action::Login));
|
||||
connect(m_currentTask.get(), &Task::succeeded, this, &MinecraftAccount::authSucceeded);
|
||||
connect(m_currentTask.get(), &Task::failed, this, &MinecraftAccount::authFailed);
|
||||
connect(m_currentTask.get(), &Task::aborted, this, [this] { authFailed(tr("Aborted")); });
|
||||
@ -135,7 +135,7 @@ shared_qobject_ptr<AuthFlow> MinecraftAccount::refresh()
|
||||
return m_currentTask;
|
||||
}
|
||||
|
||||
m_currentTask.reset(new AuthFlow(&data, AuthFlow::Action::Refresh, this));
|
||||
m_currentTask.reset(new AuthFlow(&data, AuthFlow::Action::Refresh));
|
||||
|
||||
connect(m_currentTask.get(), &Task::succeeded, this, &MinecraftAccount::authSucceeded);
|
||||
connect(m_currentTask.get(), &Task::failed, this, &MinecraftAccount::authFailed);
|
||||
|
@ -74,12 +74,12 @@ void MSADeviceCodeStep::perform()
|
||||
m_task->setAskRetry(false);
|
||||
m_task->addNetAction(m_request);
|
||||
|
||||
connect(m_task.get(), &Task::finished, this, &MSADeviceCodeStep::deviceAutorizationFinished);
|
||||
connect(m_task.get(), &Task::finished, this, &MSADeviceCodeStep::deviceAuthorizationFinished);
|
||||
|
||||
m_task->start();
|
||||
}
|
||||
|
||||
struct DeviceAutorizationResponse {
|
||||
struct DeviceAuthorizationResponse {
|
||||
QString device_code;
|
||||
QString user_code;
|
||||
QString verification_uri;
|
||||
@ -90,17 +90,17 @@ struct DeviceAutorizationResponse {
|
||||
QString error_description;
|
||||
};
|
||||
|
||||
DeviceAutorizationResponse parseDeviceAutorizationResponse(const QByteArray& data)
|
||||
DeviceAuthorizationResponse parseDeviceAuthorizationResponse(const QByteArray& data)
|
||||
{
|
||||
QJsonParseError err;
|
||||
QJsonDocument doc = QJsonDocument::fromJson(data, &err);
|
||||
if (err.error != QJsonParseError::NoError) {
|
||||
qWarning() << "Failed to parse device autorization response due to err:" << err.errorString();
|
||||
qWarning() << "Failed to parse device authorization response due to err:" << err.errorString();
|
||||
return {};
|
||||
}
|
||||
|
||||
if (!doc.isObject()) {
|
||||
qWarning() << "Device autorization response is not an object";
|
||||
qWarning() << "Device authorization response is not an object";
|
||||
return {};
|
||||
}
|
||||
auto obj = doc.object();
|
||||
@ -111,9 +111,9 @@ DeviceAutorizationResponse parseDeviceAutorizationResponse(const QByteArray& dat
|
||||
};
|
||||
}
|
||||
|
||||
void MSADeviceCodeStep::deviceAutorizationFinished()
|
||||
void MSADeviceCodeStep::deviceAuthorizationFinished()
|
||||
{
|
||||
auto rsp = parseDeviceAutorizationResponse(*m_response);
|
||||
auto rsp = parseDeviceAuthorizationResponse(*m_response);
|
||||
if (!rsp.error.isEmpty() || !rsp.error_description.isEmpty()) {
|
||||
qWarning() << "Device authorization failed:" << rsp.error;
|
||||
emit finished(AccountTaskState::STATE_FAILED_HARD,
|
||||
@ -208,12 +208,12 @@ AuthenticationResponse parseAuthenticationResponse(const QByteArray& data)
|
||||
QJsonParseError err;
|
||||
QJsonDocument doc = QJsonDocument::fromJson(data, &err);
|
||||
if (err.error != QJsonParseError::NoError) {
|
||||
qWarning() << "Failed to parse device autorization response due to err:" << err.errorString();
|
||||
qWarning() << "Failed to parse device authorization response due to err:" << err.errorString();
|
||||
return {};
|
||||
}
|
||||
|
||||
if (!doc.isObject()) {
|
||||
qWarning() << "Device autorization response is not an object";
|
||||
qWarning() << "Device authorization response is not an object";
|
||||
return {};
|
||||
}
|
||||
auto obj = doc.object();
|
||||
@ -274,4 +274,4 @@ void MSADeviceCodeStep::authenticationFinished()
|
||||
m_data->msaToken.refresh_token = rsp.refresh_token;
|
||||
m_data->msaToken.token = rsp.access_token;
|
||||
emit finished(AccountTaskState::STATE_WORKING, tr("Got"));
|
||||
}
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ class MSADeviceCodeStep : public AuthStep {
|
||||
void authorizeWithBrowser(QString url, QString code, int expiresIn);
|
||||
|
||||
private slots:
|
||||
void deviceAutorizationFinished();
|
||||
void deviceAuthorizationFinished();
|
||||
void startPoolTimer();
|
||||
void authenticateUser();
|
||||
void authenticationFinished();
|
||||
|
@ -85,8 +85,7 @@ class CustomOAuthOobReplyHandler : public QOAuthOobReplyHandler {
|
||||
MSAStep::MSAStep(AccountData* data, bool silent) : AuthStep(data), m_silent(silent)
|
||||
{
|
||||
m_clientId = APPLICATION->getMSAClientID();
|
||||
if (QCoreApplication::applicationFilePath().startsWith("/tmp/.mount_") ||
|
||||
QFile::exists(FS::PathCombine(APPLICATION->root(), "portable.txt")) || !isSchemeHandlerRegistered())
|
||||
if (QCoreApplication::applicationFilePath().startsWith("/tmp/.mount_") || APPLICATION->isPortable() || !isSchemeHandlerRegistered())
|
||||
|
||||
{
|
||||
auto replyHandler = new QOAuthHttpServerReplyHandler(this);
|
||||
@ -100,29 +99,29 @@ MSAStep::MSAStep(AccountData* data, bool silent) : AuthStep(data), m_silent(sile
|
||||
</script>
|
||||
)XXX")
|
||||
.arg(BuildConfig.LOGIN_CALLBACK_URL));
|
||||
oauth2.setReplyHandler(replyHandler);
|
||||
m_oauth2.setReplyHandler(replyHandler);
|
||||
} else {
|
||||
oauth2.setReplyHandler(new CustomOAuthOobReplyHandler(this));
|
||||
m_oauth2.setReplyHandler(new CustomOAuthOobReplyHandler(this));
|
||||
}
|
||||
oauth2.setAuthorizationUrl(QUrl("https://login.microsoftonline.com/consumers/oauth2/v2.0/authorize"));
|
||||
oauth2.setAccessTokenUrl(QUrl("https://login.microsoftonline.com/consumers/oauth2/v2.0/token"));
|
||||
oauth2.setScope("XboxLive.SignIn XboxLive.offline_access");
|
||||
oauth2.setClientIdentifier(m_clientId);
|
||||
oauth2.setNetworkAccessManager(APPLICATION->network().get());
|
||||
m_oauth2.setAuthorizationUrl(QUrl("https://login.microsoftonline.com/consumers/oauth2/v2.0/authorize"));
|
||||
m_oauth2.setAccessTokenUrl(QUrl("https://login.microsoftonline.com/consumers/oauth2/v2.0/token"));
|
||||
m_oauth2.setScope("XboxLive.SignIn XboxLive.offline_access");
|
||||
m_oauth2.setClientIdentifier(m_clientId);
|
||||
m_oauth2.setNetworkAccessManager(APPLICATION->network().get());
|
||||
|
||||
connect(&oauth2, &QOAuth2AuthorizationCodeFlow::granted, this, [this] {
|
||||
m_data->msaClientID = oauth2.clientIdentifier();
|
||||
connect(&m_oauth2, &QOAuth2AuthorizationCodeFlow::granted, this, [this] {
|
||||
m_data->msaClientID = m_oauth2.clientIdentifier();
|
||||
m_data->msaToken.issueInstant = QDateTime::currentDateTimeUtc();
|
||||
m_data->msaToken.notAfter = oauth2.expirationAt();
|
||||
m_data->msaToken.extra = oauth2.extraTokens();
|
||||
m_data->msaToken.refresh_token = oauth2.refreshToken();
|
||||
m_data->msaToken.token = oauth2.token();
|
||||
m_data->msaToken.notAfter = m_oauth2.expirationAt();
|
||||
m_data->msaToken.extra = m_oauth2.extraTokens();
|
||||
m_data->msaToken.refresh_token = m_oauth2.refreshToken();
|
||||
m_data->msaToken.token = m_oauth2.token();
|
||||
emit finished(AccountTaskState::STATE_WORKING, tr("Got "));
|
||||
});
|
||||
connect(&oauth2, &QOAuth2AuthorizationCodeFlow::authorizeWithBrowser, this, &MSAStep::authorizeWithBrowser);
|
||||
connect(&oauth2, &QOAuth2AuthorizationCodeFlow::requestFailed, this, [this, silent](const QAbstractOAuth2::Error err) {
|
||||
connect(&m_oauth2, &QOAuth2AuthorizationCodeFlow::authorizeWithBrowser, this, &MSAStep::authorizeWithBrowser);
|
||||
connect(&m_oauth2, &QOAuth2AuthorizationCodeFlow::requestFailed, this, [this, silent](const QAbstractOAuth2::Error err) {
|
||||
auto state = AccountTaskState::STATE_FAILED_HARD;
|
||||
if (oauth2.status() == QAbstractOAuth::Status::Granted || silent) {
|
||||
if (m_oauth2.status() == QAbstractOAuth::Status::Granted || silent) {
|
||||
if (err == QAbstractOAuth2::Error::NetworkError) {
|
||||
state = AccountTaskState::STATE_OFFLINE;
|
||||
} else {
|
||||
@ -136,16 +135,16 @@ MSAStep::MSAStep(AccountData* data, bool silent) : AuthStep(data), m_silent(sile
|
||||
qWarning() << message;
|
||||
emit finished(state, message);
|
||||
});
|
||||
connect(&oauth2, &QOAuth2AuthorizationCodeFlow::error, this,
|
||||
connect(&m_oauth2, &QOAuth2AuthorizationCodeFlow::error, this,
|
||||
[this](const QString& error, const QString& errorDescription, const QUrl& uri) {
|
||||
qWarning() << "Failed to login because" << error << errorDescription;
|
||||
emit finished(AccountTaskState::STATE_FAILED_HARD, errorDescription);
|
||||
});
|
||||
|
||||
connect(&oauth2, &QOAuth2AuthorizationCodeFlow::extraTokensChanged, this,
|
||||
connect(&m_oauth2, &QOAuth2AuthorizationCodeFlow::extraTokensChanged, this,
|
||||
[this](const QVariantMap& tokens) { m_data->msaToken.extra = tokens; });
|
||||
|
||||
connect(&oauth2, &QOAuth2AuthorizationCodeFlow::clientIdentifierChanged, this,
|
||||
connect(&m_oauth2, &QOAuth2AuthorizationCodeFlow::clientIdentifierChanged, this,
|
||||
[this](const QString& clientIdentifier) { m_data->msaClientID = clientIdentifier; });
|
||||
}
|
||||
|
||||
@ -166,20 +165,20 @@ void MSAStep::perform()
|
||||
emit finished(AccountTaskState::STATE_DISABLED, tr("Microsoft user authentication failed - refresh token is empty."));
|
||||
return;
|
||||
}
|
||||
oauth2.setRefreshToken(m_data->msaToken.refresh_token);
|
||||
oauth2.refreshAccessToken();
|
||||
m_oauth2.setRefreshToken(m_data->msaToken.refresh_token);
|
||||
m_oauth2.refreshAccessToken();
|
||||
} else {
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) // QMultiMap param changed in 6.0
|
||||
oauth2.setModifyParametersFunction(
|
||||
m_oauth2.setModifyParametersFunction(
|
||||
[](QAbstractOAuth::Stage stage, QMultiMap<QString, QVariant>* map) { map->insert("prompt", "select_account"); });
|
||||
#else
|
||||
oauth2.setModifyParametersFunction(
|
||||
m_oauth2.setModifyParametersFunction(
|
||||
[](QAbstractOAuth::Stage stage, QMap<QString, QVariant>* map) { map->insert("prompt", "select_account"); });
|
||||
#endif
|
||||
|
||||
*m_data = AccountData();
|
||||
m_data->msaClientID = m_clientId;
|
||||
oauth2.grant();
|
||||
m_oauth2.grant();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -55,5 +55,5 @@ class MSAStep : public AuthStep {
|
||||
private:
|
||||
bool m_silent;
|
||||
QString m_clientId;
|
||||
QOAuth2AuthorizationCodeFlow oauth2;
|
||||
QOAuth2AuthorizationCodeFlow m_oauth2;
|
||||
};
|
||||
|
@ -57,9 +57,7 @@
|
||||
#include "tasks/SequentialTask.h"
|
||||
|
||||
AutoInstallJava::AutoInstallJava(LaunchTask* parent)
|
||||
: LaunchStep(parent)
|
||||
, m_instance(m_parent->instance())
|
||||
, m_supported_arch(SysInfo::getSupportedJavaArchitecture()) {};
|
||||
: LaunchStep(parent), m_instance(m_parent->instance()), m_supported_arch(SysInfo::getSupportedJavaArchitecture()) {};
|
||||
|
||||
void AutoInstallJava::executeTask()
|
||||
{
|
||||
@ -78,7 +76,7 @@ void AutoInstallJava::executeTask()
|
||||
auto java = std::dynamic_pointer_cast<JavaInstall>(javas->at(i));
|
||||
if (java && packProfile->getProfile()->getCompatibleJavaMajors().contains(java->id.major())) {
|
||||
if (!java->is_64bit) {
|
||||
emit logLine(tr("The automatic Java mechanism detected a 32-bit installation of Java."), MessageLevel::Info);
|
||||
emit logLine(tr("The automatic Java mechanism detected a 32-bit installation of Java."), MessageLevel::Launcher);
|
||||
}
|
||||
setJavaPath(java->path);
|
||||
return;
|
||||
@ -136,7 +134,7 @@ void AutoInstallJava::setJavaPath(QString path)
|
||||
settings->set("OverrideJavaLocation", true);
|
||||
settings->set("JavaPath", path);
|
||||
settings->set("AutomaticJava", true);
|
||||
emit logLine(tr("Compatible Java found at: %1.").arg(path), MessageLevel::Info);
|
||||
emit logLine(tr("Compatible Java found at: %1.").arg(path), MessageLevel::Launcher);
|
||||
emitSucceeded();
|
||||
}
|
||||
|
||||
@ -179,7 +177,7 @@ void AutoInstallJava::downloadJava(Meta::Version::Ptr version, QString javaName)
|
||||
return;
|
||||
}
|
||||
#if defined(Q_OS_MACOS)
|
||||
auto seq = makeShared<SequentialTask>(this, tr("Install Java"));
|
||||
auto seq = makeShared<SequentialTask>(tr("Install Java"));
|
||||
seq->addTask(m_current_task);
|
||||
seq->addTask(makeShared<Java::SymlinkTask>(final_path));
|
||||
m_current_task = seq;
|
||||
|
@ -131,6 +131,7 @@ void LauncherPartLaunch::executeTask()
|
||||
|
||||
QString wrapperCommandStr = instance->getWrapperCommand().trimmed();
|
||||
if (!wrapperCommandStr.isEmpty()) {
|
||||
wrapperCommandStr = m_parent->substituteVariables(wrapperCommandStr);
|
||||
auto wrapperArgs = Commandline::splitArgs(wrapperCommandStr);
|
||||
auto wrapperCommand = wrapperArgs.takeFirst();
|
||||
auto realWrapperCommand = QStandardPaths::findExecutable(wrapperCommand);
|
||||
@ -170,6 +171,7 @@ void LauncherPartLaunch::on_state(LoggedProcess::State state)
|
||||
case LoggedProcess::Aborted:
|
||||
case LoggedProcess::Crashed: {
|
||||
m_parent->setPid(-1);
|
||||
m_parent->instance()->setMinecraftRunning(false);
|
||||
emitFailed(tr("Game crashed."));
|
||||
return;
|
||||
}
|
||||
|
@ -261,7 +261,7 @@ bool ResourceFolderModel::update()
|
||||
return true;
|
||||
}
|
||||
|
||||
void ResourceFolderModel::resolveResource(Resource* res)
|
||||
void ResourceFolderModel::resolveResource(Resource::Ptr res)
|
||||
{
|
||||
if (!res->shouldResolve()) {
|
||||
return;
|
||||
@ -277,11 +277,14 @@ void ResourceFolderModel::resolveResource(Resource* res)
|
||||
m_active_parse_tasks.insert(ticket, task);
|
||||
|
||||
connect(
|
||||
task.get(), &Task::succeeded, this, [=] { onParseSucceeded(ticket, res->internal_id()); }, Qt::ConnectionType::QueuedConnection);
|
||||
connect(task.get(), &Task::failed, this, [=] { onParseFailed(ticket, res->internal_id()); }, Qt::ConnectionType::QueuedConnection);
|
||||
task.get(), &Task::succeeded, this, [this, ticket, res] { onParseSucceeded(ticket, res->internal_id()); },
|
||||
Qt::ConnectionType::QueuedConnection);
|
||||
connect(
|
||||
task.get(), &Task::failed, this, [this, ticket, res] { onParseFailed(ticket, res->internal_id()); },
|
||||
Qt::ConnectionType::QueuedConnection);
|
||||
connect(
|
||||
task.get(), &Task::finished, this,
|
||||
[=] {
|
||||
[this, ticket] {
|
||||
m_active_parse_tasks.remove(ticket);
|
||||
emit parseFinished();
|
||||
},
|
||||
@ -317,7 +320,7 @@ void ResourceFolderModel::onUpdateSucceeded()
|
||||
void ResourceFolderModel::onParseSucceeded(int ticket, QString resource_id)
|
||||
{
|
||||
auto iter = m_active_parse_tasks.constFind(ticket);
|
||||
if (iter == m_active_parse_tasks.constEnd())
|
||||
if (iter == m_active_parse_tasks.constEnd() || !m_resources_index.contains(resource_id))
|
||||
return;
|
||||
|
||||
int row = m_resources_index[resource_id];
|
||||
@ -629,7 +632,7 @@ QString ResourceFolderModel::instDirPath() const
|
||||
void ResourceFolderModel::onParseFailed(int ticket, QString resource_id)
|
||||
{
|
||||
auto iter = m_active_parse_tasks.constFind(ticket);
|
||||
if (iter == m_active_parse_tasks.constEnd())
|
||||
if (iter == m_active_parse_tasks.constEnd() || !m_resources_index.contains(resource_id))
|
||||
return;
|
||||
|
||||
auto removed_index = m_resources_index[resource_id];
|
||||
|
@ -76,7 +76,7 @@ class ResourceFolderModel : public QAbstractListModel {
|
||||
virtual bool update();
|
||||
|
||||
/** Creates a new parse task, if needed, for 'res' and start it.*/
|
||||
virtual void resolveResource(Resource* res);
|
||||
virtual void resolveResource(Resource::Ptr res);
|
||||
|
||||
[[nodiscard]] qsizetype size() const { return m_resources.size(); }
|
||||
[[nodiscard]] bool empty() const { return size() == 0; }
|
||||
@ -285,7 +285,7 @@ void ResourceFolderModel::applyUpdates(QSet<QString>& current_set, QSet<QString>
|
||||
}
|
||||
|
||||
m_resources[row].reset(new_resource);
|
||||
resolveResource(m_resources.at(row).get());
|
||||
resolveResource(m_resources.at(row));
|
||||
emit dataChanged(index(row, 0), index(row, columnCount(QModelIndex()) - 1));
|
||||
}
|
||||
}
|
||||
@ -333,7 +333,7 @@ void ResourceFolderModel::applyUpdates(QSet<QString>& current_set, QSet<QString>
|
||||
for (auto& added : added_set) {
|
||||
auto res = new_resources[added];
|
||||
m_resources.append(res);
|
||||
resolveResource(m_resources.last().get());
|
||||
resolveResource(m_resources.last());
|
||||
}
|
||||
|
||||
endInsertRows();
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "Application.h"
|
||||
#include "FileSystem.h"
|
||||
#include "minecraft/mod/Resource.h"
|
||||
|
||||
@ -25,16 +26,12 @@ class BasicFolderLoadTask : public Task {
|
||||
[[nodiscard]] ResultPtr result() const { return m_result; }
|
||||
|
||||
public:
|
||||
BasicFolderLoadTask(QDir dir) : Task(nullptr, false), m_dir(dir), m_result(new Result), m_thread_to_spawn_into(thread())
|
||||
BasicFolderLoadTask(QDir dir) : Task(false), m_dir(dir), m_result(new Result), m_thread_to_spawn_into(thread())
|
||||
{
|
||||
m_create_func = [](QFileInfo const& entry) -> Resource::Ptr { return makeShared<Resource>(entry); };
|
||||
}
|
||||
BasicFolderLoadTask(QDir dir, std::function<Resource::Ptr(QFileInfo const&)> create_function)
|
||||
: Task(nullptr, false)
|
||||
, m_dir(dir)
|
||||
, m_result(new Result)
|
||||
, m_create_func(std::move(create_function))
|
||||
, m_thread_to_spawn_into(thread())
|
||||
: Task(false), m_dir(dir), m_result(new Result), m_create_func(std::move(create_function)), m_thread_to_spawn_into(thread())
|
||||
{}
|
||||
|
||||
[[nodiscard]] bool canAbort() const override { return true; }
|
||||
@ -52,6 +49,9 @@ class BasicFolderLoadTask : public Task {
|
||||
m_dir.refresh();
|
||||
for (auto entry : m_dir.entryInfoList()) {
|
||||
auto filePath = entry.absoluteFilePath();
|
||||
if (auto app = APPLICATION_DYN; app && app->checkQSavePath(filePath)) {
|
||||
continue;
|
||||
}
|
||||
auto newFilePath = FS::getUniqueResourceName(filePath);
|
||||
if (newFilePath != filePath) {
|
||||
FS::move(filePath, newFilePath);
|
||||
|
@ -52,11 +52,10 @@ static bool checkDependencies(std::shared_ptr<GetModDependenciesTask::PackDepend
|
||||
(!loaders || !sel->version.loaders || sel->version.loaders & loaders);
|
||||
}
|
||||
|
||||
GetModDependenciesTask::GetModDependenciesTask(QObject* parent,
|
||||
BaseInstance* instance,
|
||||
GetModDependenciesTask::GetModDependenciesTask(BaseInstance* instance,
|
||||
ModFolderModel* folder,
|
||||
QList<std::shared_ptr<PackDependency>> selected)
|
||||
: SequentialTask(parent, tr("Get dependencies"))
|
||||
: SequentialTask(tr("Get dependencies"))
|
||||
, m_selected(selected)
|
||||
, m_flame_provider{ ModPlatform::ResourceProvider::FLAME, std::make_shared<ResourceDownload::FlameModModel>(*instance),
|
||||
std::make_shared<FlameAPI>() }
|
||||
@ -185,7 +184,7 @@ Task::Ptr GetModDependenciesTask::prepareDependencyTask(const ModPlatform::Depen
|
||||
auto provider = providerName == m_flame_provider.name ? m_flame_provider : m_modrinth_provider;
|
||||
|
||||
auto tasks = makeShared<SequentialTask>(
|
||||
this, QString("DependencyInfo: %1").arg(dep.addonId.toString().isEmpty() ? dep.version : dep.addonId.toString()));
|
||||
QString("DependencyInfo: %1").arg(dep.addonId.toString().isEmpty() ? dep.version : dep.addonId.toString()));
|
||||
|
||||
if (!dep.addonId.toString().isEmpty()) {
|
||||
tasks->addTask(getProjectInfoTask(pDep));
|
||||
|
@ -61,10 +61,7 @@ class GetModDependenciesTask : public SequentialTask {
|
||||
std::shared_ptr<ResourceAPI> api;
|
||||
};
|
||||
|
||||
explicit GetModDependenciesTask(QObject* parent,
|
||||
BaseInstance* instance,
|
||||
ModFolderModel* folder,
|
||||
QList<std::shared_ptr<PackDependency>> selected);
|
||||
explicit GetModDependenciesTask(BaseInstance* instance, ModFolderModel* folder, QList<std::shared_ptr<PackDependency>> selected);
|
||||
|
||||
auto getDependecies() const -> QList<std::shared_ptr<PackDependency>> { return m_pack_dependencies; }
|
||||
QHash<QString, PackDependencyExtraInfo> getExtraInfo();
|
||||
|
@ -157,7 +157,7 @@ bool validate(QFileInfo file)
|
||||
|
||||
} // namespace DataPackUtils
|
||||
|
||||
LocalDataPackParseTask::LocalDataPackParseTask(int token, DataPack& dp) : Task(nullptr, false), m_token(token), m_data_pack(dp) {}
|
||||
LocalDataPackParseTask::LocalDataPackParseTask(int token, DataPack& dp) : Task(false), m_token(token), m_data_pack(dp) {}
|
||||
|
||||
bool LocalDataPackParseTask::abort()
|
||||
{
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <QJsonValue>
|
||||
#include <QRegularExpression>
|
||||
#include <QString>
|
||||
|
||||
#include "FileSystem.h"
|
||||
@ -15,6 +16,8 @@
|
||||
#include "minecraft/mod/ModDetails.h"
|
||||
#include "settings/INIFile.h"
|
||||
|
||||
static QRegularExpression newlineRegex("\r\n|\n|\r");
|
||||
|
||||
namespace ModUtils {
|
||||
|
||||
// NEW format
|
||||
@ -290,86 +293,90 @@ ModDetails ReadFabricModInfo(QByteArray contents)
|
||||
// https://github.com/QuiltMC/rfcs/blob/master/specification/0002-quilt.mod.json.md
|
||||
ModDetails ReadQuiltModInfo(QByteArray contents)
|
||||
{
|
||||
QJsonParseError jsonError;
|
||||
QJsonDocument jsonDoc = QJsonDocument::fromJson(contents, &jsonError);
|
||||
auto object = Json::requireObject(jsonDoc, "quilt.mod.json");
|
||||
auto schemaVersion = Json::ensureInteger(object.value("schema_version"), 0, "Quilt schema_version");
|
||||
|
||||
ModDetails details;
|
||||
try {
|
||||
QJsonParseError jsonError;
|
||||
QJsonDocument jsonDoc = QJsonDocument::fromJson(contents, &jsonError);
|
||||
auto object = Json::requireObject(jsonDoc, "quilt.mod.json");
|
||||
auto schemaVersion = Json::ensureInteger(object.value("schema_version"), 0, "Quilt schema_version");
|
||||
|
||||
// https://github.com/QuiltMC/rfcs/blob/be6ba280d785395fefa90a43db48e5bfc1d15eb4/specification/0002-quilt.mod.json.md
|
||||
if (schemaVersion == 1) {
|
||||
auto modInfo = Json::requireObject(object.value("quilt_loader"), "Quilt mod info");
|
||||
// https://github.com/QuiltMC/rfcs/blob/be6ba280d785395fefa90a43db48e5bfc1d15eb4/specification/0002-quilt.mod.json.md
|
||||
if (schemaVersion == 1) {
|
||||
auto modInfo = Json::requireObject(object.value("quilt_loader"), "Quilt mod info");
|
||||
|
||||
details.mod_id = Json::requireString(modInfo.value("id"), "Mod ID");
|
||||
details.version = Json::requireString(modInfo.value("version"), "Mod version");
|
||||
details.mod_id = Json::requireString(modInfo.value("id"), "Mod ID");
|
||||
details.version = Json::requireString(modInfo.value("version"), "Mod version");
|
||||
|
||||
auto modMetadata = Json::ensureObject(modInfo.value("metadata"));
|
||||
auto modMetadata = Json::ensureObject(modInfo.value("metadata"));
|
||||
|
||||
details.name = Json::ensureString(modMetadata.value("name"), details.mod_id);
|
||||
details.description = Json::ensureString(modMetadata.value("description"));
|
||||
details.name = Json::ensureString(modMetadata.value("name"), details.mod_id);
|
||||
details.description = Json::ensureString(modMetadata.value("description"));
|
||||
|
||||
auto modContributors = Json::ensureObject(modMetadata.value("contributors"));
|
||||
auto modContributors = Json::ensureObject(modMetadata.value("contributors"));
|
||||
|
||||
// We don't really care about the role of a contributor here
|
||||
details.authors += modContributors.keys();
|
||||
// We don't really care about the role of a contributor here
|
||||
details.authors += modContributors.keys();
|
||||
|
||||
auto modContact = Json::ensureObject(modMetadata.value("contact"));
|
||||
auto modContact = Json::ensureObject(modMetadata.value("contact"));
|
||||
|
||||
if (modContact.contains("homepage")) {
|
||||
details.homeurl = Json::requireString(modContact.value("homepage"));
|
||||
}
|
||||
if (modContact.contains("issues")) {
|
||||
details.issue_tracker = Json::requireString(modContact.value("issues"));
|
||||
}
|
||||
if (modContact.contains("homepage")) {
|
||||
details.homeurl = Json::requireString(modContact.value("homepage"));
|
||||
}
|
||||
if (modContact.contains("issues")) {
|
||||
details.issue_tracker = Json::requireString(modContact.value("issues"));
|
||||
}
|
||||
|
||||
if (modMetadata.contains("license")) {
|
||||
auto license = modMetadata.value("license");
|
||||
if (license.isArray()) {
|
||||
for (auto l : license.toArray()) {
|
||||
if (l.isString()) {
|
||||
details.licenses.append(ModLicense(l.toString()));
|
||||
} else if (l.isObject()) {
|
||||
auto obj = l.toObject();
|
||||
details.licenses.append(ModLicense(obj.value("name").toString(), obj.value("id").toString(),
|
||||
obj.value("url").toString(), obj.value("description").toString()));
|
||||
if (modMetadata.contains("license")) {
|
||||
auto license = modMetadata.value("license");
|
||||
if (license.isArray()) {
|
||||
for (auto l : license.toArray()) {
|
||||
if (l.isString()) {
|
||||
details.licenses.append(ModLicense(l.toString()));
|
||||
} else if (l.isObject()) {
|
||||
auto obj = l.toObject();
|
||||
details.licenses.append(ModLicense(obj.value("name").toString(), obj.value("id").toString(),
|
||||
obj.value("url").toString(), obj.value("description").toString()));
|
||||
}
|
||||
}
|
||||
} else if (license.isString()) {
|
||||
details.licenses.append(ModLicense(license.toString()));
|
||||
} else if (license.isObject()) {
|
||||
auto obj = license.toObject();
|
||||
details.licenses.append(ModLicense(obj.value("name").toString(), obj.value("id").toString(),
|
||||
obj.value("url").toString(), obj.value("description").toString()));
|
||||
}
|
||||
}
|
||||
|
||||
if (modMetadata.contains("icon")) {
|
||||
auto icon = modMetadata.value("icon");
|
||||
if (icon.isObject()) {
|
||||
auto obj = icon.toObject();
|
||||
// take the largest icon
|
||||
int largest = 0;
|
||||
for (auto key : obj.keys()) {
|
||||
auto size = key.split('x').first().toInt();
|
||||
if (size > largest) {
|
||||
largest = size;
|
||||
}
|
||||
}
|
||||
if (largest > 0) {
|
||||
auto key = QString::number(largest) + "x" + QString::number(largest);
|
||||
details.icon_file = obj.value(key).toString();
|
||||
} else { // parsing the sizes failed
|
||||
// take the first
|
||||
for (auto i : obj) {
|
||||
details.icon_file = i.toString();
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (icon.isString()) {
|
||||
details.icon_file = icon.toString();
|
||||
}
|
||||
} else if (license.isString()) {
|
||||
details.licenses.append(ModLicense(license.toString()));
|
||||
} else if (license.isObject()) {
|
||||
auto obj = license.toObject();
|
||||
details.licenses.append(ModLicense(obj.value("name").toString(), obj.value("id").toString(), obj.value("url").toString(),
|
||||
obj.value("description").toString()));
|
||||
}
|
||||
}
|
||||
|
||||
if (modMetadata.contains("icon")) {
|
||||
auto icon = modMetadata.value("icon");
|
||||
if (icon.isObject()) {
|
||||
auto obj = icon.toObject();
|
||||
// take the largest icon
|
||||
int largest = 0;
|
||||
for (auto key : obj.keys()) {
|
||||
auto size = key.split('x').first().toInt();
|
||||
if (size > largest) {
|
||||
largest = size;
|
||||
}
|
||||
}
|
||||
if (largest > 0) {
|
||||
auto key = QString::number(largest) + "x" + QString::number(largest);
|
||||
details.icon_file = obj.value(key).toString();
|
||||
} else { // parsing the sizes failed
|
||||
// take the first
|
||||
for (auto i : obj) {
|
||||
details.icon_file = i.toString();
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (icon.isString()) {
|
||||
details.icon_file = icon.toString();
|
||||
}
|
||||
}
|
||||
} catch (const Exception& e) {
|
||||
qWarning() << "Unable to parse mod info:" << e.cause();
|
||||
}
|
||||
return details;
|
||||
}
|
||||
@ -487,11 +494,11 @@ bool processZIP(Mod& mod, [[maybe_unused]] ProcessingLevel level)
|
||||
}
|
||||
|
||||
// quick and dirty line-by-line parser
|
||||
auto manifestLines = file.readAll().split('\n');
|
||||
auto manifestLines = QString(file.readAll()).split(newlineRegex);
|
||||
QString manifestVersion = "";
|
||||
for (auto& line : manifestLines) {
|
||||
if (QString(line).startsWith("Implementation-Version: ")) {
|
||||
manifestVersion = QString(line).remove("Implementation-Version: ");
|
||||
if (line.startsWith("Implementation-Version: ", Qt::CaseInsensitive)) {
|
||||
manifestVersion = line.remove("Implementation-Version: ", Qt::CaseInsensitive);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -730,7 +737,7 @@ bool loadIconFile(const Mod& mod, QPixmap* pixmap)
|
||||
} // namespace ModUtils
|
||||
|
||||
LocalModParseTask::LocalModParseTask(int token, ResourceType type, const QFileInfo& modFile)
|
||||
: Task(nullptr, false), m_token(token), m_type(type), m_modFile(modFile), m_result(new Result())
|
||||
: Task(false), m_token(token), m_type(type), m_modFile(modFile), m_result(new Result())
|
||||
{}
|
||||
|
||||
bool LocalModParseTask::abort()
|
||||
|
@ -358,9 +358,7 @@ bool validate(QFileInfo file)
|
||||
|
||||
} // namespace ResourcePackUtils
|
||||
|
||||
LocalResourcePackParseTask::LocalResourcePackParseTask(int token, ResourcePack& rp)
|
||||
: Task(nullptr, false), m_token(token), m_resource_pack(rp)
|
||||
{}
|
||||
LocalResourcePackParseTask::LocalResourcePackParseTask(int token, ResourcePack& rp) : Task(false), m_token(token), m_resource_pack(rp) {}
|
||||
|
||||
bool LocalResourcePackParseTask::abort()
|
||||
{
|
||||
|
@ -93,7 +93,7 @@ bool validate(QFileInfo file)
|
||||
|
||||
} // namespace ShaderPackUtils
|
||||
|
||||
LocalShaderPackParseTask::LocalShaderPackParseTask(int token, ShaderPack& sp) : Task(nullptr, false), m_token(token), m_shader_pack(sp) {}
|
||||
LocalShaderPackParseTask::LocalShaderPackParseTask(int token, ShaderPack& sp) : Task(false), m_token(token), m_shader_pack(sp) {}
|
||||
|
||||
bool LocalShaderPackParseTask::abort()
|
||||
{
|
||||
|
@ -230,8 +230,7 @@ bool validate(QFileInfo file)
|
||||
|
||||
} // namespace TexturePackUtils
|
||||
|
||||
LocalTexturePackParseTask::LocalTexturePackParseTask(int token, TexturePack& rp) : Task(nullptr, false), m_token(token), m_texture_pack(rp)
|
||||
{}
|
||||
LocalTexturePackParseTask::LocalTexturePackParseTask(int token, TexturePack& rp) : Task(false), m_token(token), m_texture_pack(rp) {}
|
||||
|
||||
bool LocalTexturePackParseTask::abort()
|
||||
{
|
||||
|
@ -170,7 +170,7 @@ bool validate(QFileInfo file)
|
||||
|
||||
} // namespace WorldSaveUtils
|
||||
|
||||
LocalWorldSaveParseTask::LocalWorldSaveParseTask(int token, WorldSave& save) : Task(nullptr, false), m_token(token), m_save(save) {}
|
||||
LocalWorldSaveParseTask::LocalWorldSaveParseTask(int token, WorldSave& save) : Task(false), m_token(token), m_save(save) {}
|
||||
|
||||
bool LocalWorldSaveParseTask::abort()
|
||||
{
|
||||
|
@ -36,13 +36,14 @@
|
||||
|
||||
#include "ModFolderLoadTask.h"
|
||||
|
||||
#include "Application.h"
|
||||
#include "FileSystem.h"
|
||||
#include "minecraft/mod/MetadataHandler.h"
|
||||
|
||||
#include <QThread>
|
||||
|
||||
ModFolderLoadTask::ModFolderLoadTask(QDir mods_dir, QDir index_dir, bool is_indexed, bool clean_orphan)
|
||||
: Task(nullptr, false)
|
||||
: Task(false)
|
||||
, m_mods_dir(mods_dir)
|
||||
, m_index_dir(index_dir)
|
||||
, m_is_indexed(is_indexed)
|
||||
@ -65,6 +66,9 @@ void ModFolderLoadTask::executeTask()
|
||||
m_mods_dir.refresh();
|
||||
for (auto entry : m_mods_dir.entryInfoList()) {
|
||||
auto filePath = entry.absoluteFilePath();
|
||||
if (auto app = APPLICATION_DYN; app && app->checkQSavePath(filePath)) {
|
||||
continue;
|
||||
}
|
||||
auto newFilePath = FS::getUniqueResourceName(filePath);
|
||||
if (newFilePath != filePath) {
|
||||
FS::move(filePath, newFilePath);
|
||||
|
@ -16,7 +16,7 @@ class CheckUpdateTask : public Task {
|
||||
std::list<Version>& mcVersions,
|
||||
QList<ModPlatform::ModLoaderType> loadersList,
|
||||
std::shared_ptr<ModFolderModel> mods_folder)
|
||||
: Task(nullptr), m_mods(mods), m_game_versions(mcVersions), m_loaders_list(loadersList), m_mods_folder(mods_folder) {};
|
||||
: Task(), m_mods(mods), m_game_versions(mcVersions), m_loaders_list(loadersList), m_mods_folder(mods_folder) {};
|
||||
|
||||
struct UpdatableMod {
|
||||
QString name;
|
||||
|
@ -19,31 +19,32 @@ static ModrinthAPI modrinth_api;
|
||||
static FlameAPI flame_api;
|
||||
|
||||
EnsureMetadataTask::EnsureMetadataTask(Mod* mod, QDir dir, ModPlatform::ResourceProvider prov)
|
||||
: Task(nullptr), m_index_dir(dir), m_provider(prov), m_hashing_task(nullptr), m_current_task(nullptr)
|
||||
: Task(), m_index_dir(dir), m_provider(prov), m_hashingTask(nullptr), m_current_task(nullptr)
|
||||
{
|
||||
auto hash_task = createNewHash(mod);
|
||||
if (!hash_task)
|
||||
auto hashTask = createNewHash(mod);
|
||||
if (!hashTask)
|
||||
return;
|
||||
connect(hash_task.get(), &Hashing::Hasher::resultsReady, [this, mod](QString hash) { m_mods.insert(hash, mod); });
|
||||
connect(hash_task.get(), &Task::failed, [this, mod] { emitFail(mod, "", RemoveFromList::No); });
|
||||
hash_task->start();
|
||||
connect(hashTask.get(), &Hashing::Hasher::resultsReady, [this, mod](QString hash) { m_mods.insert(hash, mod); });
|
||||
connect(hashTask.get(), &Task::failed, [this, mod] { emitFail(mod, "", RemoveFromList::No); });
|
||||
m_hashingTask = hashTask;
|
||||
}
|
||||
|
||||
EnsureMetadataTask::EnsureMetadataTask(QList<Mod*>& mods, QDir dir, ModPlatform::ResourceProvider prov)
|
||||
: Task(nullptr), m_index_dir(dir), m_provider(prov), m_current_task(nullptr)
|
||||
: Task(), m_index_dir(dir), m_provider(prov), m_current_task(nullptr)
|
||||
{
|
||||
m_hashing_task.reset(new ConcurrentTask(this, "MakeHashesTask", APPLICATION->settings()->get("NumberOfConcurrentTasks").toInt()));
|
||||
auto hashTask = makeShared<ConcurrentTask>("MakeHashesTask", APPLICATION->settings()->get("NumberOfConcurrentTasks").toInt());
|
||||
m_hashingTask = hashTask;
|
||||
for (auto* mod : mods) {
|
||||
auto hash_task = createNewHash(mod);
|
||||
if (!hash_task)
|
||||
continue;
|
||||
connect(hash_task.get(), &Hashing::Hasher::resultsReady, [this, mod](QString hash) { m_mods.insert(hash, mod); });
|
||||
connect(hash_task.get(), &Task::failed, [this, mod] { emitFail(mod, "", RemoveFromList::No); });
|
||||
m_hashing_task->addTask(hash_task);
|
||||
hashTask->addTask(hash_task);
|
||||
}
|
||||
}
|
||||
EnsureMetadataTask::EnsureMetadataTask(QHash<QString, Mod*>& mods, QDir dir, ModPlatform::ResourceProvider prov)
|
||||
: Task(nullptr), m_mods(mods), m_index_dir(dir), m_provider(prov), m_current_task(nullptr)
|
||||
: Task(), m_mods(mods), m_index_dir(dir), m_provider(prov), m_current_task(nullptr)
|
||||
{}
|
||||
|
||||
Hashing::Hasher::Ptr EnsureMetadataTask::createNewHash(Mod* mod)
|
||||
|
@ -20,7 +20,7 @@ class EnsureMetadataTask : public Task {
|
||||
|
||||
~EnsureMetadataTask() = default;
|
||||
|
||||
Task::Ptr getHashingTask() { return m_hashing_task; }
|
||||
Task::Ptr getHashingTask() { return m_hashingTask; }
|
||||
|
||||
public slots:
|
||||
bool abort() override;
|
||||
@ -58,6 +58,6 @@ class EnsureMetadataTask : public Task {
|
||||
ModPlatform::ResourceProvider m_provider;
|
||||
|
||||
QHash<QString, ModPlatform::IndexedVersion> m_temp_versions;
|
||||
ConcurrentTask::Ptr m_hashing_task;
|
||||
Task::Ptr m_hashingTask;
|
||||
Task::Ptr m_current_task;
|
||||
};
|
||||
|
@ -31,6 +31,19 @@ static const QMap<QString, IndexedVersionType::VersionType> s_indexed_version_ty
|
||||
{ "alpha", IndexedVersionType::VersionType::Alpha }
|
||||
};
|
||||
|
||||
static const QList<ModLoaderType> loaderList = { NeoForge, Forge, Cauldron, LiteLoader, Quilt, Fabric };
|
||||
|
||||
QList<ModLoaderType> modLoaderTypesToList(ModLoaderTypes flags)
|
||||
{
|
||||
QList<ModLoaderType> flagList;
|
||||
for (auto flag : loaderList) {
|
||||
if (flags.testFlag(flag)) {
|
||||
flagList.append(flag);
|
||||
}
|
||||
}
|
||||
return flagList;
|
||||
}
|
||||
|
||||
IndexedVersionType::IndexedVersionType(const QString& type) : IndexedVersionType(enumFromString(type)) {}
|
||||
|
||||
IndexedVersionType::IndexedVersionType(const IndexedVersionType::VersionType& type)
|
||||
|
@ -32,6 +32,7 @@ namespace ModPlatform {
|
||||
|
||||
enum ModLoaderType { NeoForge = 1 << 0, Forge = 1 << 1, Cauldron = 1 << 2, LiteLoader = 1 << 3, Fabric = 1 << 4, Quilt = 1 << 5 };
|
||||
Q_DECLARE_FLAGS(ModLoaderTypes, ModLoaderType)
|
||||
QList<ModLoaderType> modLoaderTypesToList(ModLoaderTypes flags);
|
||||
|
||||
enum class ResourceProvider { MODRINTH, FLAME };
|
||||
|
||||
|
@ -73,7 +73,7 @@ class ResourceAPI {
|
||||
std::optional<QString> search;
|
||||
std::optional<SortingMethod> sorting;
|
||||
std::optional<ModPlatform::ModLoaderTypes> loaders;
|
||||
std::optional<std::list<Version> > versions;
|
||||
std::optional<std::list<Version>> versions;
|
||||
std::optional<QString> side;
|
||||
std::optional<QStringList> categoryIds;
|
||||
};
|
||||
@ -168,11 +168,23 @@ class ResourceAPI {
|
||||
protected:
|
||||
[[nodiscard]] inline QString debugName() const { return "External resource API"; }
|
||||
|
||||
[[nodiscard]] inline auto getGameVersionsString(std::list<Version> mcVersions) const -> QString
|
||||
[[nodiscard]] inline QString mapMCVersionToModrinth(Version v) const
|
||||
{
|
||||
static const QString preString = " Pre-Release ";
|
||||
auto verStr = v.toString();
|
||||
|
||||
if (verStr.contains(preString)) {
|
||||
verStr.replace(preString, "-pre");
|
||||
}
|
||||
verStr.replace(" ", "-");
|
||||
return verStr;
|
||||
}
|
||||
|
||||
[[nodiscard]] inline QString getGameVersionsString(std::list<Version> mcVersions) const
|
||||
{
|
||||
QString s;
|
||||
for (auto& ver : mcVersions) {
|
||||
s += QString("\"%1\",").arg(ver.toString());
|
||||
s += QString("\"%1\",").arg(mapMCVersionToModrinth(ver));
|
||||
}
|
||||
s.remove(s.length() - 1, 1); // remove last comma
|
||||
return s;
|
||||
|
@ -112,6 +112,8 @@ void Flame::FileResolvingTask::netJobFinished()
|
||||
auto obj = Json::requireObject(file);
|
||||
auto version = FlameMod::loadIndexedPackVersion(obj);
|
||||
auto fileid = version.fileId.toInt();
|
||||
Q_ASSERT(fileid != 0);
|
||||
Q_ASSERT(m_manifest.files.contains(fileid));
|
||||
m_manifest.files[fileid].version = version;
|
||||
auto url = QUrl(version.downloadUrl, QUrl::TolerantMode);
|
||||
if (!url.isValid() && "sha1" == version.hash_type && !version.hash.isEmpty()) {
|
||||
@ -144,7 +146,7 @@ void Flame::FileResolvingTask::netJobFinished()
|
||||
<< " reason: " << parse_error.errorString();
|
||||
qWarning() << *m_result;
|
||||
|
||||
failed(parse_error.errorString());
|
||||
getFlameProjects();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -270,21 +270,44 @@ std::optional<ModPlatform::IndexedVersion> FlameAPI::getLatestVersion(QList<ModP
|
||||
QList<ModPlatform::ModLoaderType> instanceLoaders,
|
||||
ModPlatform::ModLoaderTypes modLoaders)
|
||||
{
|
||||
// edge case: mod has installed for forge but the instance is fabric => fabric version will be prioritizated on update
|
||||
auto bestVersion = [&versions](ModPlatform::ModLoaderTypes loader) {
|
||||
std::optional<ModPlatform::IndexedVersion> ver;
|
||||
for (auto file_tmp : versions) {
|
||||
if (file_tmp.loaders & loader && (!ver.has_value() || file_tmp.date > ver->date)) {
|
||||
ver = file_tmp;
|
||||
static const auto noLoader = ModPlatform::ModLoaderType(0);
|
||||
QHash<ModPlatform::ModLoaderType, ModPlatform::IndexedVersion> bestMatch;
|
||||
auto checkVersion = [&bestMatch](const ModPlatform::IndexedVersion& version, const ModPlatform::ModLoaderType& loader) {
|
||||
if (bestMatch.contains(loader)) {
|
||||
auto best = bestMatch.value(loader);
|
||||
if (version.date > best.date) {
|
||||
bestMatch[loader] = version;
|
||||
}
|
||||
} else {
|
||||
bestMatch[loader] = version;
|
||||
}
|
||||
};
|
||||
for (auto file_tmp : versions) {
|
||||
auto loaders = ModPlatform::modLoaderTypesToList(file_tmp.loaders);
|
||||
if (loaders.isEmpty()) {
|
||||
checkVersion(file_tmp, noLoader);
|
||||
} else {
|
||||
for (auto loader : loaders) {
|
||||
checkVersion(file_tmp, loader);
|
||||
}
|
||||
}
|
||||
return ver;
|
||||
};
|
||||
for (auto l : instanceLoaders) {
|
||||
auto ver = bestVersion(l);
|
||||
if (ver.has_value()) {
|
||||
return ver;
|
||||
}
|
||||
// edge case: mod has installed for forge but the instance is fabric => fabric version will be prioritizated on update
|
||||
auto currentLoaders = instanceLoaders + ModPlatform::modLoaderTypesToList(modLoaders);
|
||||
currentLoaders.append(noLoader); // add a fallback in case the versions do not define a loader
|
||||
|
||||
for (auto loader : currentLoaders) {
|
||||
if (bestMatch.contains(loader)) {
|
||||
auto bestForLoader = bestMatch.value(loader);
|
||||
// awkward case where the mod has only two loaders and one of them is not specified
|
||||
if (loader != noLoader && bestMatch.contains(noLoader) && bestMatch.size() == 2) {
|
||||
auto bestForNoLoader = bestMatch.value(noLoader);
|
||||
if (bestForNoLoader.date > bestForLoader.date) {
|
||||
return bestForNoLoader;
|
||||
}
|
||||
}
|
||||
return bestForLoader;
|
||||
}
|
||||
}
|
||||
return bestVersion(modLoaders);
|
||||
return {};
|
||||
}
|
||||
|
@ -444,6 +444,7 @@ bool FlameCreationTask::createInstance()
|
||||
setError(tr("Unable to resolve mod IDs:\n") + reason);
|
||||
loop.quit();
|
||||
});
|
||||
connect(m_mod_id_resolver.get(), &Flame::FileResolvingTask::aborted, &loop, &QEventLoop::quit);
|
||||
connect(m_mod_id_resolver.get(), &Flame::FileResolvingTask::progress, this, &FlameCreationTask::setProgress);
|
||||
connect(m_mod_id_resolver.get(), &Flame::FileResolvingTask::status, this, &FlameCreationTask::setStatus);
|
||||
connect(m_mod_id_resolver.get(), &Flame::FileResolvingTask::stepProgress, this, &FlameCreationTask::propagateStepProgress);
|
||||
@ -676,7 +677,7 @@ void FlameCreationTask::validateZIPResources(QEventLoop& loop)
|
||||
break;
|
||||
}
|
||||
}
|
||||
auto task = makeShared<ConcurrentTask>(this, "CreateModMetadata", APPLICATION->settings()->get("NumberOfConcurrentTasks").toInt());
|
||||
auto task = makeShared<ConcurrentTask>("CreateModMetadata", APPLICATION->settings()->get("NumberOfConcurrentTasks").toInt());
|
||||
auto results = m_mod_id_resolver->getResults().files;
|
||||
auto folder = FS::PathCombine(m_stagingPath, "minecraft", "mods", ".index");
|
||||
for (auto file : results) {
|
||||
|
@ -105,9 +105,6 @@ void FlameMod::loadIndexedPackVersions(ModPlatform::IndexedPack& pack,
|
||||
auto FlameMod::loadIndexedPackVersion(QJsonObject& obj, bool load_changelog) -> ModPlatform::IndexedVersion
|
||||
{
|
||||
auto versionArray = Json::requireArray(obj, "gameVersions");
|
||||
if (versionArray.isEmpty()) {
|
||||
return {};
|
||||
}
|
||||
|
||||
ModPlatform::IndexedVersion file;
|
||||
for (auto mcVer : versionArray) {
|
||||
|
@ -103,8 +103,7 @@ void FlamePackExportTask::collectHashes()
|
||||
setStatus(tr("Finding file hashes..."));
|
||||
setProgress(1, 5);
|
||||
auto allMods = mcInstance->loaderModList()->allMods();
|
||||
ConcurrentTask::Ptr hashingTask(
|
||||
new ConcurrentTask(this, "MakeHashesTask", APPLICATION->settings()->get("NumberOfConcurrentTasks").toInt()));
|
||||
ConcurrentTask::Ptr hashingTask(new ConcurrentTask("MakeHashesTask", APPLICATION->settings()->get("NumberOfConcurrentTasks").toInt()));
|
||||
task.reset(hashingTask);
|
||||
for (const QFileInfo& file : files) {
|
||||
const QString relative = gameRoot.relativeFilePath(file.absoluteFilePath());
|
||||
|
@ -45,7 +45,7 @@ static void loadManifestV1(Flame::Manifest& pack, QJsonObject& manifest)
|
||||
|
||||
Flame::File file;
|
||||
loadFileV1(file, obj);
|
||||
|
||||
Q_ASSERT(file.projectId != 0);
|
||||
pack.files.insert(file.fileId, file);
|
||||
}
|
||||
|
||||
|
@ -43,11 +43,16 @@ Task::Ptr NetworkResourceAPI::searchProjects(SearchArgs&& args, SearchCallbacks&
|
||||
callbacks.on_succeed(doc);
|
||||
});
|
||||
|
||||
QObject::connect(netJob.get(), &NetJob::failed, [netJob, callbacks](const QString& reason) {
|
||||
// Capture a weak_ptr instead of a shared_ptr to avoid circular dependency issues.
|
||||
// This prevents the lambda from extending the lifetime of the shared resource,
|
||||
// as it only temporarily locks the resource when needed.
|
||||
auto weak = netJob.toWeakRef();
|
||||
QObject::connect(netJob.get(), &NetJob::failed, [weak, callbacks](const QString& reason) {
|
||||
int network_error_code = -1;
|
||||
if (auto* failed_action = netJob->getFailedActions().at(0); failed_action)
|
||||
network_error_code = failed_action->replyStatusCode();
|
||||
|
||||
if (auto netJob = weak.lock()) {
|
||||
if (auto* failed_action = netJob->getFailedActions().at(0); failed_action)
|
||||
network_error_code = failed_action->replyStatusCode();
|
||||
}
|
||||
callbacks.on_fail(reason, network_error_code);
|
||||
});
|
||||
QObject::connect(netJob.get(), &NetJob::aborted, [callbacks] { callbacks.on_abort(); });
|
||||
@ -102,11 +107,17 @@ Task::Ptr NetworkResourceAPI::getProjectVersions(VersionSearchArgs&& args, Versi
|
||||
|
||||
callbacks.on_succeed(doc, args.pack);
|
||||
});
|
||||
QObject::connect(netJob.get(), &NetJob::failed, [netJob, callbacks](const QString& reason) {
|
||||
int network_error_code = -1;
|
||||
if (auto* failed_action = netJob->getFailedActions().at(0); failed_action)
|
||||
network_error_code = failed_action->replyStatusCode();
|
||||
|
||||
// Capture a weak_ptr instead of a shared_ptr to avoid circular dependency issues.
|
||||
// This prevents the lambda from extending the lifetime of the shared resource,
|
||||
// as it only temporarily locks the resource when needed.
|
||||
auto weak = netJob.toWeakRef();
|
||||
QObject::connect(netJob.get(), &NetJob::failed, [weak, callbacks](const QString& reason) {
|
||||
int network_error_code = -1;
|
||||
if (auto netJob = weak.lock()) {
|
||||
if (auto* failed_action = netJob->getFailedActions().at(0); failed_action)
|
||||
network_error_code = failed_action->replyStatusCode();
|
||||
}
|
||||
callbacks.on_fail(reason, network_error_code);
|
||||
});
|
||||
|
||||
@ -153,11 +164,17 @@ Task::Ptr NetworkResourceAPI::getDependencyVersion(DependencySearchArgs&& args,
|
||||
|
||||
callbacks.on_succeed(doc, args.dependency);
|
||||
});
|
||||
QObject::connect(netJob.get(), &NetJob::failed, [netJob, callbacks](const QString& reason) {
|
||||
int network_error_code = -1;
|
||||
if (auto* failed_action = netJob->getFailedActions().at(0); failed_action)
|
||||
network_error_code = failed_action->replyStatusCode();
|
||||
|
||||
// Capture a weak_ptr instead of a shared_ptr to avoid circular dependency issues.
|
||||
// This prevents the lambda from extending the lifetime of the shared resource,
|
||||
// as it only temporarily locks the resource when needed.
|
||||
auto weak = netJob.toWeakRef();
|
||||
QObject::connect(netJob.get(), &NetJob::failed, [weak, callbacks](const QString& reason) {
|
||||
int network_error_code = -1;
|
||||
if (auto netJob = weak.lock()) {
|
||||
if (auto* failed_action = netJob->getFailedActions().at(0); failed_action)
|
||||
network_error_code = failed_action->replyStatusCode();
|
||||
}
|
||||
callbacks.on_fail(reason, network_error_code);
|
||||
});
|
||||
return netJob;
|
||||
|
@ -138,7 +138,7 @@ void PackInstallTask::install()
|
||||
if (unzipMcDir.exists()) {
|
||||
// ok, found minecraft dir, move contents to instance dir
|
||||
if (!FS::move(m_stagingPath + "/unzip/minecraft", m_stagingPath + "/minecraft")) {
|
||||
emitFailed(tr("Failed to move unzipped Minecraft!"));
|
||||
emitFailed(tr("Failed to move unpacked Minecraft!"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ Task::Ptr ModrinthAPI::currentVersions(const QStringList& hashes, QString hash_f
|
||||
auto body_raw = body.toJson();
|
||||
|
||||
netJob->addNetAction(Net::ApiUpload::makeByteArray(QString(BuildConfig.MODRINTH_PROD_URL + "/version_files"), response, body_raw));
|
||||
|
||||
netJob->setAskRetry(false);
|
||||
return netJob;
|
||||
}
|
||||
|
||||
@ -54,7 +54,7 @@ Task::Ptr ModrinthAPI::latestVersion(QString hash,
|
||||
if (mcVersions.has_value()) {
|
||||
QStringList game_versions;
|
||||
for (auto& ver : mcVersions.value()) {
|
||||
game_versions.append(ver.toString());
|
||||
game_versions.append(mapMCVersionToModrinth(ver));
|
||||
}
|
||||
Json::writeStringList(body_obj, "game_versions", game_versions);
|
||||
}
|
||||
@ -87,7 +87,7 @@ Task::Ptr ModrinthAPI::latestVersions(const QStringList& hashes,
|
||||
if (mcVersions.has_value()) {
|
||||
QStringList game_versions;
|
||||
for (auto& ver : mcVersions.value()) {
|
||||
game_versions.append(ver.toString());
|
||||
game_versions.append(mapMCVersionToModrinth(ver));
|
||||
}
|
||||
Json::writeStringList(body_obj, "game_versions", game_versions);
|
||||
}
|
||||
|
@ -81,6 +81,21 @@ class ModrinthAPI : public NetworkResourceAPI {
|
||||
return {};
|
||||
}
|
||||
|
||||
[[nodiscard]] static inline QString mapMCVersionFromModrinth(QString v)
|
||||
{
|
||||
static const QString preString = " Pre-Release ";
|
||||
bool pre = false;
|
||||
if (v.contains("-pre")) {
|
||||
pre = true;
|
||||
v.replace("-pre", preString);
|
||||
}
|
||||
v.replace("-", " ");
|
||||
if (pre) {
|
||||
v.replace(" Pre Release ", preString);
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
private:
|
||||
[[nodiscard]] static QString resourceTypeParameter(ModPlatform::ResourceType type)
|
||||
{
|
||||
@ -170,7 +185,7 @@ class ModrinthAPI : public NetworkResourceAPI {
|
||||
{
|
||||
QString s;
|
||||
for (auto& ver : mcVersions) {
|
||||
s += QString("\"versions:%1\",").arg(ver.toString());
|
||||
s += QString("\"versions:%1\",").arg(mapMCVersionToModrinth(ver));
|
||||
}
|
||||
s.remove(s.length() - 1, 1); // remove last comma
|
||||
return s.isEmpty() ? QString() : s;
|
||||
@ -187,7 +202,7 @@ class ModrinthAPI : public NetworkResourceAPI {
|
||||
: QString("%1/project/%2/version?game_versions=[\"%3\"]&loaders=[\"%4\"]")
|
||||
.arg(BuildConfig.MODRINTH_PROD_URL)
|
||||
.arg(args.dependency.addonId.toString())
|
||||
.arg(args.mcVersion.toString())
|
||||
.arg(mapMCVersionToModrinth(args.mcVersion))
|
||||
.arg(getModLoaderStrings(args.loader).join("\",\""));
|
||||
};
|
||||
};
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user