def interactive_menu(self): """Main interactive menu""" while True: print("\n" + "="*50) print("๐ฎ WBFS MANAGER - Wii Backup File System Tool") print("="*50) print("1. ๐ List all games on WBFS drive") print("2. โ Add game (ISO/WBFS) to WBFS drive") print("3. โ Remove game from WBFS drive") print("4. ๐พ Extract game from WBFS to file") print("5. ๐ Format drive/partition as WBFS (ERASE ALL)") print("6. ๐ Check disk usage") print("7. ๐ช Exit") choice = input("\nSelect option (1-7): ").strip() if choice == '1': device = input("Enter WBFS device (e.g., /dev/sdb1): ") self.list_games(device) elif choice == '2': device = input("Enter WBFS device: ") game_file = input("Enter path to ISO/WBFS file: ") self.add_game(device, game_file) elif choice == '3': device = input("Enter WBFS device: ") self.list_games(device) game_id = input("Enter Game ID to remove (e.g., SMNE01): ") self.remove_game(device, game_id) elif choice == '4': device = input("Enter WBFS device: ") self.list_games(device) game_id = input("Enter Game ID to extract: ") output = input("Output filename (e.g., game.iso): ") self.extract_game(device, game_id, output) elif choice == '5': device = input("Enter device to format (e.g., /dev/sdb): ") self.format_partition(device) elif choice == '6': device = input("Enter WBFS device: ") self.check_usage(device) elif choice == '7': print("๐ Goodbye!") break else: print("โ Invalid choice. Please try again.") def main(): if os.geteuid() != 0: print("โ ๏ธ This tool requires root privileges for most operations.") print("Please run with: sudo python3 wbfs_manager.py") sys.exit(1)
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.")
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)") โ Remove game from WBFS drive") print("4
class WBFSManager: def (self): self.check_dependencies()
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.") ๐ Check disk usage") print("7
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.")
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}") game in enumerate(games_found
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.")
def interactive_menu(self): """Main interactive menu""" while True: print("\n" + "="*50) print("๐ฎ WBFS MANAGER - Wii Backup File System Tool") print("="*50) print("1. ๐ List all games on WBFS drive") print("2. โ Add game (ISO/WBFS) to WBFS drive") print("3. โ Remove game from WBFS drive") print("4. ๐พ Extract game from WBFS to file") print("5. ๐ Format drive/partition as WBFS (ERASE ALL)") print("6. ๐ Check disk usage") print("7. ๐ช Exit") choice = input("\nSelect option (1-7): ").strip() if choice == '1': device = input("Enter WBFS device (e.g., /dev/sdb1): ") self.list_games(device) elif choice == '2': device = input("Enter WBFS device: ") game_file = input("Enter path to ISO/WBFS file: ") self.add_game(device, game_file) elif choice == '3': device = input("Enter WBFS device: ") self.list_games(device) game_id = input("Enter Game ID to remove (e.g., SMNE01): ") self.remove_game(device, game_id) elif choice == '4': device = input("Enter WBFS device: ") self.list_games(device) game_id = input("Enter Game ID to extract: ") output = input("Output filename (e.g., game.iso): ") self.extract_game(device, game_id, output) elif choice == '5': device = input("Enter device to format (e.g., /dev/sdb): ") self.format_partition(device) elif choice == '6': device = input("Enter WBFS device: ") self.check_usage(device) elif choice == '7': print("๐ Goodbye!") break else: print("โ Invalid choice. Please try again.") def main(): if os.geteuid() != 0: print("โ ๏ธ This tool requires root privileges for most operations.") print("Please run with: sudo python3 wbfs_manager.py") sys.exit(1)
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.")
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)")
class WBFSManager: def (self): self.check_dependencies()
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.")
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 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.")