diff --git a/clean.sh b/clean.sh new file mode 100644 index 0000000..2008a0f --- /dev/null +++ b/clean.sh @@ -0,0 +1 @@ +rm -rf src client.mappings client.jar client.txt \ No newline at end of file diff --git a/create-branch.sh b/create-branch.sh index 9b1fd6c..01a0923 100755 --- a/create-branch.sh +++ b/create-branch.sh @@ -2,50 +2,11 @@ # USAGE: bash create-branch.sh -mc_version_manifest='https://launchermeta.mojang.com/mc/game/version_manifest.json' -enigma='java -jar enigma/enigma-cli/build/libs/enigma-cli-0.21+local-all.jar' - -# check dependencies. this script requires jq -if [ $(dpkg-query -W -f='${Status}' jq 2>/dev/null | grep -c "ok installed") -eq 0 ]; -then - echo "'jq' is not installed, run 'sudo apt-get install jq' to use this script" - exit -fi - # new branch echo "Creating branch '$1'" git branch -D $1 || true git checkout $2 $1 -# find our version.json file -echo 'Reading version_manifest.json...' -json_file=$(curl -s $mc_version_manifest | jq -r --arg version $1 '.versions[] | select(.id == $version).url') - -# find jar and mappings url -echo "Reading $1.json..." -json_file_contents=$(curl -s $json_file) -client_jar=$(echo $json_file_contents | jq -r '.downloads.client.url') -client_mappings=$(echo $json_file_contents | jq -r '.downloads.client_mappings.url') - -# download client.jar -echo "Downloading client.jar..." -curl -# -o client.jar $client_jar - -# download client.txt -echo "Downloading ProGuard mappings: client.txt..." -curl -# -o client.txt $client_mappings - -# remove current src directory -rm -rf src - -echo "Converting ProGuard mappings to Engima mappings: client.mappings..." -$enigma convert-mappings proguard client.txt enigma_file client.mappings - -mkdir src - -echo "Decompiling client.jar..." -$enigma decompile procyon client.jar src client.mappings - echo "Committing changes..." git add src git add client.txt diff --git a/create-branches.sh b/create-branches.sh index f1230bb..cf8ae5a 100755 --- a/create-branches.sh +++ b/create-branches.sh @@ -4,6 +4,9 @@ branch_flags=--orphan cat versions.txt | while read line do + ./clean.sh + ./setup-mappings.sh $line + ./decompile-mc.sh ./create-branch.sh $line $branch_flags branch_flags=-b done diff --git a/decompile-mc.sh b/decompile-mc.sh new file mode 100644 index 0000000..b793328 --- /dev/null +++ b/decompile-mc.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +# clear out current src directory +rm -rf src +mkdir src + +echo "Decompiling client.jar..." +#procyon, cfr +./enigma.sh decompile procyon client.jar src client.mappings + diff --git a/enigma.sh b/enigma.sh new file mode 100644 index 0000000..ae54ef6 --- /dev/null +++ b/enigma.sh @@ -0,0 +1,4 @@ +# TODO: at what version does this start giving snowmans. +# TODO: does cfr decompiler also give snowmans + +java -jar enigma/enigma-cli/build/libs/enigma-cli-0.21+local-all.jar $@ \ No newline at end of file diff --git a/setup-mappings.sh b/setup-mappings.sh new file mode 100644 index 0000000..4e31348 --- /dev/null +++ b/setup-mappings.sh @@ -0,0 +1,36 @@ +#!/usr/bin/env bash + +# USAGE: bash setup-mappings.sh + +mc_version_manifest='https://launchermeta.mojang.com/mc/game/version_manifest.json' + +# check dependencies. this script requires jq +if [ $(dpkg-query -W -f='${Status}' jq 2>/dev/null | grep -c "ok installed") -eq 0 ]; +then + echo "'jq' is not installed, run 'sudo apt-get install jq' to use this script" + exit +fi + +# find our version.json file +echo 'Reading version_manifest.json...' +json_file=$(curl -s $mc_version_manifest | jq -r --arg version $1 '.versions[] | select(.id == $version).url') + +# find jar and mappings url +echo "Reading $1.json..." +json_file_contents=$(curl -s $json_file) +client_jar=$(echo $json_file_contents | jq -r '.downloads.client.url') +client_mappings=$(echo $json_file_contents | jq -r '.downloads.client_mappings.url') + +# download client.jar +echo "Downloading client.jar..." +curl -# -o client.jar $client_jar + +# download client.txt +echo "Downloading ProGuard mappings: client.txt..." +curl -# -o client.txt $client_mappings + +# delete old mappings +rm -rf client.mappings + +echo "Converting ProGuard mappings to Engima mappings: client.mappings..." +./enigma.sh convert-mappings proguard client.txt enigma client.mappings