michael-fadely / sadx-dc-lighting

Sonic Adventure 1 palette lighting for SADX PC.
MIT License
39 stars 3 forks source link

PL callbacks override SL callbacks on the same stage #87

Closed michael-fadely closed 7 months ago

michael-fadely commented 1 year ago

When a PL and SL callback are registered (via pl_load_register and sl_load_register) which have overlapping "coverage" (i.e. both intend to handle the same stage and act), the PL callback will always take precedence.

Both PL and SL callback handling functions store the last stage/act that successfully loaded a file (https://github.com/michael-fadely/sadx-dc-lighting/blob/master/sadx-dc-lighting/lantern.cpp#L868-L870 and https://github.com/michael-fadely/sadx-dc-lighting/blob/master/sadx-dc-lighting/lantern.cpp#L914-L916). Since these are checked before running any callbacks, the first PL callback to succeed disallows any SL callbacks from actually executing (https://github.com/michael-fadely/sadx-dc-lighting/blob/master/sadx-dc-lighting/lantern.cpp#L901-L903).

The whole multi-instance thing (which is used by Sky Deck) is what's going to make this tedious to fix cleanly. It's effectively the crux of the issue here, in fact, due to the aforementioned level and act IDs being stored in each instance.

Thanks to Kell for the report.

michael-fadely commented 7 months ago

Fixed by fbeec0b38a61eb1b14404beef74a626f2eb68101