Skip to content
Draft
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ GameHub Lite is a community-maintained modified version of GameHub for education

## GameHub Lite Patcher

A patching system that transforms GameHub 5.1.0 into GameHub Lite. A privacy-focused, lightweight version with telemetry removed and offline support added.
A patching system that transforms GameHub 5.3.5 into GameHub Lite. A privacy-focused, lightweight version with telemetry removed and offline support added.

## What is GameHub Lite?

Expand Down Expand Up @@ -55,7 +55,7 @@ stop using windows

### Patching

1. Download GameHub 5.1.0 APK and place it at `apk/GameHub-5.1.0.apk`
1. Download GameHub 5.3.5 APK and place it at `apk/GameHub-5.3.5.apk`

2. Run the patcher:

Expand Down Expand Up @@ -216,7 +216,7 @@ patches/

If patches fail due to APK version mismatch:

- Ensure you're using GameHub 5.1.0 exactly
- Ensure you're using GameHub 5.3.5 exactly
- Check the MD5 hash matches expected value
- Try regenerating patches with your APK version

Expand All @@ -235,8 +235,8 @@ If patches fail due to APK version mismatch:

| GameHub Version | Patcher Version | Status |
| --------------- | --------------- | -------------- |
| 5.1.0 | 1.0 | Supported |
| 5.3.3 | - | in development |
| 5.1.0 | 1.0 | Deprecated |
| 5.3.5 | 1.0 | Supported |

## Alternative: ReVanced Patches (WORK IN PROGRESS)

Expand All @@ -245,7 +245,7 @@ This doesn't currently support all features of the Lite APK, but you are free to

```bash
cd revanced
./apply-patches.sh ../apk/GameHub-5.1.0.apk
./apply-patches.sh ../apk/GameHub-5.3.5.apk
```

See [revanced/README.md](revanced/README.md) for details.
Expand Down
2 changes: 1 addition & 1 deletion generate-patches.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
DECOMPILED_DIR="$SCRIPT_DIR/decompiled"
PATCHES_DIR="$SCRIPT_DIR/patches"

ORIGINAL_APK="${1:-$SCRIPT_DIR/apk/GameHub-5.1.0.apk}"
ORIGINAL_APK="${1:-$SCRIPT_DIR/apk/GameHub-5.3.5.apk}"
LITE_APK="${2:-$SCRIPT_DIR/apk/GameHub-Lite.apk}"

