├── .github └── workflows │ └── main.yml ├── .gitignore ├── README.md ├── patch_perseus.sh ├── testkey.pk8 ├── testkey.x509.pem └── zipalign_sign.sh /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | name: Perseus Build 2 | 3 | on: 4 | workflow_dispatch: 5 | 6 | jobs: 7 | build: 8 | runs-on: ubuntu-latest 9 | 10 | steps: 11 | - uses: actions/checkout@v3 12 | 13 | - name: Setup Java JDK 14 | uses: actions/setup-java@v3.3.0 15 | with: 16 | java-version: "17" 17 | distribution: "adopt" 18 | 19 | - name: Build Perseus APK 20 | run: ./patch_perseus.sh 21 | 22 | - name: Zipalign and Sign Android release 23 | run: ./zipalign_sign.sh 24 | 25 | - uses: marvinpinto/action-automatic-releases@latest 26 | with: 27 | repo_token: "${{ secrets.GITHUB_TOKEN }}" 28 | automatic_release_tag: "latest" 29 | draft: true 30 | title: "Perseus Release v${{ env.PERSEUS_VERSION }}" 31 | files: | 32 | build/*.apk -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .vscode 2 | AzurLane 3 | com.YoStarEN.AzurLane* 4 | Perseus 5 | apkeep 6 | apktool.jar 7 | *.keystore -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Perseus Build 2 | This repo template will allow you to build Perseus using Github Actions. This will helps people who don't want to setup build environments on their machines. 3 | 4 | ## Notes 5 | - Under **NO CIRCUMSTANCES** any APKs will be uploaded to this repository to avoid DMCA. 6 | - This repo was designed for two circumstances: CN version and other regions when apkpure doesn't have the latest version. 7 | - The ability to edit the code is required 8 | - I don't use github frequently. So I won't do any Technical support for this. 9 | 10 | ## How to setup 11 | 1. Create a new PRIVATE repository using this repository as a template ([Guide](https://docs.github.com/en/repositories/creating-and-managing-repositories/creating-a-repository-from-a-template)). 12 | 2. Go to newly created repo Settings > Actions > General > Workflow permissions > Set Read and Write permission. 13 | 3. Find the download link yourself and replace the link in line 29 in patch_perseus.sh (if you need versions of other regions, you also need to change the package name, Ctrl+H would do the job.) 14 | 15 | ## How to build 16 | 1. Go to Actions -> All workflows -> Perseus Build 17 | 2. Run the workflow 18 | 3. Download the APKs from the draft releases 19 | 20 | ## How to change region 21 | 1. This project can only patch .apk file, if you want to patch .xapk file, uncommennt these 2 lines in patch_perseus.sh and change the suffix in wget:![image](https://github.com/CapitalGrin/AzurLaneBiliBili-Perseus/assets/109933411/c1d4ea1e-c00f-49d5-969e-11054d6ae8c6) 22 | ![image](https://github.com/CapitalGrin/AzurLaneBiliBili-Perseus/assets/109933411/8d721bae-34d8-4edf-8944-fc95e308ab13) 23 | 2. change the download link here in patch_perseus.sh . And make sure the link is not Disposable or Dynamic.(high lighted part) 24 | ![image](https://github.com/CapitalGrin/AzurLaneBiliBili-Perseus/assets/109933411/07f37070-015d-4b40-84e1-b23a1f6c856c) 25 | 3. replace ALL the packge name in patch_perseus.sh , Ctrl+F would do the work.(Don't change the suffix though) 26 | ![image](https://github.com/CapitalGrin/AzurLaneBiliBili-Perseus/assets/109933411/d91800e7-ca14-4b91-9931-07acc28a5d56) 27 | -------------------------------------------------------------------------------- /patch_perseus.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Download apkeep 3 | get_artifact_download_url () { 4 | # Usage: get_download_url 5 | local api_url="https://api.github.com/repos/$1/releases/latest" 6 | local result=$(curl $api_url | jq ".assets[] | select(.name | contains(\"$2\") and contains(\"$3\") and (contains(\".sig\") | not)) | .browser_download_url") 7 | echo ${result:1:-1} 8 | } 9 | 10 | # Artifacts associative array aka dictionary 11 | declare -A artifacts 12 | 13 | artifacts["apkeep"]="EFForg/apkeep apkeep-x86_64-unknown-linux-gnu" 14 | artifacts["apktool.jar"]="iBotPeaches/Apktool apktool .jar" 15 | 16 | # Fetch all the dependencies 17 | for artifact in "${!artifacts[@]}"; do 18 | if [ ! -f $artifact ]; then 19 | echo "Downloading $artifact" 20 | curl -L -o $artifact $(get_artifact_download_url ${artifacts[$artifact]}) 21 | fi 22 | done 23 | 24 | chmod +x apkeep 25 | 26 | # Download Azur Lane 27 | if [ ! -f "com.bilibili.AzurLane.apk" ]; then 28 | echo "Get Azur Lane apk" 29 | 30 | # eg: wget "your download link" -O "your packge name.apk" -q 31 | #if you want to patch .xapk, change the suffix here to wget "your download link" -O "your packge name.xapk" -q 32 | wget https://pkg.biligame.com/games/blhx_9.5.11_0427_1_20250506_095207_d4e3f.apk -O com.bilibili.AzurLane.apk -q 33 | echo "apk downloaded !" 34 | 35 | # if you can only download .xapk file uncomment 2 lines below. (delete the '#') 36 | #unzip -o com.YoStarJP.AzurLane.xapk -d AzurLane 37 | #cp AzurLane/com.YoStarJP.AzurLane.apk . 38 | fi 39 | 40 | # Download Perseus 41 | if [ ! -d "Perseus" ]; then 42 | echo "Downloading Perseus" 43 | git clone https://github.com/Egoistically/Perseus 44 | fi 45 | 46 | echo "Decompile Azur Lane apk" 47 | java -jar apktool.jar -q -f d com.bilibili.AzurLane.apk 48 | 49 | echo "Copy Perseus libs" 50 | cp -r Perseus/. com.bilibili.AzurLane/lib/ 51 | 52 | echo "Patching Azur Lane with Perseus" 53 | oncreate=$(grep -n -m 1 'onCreate' com.bilibili.AzurLane/smali_classes2/com/unity3d/player/UnityPlayerActivity.smali | sed 's/[0-9]*\:\(.*\)/\1/') 54 | sed -ir "s#\($oncreate\)#.method private static native init(Landroid/content/Context;)V\n.end method\n\n\1#" com.bilibili.AzurLane/smali_classes2/com/unity3d/player/UnityPlayerActivity.smali 55 | sed -ir "s#\($oncreate\)#\1\n const-string v0, \"Perseus\"\n\n\ invoke-static {v0}, Ljava/lang/System;->loadLibrary(Ljava/lang/String;)V\n\n invoke-static {p0}, Lcom/unity3d/player/UnityPlayerActivity;->init(Landroid/content/Context;)V\n#" com.bilibili.AzurLane/smali_classes2/com/unity3d/player/UnityPlayerActivity.smali 56 | 57 | echo "Build Patched Azur Lane apk" 58 | java -jar apktool.jar -q -f b com.bilibili.AzurLane -o build/com.bilibili.AzurLane.patched.apk 59 | 60 | echo "Set Github Release version" 61 | s=($(./apkeep -a com.bilibili.AzurLane -l)) 62 | echo "PERSEUS_VERSION=$(echo ${s[-1]})" >> $GITHUB_ENV 63 | -------------------------------------------------------------------------------- /testkey.pk8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapitalGrin/AzurLaneBiliBili-Perseus/fb62cbaaa185ceda3a5f5bb18d6b6c1cefc3292b/testkey.pk8 -------------------------------------------------------------------------------- /testkey.x509.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIEqDCCA5CgAwIBAgIJAJNurL4H8gHfMA0GCSqGSIb3DQEBBQUAMIGUMQswCQYD 3 | VQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4g 4 | VmlldzEQMA4GA1UEChMHQW5kcm9pZDEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UE 5 | AxMHQW5kcm9pZDEiMCAGCSqGSIb3DQEJARYTYW5kcm9pZEBhbmRyb2lkLmNvbTAe 6 | Fw0wODAyMjkwMTMzNDZaFw0zNTA3MTcwMTMzNDZaMIGUMQswCQYDVQQGEwJVUzET 7 | MBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEQMA4G 8 | A1UEChMHQW5kcm9pZDEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9p 9 | ZDEiMCAGCSqGSIb3DQEJARYTYW5kcm9pZEBhbmRyb2lkLmNvbTCCASAwDQYJKoZI 10 | hvcNAQEBBQADggENADCCAQgCggEBANaTGQTexgskse3HYuDZ2CU+Ps1s6x3i/waM 11 | qOi8qM1r03hupwqnbOYOuw+ZNVn/2T53qUPn6D1LZLjk/qLT5lbx4meoG7+yMLV4 12 | wgRDvkxyGLhG9SEVhvA4oU6Jwr44f46+z4/Kw9oe4zDJ6pPQp8PcSvNQIg1QCAcy 13 | 4ICXF+5qBTNZ5qaU7Cyz8oSgpGbIepTYOzEJOmc3Li9kEsBubULxWBjf/gOBzAzU 14 | RNps3cO4JFgZSAGzJWQTT7/emMkod0jb9WdqVA2BVMi7yge54kdVMxHEa5r3b97s 15 | zI5p58ii0I54JiCUP5lyfTwE/nKZHZnfm644oLIXf6MdW2r+6R8CAQOjgfwwgfkw 16 | HQYDVR0OBBYEFEhZAFY9JyxGrhGGBaR0GawJyowRMIHJBgNVHSMEgcEwgb6AFEhZ 17 | AFY9JyxGrhGGBaR0GawJyowRoYGapIGXMIGUMQswCQYDVQQGEwJVUzETMBEGA1UE 18 | CBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEQMA4GA1UEChMH 19 | QW5kcm9pZDEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDEiMCAG 20 | CSqGSIb3DQEJARYTYW5kcm9pZEBhbmRyb2lkLmNvbYIJAJNurL4H8gHfMAwGA1Ud 21 | EwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAHqvlozrUMRBBVEY0NqrrwFbinZa 22 | J6cVosK0TyIUFf/azgMJWr+kLfcHCHJsIGnlw27drgQAvilFLAhLwn62oX6snb4Y 23 | LCBOsVMR9FXYJLZW2+TcIkCRLXWG/oiVHQGo/rWuWkJgU134NDEFJCJGjDbiLCpe 24 | +ZTWHdcwauTJ9pUbo8EvHRkU3cYfGmLaLfgn9gP+pWA7LFQNvXwBnDa6sppCccEX 25 | 31I828XzgXpJ4O+mDL1/dBd+ek8ZPUP0IgdyZm5MTYPhvVqGCHzzTy3sIeJFymwr 26 | sBbmg2OAUNLEMO6nwmocSdN2ClirfxqCzJOLSDE4QyS9BAH6EhY6UFcOaE0= 27 | -----END CERTIFICATE----- 28 | -------------------------------------------------------------------------------- /zipalign_sign.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | PATH=$PATH:$ANDROID_HOME/build-tools/32.0.0/ 3 | for f in build/*.apk; do 4 | mv $f ${f%.apk}.apk.unsigned 5 | echo "Zipaligning $f" 6 | zipalign -pvf 4 ${f%.apk}.apk.unsigned $f 7 | rm ${f%.apk}.apk.unsigned 8 | echo "Signing $f" 9 | echo $(apksigner --version) 10 | apksigner sign --key testkey.pk8 --cert testkey.x509.pem $f 11 | done --------------------------------------------------------------------------------