Merge pull request #16 from HardcodedCat/main

Added linux support to NetherSX2-builder
This commit is contained in:
Trixarian 2023-09-18 19:34:37 +02:00 committed by GitHub
commit 762ad03657
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 286 additions and 75 deletions

151
README.md
View File

@ -1,75 +1,76 @@
# NetherSX2-patch
These are Unofficial companion scripts for NetherSX2 to expand on the amazing work already done by Anon and EZOnTheEyes
![NetherSX2-Patch in Action](http://trixarian.net/nethersx2-in-action2.jpg)
They aim to do the following:
* Remove the unnecessary ad services bloat left in the apk
* Fix the RetroAchievements Notifications
* Update the GameDB, Controller Support, and the Widescreen and No-Interlace Patches
* Add additional AetherSX2/NetherSX2 spesific fixes to the GameDB
* Resign the APK to Remove the Play Protect Warning
The Update Script can also be used to reupdate the GameDB, Controller Support, and Widescreen and No-Interlace Patches at a later date
Note: This **ONLY** works with NetherSX2. They will break AetherSX2 if used with it
## Prerequisites
Windows:
* Windows Vista or higher
* [The Java(TM) SE Development Kit](https://www.oracle.com/java/technologies/downloads/#jdk20-windows)
Linux:
* The OpenJDK package (this name my vary depending on your Linux Distro)
* Optional: The aapt and apksigner packages (the Linux version uses it's own binaries if these packages aren't installed)
All:
* A copy of the NetherSX2 APK (see below on how to build it)
The rest comes prepackaged for your convenience
## Getting a copy of the NetherSX2 APK
The best method is to use EZOnTheEyes' guide to build it yourself:
[![NetherSX2 Installation and Usage Guide](http://img.youtube.com/vi/2y3uRlYq4SY/0.jpg)](http://www.youtube.com/watch?v=2y3uRlYq4SY)
Alternatively, NetherSX2-builder and xdelta patch in the Downloads section can be used to create a copy of NetherSX2 with these changes pre-applied
## Using these scripts
Once you have a copy of the NetherSX2 APK named 15210-v1.5-4248-noads.apk, drop it in the same folder as patch-apk.bat
1. Run patch-apk.bat to patch your NetherSX2 APK to the latest version. This will reduce the APK size by about 400KB
2. Copy the now modified version of 15210-v1.5-4248-noads.apk back to your phone and install it using your File Manager
You can now use update-files.bat with the above APK to update the GameDB, Controller Support, and the Widescreen and No-Interlace Patches at a later date without needing to repatch it each time
**Linux version:**
Once you have a copy of the NetherSX2 APK named 15210-v1.5-4248-noads.apk, drop it in the same folder as patch-apk.sh and run these commands:
```bash
chmod +x patch-apk.sh update-files.sh
# then run sh file
./patch-apk.sh
# If your apk was already patched and you want to update it, then run it.
./update-files.sh
```
Credit: [TheKingFireS](https://github.com/TheKingFireS)
And there you go, you should now have an updated and bug fixed copy of NetherSX2 on your phone!
## Downloads
* [NetherSX2-builder.zip](https://github.com/Trixarian/NetherSX2-patch/releases/download/1.6/NetherSX2-builder.zip) - Alternate way to build the NetherSX2 APK for yourself with these fixes already pre-applied. It can be used with these scripts to update it's contents
* [NetherSX2-patch.zip](https://github.com/Trixarian/NetherSX2-patch/releases/download/1.6/NetherSX2-patch.zip) - Copy of these scripts. They're meant to be used with a NetherSX2's APK. See above on how to generate it
* [nethersx2.xdelta](https://github.com/Trixarian/NetherSX2-patch/releases/download/1.6/nethersx2.xdelta) - The xdelta patch that can be applied to the AetherSX2 4248 apk with any patching program that supports the format and comes with all the changes pre-applied. This allows the creation of NetherSX2 on systems other than Windows, including Android when using the UniPatcher application
NOTE: No APKs are provided due to licensing issues. You have to build it yourselves using the above methods
## Credits
* PCSX2: <https://github.com/PCSX2/pcsx2>
* AetherSX2: <https://www.aethersx2.com/archive/>
* EZOnTheEyes: <https://www.youtube.com/@EZOnTheEyes>
* cmdcolor: <https://github.com/alecmev/cmdcolor>
* md5sums: http://www.pc-tools.net/win32/md5sums
* Android Keystore: <https://github.com/jorfao/pkStore>
* Alternate Keystore: <https://github.com/tytydraco/public-keystore>
* Android build-tools: <https://androidsdkmanager.azurewebsites.net/Buildtools>
# NetherSX2-patch
These are Unofficial companion scripts for NetherSX2 to expand on the amazing work already done by Anon and EZOnTheEyes
![NetherSX2-Patch in Action](http://trixarian.net/nethersx2-in-action2.jpg)
They aim to do the following:
* Remove the unnecessary ad services bloat left in the apk
* Fix the RetroAchievements Notifications
* Update the GameDB, Controller Support, and the Widescreen and No-Interlace Patches
* Add additional AetherSX2/NetherSX2 spesific fixes to the GameDB
* Resign the APK to Remove the Play Protect Warning
The Update Script can also be used to reupdate the GameDB, Controller Support, and Widescreen and No-Interlace Patches at a later date
Note: This **ONLY** works with NetherSX2. They will break AetherSX2 if used with it
## Prerequisites
Windows:
* Windows Vista or higher
* [The Java(TM) SE Development Kit](https://www.oracle.com/java/technologies/downloads/#jdk20-windows)
Linux:
* The xdelta3 package
* The OpenJDK package (this name my vary depending on your Linux Distro)
* Optional: The aapt and apksigner packages (the Linux version uses it's own binaries if these packages aren't installed)
All:
* A copy of the NetherSX2 APK (see below on how to build it)
The rest comes prepackaged for your convenience
## Getting a copy of the NetherSX2 APK
The best method is to use EZOnTheEyes' guide to build it yourself:
[![NetherSX2 Installation and Usage Guide](http://img.youtube.com/vi/2y3uRlYq4SY/0.jpg)](http://www.youtube.com/watch?v=2y3uRlYq4SY)
Alternatively, NetherSX2-builder and xdelta patch in the Downloads section can be used to create a copy of NetherSX2 with these changes pre-applied
## Using these scripts
Once you have a copy of the NetherSX2 APK named 15210-v1.5-4248-noads.apk, drop it in the same folder as patch-apk.bat
1. Run patch-apk.bat to patch your NetherSX2 APK to the latest version. This will reduce the APK size by about 400KB
2. Copy the now modified version of 15210-v1.5-4248-noads.apk back to your phone and install it using your File Manager
You can now use update-files.bat with the above APK to update the GameDB, Controller Support, and the Widescreen and No-Interlace Patches at a later date without needing to repatch it each time
**Linux version:**
Once you have a copy of the NetherSX2 APK named 15210-v1.5-4248-noads.apk, drop it in the same folder as patch-apk.sh and run these commands:
```bash
chmod +x patch-apk.sh update-files.sh
# then run sh file
./patch-apk.sh
# If your apk was already patched and you want to update it, then run it.
./update-files.sh
```
Credit: [TheKingFireS](https://github.com/TheKingFireS)
And there you go, you should now have an updated and bug fixed copy of NetherSX2 on your phone!
## Downloads
* [NetherSX2-builder.zip](https://github.com/Trixarian/NetherSX2-patch/releases/download/1.6/NetherSX2-builder.zip) - Alternate way to build the NetherSX2 APK for yourself with these fixes already pre-applied. It can be used with these scripts to update it's contents
* [NetherSX2-patch.zip](https://github.com/Trixarian/NetherSX2-patch/releases/download/1.6/NetherSX2-patch.zip) - Copy of these scripts. They're meant to be used with a NetherSX2's APK. See above on how to generate it
* [nethersx2.xdelta](https://github.com/Trixarian/NetherSX2-patch/releases/download/1.6/nethersx2.xdelta) - The xdelta patch that can be applied to the AetherSX2 4248 apk with any patching program that supports the format and comes with all the changes pre-applied. This allows the creation of NetherSX2 on systems other than Windows, including Android when using the UniPatcher application
NOTE: No APKs are provided due to licensing issues. You have to build it yourselves using the above methods
## Credits
* PCSX2: <https://github.com/PCSX2/pcsx2>
* AetherSX2: <https://www.aethersx2.com/archive/>
* EZOnTheEyes: <https://www.youtube.com/@EZOnTheEyes>
* cmdcolor: <https://github.com/alecmev/cmdcolor>
* md5sums: http://www.pc-tools.net/win32/md5sums
* Android Keystore: <https://github.com/jorfao/pkStore>
* Alternate Keystore: <https://github.com/tytydraco/public-keystore>
* Android build-tools: <https://androidsdkmanager.azurewebsites.net/Buildtools>

16
builder/README.txt Normal file
View File

@ -0,0 +1,16 @@
========================
NetherSX2 Builder v1.7
========================
1. Double click build-nethersx2.bat (or run 'bash build-nethersx2.sh')
2. Wait for patching to be done and press any key if prompted
3. Copy 15210-v1.5-4248-noads.apk in the PatchedAPK folder on to your phone
4. Install the APK from your Android File Manager
5. Enjoy!
Credits:
https://www.aethersx2.com/archive/
https://github.com/jmacd/xdelta-gpl
https://github.com/alecmev/cmdcolor
https://www.youtube.com/@EZOnTheEyes
http://www.pc-tools.net/win32/md5sums

103
builder/build-nethersx2.bat Normal file
View File

@ -0,0 +1,103 @@
@echo off
:: ********************************* CONFIG **********************************
set patch_name=NetherSX2 Builder v1.7
set patch_author=
set md5hash=c98b0e4152d3b02fbfb9f62581abada5
set xdelta_name=nethersx2.xdelta
set patched_end=-noads
:: ***************************************************************************
:: Setting Base Variables
set p2f=%~dp0
set input_path=%p2f%OriginalAPK
set output_path=%p2f%PatchedAPK
set xdelta_patch="%p2f%lib\%xdelta_name%"
set col="%p2f%lib\cmdcolor.exe"
:: Preparing to Start
call :strlen titlen patch_name
call :strlen autlen patch_author
set /A autlen=%autlen%+3
if %titlen% geq %autlen% (
set /A result=%titlen%
) else (
set /A result=%autlen%
)
set bline===
set /A index=1
:while
if %index% leq %result% (
set /A index=index+1
set bline=%bline%=
goto :while
)
:: Opening Banner
echo \033[91m%bline% | %col%
echo \033[91m %patch_name% | %col%
if %autlen% gtr 3 echo \033[91m by %patch_author% | %col%
echo \033[91m%bline% | %col%
:: Preparing to Patch
:: Checks if the input folder exists
if not exist "%input_path%\" md "%input_path%"
cd "%input_path%"
:: Checks if there's an apk to patch and if the md5 hash matches
:: Otherwise it downloads it from the Discord
if not exist *.apk goto nofile
for /r %%i in (*.apk) do (
for /f %%f in ('""%p2f%lib\md5sum.exe" "%%i""') do (
if %%f equ %md5hash% (
goto patch
) else (
goto wrongmd5
)
)
)
:patch
:: Checks if the output folder exists
if not exist "%output_path%\" md "%output_path%"
:: Patching the file
<nul set /p "=\033[96mPatching to \033[91mNetherSX2... " | %col%
for /r %%i in (*.apk) do "%p2f%lib\xdelta.exe" -d -f -s "%%i" %xdelta_patch% "%output_path%\%%~ni%patched_end%.apk"
echo \033[92m[Done] | %col%
timeout /t 3
cd "%output_path%"
explorer .
goto end
:strlen <Result> <String>
(
setlocal EnableDelayedExpansion
(set^ tmp=!%~2!)
if defined tmp (
set "len=1"
for %%P in (4096 2048 1024 512 256 128 64 32 16 8 4 2 1) do (
if "!tmp:~%%P,1!" NEQ "" (
set /a "len+=%%P"
set "tmp=!tmp:~%%P!"
)
)
) else (
set len=0
)
)
(
endlocal
set "%~1=%len%"
exit /b
)
:nofile
<nul set /p "=\033[96mDownloading \033[94mAetherSX2... " | %col%
powershell -Command "(new-object System.Net.WebClient).DownloadFile('https://www.aethersx2.com/archive/android/alpha/15210-v1.5-4248.apk','15210-v1.5-4248.apk')"
echo \033[92m[Done] | %col%
goto patch
:wrongmd5
echo \033[31mError: APK found, but it's the wrong one! | %col%
pause
goto end
:end

View File

@ -0,0 +1,91 @@
#!/bin/bash
# ********************************* CONFIG **********************************
patch_name="NetherSX2 Builder v1.7"
patch_author=""
md5hash="c98b0e4152d3b02fbfb9f62581abada5"
xdelta_name="nethersx2.xdelta"
patched_end="-noads"
# ***************************************************************************
# Setting Base Variables
p2f="$(dirname "$(readlink -f "$0")")"
input_path="$p2f/OriginalAPK"
output_path="$p2f/PatchedAPK"
xdelta_patch="$p2f/lib/$xdelta_name"
# Preparing to Start
titlen="${#patch_name}"
autlen="${#patch_author}"
autlen=$((autlen+3))
if [ "$titlen" -ge "$autlen" ]; then
result="$titlen"
else
result="$autlen"
fi
bline="=="
index=1
while [ "$index" -le "$result" ]; do
bline="$bline="
index=$((index+1))
done
# Opening Banner
echo -e "\e[91m$bline\e[0m"
echo -e "\e[91m $patch_name\e[0m"
if [ "$autlen" -gt 3 ]; then
echo -e "\e[91m by $patch_author\e[0m"
fi
echo -e "\e[91m$bline\e[0m"
# Preparing Functions
patch() {
# Checks if the output folder exists
if [ ! -d "$output_path" ]; then
mkdir -p "$output_path"
fi
# Patching the file
echo -ne "\e[96mPatching to \e[0m\e[91mNetherSX2...\e[0m"
for i in "$input_path"/*.apk; do
xdelta3 -d -f -s "$i" "$xdelta_patch" "$output_path/$(basename "$i" .apk)$patched_end.apk"
done
echo -e "\e[92m[Done]\e[0m"
read -p "Press Enter to exit..."
cd "$output_path"
exit 0
}
nofile() {
echo -ne "\e[96mDownloading \e[0m\e[94mAetherSX2...\e[0m"
curl -s -o "$input_path/15210-v1.5-4248.apk" "https://www.aethersx2.com/archive/android/alpha/15210-v1.5-4248.apk"
echo -e "\e[92m[Done]\e[0m"
patch
}
wrongmd5() {
echo -e "\e[31mError: APK found, but it's the wrong one!\e[0m"
read -p "Press Enter to exit..."
exit 1
}
# Checks if the input folder exists
if [ ! -d "$input_path" ]; then
mkdir -p "$input_path"
nofile
else
# Checks if there's an apk to patch and if the md5 hash matches
# Otherwise it downloads it from the AetherSX2 Archive
if [ -z "$(find $input_path -name "*.apk" -type f)" ]; then
nofile
fi
fi
for i in "$input_path"/*.apk; do
md5_checksum=$(md5sum "$i" | awk '{print $1}')
if [ "$md5_checksum" = "$md5hash" ]; then
patch
else
wrongmd5
fi
done

BIN
builder/lib/cmdcolor.exe Normal file

Binary file not shown.

BIN
builder/lib/md5sum.exe Normal file

Binary file not shown.

Binary file not shown.

BIN
builder/lib/xdelta.exe Normal file

Binary file not shown.