print_step() {
Expand Down
42 changes: 25 additions & 17 deletions patch.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash
#
# GameHub Lite Patcher
# Applies patches to GameHub 5.1.0 APK to create GameHub Lite
# Applies patches to GameHub 5.3.5 APK to create GameHub Lite
#

set -e
Expand Down Expand Up @@ -52,7 +52,7 @@ get_variant_package() {
}

# Source APK (can be overridden)
SOURCE_APK="${1:-$SCRIPT_DIR/apk/GameHub-5.1.0.apk}"
SOURCE_APK="${1:-$SCRIPT_DIR/apk/GameHub-5.3.5.apk}"
OUTPUT_APK="$OUTPUT_DIR/GameHub-Lite.apk"

print_step() {
Expand All @@ -78,7 +78,7 @@ extract_version() {
VERSION=$(grep "versionName:" "$WORK_DIR/decompiled/apktool.yml" | head -1 | awk -F': ' '{print $2}' | tr -d "'" | tr -d ' ')
fi
# Default fallback
VERSION="${VERSION:-5.1.0}"
VERSION="${VERSION:-5.3.5}"
print_success "Version: $VERSION"
}

Expand Down Expand Up @@ -171,34 +171,42 @@ verify_source_apk() {
if [ ! -f "$SOURCE_APK" ]; then
print_error "Source APK not found: $SOURCE_APK"
echo ""
echo "Please provide GameHub 5.1.0 APK as first argument or place it at:"
echo " $SCRIPT_DIR/apk/GameHub-5.1.0.apk"
echo "Please provide GameHub 5.3.5 APK as first argument or place it at:"
echo " $SCRIPT_DIR/apk/GameHub-5.3.5.apk"
exit 1
fi

# Calculate MD5 of source APK
local md5
if command -v md5sum &>/dev/null; then
md5=$(md5sum "$SOURCE_APK" | awk '{print $1}')
# Calculate SHA-256 of source APK
local sha256
local -a sha256_cmd
if command -v sha256sum &>/dev/null; then
sha256_cmd=(sha256sum)
elif command -v shasum &>/dev/null; then
sha256_cmd=(shasum -a 256)
else
md5=$(md5 -q "$SOURCE_APK")
print_error "Neither sha256sum nor shasum is available."
exit 1
fi
sha256=$("${sha256_cmd[@]}" "$SOURCE_APK" | awk '{print $1}')

# Expected MD5 for GameHub 5.1.0
local expected_md5="42db81116bf3c74e52e6f6afb4ec9f91" # Replace with actual MD5 if you are intentionally using a different APK
# Expected SHA-256 for GameHub 5.3.5 (set via env for flexibility)
local expected_sha256="${EXPECTED_SHA256:-}"

print_success "Source APK found: $(basename "$SOURCE_APK")"
echo " MD5: $md5"
if [ "$md5" != "$expected_md5" ]; then
print_warning "MD5 checksum does not match expected value."
echo " SHA-256: $sha256"

if [ -n "$expected_sha256" ] && [ "$sha256" != "$expected_sha256" ]; then
print_warning "SHA-256 checksum does not match expected value."
print_warning "Proceeding may lead to unexpected results."
read -pr "Do you want to continue? (y/N): " choice
read -r -p "Do you want to continue? (y/N): " choice
if [[ ! "$choice" =~ ^[Yy]$ ]]; then
print_error "Aborting."
exit 1
fi
elif [ -n "$expected_sha256" ]; then
print_success "SHA-256 checksum verified."
else
print_success "MD5 checksum verified."
print_warning "SHA-256 verification skipped; EXPECTED_SHA256 is not set."
fi
}

Expand Down
6 changes: 2 additions & 4 deletions patches/diffs/apktool.yml.patch
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@
@@ -10,16 +10,14 @@
forcedPackageId: 127
versionInfo:
- versionCode: 60
+ versionCode: 61
- versionName: 5.1.0
+ versionName: 5.1.4
versionCode: 60
versionName: 5.3.5
doNotCompress:
- arsc
- gif
Expand Down
12 changes: 6 additions & 6 deletions revanced/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ This is an **alternative** to the diff-based patching system in the parent direc

```bash
# Using the helper script
./apply-patches.sh path/to/GameHub-5.1.0.apk
./apply-patches.sh path/to/GameHub-5.3.5.apk

# With custom output
./apply-patches.sh GameHub-5.1.0.apk -o GameHub-Lite.apk
./apply-patches.sh GameHub-5.3.5.apk -o GameHub-Lite.apk

# List available patches
./apply-patches.sh -l
Expand All @@ -66,7 +66,7 @@ This is an **alternative** to the diff-based patching system in the parent direc
java -jar tools/revanced-cli.jar patch \
--patch-bundle build/libs/gamehub-lite-patches.jar \
--out GameHub-Lite.apk \
GameHub-5.1.0.apk
GameHub-5.3.5.apk
```

### Using ReVanced Manager
Expand Down Expand Up @@ -137,7 +137,7 @@ revanced/
name = "My Patch",
description = "Does something useful",
) {
compatibleWith("com.xiaoji.egggame"("5.1.0"))
compatibleWith("com.xiaoji.egggame"("5.3.5"))

execute {
myFingerprint.method.addInstructions(0, "return-void")
Expand All @@ -149,7 +149,7 @@ revanced/

```bash
# Build and apply in one step
./gradlew build && ./apply-patches.sh ../apk/GameHub-5.1.0.apk
./gradlew build && ./apply-patches.sh ../apk/GameHub-5.3.5.apk

# Install on device
adb install output/GameHub-Lite.apk
Expand Down Expand Up @@ -201,7 +201,7 @@ gpr.key=ghp_xxxxxxxxxxxx
Ensure the fingerprint matches the target method. Use jadx to inspect the APK:

```bash
jadx GameHub-5.1.0.apk -d jadx-output
jadx GameHub-5.3.5.apk -d jadx-output
```

### APK Won't Install
Expand Down
30 changes: 14 additions & 16 deletions revanced/apply-patches.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#!/bin/bash
#
# GameHub Lite - ReVanced Patch Applier
# Applies ReVanced patches to GameHub 5.1.0 APK
# Applies ReVanced patches to GameHub 5.3.5 APK
#

set -e

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PATCHES_JAR="$SCRIPT_DIR/build/libs/gamehub-lite-patches.jar"
PATCHES_JAR="$SCRIPT_DIR/patches/build/libs/gamehub-lite-patches.jar"
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated
CLI_JAR="$SCRIPT_DIR/tools/revanced-cli.jar"
OUTPUT_DIR="$SCRIPT_DIR/output"

Expand Down Expand Up @@ -44,9 +44,9 @@ show_usage() {
echo " -h, --help Show this help message"
echo ""
echo "Examples:"
echo " $0 GameHub-5.1.0.apk"
echo " $0 GameHub-5.1.0.apk -o my-output.apk"
echo " $0 GameHub-5.1.0.apk -p \"Disable All Telemetry,GameHub Lite\""
echo " $0 GameHub-5.3.5.apk"
echo " $0 GameHub-5.3.5.apk -o my-output.apk"
echo " $0 GameHub-5.3.5.apk -p \"Disable All Telemetry,GameHub Lite\""
}

check_dependencies() {
Expand Down Expand Up @@ -75,12 +75,12 @@ download_cli() {
mkdir -p "$SCRIPT_DIR/tools"

# Get latest ReVanced CLI release
local cli_url="https://github.com/ReVanced/revanced-cli/releases/latest/download/revanced-cli-all.jar"
local cli_url="https://github.com/ReVanced/revanced-cli/releases/download/v5.0.1/revanced-cli-5.0.1-all.jar"

print_step "Downloading ReVanced CLI..."
curl -L -o "$CLI_JAR" "$cli_url"
curl -fL --retry 3 --connect-timeout 15 -o "$CLI_JAR" "$cli_url"

if [ -f "$CLI_JAR" ]; then
if [ -s "$CLI_JAR" ]; then
print_success "ReVanced CLI downloaded"
else
print_error "Failed to download ReVanced CLI"
Expand All @@ -94,7 +94,7 @@ build_patches() {
cd "$SCRIPT_DIR"

if [ -f "gradlew" ]; then
./gradlew build
./gradlew apiDump build jar
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated
else
print_error "Gradle wrapper not found. Run 'gradle wrapper' first"
exit 1
Expand All @@ -112,7 +112,7 @@ list_patches() {
print_step "Available patches:"

java -jar "$CLI_JAR" list-patches \
--patch-bundle "$PATCHES_JAR"
-p "$PATCHES_JAR"
}

apply_patches() {
Expand All @@ -129,21 +129,19 @@ apply_patches() {

print_step "Applying patches to $(basename "$input_apk")..."

local cmd="java -jar $CLI_JAR patch"
cmd="$cmd --patch-bundle $PATCHES_JAR"
cmd="$cmd --out $output_apk"
local cmd=(java -jar "$CLI_JAR" patch -p "$PATCHES_JAR" -o "$output_apk")

if [ -n "$patch_list" ]; then
# Apply specific patches
IFS=',' read -ra PATCHES <<< "$patch_list"
for patch in "${PATCHES[@]}"; do
cmd="$cmd --include \"$patch\""
cmd+=(-e "$patch")
done
fi

cmd="$cmd $input_apk"
cmd+=("$input_apk")

eval "$cmd"
"${cmd[@]}"

if [ -f "$output_apk" ]; then
print_success "Patched APK created: $output_apk"
Expand Down
Binary file added revanced/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion revanced/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.0-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
Loading