Wbfs Access
def extract_game(self, device, game_id, output_file): """Extract a game from WBFS to ISO/WBFS file""" print(f"Extracting {game_id} to {output_file}...") try: subprocess.run(['sudo', 'wbfs-tool', device, 'extract', game_id, output_file], check=True) print(f"✅ Game extracted to {output_file}") except subprocess.CalledProcessError: print(f"❌ Extraction failed.")
print(f"🎮 Found {len(games_found)} games:") for i, game in enumerate(games_found, 1): size_mb = os.path.getsize(game) / (1024*1024) print(f" {i}. {Path(game).name} ({size_mb:.1f} MB)")
def list_games(self, device): """List all games on WBFS partition""" try: result = subprocess.run(['sudo', 'wbfs-tool', device, 'ls'], capture_output=True, text=True, check=True) print("\n📀 Games on WBFS drive:") print("-" * 50) print(result.stdout) except subprocess.CalledProcessError: print("❌ No WBFS partition found or unable to read.") game in enumerate(games_found
def check_usage(self, device): """Show used/free space on WBFS partition""" try: result = subprocess.run(['sudo', 'wbfs-tool', device, 'df'], capture_output=True, text=True, check=True) print("\n💾 Disk Usage:") print(result.stdout) except: print("❌ Could not read disk usage.")
def format_partition(self, device): """Format a partition as WBFS (WARNING: ERASES DATA)""" print(f"\n⚠️ WARNING: This will erase ALL data on {device}") confirm = input(f"Type 'YES' to format {device} as WBFS: ") if confirm == "YES": try: subprocess.run(['sudo', 'wbfs-tool', device, 'init'], check=True) print(f"✅ Successfully formatted {device} as WBFS") except subprocess.CalledProcessError as e: print(f"❌ Format failed: {e}") else: print("Format cancelled.") game in enumerate(games_found
def add_game(self, device, game_file): """Add a game (ISO or WBFS) to WBFS partition""" if not os.path.exists(game_file): print(f"❌ File not found: {game_file}") return print(f"Adding {game_file} to {device}...") try: subprocess.run(['sudo', 'wbfs-tool', device, 'add', game_file], check=True) print(f"✅ Game added successfully!") except subprocess.CalledProcessError as e: print(f"❌ Failed to add game: {e}")
def remove_game(self, device, game_id): """Remove a game by its ID (e.g., 'SMNE01' for New Super Mario Bros)""" print(f"Removing game {game_id} from {device}...") try: subprocess.run(['sudo', 'wbfs-tool', device, 'rm', game_id], check=True) print(f"✅ Game {game_id} removed!") except subprocess.CalledProcessError: print(f"❌ Failed to remove game {game_id}. Check ID and try again.") game in enumerate(games_found
if not games_found: print("❌ No game files found!") return