ps1: embed real game art (ICON0 + PIC1) in converted EBOOTs
Fetch the game's cover art (libretro / ScreenScraper / IGDB / Wikipedia, reusing the local cover cache) and bake it into the EBOOT's ICON0 (144x80 XMB icon) and PIC1 (480x272 launch background) instead of the default PS1 icon. Best-effort: falls back to the base icon/empty background when no art is found. convert()/convert_to_folder() gain optional icon0/pic1 params.
This commit is contained in:
+14
-7
@@ -871,6 +871,8 @@ def convert(
|
||||
progress_cb=None,
|
||||
cancel_event=None,
|
||||
complevel: int = 1,
|
||||
icon0: Optional[bytes] = None,
|
||||
pic1: Optional[bytes] = None,
|
||||
) -> Path:
|
||||
"""Convert a PS1 disc image to ``out_path`` (an ``EBOOT.PBP``).
|
||||
|
||||
@@ -878,6 +880,9 @@ def convert(
|
||||
``.iso``/``.img``/``.bin``. ``base_pbp`` must be a PSN PS1 classic EBOOT.
|
||||
``complevel`` is the DEFLATE level for the disc data (1-9; 0 = raw, which
|
||||
does not boot on real hardware and is only useful for diagnostics).
|
||||
``icon0`` (144x80 PNG) and ``pic1`` (480x272 PNG) override the generated
|
||||
icon/background; when absent the base PBP's ICON0 is reused and PIC1 is
|
||||
left empty.
|
||||
"""
|
||||
if not base_pbp.is_file():
|
||||
raise ConversionError(f"base.pbp not found: {base_pbp}")
|
||||
@@ -901,11 +906,10 @@ def convert(
|
||||
# Reuse the base PBP's SFO, patched with our title + game id (the
|
||||
# popstation approach), rather than rebuilding it from scratch.
|
||||
sfo = patch_sfo(extract_sfo(base_pbp), title, game_id)
|
||||
# Reuse the base PBP's ICON0 too. The XMB icon parser is picky about PNG
|
||||
# variants, and the base icon is guaranteed to decode; the other image
|
||||
# sections are left empty exactly like popstation when no assets are
|
||||
# supplied alongside the conversion.
|
||||
icon0 = extract_icon0(base_pbp)
|
||||
# Reuse the base PBP's ICON0 when no custom icon was supplied (the XMB
|
||||
# icon parser is picky about PNG variants, and the base icon is guaranteed
|
||||
# to decode). PIC1 is the launch background; empty when no art is given.
|
||||
icon0 = icon0 or extract_icon0(base_pbp)
|
||||
|
||||
# Sections in header order; empty sections keep the previous offset.
|
||||
sections = {
|
||||
@@ -913,7 +917,7 @@ def convert(
|
||||
"icon0": icon0,
|
||||
"icon1": b"",
|
||||
"pic0": b"",
|
||||
"pic1": b"",
|
||||
"pic1": pic1 or b"",
|
||||
"snd0": b"",
|
||||
"data_psp": data_psp,
|
||||
# psar written separately, sized after everything else.
|
||||
@@ -981,6 +985,8 @@ def convert_to_folder(
|
||||
progress_cb=None,
|
||||
cancel_event=None,
|
||||
complevel: int = 1,
|
||||
icon0: Optional[bytes] = None,
|
||||
pic1: Optional[bytes] = None,
|
||||
) -> Path:
|
||||
"""Convert a PS1 disc into a game folder ready for /PSP/GAME.
|
||||
|
||||
@@ -993,7 +999,8 @@ def convert_to_folder(
|
||||
folder.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
convert(source, title, game_id, base_pbp, folder / "EBOOT.PBP",
|
||||
progress_cb=progress_cb, cancel_event=cancel_event, complevel=complevel)
|
||||
progress_cb=progress_cb, cancel_event=cancel_event, complevel=complevel,
|
||||
icon0=icon0, pic1=pic1)
|
||||
return folder
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user