mirror of
https://github.com/izzy2lost/2ship2harkinian-Android.git
synced 2026-06-19 01:20:08 -07:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4ee3f23df8 | ||
|
|
cb1378429f | ||
|
|
5cadb5923d | ||
|
|
f51b428de4 | ||
|
|
7fb49b5e01 | ||
|
|
5a735395da | ||
|
|
dda4e4b5c9 | ||
|
|
6d76ce9f5e | ||
|
|
e0ed28543b | ||
|
|
1afe496fed | ||
|
|
31685557d2 | ||
|
|
cf92349436 | ||
|
|
8a74695a74 | ||
|
|
ebb9e3fc8e | ||
|
|
01b127b7f3 | ||
|
|
422839dea4 | ||
|
|
a2e93687f6 | ||
|
|
fab4340461 | ||
|
|
b7a607b765 | ||
|
|
4669337a3f | ||
|
|
7b11b129f7 | ||
|
|
b18eb6b649 | ||
|
|
0879154432 | ||
|
|
f1698ae721 | ||
|
|
ad50070aba | ||
|
|
449a2ebc70 | ||
|
|
be70a5a123 | ||
|
|
d1bbba626d | ||
|
|
2141922ee3 | ||
|
|
c2ec2f2cc3 | ||
|
|
207df24ffd | ||
|
|
0966633d2a | ||
|
|
50bc007d46 | ||
|
|
941b48b802 | ||
|
|
cbc89b8af4 | ||
|
|
9cd2f6e784 | ||
|
|
64ebfa222e | ||
|
|
0129959d7b | ||
|
|
3ebfdb3928 | ||
|
|
bb386e25a0 | ||
|
|
4d3c39224c | ||
|
|
0b16bced84 | ||
|
|
b7d7a2d9bf | ||
|
|
fa702ed90c | ||
|
|
7e10b1315e | ||
|
|
cae9c27c62 | ||
|
|
cd4ee56d48 | ||
|
|
790d36bfbc | ||
|
|
da793a5bf2 | ||
|
|
69edc89292 | ||
|
|
a93f011253 | ||
|
|
4c670ad342 | ||
|
|
d9d6dbdf51 | ||
|
|
da04b7f859 | ||
|
|
8e0b482b23 | ||
|
|
d3933591b5 | ||
|
|
f31674a12e | ||
|
|
c474a82a94 | ||
|
|
71c2c94ece | ||
|
|
75bc685360 | ||
|
|
200aaf7be8 | ||
|
|
f33f994adc | ||
|
|
b1eea9ca76 | ||
|
|
1475e6af7b | ||
|
|
25887952c9 | ||
|
|
137ca0de12 | ||
|
|
a5059beaeb | ||
|
|
4d1ddff798 | ||
|
|
bbfa903a99 | ||
|
|
6ff3be97de | ||
|
|
466a716222 | ||
|
|
185e761f78 | ||
|
|
ea8809ddd0 | ||
|
|
13035d72a4 | ||
|
|
136a928883 | ||
|
|
0c2a51c9f4 | ||
|
|
d74699740e | ||
|
|
542feb038e | ||
|
|
b0ca99f18c | ||
|
|
53faf37dc1 | ||
|
|
63ffddb67b | ||
|
|
4a57bdbc5f | ||
|
|
0ec23b34ba | ||
|
|
d0caa0f78c | ||
|
|
51af06463f | ||
|
|
17dd587241 | ||
|
|
57cb5d2b51 | ||
|
|
24d8d47ab2 | ||
|
|
aa1b0108f4 | ||
|
|
e0731a194c | ||
|
|
0455c0f053 | ||
|
|
5984bdea19 | ||
|
|
2bb149b367 | ||
|
|
7458760c75 | ||
|
|
dcc38678a6 | ||
|
|
f201a494d2 | ||
|
|
6af9227293 | ||
|
|
36f31463f3 | ||
|
|
da76b32433 | ||
|
|
00403e452f | ||
|
|
03a33628cb | ||
|
|
60673fac35 | ||
|
|
72f6fd158c | ||
|
|
2e4710c6c2 | ||
|
|
1f3ca038a8 | ||
|
|
791064e870 | ||
|
|
3ef3e7a239 | ||
|
|
0d4e554ac6 | ||
|
|
a933d73589 | ||
|
|
a38b9daa6d | ||
|
|
120562952c | ||
|
|
fc309f5eaa | ||
|
|
e87d7c6954 | ||
|
|
8b2b12dbe8 | ||
|
|
c2199dddcf | ||
|
|
cc3e015f12 | ||
|
|
a383b4b330 | ||
|
|
df81f97e43 | ||
|
|
e60ca15ae6 | ||
|
|
84b9b4218a | ||
|
|
6fd7fc3a9d | ||
|
|
51a6d9d926 | ||
|
|
4b36181ee2 | ||
|
|
5e17828cc4 | ||
|
|
d2a11f1476 | ||
|
|
f8f00e6d9b | ||
|
|
2d8bc175fe | ||
|
|
5de6a9ac8f | ||
|
|
03a597d44c | ||
|
|
139a240ed3 | ||
|
|
26321c9a17 | ||
|
|
888b8fe24a | ||
|
|
53e76c5aeb | ||
|
|
f64cf9d56d | ||
|
|
43ebcd0305 | ||
|
|
07ac8c2a1b | ||
|
|
891fcafa57 | ||
|
|
8e3a447798 | ||
|
|
41ace195cd | ||
|
|
c0593af8db | ||
|
|
4770f538a9 | ||
|
|
5dedbc45c1 | ||
|
|
bb6c6f5995 | ||
|
|
d0dd8c2786 | ||
|
|
b54542494e | ||
|
|
eae50e33e3 | ||
|
|
04e5ac449d | ||
|
|
50b06bff0b | ||
|
|
3a86bdf2dc | ||
|
|
78f0525ec0 | ||
|
|
a3add6092b | ||
|
|
a39a9a58e9 | ||
|
|
7bf60f6771 | ||
|
|
63c293f78a | ||
|
|
57d4e62ed0 | ||
|
|
877d7f732b | ||
|
|
47e98e8ee9 | ||
|
|
65870f3c07 | ||
|
|
464c55fcbb | ||
|
|
8ac7dc6b7d | ||
|
|
e484e0ba82 | ||
|
|
f32bccc5b9 | ||
|
|
c7aafb65fd | ||
|
|
6ff53d4827 | ||
|
|
73c468d5cf | ||
|
|
74afca9bf7 | ||
|
|
3590cfa118 | ||
|
|
9a81e3eac9 | ||
|
|
6b9276847e | ||
|
|
cf3b18a7ab | ||
|
|
6a5a5cf201 | ||
|
|
a61cf53f22 | ||
|
|
343e072924 | ||
|
|
c2e1c56413 | ||
|
|
e2fb954d99 | ||
|
|
63def6f8df | ||
|
|
0ba35fe6a4 | ||
|
|
eb208233e2 | ||
|
|
291973fffe | ||
|
|
01ae001de5 | ||
|
|
788c74a19e | ||
|
|
711b02be55 | ||
|
|
41e35ff3ee | ||
|
|
513e89c073 | ||
|
|
0eaa533f25 |
@@ -1 +1 @@
|
||||
libusb-dev libusb-1.0-0-dev libsdl2-dev libsdl2-net-dev libpng-dev libglew-dev libzip-dev zipcmp zipmerge ziptool nlohmann-json3-dev libtinyxml2-dev libspdlog-dev ninja-build
|
||||
libusb-dev libusb-1.0-0-dev libsdl2-dev libsdl2-net-dev libpng-dev libglew-dev nlohmann-json3-dev libtinyxml2-dev libspdlog-dev ninja-build
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Call the original gtar executable with sudo for macports cache restoration to root folder
|
||||
exec sudo /opt/homebrew/bin/gtar.orig "$@"
|
||||
+182
-218
@@ -98,74 +98,8 @@ jobs:
|
||||
# source-dir: _packages
|
||||
# destination-dir: ./
|
||||
|
||||
# generate-2ship-otr:
|
||||
# runs-on: ubuntu-22.04
|
||||
# steps:
|
||||
# - uses: actions/checkout@v4
|
||||
# with:
|
||||
# submodules: true
|
||||
# - name: ccache
|
||||
# uses: hendrikmuhs/ccache-action@v1.2.11
|
||||
# with:
|
||||
# key: ${{ runner.os }}-otr-ccache-${{ github.ref }}-${{ github.sha }}
|
||||
# restore-keys: |
|
||||
# ${{ runner.os }}-otr-ccache-${{ github.ref }}
|
||||
# ${{ runner.os }}-otr-ccache
|
||||
# - name: Install dependencies
|
||||
# run: |
|
||||
# sudo apt-get update
|
||||
# sudo apt-get install -y $(cat .github/workflows/apt-deps.txt)
|
||||
# - name: Cache build folders
|
||||
# uses: actions/cache@v4
|
||||
# with:
|
||||
# key: ${{ runner.os }}-otr-build-${{ github.ref }}-${{ github.sha }}
|
||||
# restore-keys: |
|
||||
# ${{ runner.os }}-otr-build-${{ github.ref }}
|
||||
# ${{ runner.os }}-otr-build
|
||||
# path: |
|
||||
# build-cmake
|
||||
# SDL2-2.28.5
|
||||
# tinyxml2-10.0.0
|
||||
# - name: Install latest SDL
|
||||
# run: |
|
||||
# export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
|
||||
# if [ ! -d "SDL2-2.28.5" ]; then
|
||||
# wget https://www.libsdl.org/release/SDL2-2.28.5.tar.gz
|
||||
# tar -xzf SDL2-2.28.5.tar.gz
|
||||
# fi
|
||||
# cd SDL2-2.28.5
|
||||
# ./configure --enable-hidapi-libusb
|
||||
# make -j 10
|
||||
# sudo make install
|
||||
# sudo cp -av /usr/local/lib/libSDL* /lib/x86_64-linux-gnu/
|
||||
# - name: Install latest tinyxml2
|
||||
# run: |
|
||||
# sudo apt-get remove libtinyxml2-dev
|
||||
# export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
|
||||
# if [ ! -d "tinyxml2-10.0.0" ]; then
|
||||
# wget https://github.com/leethomason/tinyxml2/archive/refs/tags/10.0.0.tar.gz
|
||||
# tar -xzf 10.0.0.tar.gz
|
||||
# fi
|
||||
# cd tinyxml2-10.0.0
|
||||
# mkdir -p build
|
||||
# cd build
|
||||
# cmake ..
|
||||
# make
|
||||
# sudo make install
|
||||
# - name: Generate 2ship.o2r
|
||||
# run: |
|
||||
# export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
|
||||
# cmake --no-warn-unused-cli -H. -Bbuild-cmake -GNinja -DCMAKE_BUILD_TYPE:STRING=Release
|
||||
# cmake --build build-cmake --config Release --target Generate2ShipOtr -j3
|
||||
# - uses: actions/upload-artifact@v4
|
||||
# with:
|
||||
# name: 2ship.o2r
|
||||
# path: 2ship.o2r
|
||||
# retention-days: 1
|
||||
|
||||
build-macos:
|
||||
# needs: generate-2ship-otr
|
||||
runs-on: macos-14
|
||||
generate-2ship-otr:
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
@@ -173,105 +107,30 @@ jobs:
|
||||
- name: ccache
|
||||
uses: hendrikmuhs/ccache-action@v1.2.13
|
||||
with:
|
||||
create-symlink: true
|
||||
key: ${{ runner.os }}-14-ccache-${{ github.ref }}-${{ github.sha }}
|
||||
key: ${{ runner.os }}-otr-ccache-${{ github.ref }}-${{ github.sha }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-14-ccache-${{ github.ref }}
|
||||
${{ runner.os }}-14-ccache
|
||||
- name: Cache MacPorts
|
||||
id: cache-macports
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: /opt/local/
|
||||
key: ${{ runner.os }}-macports-${{ hashFiles('.github/workflows/macports-deps.txt') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-macports
|
||||
- name: Install MacPorts (if necessary)
|
||||
run: |
|
||||
if [ -d /opt/local/ ]; then
|
||||
echo "MacPorts already installed"
|
||||
else
|
||||
wget https://github.com/macports/macports-base/releases/download/v2.9.3/MacPorts-2.9.3-14-Sonoma.pkg
|
||||
sudo installer -pkg ./MacPorts-2.9.3-14-Sonoma.pkg -target /
|
||||
fi
|
||||
echo "/opt/local/bin:/opt/local/sbin" >> $GITHUB_PATH
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
brew uninstall --ignore-dependencies libpng
|
||||
sudo port install $(cat .github/workflows/macports-deps.txt)
|
||||
brew install ninja
|
||||
# - name: Download 2ship.o2r
|
||||
# uses: actions/download-artifact@v4
|
||||
# with:
|
||||
# name: 2ship.o2r
|
||||
# path: build-cmake/mm
|
||||
- name: Build 2Ship
|
||||
run: |
|
||||
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
|
||||
cmake --no-warn-unused-cli -H. -Bbuild-cmake -GNinja -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64"
|
||||
cmake --build build-cmake --config Release --target Generate2ShipOtr --parallel 10
|
||||
cmake --build build-cmake --config Release --parallel 10
|
||||
(cd build-cmake && cpack)
|
||||
|
||||
mv _packages/*.dmg 2Ship.dmg
|
||||
mv README.md readme.txt
|
||||
# - name: Upload build
|
||||
# if: ${{ startsWith(github.ref, 'refs/heads/develop') }}
|
||||
# uses: actions/upload-artifact@v4
|
||||
# with:
|
||||
# name: 2ship-mac
|
||||
# path: |
|
||||
# 2Ship.dmg
|
||||
# readme.txt
|
||||
- name: Zip build
|
||||
run: |
|
||||
mkdir -p _release
|
||||
zip -qq _release/2ship-mac.zip 2ship.dmg readme.txt
|
||||
- name: Upload build
|
||||
if: ${{ startsWith(github.ref, 'refs/heads/develop') }}
|
||||
uses: ryand56/r2-upload-action@latest
|
||||
with:
|
||||
r2-account-id: ${{ secrets.R2_ACCOUNT_ID }}
|
||||
r2-access-key-id: ${{ secrets.R2_ACCESS_KEY_ID }}
|
||||
r2-secret-access-key: ${{ secrets.R2_SECRET_ACCESS_KEY }}
|
||||
r2-bucket: ${{ secrets.R2_BUCKET }}
|
||||
source-dir: _release
|
||||
destination-dir: ./
|
||||
|
||||
build-linux:
|
||||
# needs: generate-2ship-otr
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true
|
||||
${{ runner.os }}-otr-ccache-${{ github.ref }}
|
||||
${{ runner.os }}-otr-ccache-
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y $(cat .github/workflows/apt-deps.txt)
|
||||
- name: ccache
|
||||
uses: hendrikmuhs/ccache-action@v1.2.11
|
||||
with:
|
||||
key: linux-ccache-${{ github.ref }}-${{ github.sha }}
|
||||
restore-keys: |
|
||||
linux-ccache-${{ github.ref }}
|
||||
linux-ccache
|
||||
sudo apt-get install -y $(cat .github/workflows/apt-deps.txt) libzip-dev zipcmp zipmerge ziptool
|
||||
- name: Cache build folders
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
key: linux-build-${{ github.ref }}-${{ github.sha }}
|
||||
key: ${{ runner.os }}-otr-build-${{ github.ref }}-${{ github.sha }}
|
||||
restore-keys: |
|
||||
linux-build-${{ github.ref }}
|
||||
linux-build
|
||||
${{ runner.os }}-otr-build-${{ github.ref }}
|
||||
${{ runner.os }}-otr-build-
|
||||
path: |
|
||||
build-cmake
|
||||
SDL2-2.28.5
|
||||
SDL2_net-2.2.0
|
||||
tinyxml2-10.0.0
|
||||
- name: Install latest SDL
|
||||
run: |
|
||||
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
|
||||
if [ ! -d "SDL2-2.28.5" ]; then
|
||||
wget https://www.libsdl.org/release/SDL2-2.28.5.tar.gz
|
||||
wget https://github.com/libsdl-org/SDL/releases/download/release-2.28.5/SDL2-2.28.5.tar.gz
|
||||
tar -xzf SDL2-2.28.5.tar.gz
|
||||
fi
|
||||
cd SDL2-2.28.5
|
||||
@@ -293,28 +152,162 @@ jobs:
|
||||
cmake ..
|
||||
make
|
||||
sudo make install
|
||||
- name: Install latest SDL_net
|
||||
- name: Generate 2ship.o2r
|
||||
run: |
|
||||
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
|
||||
if [ ! -d "SDL2_net-2.2.0" ]; then
|
||||
wget https://www.libsdl.org/projects/SDL_net/release/SDL2_net-2.2.0.tar.gz
|
||||
tar -xzf SDL2_net-2.2.0.tar.gz
|
||||
cmake --no-warn-unused-cli -H. -Bbuild-cmake -GNinja -DCMAKE_BUILD_TYPE:STRING=Release
|
||||
cmake --build build-cmake --config Release --target Generate2ShipOtr -j3
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: 2ship.o2r
|
||||
path: 2ship.o2r
|
||||
retention-days: 1
|
||||
|
||||
build-macos:
|
||||
needs: generate-2ship-otr
|
||||
runs-on: macos-14
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true
|
||||
- name: ccache
|
||||
uses: hendrikmuhs/ccache-action@v1.2.13
|
||||
with:
|
||||
create-symlink: true
|
||||
key: ${{ runner.os }}-14-ccache-${{ github.ref }}-${{ github.sha }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-14-ccache-${{ github.ref }}
|
||||
${{ runner.os }}-14-ccache-
|
||||
# Needed to apply sudo for macports cache restore
|
||||
- name: Install gtar wrapper
|
||||
run: |
|
||||
sudo mv /opt/homebrew/bin/gtar /opt/homebrew/bin/gtar.orig
|
||||
sudo cp .github/workflows/gtar /opt/homebrew/bin/gtar
|
||||
sudo chmod +x /opt/homebrew/bin/gtar
|
||||
- name: Cache MacPorts
|
||||
id: cache-macports
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: /opt/local/
|
||||
key: ${{ runner.os }}-14-macports-${{ hashFiles('.github/workflows/macports-deps.txt') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-14-macports-
|
||||
# Updated PATH applies to the next step and onwards
|
||||
- name: Install MacPorts (if necessary)
|
||||
run: |
|
||||
if command -v /opt/local/bin/port 2>&1 >/dev/null; then
|
||||
echo "MacPorts already installed"
|
||||
else
|
||||
echo "Installing MacPorts"
|
||||
wget https://github.com/macports/macports-base/releases/download/v2.9.3/MacPorts-2.9.3-14-Sonoma.pkg
|
||||
sudo installer -pkg ./MacPorts-2.9.3-14-Sonoma.pkg -target /
|
||||
fi
|
||||
cd SDL2_net-2.2.0
|
||||
./configure
|
||||
echo "/opt/local/bin:/opt/local/sbin" >> "$GITHUB_PATH"
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
brew uninstall --ignore-dependencies libpng
|
||||
sudo port install $(cat .github/workflows/macports-deps.txt)
|
||||
brew install ninja
|
||||
- name: Download 2ship.o2r
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: 2ship.o2r
|
||||
path: build-cmake/mm
|
||||
- name: Build 2Ship
|
||||
run: |
|
||||
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
|
||||
cmake --no-warn-unused-cli -H. -Bbuild-cmake -GNinja -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64"
|
||||
cmake --build build-cmake --config Release --parallel 10
|
||||
(cd build-cmake && cpack)
|
||||
|
||||
mv _packages/*.dmg 2Ship.dmg
|
||||
mv README.md readme.txt
|
||||
- name: Upload build
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: 2ship-mac
|
||||
path: |
|
||||
2Ship.dmg
|
||||
readme.txt
|
||||
|
||||
build-linux:
|
||||
needs: generate-2ship-otr
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y $(cat .github/workflows/apt-deps.txt)
|
||||
- name: ccache
|
||||
uses: hendrikmuhs/ccache-action@v1.2.13
|
||||
with:
|
||||
key: linux-ccache-${{ github.ref }}-${{ github.sha }}
|
||||
restore-keys: |
|
||||
linux-ccache-${{ github.ref }}
|
||||
linux-ccache-
|
||||
- name: Cache build folders
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
key: linux-build-${{ github.ref }}-${{ github.sha }}
|
||||
restore-keys: |
|
||||
linux-build-${{ github.ref }}
|
||||
linux-build-
|
||||
path: |
|
||||
SDL2-2.30.3
|
||||
tinyxml2-10.0.0
|
||||
libzip-1.10.1
|
||||
- name: Install latest SDL
|
||||
run: |
|
||||
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
|
||||
if [ ! -d "SDL2-2.30.3" ]; then
|
||||
wget https://github.com/libsdl-org/SDL/releases/download/release-2.30.3/SDL2-2.30.3.tar.gz
|
||||
tar -xzf SDL2-2.30.3.tar.gz
|
||||
fi
|
||||
cd SDL2-2.30.3
|
||||
./configure --enable-hidapi-libusb
|
||||
make -j 10
|
||||
sudo make install
|
||||
sudo cp -av /usr/local/lib/libSDL* /lib/x86_64-linux-gnu/
|
||||
# - name: Download 2ship.o2r
|
||||
# uses: actions/download-artifact@v4
|
||||
# with:
|
||||
# name: 2ship.o2r
|
||||
# path: build-cmake/mm
|
||||
- name: Install latest tinyxml2
|
||||
run: |
|
||||
sudo apt-get remove libtinyxml2-dev
|
||||
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
|
||||
if [ ! -d "tinyxml2-10.0.0" ]; then
|
||||
wget https://github.com/leethomason/tinyxml2/archive/refs/tags/10.0.0.tar.gz
|
||||
tar -xzf 10.0.0.tar.gz
|
||||
fi
|
||||
cd tinyxml2-10.0.0
|
||||
mkdir -p build
|
||||
cd build
|
||||
cmake ..
|
||||
make
|
||||
sudo make install
|
||||
- name: Install libzip without crypto
|
||||
run: |
|
||||
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
|
||||
if [ ! -d "libzip-1.10.1" ]; then
|
||||
wget https://github.com/nih-at/libzip/releases/download/v1.10.1/libzip-1.10.1.tar.gz
|
||||
tar -xzf libzip-1.10.1.tar.gz
|
||||
fi
|
||||
cd libzip-1.10.1
|
||||
mkdir -p build
|
||||
cd build
|
||||
cmake .. -DENABLE_COMMONCRYPTO=OFF -DENABLE_GNUTLS=OFF -DENABLE_MBEDTLS=OFF -DENABLE_OPENSSL=OFF
|
||||
make
|
||||
sudo make install
|
||||
sudo cp -av /usr/local/lib/libzip* /lib/x86_64-linux-gnu/
|
||||
- name: Download 2ship.o2r
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: 2ship.o2r
|
||||
path: build-cmake/mm
|
||||
- name: Build 2Ship
|
||||
run: |
|
||||
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
|
||||
cmake --no-warn-unused-cli -H. -Bbuild-cmake -GNinja -DCMAKE_BUILD_TYPE:STRING=Release -DBUILD_REMOTE_CONTROL=1
|
||||
cmake --build build-cmake --config Release --target Generate2ShipOtr -j3
|
||||
cmake --build build-cmake --config Release -j3
|
||||
(cd build-cmake && cpack -G External)
|
||||
|
||||
@@ -323,32 +316,16 @@ jobs:
|
||||
env:
|
||||
CC: gcc-12
|
||||
CXX: g++-12
|
||||
# Temporarily replaced with an upload to R2 until we go public
|
||||
# - name: Upload build
|
||||
# uses: actions/upload-artifact@v4
|
||||
# with:
|
||||
# name: 2ship-linux
|
||||
# path: |
|
||||
# 2ship.appimage
|
||||
# readme.txt
|
||||
# Remove Zip step when uploading directly to GH artifactory
|
||||
- name: Zip build
|
||||
run: |
|
||||
mkdir -p _release
|
||||
zip -qq _release/2ship-linux.zip 2ship.appimage readme.txt
|
||||
- name: Upload build
|
||||
if: ${{ startsWith(github.ref, 'refs/heads/develop') }}
|
||||
uses: ryand56/r2-upload-action@latest
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
r2-account-id: ${{ secrets.R2_ACCOUNT_ID }}
|
||||
r2-access-key-id: ${{ secrets.R2_ACCESS_KEY_ID }}
|
||||
r2-secret-access-key: ${{ secrets.R2_SECRET_ACCESS_KEY }}
|
||||
r2-bucket: ${{ secrets.R2_BUCKET }}
|
||||
source-dir: _release
|
||||
destination-dir: ./
|
||||
name: 2ship-linux
|
||||
path: |
|
||||
2ship.appimage
|
||||
readme.txt
|
||||
|
||||
build-windows:
|
||||
# needs: generate-2ship-otr
|
||||
needs: generate-2ship-otr
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- name: Install dependencies
|
||||
@@ -359,60 +336,47 @@ jobs:
|
||||
with:
|
||||
submodules: true
|
||||
- name: ccache
|
||||
uses: hendrikmuhs/ccache-action@v1.2.11
|
||||
uses: hendrikmuhs/ccache-action@v1.2.13
|
||||
with:
|
||||
variant: sccache
|
||||
max-size: "1G"
|
||||
key: ${{ runner.os }}-ccache-${{ github.ref }}-${{ github.sha }}
|
||||
key: ${{ runner.os }}-ccache1-${{ github.ref }}-${{ github.sha }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-ccache-${{ github.ref }}
|
||||
${{ runner.os }}-ccache
|
||||
${{ runner.os }}-ccache1-${{ github.ref }}
|
||||
${{ runner.os }}-ccache1-
|
||||
- name: Cache build folder
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
save-always: true
|
||||
key: ${{ runner.os }}-build-${{ github.ref }}-${{ github.sha }}
|
||||
key: ${{ runner.os }}-build1-${{ github.ref }}-${{ github.sha }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-build-${{ github.ref }}
|
||||
${{ runner.os }}-build
|
||||
${{ runner.os }}-build1-${{ github.ref }}
|
||||
${{ runner.os }}-build1-
|
||||
path: |
|
||||
build-windows
|
||||
vcpkg
|
||||
- name: Configure Developer Command Prompt
|
||||
uses: ilammy/msvc-dev-cmd@v1
|
||||
# - name: Download 2ship.o2r
|
||||
# uses: actions/download-artifact@v4
|
||||
# with:
|
||||
# name: 2ship.o2r
|
||||
# path: build-windows/mm
|
||||
- name: Download 2ship.o2r
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: 2ship.o2r
|
||||
path: build-windows/mm
|
||||
- name: Build 2Ship
|
||||
env:
|
||||
env:
|
||||
VCPKG_ROOT: ${{github.workspace}}/vcpkg
|
||||
run: |
|
||||
set $env:PATH="$env:USERPROFILE/.cargo/bin;$env:PATH"
|
||||
cmake -S . -B build-windows -G Ninja -DCMAKE_MAKE_PROGRAM=ninja -DCMAKE_BUILD_TYPE:STRING=Release
|
||||
cmake --build build-windows --config Release --target Generate2ShipOtr --parallel 10
|
||||
cmake -S . -B build-windows -G Ninja -DCMAKE_MAKE_PROGRAM=ninja -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache
|
||||
cmake --build build-windows --config Release --parallel 10
|
||||
|
||||
(cd build-windows && cpack)
|
||||
cd ..
|
||||
mv _packages/*.zip _packages/2ship-windows.zip
|
||||
# Temporarily replaced with an upload to R2 until we go public
|
||||
# - name: Unzip package
|
||||
# run: Expand-Archive -Path _packages/2ship-windows.zip -DestinationPath 2ship-windows
|
||||
# - name: Upload build
|
||||
# if: ${{ startsWith(github.ref, 'refs/heads/develop') }}
|
||||
# uses: actions/upload-artifact@v4
|
||||
# with:
|
||||
# name: 2ship-windows
|
||||
# path: 2ship-windows
|
||||
- name: Unzip package
|
||||
run: Expand-Archive -Path _packages/2ship-windows.zip -DestinationPath 2ship-windows
|
||||
- name: Upload build
|
||||
if: ${{ startsWith(github.ref, 'refs/heads/develop') }}
|
||||
uses: ryand56/r2-upload-action@latest
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
r2-account-id: ${{ secrets.R2_ACCOUNT_ID }}
|
||||
r2-access-key-id: ${{ secrets.R2_ACCESS_KEY_ID }}
|
||||
r2-secret-access-key: ${{ secrets.R2_SECRET_ACCESS_KEY }}
|
||||
r2-bucket: ${{ secrets.R2_BUCKET }}
|
||||
source-dir: _packages
|
||||
destination-dir: ./
|
||||
name: 2ship-windows
|
||||
path: 2ship-windows
|
||||
|
||||
@@ -12,7 +12,7 @@ jobs:
|
||||
if: ${{ github.event.workflow_run.event == 'pull_request' }}
|
||||
steps:
|
||||
- id: 'pr-number'
|
||||
uses: actions/github-script@v6
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
result-encoding: string
|
||||
script: |
|
||||
@@ -20,8 +20,9 @@ jobs:
|
||||
const pullHeadSHA = '${{github.event.workflow_run.head_sha}}';
|
||||
const pullUserId = ${{github.event.sender.id}};
|
||||
const prNumber = await (async () => {
|
||||
const pulls = await github.rest.pulls.list({owner, repo});
|
||||
for await (const {data} of github.paginate.iterator(pulls)) {
|
||||
for await (const { data } of github.paginate.iterator(
|
||||
github.rest.pulls.list, { owner, repo }
|
||||
)) {
|
||||
for (const pull of data) {
|
||||
if (pull.head.sha === pullHeadSHA && pull.user.id === pullUserId) {
|
||||
return pull.number;
|
||||
@@ -36,7 +37,7 @@ jobs:
|
||||
|
||||
return prNumber;
|
||||
- id: 'artifacts-text'
|
||||
uses: actions/github-script@v6
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
result-encoding: string
|
||||
script: |
|
||||
@@ -48,12 +49,13 @@ jobs:
|
||||
|
||||
return allArtifacts.data.artifacts.reduce((acc, item) => {
|
||||
if (item.name === "assets") return acc;
|
||||
if (item.name === "2ship.o2r") return acc;
|
||||
acc += `
|
||||
- [${item.name}.zip](https://nightly.link/${context.repo.owner}/${context.repo.repo}/actions/artifacts/${item.id}.zip?h=20a00267c7ffeb2eb80ab31f356f2ba5f120f43c)`;
|
||||
- [${item.name}.zip](https://nightly.link/${context.repo.owner}/${context.repo.repo}/actions/artifacts/${item.id}.zip)`;
|
||||
return acc;
|
||||
}, '### Build Artifacts');
|
||||
- id: 'add-to-pr'
|
||||
uses: garrettjoecox/pr-section@3.1.0
|
||||
uses: garrettjoecox/pr-section@4.0.0
|
||||
with:
|
||||
repo-token: '${{ secrets.GITHUB_TOKEN }}'
|
||||
pr-number: ${{ steps.pr-number.outputs.result }}
|
||||
|
||||
@@ -66,3 +66,4 @@ _packages/
|
||||
|
||||
/mm/src/boot/build.c
|
||||
/mm/windows/properties.h
|
||||
/clang-format.exe
|
||||
|
||||
+3
-3
@@ -1,9 +1,9 @@
|
||||
[submodule "libultraship"]
|
||||
path = libultraship
|
||||
url = https://github.com/kenix3/libultraship.git
|
||||
url = https://github.com/Waterdish/libultraship.git
|
||||
[submodule "OTRExporter"]
|
||||
path = OTRExporter
|
||||
url = https://github.com/louist103/OTRExporter.git
|
||||
url = https://github.com/Waterdish/OTRExporter.git
|
||||
[submodule "ZAPDTR"]
|
||||
path = ZAPDTR
|
||||
url = https://github.com/louist103/ZAPDTR.git
|
||||
url = https://github.com/Waterdish/ZAPDTR.git
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
# Gradle files
|
||||
.gradle/
|
||||
build/
|
||||
|
||||
# Local configuration file (sdk path, etc)
|
||||
local.properties
|
||||
|
||||
# Log/OS Files
|
||||
*.log
|
||||
|
||||
# Android Studio generated files and folders
|
||||
captures/
|
||||
.externalNativeBuild/
|
||||
.cxx/
|
||||
*.apk
|
||||
output.json
|
||||
app/release/
|
||||
|
||||
# IntelliJ
|
||||
*.iml
|
||||
.idea/
|
||||
misc.xml
|
||||
deploymentTargetDropDown.xml
|
||||
render.experimental.xml
|
||||
|
||||
# Keystore files
|
||||
*.jks
|
||||
*.keystore
|
||||
|
||||
# Google Services (e.g. APIs or Firebase)
|
||||
google-services.json
|
||||
|
||||
# Android Profiling
|
||||
*.hprof
|
||||
@@ -0,0 +1,86 @@
|
||||
def buildAsLibrary = project.hasProperty('BUILD_AS_LIBRARY');
|
||||
def buildAsApplication = !buildAsLibrary
|
||||
if (buildAsApplication) {
|
||||
apply plugin: 'com.android.application'
|
||||
}
|
||||
else {
|
||||
apply plugin: 'com.android.library'
|
||||
}
|
||||
|
||||
android {
|
||||
ndkPath "/home/waterdish/Android/Sdk/ndk/26.0.10792818" // Point to your own NDK
|
||||
compileSdkVersion 31
|
||||
defaultConfig {
|
||||
if (buildAsApplication) {
|
||||
applicationId "com.dishii.mm"
|
||||
}
|
||||
minSdkVersion 24
|
||||
targetSdkVersion 31
|
||||
versionCode 4
|
||||
versionName "1.1.1"
|
||||
externalNativeBuild {
|
||||
//ndkBuild {
|
||||
// arguments "APP_PLATFORM=android-23"
|
||||
// abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
|
||||
//}
|
||||
cmake {
|
||||
arguments "-DSDL_SHARED=ON", "-DANDROID_STL=c++_static", "-DHAVE_LD_VERSION_SCRIPT=OFF",'-DUSE_OPENGLES=ON'
|
||||
abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
|
||||
//abiFilters 'arm64-v8a'
|
||||
}
|
||||
}
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
applicationVariants.all { variant ->
|
||||
tasks["merge${variant.name.capitalize()}Assets"]
|
||||
.dependsOn("externalNativeBuild${variant.name.capitalize()}")
|
||||
}
|
||||
if (!project.hasProperty('EXCLUDE_NATIVE_LIBS')) {
|
||||
sourceSets.main {
|
||||
jniLibs.srcDir 'libs'
|
||||
}
|
||||
externalNativeBuild {
|
||||
//ndkBuild {
|
||||
// path 'jni/Android.mk'
|
||||
//}
|
||||
cmake {
|
||||
path '../../CMakeLists.txt'
|
||||
version "3.25.1"
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
lintOptions {
|
||||
abortOnError false
|
||||
}
|
||||
|
||||
if (buildAsLibrary) {
|
||||
libraryVariants.all { variant ->
|
||||
variant.outputs.each { output ->
|
||||
def outputFile = output.outputFile
|
||||
if (outputFile != null && outputFile.name.endsWith(".aar")) {
|
||||
def fileName = "org.libsdl.app.aar";
|
||||
output.outputFile = new File(outputFile.parent, fileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
||||
implementation 'androidx.core:core:1.7.0' // Use the latest version
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
||||
}
|
||||
|
||||
task wrapper(type: Wrapper) {
|
||||
gradleVersion = '7.0.3'
|
||||
}
|
||||
|
||||
task prepareKotlinBuildScriptModel {
|
||||
}
|
||||
BIN
Binary file not shown.
@@ -0,0 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
+234
@@ -0,0 +1,234 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright © 2015-2021 the original authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Gradle start up script for POSIX generated by Gradle.
|
||||
#
|
||||
# Important for running:
|
||||
#
|
||||
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||
# noncompliant, but you have some other compliant shell such as ksh or
|
||||
# bash, then to run this script, type that shell name before the whole
|
||||
# command line, like:
|
||||
#
|
||||
# ksh Gradle
|
||||
#
|
||||
# Busybox and similar reduced shells will NOT work, because this script
|
||||
# requires all of these POSIX shell features:
|
||||
# * functions;
|
||||
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||
# * compound commands having a testable exit status, especially «case»;
|
||||
# * various built-in commands including «command», «set», and «ulimit».
|
||||
#
|
||||
# Important for patching:
|
||||
#
|
||||
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||
#
|
||||
# The "traditional" practice of packing multiple parameters into a
|
||||
# space-separated string is a well documented source of bugs and security
|
||||
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||
# options in "$@", and eventually passing that to Java.
|
||||
#
|
||||
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||
# see the in-line comments for details.
|
||||
#
|
||||
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
|
||||
# Resolve links: $0 may be a link
|
||||
app_path=$0
|
||||
|
||||
# Need this for daisy-chained symlinks.
|
||||
while
|
||||
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||
[ -h "$app_path" ]
|
||||
do
|
||||
ls=$( ls -ld "$app_path" )
|
||||
link=${ls#*' -> '}
|
||||
case $link in #(
|
||||
/*) app_path=$link ;; #(
|
||||
*) app_path=$APP_HOME$link ;;
|
||||
esac
|
||||
done
|
||||
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=${0##*/}
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
} >&2
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
} >&2
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "$( uname )" in #(
|
||||
CYGWIN* ) cygwin=true ;; #(
|
||||
Darwin* ) darwin=true ;; #(
|
||||
MSYS* | MINGW* ) msys=true ;; #(
|
||||
NONSTOP* ) nonstop=true ;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||
else
|
||||
JAVACMD=$JAVA_HOME/bin/java
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD=java
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
case $MAX_FD in #(
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
fi
|
||||
|
||||
# Collect all arguments for the java command, stacking in reverse order:
|
||||
# * args from the command line
|
||||
# * the main class name
|
||||
# * -classpath
|
||||
# * -D...appname settings
|
||||
# * --module-path (only if needed)
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if "$cygwin" || "$msys" ; then
|
||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||
|
||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
for arg do
|
||||
if
|
||||
case $arg in #(
|
||||
-*) false ;; # don't mess with options #(
|
||||
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||
[ -e "$t" ] ;; #(
|
||||
*) false ;;
|
||||
esac
|
||||
then
|
||||
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||
fi
|
||||
# Roll the args list around exactly as many times as the number of
|
||||
# args, so each arg winds up back in the position where it started, but
|
||||
# possibly modified.
|
||||
#
|
||||
# NB: a `for` loop captures its iteration list before it begins, so
|
||||
# changing the positional parameters here affects neither the number of
|
||||
# iterations, nor the values presented in `arg`.
|
||||
shift # remove old arg
|
||||
set -- "$@" "$arg" # push replacement arg
|
||||
done
|
||||
fi
|
||||
|
||||
# Collect all arguments for the java command;
|
||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||
# shell script including quotes and variable substitutions, so put them in
|
||||
# double quotes to make sure that they get re-expanded; and
|
||||
# * put everything else in single quotes, so that it's not re-expanded.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-classpath "$CLASSPATH" \
|
||||
org.gradle.wrapper.GradleWrapperMain \
|
||||
"$@"
|
||||
|
||||
# Use "xargs" to parse quoted args.
|
||||
#
|
||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||
#
|
||||
# In Bash we could simply go:
|
||||
#
|
||||
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||
# set -- "${ARGS[@]}" "$@"
|
||||
#
|
||||
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||
# character that might be a shell metacharacter, then use eval to reverse
|
||||
# that process (while maintaining the separation between arguments), and wrap
|
||||
# the whole thing up as a single "set" statement.
|
||||
#
|
||||
# This will of course break if any of these variables contains a newline or
|
||||
# an unmatched quote.
|
||||
#
|
||||
|
||||
eval "set -- $(
|
||||
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||
xargs -n1 |
|
||||
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||
tr '\n' ' '
|
||||
)" '"$@"'
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
Vendored
+89
@@ -0,0 +1,89 @@
|
||||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
Vendored
+17
@@ -0,0 +1,17 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# By default, the flags in this file are appended to flags specified
|
||||
# in [sdk]/tools/proguard/proguard-android.txt
|
||||
# You can edit the include path and order by changing the proguardFiles
|
||||
# directive in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# Add any project specific keep options here:
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
@@ -0,0 +1,114 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Replace com.test.game with the identifier of your game below, e.g.
|
||||
com.gamemaker.game
|
||||
-->
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.dishii.mm"
|
||||
android:versionCode="4"
|
||||
android:versionName="1.1.1"
|
||||
android:installLocation="auto">
|
||||
|
||||
<!-- OpenGL ES 3.0 -->
|
||||
<uses-feature android:glEsVersion="0x00030000"/>
|
||||
|
||||
<!-- Touchscreen support -->
|
||||
<uses-feature
|
||||
android:name="android.hardware.touchscreen"
|
||||
android:required="false" />
|
||||
|
||||
<!-- Game controller support -->
|
||||
<uses-feature
|
||||
android:name="android.hardware.bluetooth"
|
||||
android:required="false" />
|
||||
<uses-feature
|
||||
android:name="android.hardware.gamepad"
|
||||
android:required="false" />
|
||||
<uses-feature
|
||||
android:name="android.hardware.usb.host"
|
||||
android:required="false" />
|
||||
|
||||
<!-- External mouse input events -->
|
||||
<uses-feature
|
||||
android:name="android.hardware.type.pc"
|
||||
android:required="false" />
|
||||
|
||||
<!-- Gyroscope support -->
|
||||
<uses-feature
|
||||
android:name="android.hardware.sensor.gyroscope"
|
||||
android:required="false"/>
|
||||
|
||||
<!-- Audio recording support -->
|
||||
<!-- if you want to capture audio, uncomment this. -->
|
||||
<!-- <uses-feature
|
||||
android:name="android.hardware.microphone"
|
||||
android:required="false" /> -->
|
||||
|
||||
<!-- Allow downloading to the external storage on Android 5.1 and older -->
|
||||
<!-- <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="22" /> -->
|
||||
|
||||
<!-- Allow access to Bluetooth devices -->
|
||||
<!-- Currently this is just for Steam Controller support and requires setting SDL_HINT_JOYSTICK_HIDAPI_STEAM -->
|
||||
<!-- <uses-permission android:name="android.permission.BLUETOOTH" android:maxSdkVersion="30" /> -->
|
||||
<!-- <uses-permission android:name="android.permission.BLUETOOTH_CONNECT" /> -->
|
||||
|
||||
<!-- Allow access to the vibrator -->
|
||||
<uses-permission android:name="android.permission.VIBRATE" />
|
||||
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
|
||||
<!-- if you want to capture audio, uncomment this. -->
|
||||
<!-- <uses-permission android:name="android.permission.RECORD_AUDIO" /> -->
|
||||
|
||||
<!-- Create a Java class extending SDLActivity and place it in a
|
||||
directory under app/src/main/java matching the package, e.g. app/src/main/java/com/gamemaker/game/MyGame.java
|
||||
|
||||
then replace "SDLActivity" with the name of your class (e.g. "MyGame")
|
||||
in the XML below.
|
||||
|
||||
An example Java class can be found in README-android.md
|
||||
-->
|
||||
<application android:label="@string/app_name"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:allowBackup="true"
|
||||
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
|
||||
android:hardwareAccelerated="true"
|
||||
android:appCategory="game" >
|
||||
|
||||
|
||||
<!-- Example of setting SDL hints from AndroidManifest.xml:
|
||||
<meta-data android:name="SDL_ENV.SDL_ACCELEROMETER_AS_JOYSTICK" android:value="0"/>
|
||||
-->
|
||||
<meta-data android:name="SDL_ENV.SDL_ANDROID_TRAP_BACK_BUTTON" android:value="1"/>
|
||||
<meta-data android:name="SDL_ENV.SDL_IOS_ORIENTATIONS" android:value="LandscapeLeft LandscapeRight"/>
|
||||
|
||||
|
||||
<activity android:name="MainActivity"
|
||||
android:label="@string/app_name"
|
||||
android:alwaysRetainTaskState="true"
|
||||
android:launchMode="singleInstance"
|
||||
android:configChanges="layoutDirection|locale|orientation|uiMode|screenLayout|screenSize|smallestScreenSize|keyboard|keyboardHidden|navigation"
|
||||
android:preferMinimalPostProcessing="true"
|
||||
android:exported="true"
|
||||
android:screenOrientation="landscape"
|
||||
>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
<!-- Let Android know that we can handle some USB devices and should receive this event -->
|
||||
<intent-filter>
|
||||
<action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" />
|
||||
</intent-filter>
|
||||
<!-- Drop file event -->
|
||||
<!--
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<data android:mimeType="*/*" />
|
||||
</intent-filter>
|
||||
-->
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -0,0 +1,2 @@
|
||||
# Extractor Assets Copied by CMake during buildtime
|
||||
assets/
|
||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
After Width: | Height: | Size: 90 KiB |
@@ -0,0 +1,61 @@
|
||||
package com.dishii.mm;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.AssetManager;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
||||
public class AssetCopyUtil {
|
||||
|
||||
public static void copyAssetsToExternal(Context context, String assetsFolderPath, String externalFolderPath) throws IOException {
|
||||
AssetManager assetManager = context.getAssets();
|
||||
String[] assetFiles = assetManager.list(assetsFolderPath);
|
||||
|
||||
for (String assetFile : assetFiles) {
|
||||
String assetPath = assetsFolderPath + File.separator + assetFile;
|
||||
String externalPath = externalFolderPath + File.separator + assetFile;
|
||||
|
||||
if (assetManager.list(assetPath).length > 0) {
|
||||
// It's a directory
|
||||
// Check if the directory exists in the external storage
|
||||
File externalDir = new File(externalPath);
|
||||
if (!externalDir.exists()) {
|
||||
externalDir.mkdirs(); // Create the directory if it doesn't exist
|
||||
}
|
||||
|
||||
// Recursively copy contents of the directory
|
||||
copyAssetsToExternal(context, assetPath, externalPath);
|
||||
} else {
|
||||
// It's a file
|
||||
File externalFile = new File(externalPath);
|
||||
if (!externalFile.exists()) {
|
||||
// Check if the file exists in the external storage
|
||||
InputStream in = null;
|
||||
OutputStream out = null;
|
||||
|
||||
try {
|
||||
in = assetManager.open(assetPath);
|
||||
out = new FileOutputStream(externalPath);
|
||||
|
||||
byte[] buffer = new byte[1024];
|
||||
int read;
|
||||
while ((read = in.read(buffer)) != -1) {
|
||||
out.write(buffer, 0, read);
|
||||
}
|
||||
|
||||
} finally {
|
||||
if (in != null) {
|
||||
in.close();
|
||||
}
|
||||
if (out != null) {
|
||||
out.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.dishii.mm;
|
||||
|
||||
public class ControllerButtons {
|
||||
// Xbox Buttons
|
||||
public static final int BUTTON_A = 0;
|
||||
public static final int BUTTON_B = 1;
|
||||
public static final int BUTTON_X = 2;
|
||||
public static final int BUTTON_Y = 3;
|
||||
public static final int BUTTON_LB = 9; // Left Bumper
|
||||
public static final int BUTTON_RB = -5; // Right Bumper
|
||||
public static final int BUTTON_BACK = 4;
|
||||
public static final int BUTTON_START = 6;
|
||||
public static final int BUTTON_DPAD_UP = 11;
|
||||
public static final int BUTTON_DPAD_DOWN = 12;
|
||||
public static final int BUTTON_DPAD_LEFT = 13;
|
||||
public static final int BUTTON_DPAD_RIGHT = 14;
|
||||
|
||||
// Xbox Axis (Joysticks and Triggers)
|
||||
public static final int AXIS_LX = 0; // Left stick X
|
||||
public static final int AXIS_LY = 1; // Left stick Y
|
||||
public static final int AXIS_RX = 2; // Right stick X
|
||||
public static final int AXIS_RY = 3; // Right stick Y
|
||||
public static final int AXIS_LT = -2; // Left Trigger (negative axis)
|
||||
public static final int AXIS_RT = -4; // Right Trigger (negative axis)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,474 @@
|
||||
|
||||
package com.dishii.mm;
|
||||
import org.libsdl.app.SDLActivity;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.provider.Settings;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import android.Manifest;
|
||||
import android.content.pm.PackageManager;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import android.util.Log;
|
||||
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.FrameLayout;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
|
||||
//This class is the main SDLActivity and just sets up a bunch of default files and the input overlay
|
||||
public class MainActivity extends SDLActivity{
|
||||
|
||||
private static final int STORAGE_PERMISSION_REQUEST_CODE = 1;
|
||||
|
||||
SharedPreferences preferences;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
preferences = getSharedPreferences("com.dishii.mm.prefs",Context.MODE_PRIVATE);
|
||||
|
||||
setupControllerOverlay();
|
||||
|
||||
// Check if storage permissions are granted
|
||||
if (hasStoragePermission()) {
|
||||
doVersionCheck();
|
||||
setupFiles();
|
||||
} else {
|
||||
requestStoragePermission();
|
||||
}
|
||||
attachController();
|
||||
}
|
||||
|
||||
private void doVersionCheck(){
|
||||
int currentVersion = BuildConfig.VERSION_CODE; // Use your app's version code
|
||||
int storedVersion = preferences.getInt("appVersion", 1);
|
||||
|
||||
if (currentVersion > storedVersion) {
|
||||
deleteOutdatedAssets();
|
||||
preferences.edit().putInt("appVersion", currentVersion).apply();
|
||||
}
|
||||
}
|
||||
|
||||
private void deleteOutdatedAssets(){
|
||||
File externalSohFile = new File(getExternalFilesDir(null), "2ship.o2r");
|
||||
externalSohFile.delete();
|
||||
File externalOotFile = new File(getExternalFilesDir(null), "mm.o2r");
|
||||
externalOotFile.delete();
|
||||
File externalAssetsFolder = new File(getExternalFilesDir(null), "assets");
|
||||
deleteRecursive(externalAssetsFolder);
|
||||
|
||||
}
|
||||
|
||||
private void deleteRecursive(File fileOrDirectory) {
|
||||
if (fileOrDirectory.isDirectory()) {
|
||||
for (File child : fileOrDirectory.listFiles()) {
|
||||
deleteRecursive(child);
|
||||
}
|
||||
}
|
||||
fileOrDirectory.delete();
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Check if storage permission is granted
|
||||
private boolean hasStoragePermission() {
|
||||
return ContextCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE)
|
||||
== PackageManager.PERMISSION_GRANTED &&
|
||||
ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE)
|
||||
== PackageManager.PERMISSION_GRANTED;
|
||||
}
|
||||
|
||||
// Request storage permission
|
||||
private void requestStoragePermission() {
|
||||
ActivityCompat.requestPermissions(this,
|
||||
new String[]{Manifest.permission.READ_EXTERNAL_STORAGE,
|
||||
Manifest.permission.WRITE_EXTERNAL_STORAGE},
|
||||
STORAGE_PERMISSION_REQUEST_CODE);
|
||||
}
|
||||
|
||||
// Handle permission request result
|
||||
@Override
|
||||
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
|
||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||
if (requestCode == STORAGE_PERMISSION_REQUEST_CODE) {
|
||||
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
|
||||
setupFiles();
|
||||
} else {
|
||||
// Permission denied, handle accordingly (e.g., show a message)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void setupFiles(){
|
||||
//Copy assets folder for rom extraction
|
||||
File externalAssetsDir = new File(getExternalFilesDir(null), "assets");
|
||||
if (!externalAssetsDir.exists()) {
|
||||
try {
|
||||
externalAssetsDir.mkdirs();
|
||||
AssetCopyUtil.copyAssetsToExternal(this, "assets", externalAssetsDir.getAbsolutePath());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
//Create empty mods folder
|
||||
File externalModsDir = new File(getExternalFilesDir(null), "mods");
|
||||
externalModsDir.mkdirs();
|
||||
|
||||
//Copy 2ship.o2r
|
||||
File externalSohOtrFile = new File(getExternalFilesDir(null), "2ship.o2r");
|
||||
if (!externalSohOtrFile.exists()) {
|
||||
try {
|
||||
InputStream in = getAssets().open("2ship.o2r");
|
||||
OutputStream out = new FileOutputStream(externalSohOtrFile);
|
||||
|
||||
byte[] buffer = new byte[1024];
|
||||
int read;
|
||||
while ((read = in.read(buffer)) != -1) {
|
||||
out.write(buffer, 0, read);
|
||||
}
|
||||
|
||||
in.close();
|
||||
out.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
File configFile = new File(getExternalFilesDir(null), "2ship2harkinian.json");
|
||||
if (!configFile.exists()) {
|
||||
try {
|
||||
InputStream in = getAssets().open("2ship2harkinian.json");
|
||||
OutputStream out = new FileOutputStream(configFile);
|
||||
|
||||
byte[] buffer = new byte[1024];
|
||||
int read;
|
||||
while ((read = in.read(buffer)) != -1) {
|
||||
out.write(buffer, 0, read);
|
||||
}
|
||||
|
||||
in.close();
|
||||
out.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private native void nativeHandleSelectedFile(String filePath);
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
if (requestCode == 0 && resultCode == RESULT_OK) {
|
||||
Uri selectedFileUri = data.getData();
|
||||
String fileName = "MM.z64";
|
||||
File destinationDirectory = getExternalFilesDir(null); // The second argument can specify a subdirectory, or you can pass null to use the root directory.
|
||||
File destinationFile = new File(destinationDirectory, fileName);
|
||||
|
||||
if (destinationDirectory != null) {
|
||||
try {
|
||||
InputStream in = getContentResolver().openInputStream(selectedFileUri);
|
||||
OutputStream out = new FileOutputStream(destinationFile);
|
||||
|
||||
byte[] buffer = new byte[4096];
|
||||
int bytesRead;
|
||||
while ((bytesRead = in.read(buffer)) != -1) {
|
||||
out.write(buffer, 0, bytesRead);
|
||||
}
|
||||
|
||||
in.close();
|
||||
out.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
nativeHandleSelectedFile(destinationFile.getPath());
|
||||
}
|
||||
}
|
||||
|
||||
public void openFilePicker() {
|
||||
// Create an Intent to open the file picker dialog
|
||||
Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
|
||||
intent.setType("*/*");
|
||||
|
||||
// Start the file picker dialog
|
||||
startActivityForResult(intent, 0);
|
||||
}
|
||||
|
||||
// Check if external storage is available and writable
|
||||
private boolean isExternalStorageWritable() {
|
||||
String state = Environment.getExternalStorageState();
|
||||
return Environment.MEDIA_MOUNTED.equals(state);
|
||||
}
|
||||
|
||||
|
||||
public native void attachController();
|
||||
// Native method for setting button state
|
||||
public native void setButton(int button, boolean value);
|
||||
public native void setCameraState(int axis, float value);
|
||||
|
||||
// Native method for setting joystick axis value
|
||||
public native void setAxis(int axis, short value);
|
||||
|
||||
private Button button1, button2, button3, button4;
|
||||
private Button buttonA, buttonB, buttonX, buttonY;
|
||||
private Button buttonDpadUp, buttonDpadDown, buttonDpadLeft, buttonDpadRight;
|
||||
private Button buttonLB, buttonRB, buttonZ, buttonStart, buttonBack;
|
||||
private Button buttonToggle;
|
||||
private FrameLayout leftJoystick;
|
||||
private ImageView leftJoystickKnob;
|
||||
private View overlayView;
|
||||
|
||||
// Function to set up the controller overlay (inflate layout and initialize buttons)
|
||||
private void setupControllerOverlay() {
|
||||
// Inflate the touchcontrol_overlay layout
|
||||
LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
|
||||
overlayView = inflater.inflate(R.layout.touchcontrol_overlay, null);
|
||||
|
||||
// Set layout params for overlayView to control positioning and sizing
|
||||
FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(
|
||||
FrameLayout.LayoutParams.MATCH_PARENT,
|
||||
FrameLayout.LayoutParams.MATCH_PARENT
|
||||
);
|
||||
overlayView.setLayoutParams(layoutParams);
|
||||
// Add overlay view to the main layout (you may need to add it to a container like FrameLayout)
|
||||
ViewGroup view = (ViewGroup) getContentView();
|
||||
view.addView(overlayView);
|
||||
|
||||
final ViewGroup buttonGroup = overlayView.findViewById(R.id.button_group);
|
||||
|
||||
buttonA = overlayView.findViewById(R.id.buttonA);
|
||||
buttonB = overlayView.findViewById(R.id.buttonB);
|
||||
buttonX = overlayView.findViewById(R.id.buttonX);
|
||||
buttonY = overlayView.findViewById(R.id.buttonY);
|
||||
|
||||
buttonDpadUp = overlayView.findViewById(R.id.buttonDpadUp);
|
||||
buttonDpadDown = overlayView.findViewById(R.id.buttonDpadDown);
|
||||
buttonDpadLeft = overlayView.findViewById(R.id.buttonDpadLeft);
|
||||
buttonDpadRight = overlayView.findViewById(R.id.buttonDpadRight);
|
||||
|
||||
buttonLB = overlayView.findViewById(R.id.buttonLB);
|
||||
buttonRB = overlayView.findViewById(R.id.buttonRB);
|
||||
buttonZ = overlayView.findViewById(R.id.buttonZ);
|
||||
|
||||
buttonStart = overlayView.findViewById(R.id.buttonStart);
|
||||
buttonBack = overlayView.findViewById(R.id.buttonBack);
|
||||
|
||||
buttonToggle = overlayView.findViewById(R.id.buttonToggle);
|
||||
|
||||
// Initialize joysticks and joystick knobs from the inflated layout
|
||||
leftJoystick = overlayView.findViewById(R.id.left_joystick);
|
||||
leftJoystickKnob = overlayView.findViewById(R.id.left_joystick_knob);
|
||||
|
||||
FrameLayout rightScreenArea = overlayView.findViewById(R.id.right_screen_area);
|
||||
|
||||
// Set OnTouchListeners for the Xbox controller buttons
|
||||
addTouchListener(buttonA, ControllerButtons.BUTTON_A); // SDL Button 0 (A)
|
||||
addTouchListener(buttonB, ControllerButtons.BUTTON_B); // SDL Button 1 (B)
|
||||
addTouchListener(buttonX, ControllerButtons.BUTTON_X); // SDL Button 2 (X)
|
||||
addTouchListener(buttonY, ControllerButtons.BUTTON_Y); // SDL Button 3 (Y)
|
||||
|
||||
addTouchListener(buttonDpadUp, ControllerButtons.BUTTON_DPAD_UP); // SDL Button 10 (D-Pad Up)
|
||||
addTouchListener(buttonDpadDown, ControllerButtons.BUTTON_DPAD_DOWN); // SDL Button 11 (D-Pad Down)
|
||||
addTouchListener(buttonDpadLeft, ControllerButtons.BUTTON_DPAD_LEFT); // SDL Button 12 (D-Pad Left)
|
||||
addTouchListener(buttonDpadRight, ControllerButtons.BUTTON_DPAD_RIGHT); // SDL Button 13 (D-Pad Right)
|
||||
|
||||
addTouchListener(buttonLB, ControllerButtons.BUTTON_LB); // SDL Button 4 (LB)
|
||||
addTouchListener(buttonRB, ControllerButtons.BUTTON_RB); // SDL Button 5 (RB)
|
||||
addTouchListener(buttonZ, ControllerButtons.AXIS_RT); // SDL Button 5 (Z)
|
||||
|
||||
addTouchListener(buttonStart, ControllerButtons.BUTTON_START); // SDL Button 7 (Start)
|
||||
addTouchListener(buttonBack, ControllerButtons.BUTTON_BACK); // SDL Button 6 (Back)
|
||||
|
||||
|
||||
// Setup joystick movement
|
||||
setupJoystick(leftJoystick, leftJoystickKnob, true); // Left joystick
|
||||
|
||||
setupLookAround(rightScreenArea);
|
||||
|
||||
setupToggleButton(buttonToggle,buttonGroup);
|
||||
|
||||
}
|
||||
|
||||
private void setupToggleButton(Button button, ViewGroup uiGroup){
|
||||
boolean isHidden = preferences.getBoolean("controlsVisible", false); // Default to 'false' (visible)
|
||||
uiGroup.setVisibility(isHidden ? View.INVISIBLE : View.VISIBLE); // Set the initial visibility based on the saved state
|
||||
button.setOnClickListener(new View.OnClickListener() {
|
||||
boolean isHidden = false;
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (isHidden) {
|
||||
uiGroup.setVisibility(View.VISIBLE); // Show UI elements
|
||||
} else {
|
||||
uiGroup.setVisibility(View.INVISIBLE); // Hide UI elements
|
||||
}
|
||||
preferences.edit().putBoolean("controlsVisible", !isHidden).apply();
|
||||
isHidden = !isHidden; // Toggle state
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Function to set a touch listener for each button
|
||||
private void addTouchListener(Button button, int buttonNum) {
|
||||
button.setOnTouchListener(new View.OnTouchListener() {
|
||||
@Override
|
||||
public boolean onTouch(View v, MotionEvent event) {
|
||||
switch (event.getAction()) {
|
||||
case MotionEvent.ACTION_DOWN:
|
||||
setButton(buttonNum, true);
|
||||
button.setPressed(true);
|
||||
return true;
|
||||
case MotionEvent.ACTION_UP:
|
||||
setButton(buttonNum, false);
|
||||
button.setPressed(false);
|
||||
return true;
|
||||
case MotionEvent.ACTION_CANCEL:
|
||||
setButton(buttonNum, false);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
boolean TouchAreaEnabled = true;
|
||||
|
||||
void DisableTouchArea(){
|
||||
TouchAreaEnabled = false;
|
||||
}
|
||||
void EnableTouchArea(){
|
||||
TouchAreaEnabled = true;
|
||||
}
|
||||
|
||||
private void setupLookAround(FrameLayout rightScreenArea) {
|
||||
rightScreenArea.setOnTouchListener(new View.OnTouchListener() {
|
||||
private float lastX = 0;
|
||||
private float lastY = 0;
|
||||
private boolean isTouching = false;
|
||||
|
||||
@Override
|
||||
public boolean onTouch(View v, MotionEvent event) {
|
||||
switch (event.getAction()) {
|
||||
case MotionEvent.ACTION_DOWN:
|
||||
// Start tracking the finger's position
|
||||
lastX = event.getX();
|
||||
lastY = event.getY();
|
||||
isTouching = true;
|
||||
break;
|
||||
|
||||
case MotionEvent.ACTION_MOVE:
|
||||
if (isTouching) {
|
||||
// Calculate the change in position (delta)
|
||||
float deltaX = event.getX() - lastX;
|
||||
float deltaY = event.getY() - lastY;
|
||||
|
||||
// Update the last position
|
||||
lastX = event.getX();
|
||||
lastY = event.getY();
|
||||
|
||||
// Increase sensitivity by using a larger multiplier
|
||||
// Adjust these multipliers to suit your needs
|
||||
float sensitivityMultiplier = 15; // Higher value for more sensitivity
|
||||
float rx = (deltaX * sensitivityMultiplier);
|
||||
float ry = (deltaY * sensitivityMultiplier);
|
||||
|
||||
// Send the mapped values to the joystick axes
|
||||
setCameraState(0, rx); // Right stick X axis
|
||||
setCameraState(1, ry); // Right stick Y axis
|
||||
}
|
||||
break;
|
||||
|
||||
case MotionEvent.ACTION_UP:
|
||||
case MotionEvent.ACTION_CANCEL:
|
||||
// Stop tracking the finger's position and reset joystick input
|
||||
isTouching = false;
|
||||
setCameraState(0, 0.0f); // Reset right stick X axis
|
||||
setCameraState(1, 0.0f); // Reset right stick Y axis
|
||||
break;
|
||||
}
|
||||
return TouchAreaEnabled; // Event full handled
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Function to set joystick movement with reset to center when not touched
|
||||
private void setupJoystick(FrameLayout joystickLayout, ImageView joystickKnob, boolean isLeft) {
|
||||
joystickLayout.post(() -> {
|
||||
// Calculate the joystick center once, before any events
|
||||
final float joystickCenterX = joystickLayout.getWidth() / 2f;
|
||||
final float joystickCenterY = joystickLayout.getHeight() / 2f;
|
||||
|
||||
joystickLayout.setOnTouchListener(new View.OnTouchListener() {
|
||||
@Override
|
||||
public boolean onTouch(View v, MotionEvent event) {
|
||||
switch (event.getAction()) {
|
||||
case MotionEvent.ACTION_DOWN:
|
||||
case MotionEvent.ACTION_MOVE:
|
||||
// Calculate the joystick movement and move the knob
|
||||
float deltaX = event.getX() - joystickCenterX;
|
||||
float deltaY = event.getY() - joystickCenterY;
|
||||
|
||||
// Clamp the joystick movement to prevent it from going outside the area
|
||||
float maxRadius = joystickLayout.getWidth() / 2f - joystickKnob.getWidth() / 2f;
|
||||
float distance = (float) Math.sqrt(deltaX * deltaX + deltaY * deltaY);
|
||||
if (distance > maxRadius) {
|
||||
float scale = maxRadius / distance;
|
||||
deltaX *= scale;
|
||||
deltaY *= scale;
|
||||
}
|
||||
|
||||
joystickKnob.setX(joystickCenterX + deltaX - joystickKnob.getWidth() / 2f);
|
||||
joystickKnob.setY(joystickCenterY + deltaY - joystickKnob.getHeight() / 2f);
|
||||
|
||||
// Send joystick values to native C code
|
||||
short x = (short) (deltaX / maxRadius * Short.MAX_VALUE);
|
||||
short y = (short) (deltaY / maxRadius * Short.MAX_VALUE);
|
||||
|
||||
// Send X-axis and Y-axis values
|
||||
setAxis(isLeft ? ControllerButtons.AXIS_LX : ControllerButtons.AXIS_RX, x); // X-axis
|
||||
setAxis(isLeft ? ControllerButtons.AXIS_LY : ControllerButtons.AXIS_RY, y); // Y-axis
|
||||
break;
|
||||
|
||||
case MotionEvent.ACTION_UP:
|
||||
case MotionEvent.ACTION_CANCEL:
|
||||
// Reset joystick knob to the center position (ensure it's placed correctly)
|
||||
joystickKnob.setX(joystickCenterX - joystickKnob.getWidth() / 2f);
|
||||
joystickKnob.setY(joystickCenterY - joystickKnob.getHeight() / 2f);
|
||||
|
||||
// Reset joystick values to 0 when released or canceled
|
||||
setAxis(isLeft ? ControllerButtons.AXIS_LX : ControllerButtons.AXIS_RX, (short) 0); // X-axis
|
||||
setAxis(isLeft ? ControllerButtons.AXIS_LY : ControllerButtons.AXIS_RY, (short) 0); // Y-axis
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user