aboutsummaryrefslogtreecommitdiff
path: root/bin/decompile
blob: 6dcdaac71359261cbe7937b2c3f6f39a41779e6b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env bash

main() {
	# Replace this with your local path to worlds.jar
	local WORLDSPLAYER_JAR=${WORLDSPLAYER_JAR:-"${HOME}/.local/share/bottles/bottles/WorldsPlayer/drive_c/Program Files (x86)/Worlds Inc/WorldsPlayer - BowieFull/lib/worlds.jar"}

	echo "Using WORLDSPLAYER_JAR=${WORLDSPLAYER_JAR}"

	if [[ -d source ]]; then
		echo

		read -p "source directory already exists. Do you want to overwrite it? [y/N] " -n 1 -r

		echo

		if [[ ! ${REPLY} =~ ^[Yy]$ ]]; then
			echo "Exiting ..."

			exit 1
		fi

		rm -rf source
	fi

	vineflower --explicit-generics=true "${WORLDSPLAYER_JAR}" source

	if command -v git &>/dev/null; then
		cd source || exit

		# Initialise from decompiled source
		git init
		git add .
		git commit -m "Initial commit" --no-gpg-sign

		# Apply source patches
		git apply ../patches/*.patch
		git add .
		git commit -m "Source patches" --no-gpg-sign

		cd ..
	fi
}

main