Repacker — Trueancestor Pkg

# Actual repack command (example using make_pkg) cmd = [ self.pkg_tool, "repack", "--folder", str(source), "--out", output_pkg ] if content_id: cmd.extend(["--content-id", content_id]) print(f"Repacking: {source} -> {output_pkg}") result = subprocess.run(cmd, capture_output=True, text=True) if result.returncode != 0: print(f"Error: {result.stderr}") return False print(f"Success: {output_pkg}") return True

# Apply overrides if provided if title and app_version: self._update_param_sfo(source, title, app_version) if content_id: self._update_content_id(source, content_id) trueancestor pkg repacker

def batch_repack(self, config_file, output_dir="."): """Batch repack from JSON config""" with open(config_file, 'r') as f: jobs = json.load(f) output_path = Path(output_dir) output_path.mkdir(exist_ok=True) # Actual repack command (example using make_pkg) cmd

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 output_pkg ] if content_id: cmd.extend(["--content-id"

# Actual repack command (example using make_pkg) cmd = [ self.pkg_tool, "repack", "--folder", str(source), "--out", output_pkg ] if content_id: cmd.extend(["--content-id", content_id]) print(f"Repacking: {source} -> {output_pkg}") result = subprocess.run(cmd, capture_output=True, text=True) if result.returncode != 0: print(f"Error: {result.stderr}") return False print(f"Success: {output_pkg}") return True

# Apply overrides if provided if title and app_version: self._update_param_sfo(source, title, app_version) if content_id: self._update_content_id(source, content_id)

def batch_repack(self, config_file, output_dir="."): """Batch repack from JSON config""" with open(config_file, 'r') as f: jobs = json.load(f) output_path = Path(output_dir) output_path.mkdir(exist_ok=True)

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