# SynergyEnvironmentImpl.smali Patch This patch modifies the game to check for community server URLs before using EA's servers. ## Location File: `smali/com/ea/nimble/SynergyEnvironmentImpl.smali` ## Method to Patch Find the method: ```smali .method public getSynergyDirectorServerUrl(Lcom/ea/nimble/NimbleConfiguration;)Ljava/lang/String; ``` Or in some versions: ```smali .method private getEnvironmentUrls()Ljava/lang/String; ``` ## Patch Instructions ### Step 1: Locate the CUSTOMIZED Case Search for this pattern in the method: ```smali sget-object v[X], Lcom/ea/nimble/NimbleConfiguration;->CUSTOMIZED:Lcom/ea/nimble/NimbleConfiguration; if-ne p1, v[X], :cond_[label] ``` Or look for: ```smali const-string v[X], "NimbleCustomizedSynergyServerEndpointUrl" ``` ### Step 2: Insert Community Server Check **BEFORE** the existing `NimbleCustomizedSynergyServerEndpointUrl` code, insert: ```smali # === BEGIN COMMUNITY SERVER PATCH === # Get application context invoke-static {}, Landroid/app/ActivityThread;->currentApplication()Landroid/app/Application; move-result-object v0 # Check if context is null if-nez v0, :check_community_server goto :use_manifest_url :check_community_server # Create CommunityServerManager instance new-instance v1, Lcom/community/CommunityServerManager; invoke-direct {v1, v0}, Lcom/community/CommunityServerManager;->(Landroid/content/Context;)V # Get active community server URL invoke-virtual {v1}, Lcom/community/CommunityServerManager;->getActiveServerUrl()Ljava/lang/String; move-result-object v2 # Check if URL is not null if-nez v2, :check_empty goto :use_manifest_url :check_empty # Check if URL is not empty invoke-virtual {v2}, Ljava/lang/String;->isEmpty()Z move-result v3 if-nez v3, :use_manifest_url # Return community server URL return-object v2 :use_manifest_url # Fall through to existing manifest URL code # === END COMMUNITY SERVER PATCH === ``` ## Example: Complete Patched Method ```smali .method public getSynergyDirectorServerUrl(Lcom/ea/nimble/NimbleConfiguration;)Ljava/lang/String; .registers 6 .param p1, "config" # Lcom/ea/nimble/NimbleConfiguration; # ... existing code ... # CUSTOMIZED case sget-object v1, Lcom/ea/nimble/NimbleConfiguration;->CUSTOMIZED:Lcom/ea/nimble/NimbleConfiguration; if-ne p1, v1, :cond_live # === OUR PATCH STARTS HERE === invoke-static {}, Landroid/app/ActivityThread;->currentApplication()Landroid/app/Application; move-result-object v0 if-nez v0, :check_community goto :use_manifest :check_community new-instance v1, Lcom/community/CommunityServerManager; invoke-direct {v1, v0}, Lcom/community/CommunityServerManager;->(Landroid/content/Context;)V invoke-virtual {v1}, Lcom/community/CommunityServerManager;->getActiveServerUrl()Ljava/lang/String; move-result-object v2 if-nez v2, :check_empty goto :use_manifest :check_empty invoke-virtual {v2}, Ljava/lang/String;->isEmpty()Z move-result v3 if-nez v3, :use_manifest return-object v2 # === OUR PATCH ENDS HERE === :use_manifest # Original EA code continues... const-string v2, "NimbleCustomizedSynergyServerEndpointUrl" const-string v3, "https://syn-dir.sn.eamobile.com" invoke-static {v2, v3}, Lcom/ea/nimble/NimbleApplicationConfiguration;->getConfigValueAsString(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String; move-result-object v0 return-object v0 :cond_live # ... rest of method ... .end method ``` ## Automated Patching The `RR3-Server-Browser-Installer.ps1` script should: 1. Decompile APK 2. Read `SynergyEnvironmentImpl.smali` 3. Find the CUSTOMIZED case 4. Insert patch code at the correct location 5. Save modified file 6. Rebuild APK ## Manual Patching If the automated script fails: 1. Decompile APK: `apktool d realracing3.apk` 2. Open `smali/com/ea/nimble/SynergyEnvironmentImpl.smali` in text editor 3. Find `getSynergyDirectorServerUrl` method 4. Insert patch code as shown above 5. Rebuild: `apktool b realracing3` 6. Sign APK: `uber-apk-signer -a realracing3.apk` ## Testing After patching: ```bash # Install APK adb install realracing3-patched.apk # Set a community server URL adb shell am start -n com.ea.games.r3_row/com.community.CommunityServersActivity # Check if game uses it adb logcat | grep -i synergy ``` You should see the game connecting to your community server URL instead of EA's! ## Troubleshooting ### Game crashes on start - Check smali syntax is correct - Verify register numbers don't conflict - Ensure all labels are unique ### Still connecting to EA servers - Patch may not have been applied - Check active_server_url in SharedPreferences - Verify CommunityServerManager.smali is present ### Can't find method - Game version may have different method names - Search for "getSynergyDirectorServerUrl" OR "getEnvironmentUrls" - Look for "syn-dir.sn.eamobile.com" URL strings ## Important Notes - Register numbers (v0, v1, etc.) may need adjustment based on existing code - Label names (:use_manifest, :check_community) must be unique in the method - This patch is compatible with RR3 versions 8.0+ - Always backup original APK before patching --- **This patch is the KEY to community server support!** Once applied, the game will check SharedPreferences for a community server URL before falling back to EA's servers.