import os import sys import re def patch_opela_client_for_hf(hf_space_domain, source_dir=r"C:\Users\salah\Downloads\angolax86"): print("=" * 65) print(" Opela Free Fire Client Patching Tool (Hugging Face Edition) ") print("=" * 65) print(f"Hugging Face Space Domain: {hf_space_domain}") print(f"Client Source Path: {source_dir}\n") # Clean domain input (e.g. remove https:// or trailing slashes) hf_domain = hf_space_domain.replace("https://", "").replace("http://", "").strip("/") if not os.path.exists(source_dir): print(f"[ERROR] Source directory '{source_dir}' does not exist!") return False target_bytes = hf_domain.encode('ascii') files_to_check = [ os.path.join(source_dir, "lib", "x86", "libmadoka.so"), os.path.join(source_dir, "assets", "google-services.json"), os.path.join(source_dir, "assets", "google-services-desktop.json"), os.path.join(source_dir, "assets", "bin", "Data", "Managed", "Metadata", "global-metadata.dat") ] modified_count = 0 for fpath in files_to_check: if os.path.exists(fpath): try: with open(fpath, "rb") as f: content = f.read() # Match raw IPs or domains to replace ip_domain_pattern = re.compile(rb'\b(?:[0-9]{1,3}\.){3}[0-9]{1,3}\b|https?://[a-zA-Z0-9\.\-_:]+') matches = list(ip_domain_pattern.finditer(content)) if matches: new_content = content for m in matches: old_bytes = m.group(0) if len(target_bytes) <= len(old_bytes): padded = target_bytes + b'\x00' * (len(old_bytes) - len(target_bytes)) new_content = new_content.replace(old_bytes, padded) else: new_content = new_content.replace(old_bytes, target_bytes) with open(fpath, "wb") as f: f.write(new_content) modified_count += 1 print(f"[PATCHED] {os.path.basename(fpath)}: Updated endpoints to '{hf_domain}'") except Exception as e: print(f"[WARNING] Could not patch {os.path.basename(fpath)}: {e}") print("\n" + "=" * 65) print(f" SUCCESS: Client configured for Hugging Face Space: '{hf_domain}'") print(f" Total files modified: {modified_count}") print("=" * 65) return True if __name__ == "__main__": if len(sys.argv) > 1: domain = sys.argv[1] else: domain = input("Enter your Hugging Face Space Domain (e.g. username-angola-me.hf.space): ").strip() if domain: patch_opela_client_for_hf(domain) else: print("[ERROR] No domain provided.")