Skip to content

fix: D-10 rc=-1 (pfs slot stripping), BOOT.ELF freeze (reboot_iop), CI build (FIO_MT_RDONLY)#396

Draft
Copilot wants to merge 7 commits intoBETA-10-playfrom
copilot/recover-active-mission-constraints
Draft

fix: D-10 rc=-1 (pfs slot stripping), BOOT.ELF freeze (reboot_iop), CI build (FIO_MT_RDONLY)#396
Copilot wants to merge 7 commits intoBETA-10-playfrom
copilot/recover-active-mission-constraints

Conversation

Copy link
Copy Markdown

Copilot AI commented Mar 29, 2026

Three bugs fixed: HDD-backed POPSTARTER returning rc=-1 before the embedded loader ran, BOOT.ELF hanging after HDD init, and a CI build failure from an undeclared constant.

D-10: rc=-1 — pfs slot stripped, double-mount rejected

BuildPartitionScopedExecPath was normalising pfs3:/APPS/…pfs:/APPS/…. The C side then called fileXioMount("pfs0:", partition, …) to remount — the PS2 HDD driver rejects mounting a partition at a second slot while it is already live at pfs3:-1 before the loader ever ran.

Three-part fix:

  • BuildPartitionScopedExecPath (system.lua) — return pfsN:/… paths unchanged; extract pfsN:/… with slot intact from compound hdd:part:pfsN:/… forms.
  • build_hdd_embedded_loader_target (elf.c) — check can_open_exec_path(resolved_path) first; if the pfs path is already accessible use it directly, skip remount.
  • ExecuteHddBackedViaEmbeddedLoader (elf.c) — pass "" as partition_context for pfs load paths so should_use_filexio_direct_load() returns true → fileXio branch, no IOP reset. POPSTARTER performs its own IOP reset.

U-10: BOOT.ELF freeze after HDD init

LaunchBootElf set reboot_iop = 1 when HDD was loaded, routing through SifIopReset with HDD modules active → hang. LoadExecPS2 (reboot_iop = 0) handles the handoff correctly.

  • LaunchBootElf (ui.lua) — always reboot_iop = 0; PrepareForColdExternalELFLaunch (unmounts pfs slots) still runs when HDD is loaded.

CI build: FIO_MT_RDONLY undeclared in loader.c

mount_partition_context_on_pfs0 (introduced via BETA-10-play merge) uses FIO_MT_RDONLY, which the CI toolchain's fileXio_rpc.h doesn't define yet.

  • loader.c — guard-define FIO_MT_RDONLY 0x01 after the header include, matching the PS2 SDK constant value.
#ifndef FIO_MT_RDONLY
#define FIO_MT_RDONLY 0x01
#endif

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

…o fix D-10 black screen

SifExitIopHeap() hangs indefinitely when the IOP is busy, causing
a permanent black screen. SifInitRpc/SifLoadFileInit/SifLoadFileExit
before the BRAM copy also corrupt the IOP fileXio state the embedded
loader needs after ExecPS2. Remove all six calls; keep only
FlushCache(0)/FlushCache(2) before ExecPS2. The loader manages its
own SIF lifecycle via SifInitRpc(0) in loader.c.

Update DECISIONS, STATE, ROADMAP, QA_REGRESSION_MATRIX to reflect.

Agent-Logs-Url: https://github.com/NathanNeurotic/POPSLoader/sessions/a4943d67-d41c-4b0f-9b9c-3849b61fb2fb

Co-authored-by: NathanNeurotic <109461996+NathanNeurotic@users.noreply.github.com>
Copilot AI changed the title [WIP] Extract active mission and constraints from repository fix(elf.c): remove SIF teardown calls from ExecuteViaEmbeddedLoader — fixes D-10 black screen Mar 29, 2026
Copilot AI requested a review from NathanNeurotic March 29, 2026 15:46
…ze (reboot_iop=1)

D-10 rc=-1 root cause: BuildPartitionScopedExecPath was stripping the
pfs slot (pfs3:/ → pfs:/), then C tried to remount the same partition
at pfs0: — the PS2 HDD driver rejects mounting a partition at a second
slot when already mounted at pfs3: → -1 before the loader ever ran.

Fix 1 (Lua): BuildPartitionScopedExecPath now returns pfs paths
unchanged (slot preserved).  For hdd:partition:pfsN:/... paths it
extracts the pfs portion with slot intact.

Fix 2 (C elf.c): build_hdd_embedded_loader_target now checks if the
resolved pfs path is already accessible (can_open_exec_path) BEFORE
attempting a partition remount.  If accessible, uses it directly.

Fix 3 (C elf.c): ExecuteHddBackedViaEmbeddedLoader passes empty
partition_context to ExecuteViaEmbeddedLoader for pfs load paths.
This makes loader.c's should_use_filexio_direct_load() return true,
routing through fileXio (no IOP reset from the loader).  POPSTARTER
always performs its own IOP reset, so none is needed here.

BOOT.ELF freeze: LaunchBootElf was setting reboot_iop=1 when HDD is
loaded, causing SifIopReset with HDD IOP modules active → hang.
Fix 4 (Lua ui.lua): always use reboot_iop=0; keep
PrepareForColdExternalELFLaunch to unmount pfs slots when HDD loaded.

Update DECISIONS, STATE, ROADMAP, QA_REGRESSION_MATRIX.

Agent-Logs-Url: https://github.com/NathanNeurotic/POPSLoader/sessions/5c587ef6-adcb-4ee6-af95-6163f87b7e5e

Co-authored-by: NathanNeurotic <109461996+NathanNeurotic@users.noreply.github.com>
Copilot AI changed the title fix(elf.c): remove SIF teardown calls from ExecuteViaEmbeddedLoader — fixes D-10 black screen fix(D-10/U-10): resolve HDD POPSTARTER rc=-1 and BOOT.ELF freeze after HDD init Mar 29, 2026
FIO_MT_RDONLY was added to fileXio_rpc.h in a later SDK revision.
CI's toolchain doesn't have it yet, causing a build error in
mount_partition_context_on_pfs0. Add a #ifndef guard so the loader
compiles on both old and new SDK versions.

Agent-Logs-Url: https://github.com/NathanNeurotic/POPSLoader/sessions/05448afa-0c0a-4f54-bfaa-4e467c8b5b5f

Co-authored-by: NathanNeurotic <109461996+NathanNeurotic@users.noreply.github.com>
Copilot AI changed the title fix(D-10/U-10): resolve HDD POPSTARTER rc=-1 and BOOT.ELF freeze after HDD init fix: D-10 rc=-1 (pfs slot stripping), BOOT.ELF freeze (reboot_iop), CI build (FIO_MT_RDONLY) Mar 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants