#!/usr/bin/env python3 """Check PS3 PARAM.SFO files for missing/invalid titles. Scans PS3 game folders and reports games with "Install" or missing titles. """ import struct from pathlib import Path def read_param_sfo(param_sfo_path): """Read PARAM.SFO file and extract TITLE field. Args: param_sfo_path: Path to PARAM.SFO file Returns: dict with 'title_id' and 'title' fields, or None if invalid """ try: with open(param_sfo_path, 'rb') as f: data = f.read() # Check magic header if data[:4] != b'\x00PSF': return None # Parse header key_table_start = struct.unpack(' 0: percent = (total_problems / results['total_games'] * 100) if results['total_games'] > 0 else 0 print(f"\n⚠ Problem rate: {percent:.1f}% ({total_problems}/{results['total_games']})") # Print problem games if results['problem_games']: print("\n" + "=" * 70) print("Problem Games:") print("=" * 70) # Group by issue type by_type = {} for game in results['problem_games']: issue = game['issue'] if issue not in by_type: by_type[issue] = [] by_type[issue].append(game) for issue_type in ['install_title', 'empty_title', 'missing_param', 'corrupted_param']: if issue_type in by_type: games = by_type[issue_type] print(f"\n{issue_type.upper().replace('_', ' ')} ({len(games)} games):") print("-" * 70) for game in sorted(games, key=lambda x: x['folder']): print(f" Folder: {game['folder']}") if game['title_id']: print(f" ID: {game['title_id']}") if game['title']: print(f" Title: '{game['title']}'") if len(games) <= 20: # Only show paths for small lists print(f" Path: {game['path']}") print() if __name__ == '__main__': main()