Skip to content

Release base-provider and callback roots after GameCore unload - #30

Draft
Akramx15 wants to merge 1 commit into
bsq-ports:masterfrom
Akramx15:codex/release-gameplay-references
Draft

Akramx15 wants to merge 1 commit into
bsq-ports:masterfrom
Akramx15:codex/release-gameplay-references

Conversation

@Akramx15

Copy link
Copy Markdown

Leaving GameCore currently leaves static strong references to the custom beatmap, player settings, movement provider and BPM controller alive until later gameplay replaces them. The callback controller pointer also survives the outgoing scene.

This draft clears those references after the matching GameCore unload. Scene handles distinguish gameplay from additive environments; Unity's unload callback runs first, and a replacement GameCore loaded during that callback is protected. It does not manually free shared track/point-definition contexts or change the public interop API.

Validation: both included host tests pass across 100 transition/cleanup cycles, including additive/duplicate unloads, reentrant replacement, idempotence and omitted-root negative controls. Cleanup bodies run against host stand-ins rather than IL2CPP.

The equivalent logic was observed in an experimental local Beat Saber 1.45.1 build on Quest 3: three bounded map runs (about eight advancing song seconds each) returned to the menu and logged release of all three base-provider roots without an observed exception. The upstream-supported 1.40.8 version has not been device-tested with this patch. An NDK r27c syntax-only attempt stopped in the existing beatsaber-hook dependency's missing std::span declarations; the unmodified upstream files fail at the same point. No upstream build pass is claimed. Full songs and broad compatibility remain unverified. This source-only draft requests maintainer review, not adoption or 1.45.1 support.

Prepared with AI assistance.

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.

1 participant