Skip to main content

Trueancestor Pkg Repacker -

def _validate_tool(self): if not shutil.which(self.pkg_tool) and not os.path.exists(self.pkg_tool): raise FileNotFoundError(f"PKG tool not found: {self.pkg_tool}")

#!/usr/bin/env python3 """ TrueAncestor PKG Repacker - Batch Mode with Metadata Override Author: Assistant Requires: make_pkg_npdrm (or trueancestor's own pkg.exe) in PATH """ import os import json import subprocess import shutil from pathlib import Path trueancestor pkg repacker

class TrueAncestorRepacker: def (self, pkg_tool_path="pkg.exe"): self.pkg_tool = pkg_tool_path self._validate_tool() def _validate_tool(self): if not shutil

def _update_param_sfo(self, extracted_folder, title, app_version): """Update PARAM.SFO with new title and version""" sfo_path = Path(extracted_folder) / "PARAM.SFO" if not sfo_path.exists(): print(f"Warning: PARAM.SFO not found in {extracted_folder}") return False # Use sfo_tool (example) - replace with actual SFO editor try: subprocess.run([ "sfo_tool", "-s", f"TITLE={title}", "-s", f"APP_VER={app_version}", str(sfo_path) ], check=True) return True except subprocess.CalledProcessError: print(f"Failed to update SFO in {extracted_folder}") return False trueancestor pkg repacker

def _update_content_id(self, extracted_folder, content_id): """Update ContentID in PKG metadata (e.g., via param.sfo or custom header)""" # For real PS3 PKG, ContentID is embedded in the package header # Placeholder: write content_id into a marker file marker = Path(extracted_folder) / ".content_id" marker.write_text(content_id)