diff --git a/README-apktool.md b/README-apktool.md new file mode 100644 index 000000000..325943167 --- /dev/null +++ b/README-apktool.md @@ -0,0 +1,161 @@ +# RR3 APKTool Decompiled Version (Discord Collaboration) + +This branch contains the APKTool-decompiled version of Real Racing 3 from the Discord community team. + +**Source:** https://github.com/supermegamestre/Project-Real-Resurrection-3 + +## Why APKTool Instead of JADX? + +This repository uses **APKTool** decompilation, not JADX like the other branches. Here's why: + +### APKTool (This Branch) +- **Format:** Smali bytecode (Android assembly language) +- **Readable:** ❌ Very hard to read - low-level assembly code +- **Modifiable:** ✅ YES - Can rebuild APK after editing +- **Use Case:** Modding, patching, rebuilding APKs + +### JADX (Other Branches) +- **Format:** Java source code +- **Readable:** ✅ Easy to read - high-level Java +- **Modifiable:** ❌ NO - Cannot rebuild APK +- **Use Case:** Understanding code, reverse engineering + +## Recommended Workflow + +1. **Use JADX branches** (`main`, `discord-community`) to **understand** the code +2. **Use this APKTool branch** (`discord-apktool`) to **modify** the code +3. **Rebuild the APK** with APKTool after making changes + +### Example: +```bash +# 1. Read Java code to understand a feature +cd ../rr3-apk-main +cat sources/com/ea/feature/Example.java + +# 2. Find corresponding Smali file +cd ../rr3-apk +nano smali/com/ea/feature/Example.smali + +# 3. Make changes to Smali + +# 4. Rebuild APK +apktool b . -o modified-rr3.apk +``` + +## What's Different in This Version? + +Based on the Discord team's work: + +- ✅ **Both 32-bit and 64-bit** support (armeabi-v7a + arm64-v8a) +- ✅ **Full Smali source** for all game classes +- ✅ **All resources** (XML, images, sounds) +- ✅ **Ready to rebuild** with APKTool + +## Architecture Support + +``` +lib/ +├── armeabi-v7a/ # 32-bit ARM (older devices) +│ └── libRealRacing3.so # 22.56 MB +└── arm64-v8a/ # 64-bit ARM (modern devices) + └── libRealRacing3.so # 31.58 MB +``` + +## How to Rebuild This APK + +### Prerequisites: +```bash +# Install APKTool +# Windows: Download from https://ibotpeaches.github.io/Apktool/ +# Linux: apt install apktool + +# Install Java Development Kit +# Required for signing APKs +``` + +### Build Process: +```bash +# 1. Make your modifications to Smali or resource files + +# 2. Rebuild APK +apktool b . -o realracing3-modded.apk + +# 3. Sign the APK (required for installation) +# Generate keystore first (one-time): +keytool -genkey -v -keystore rr3.keystore -alias rr3key -keyalg RSA -keysize 2048 -validity 10000 + +# Sign the APK: +jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore rr3.keystore realracing3-modded.apk rr3key + +# 4. Optimize with zipalign: +zipalign -v 4 realracing3-modded.apk realracing3-final.apk + +# 5. Install on device: +adb install realracing3-final.apk +``` + +## Common Modding Tasks + +### 1. Change Server URL +Edit: `smali/com/ea/config/ServerConfig.smali` +Look for: `.field public static SERVER_URL:Ljava/lang/String;` + +### 2. Unlock All Cars +Edit: `smali/com/ea/garage/CarManager.smali` +Modify: `isCarUnlocked()` method to always return true + +### 3. Unlimited Currency +Edit: `smali/com/ea/currency/CurrencyManager.smali` +Modify: Currency check methods + +### 4. Remove Ads +Edit: `AndroidManifest.xml` +Remove: Ad-related permissions and activities + +## File Structure + +``` +discord-apktool/ +├── AndroidManifest.xml # App configuration +├── apktool.yml # APKTool build settings +├── res/ # Resources (images, XML, etc) +├── smali/ # Main game code (Smali) +├── smali_classes2/ # Additional classes +├── smali_classes3/ # Additional classes +├── lib/ # Native libraries (.so files) +├── assets/ # Game assets +└── original/ # Original APK metadata +``` + +## Learning Smali + +Smali is challenging but learnable. Key concepts: + +- **Registers:** `v0`, `v1`, `p0`, `p1` (like variables) +- **Method calls:** `invoke-virtual`, `invoke-static` +- **Conditional jumps:** `if-eq`, `if-ne`, `goto` +- **Field access:** `.field`, `iget`, `iput` + +**Resources:** +- https://github.com/JesusFreke/smali/wiki +- https://source.android.com/devices/tech/dalvik/dalvik-bytecode + +## Branch Comparison + +| Branch | Tool | Format | Readable | Modifiable | Use Case | +|--------|------|--------|----------|------------|----------| +| `main` | JADX | Java | ✅ Yes | ❌ No | Understanding original | +| `discord-community` | JADX | Java | ✅ Yes | ❌ No | Understanding Discord version | +| `discord-apktool` | APKTool | Smali | ❌ No | ✅ Yes | **Modding & rebuilding** | + +## Notes + +- This is the **active development version** used by the Discord team +- Check GitHub for updates: https://github.com/supermegamestre/Project-Real-Resurrection-3 +- Always test on emulator before installing on real device +- Keep backups of working APKs + +--- + +**Last synced:** 2025-02-18 +**Discord team:** supermegamestre and contributors