Skip to content

Embedding entry points (madeira_embed_make_root, madeira_embed_open_url) - #652

Open
RageMC wants to merge 1 commit into
willfaust:mainfrom
RageMC:embed-entry-points
Open

RageMC wants to merge 1 commit into
willfaust:mainfrom
RageMC:embed-entry-points

Conversation

@RageMC

@RageMC RageMC commented Dec 2, 2026

Copy link
Copy Markdown

This lets another app host Madeira. Triptych, a GPL project that combines Madeira, BCD, Henge and LinuxRunner in one iOS app, loads Madeira's binary as a dynamic library and shows it in its own window.

  • MadeiraApp.init's start-up work moves to MadeiraBoot.run(), guarded so it runs once.
  • The WindowGroup content moves to MadeiraRootView.
  • @_cdecl("madeira_embed_make_root") returns a retained UIViewController (a UIHostingController of MadeiraRootView) after running the start-up work.
  • @_cdecl("madeira_embed_open_url") passes a URL to the same handlers as .onOpenURL: the JIT network shortcut, game setup and shortcuts.

The Madeira app itself is unchanged: MadeiraApp calls MadeiraBoot.run() and shows MadeiraRootView.

Not built against current main here (no full Xcode project build on this machine). The patch came from Triptych's tree and applies cleanly to main. If you'd rather not carry C entry points, the MadeiraBoot/MadeiraRootView split alone would still let a host do this with a small shim.

🤖 Generated with Claude Code

Split MadeiraApp's start-up work into MadeiraBoot.run() (runs once) and
its scene content into MadeiraRootView, and add two C entry points so a
host app that loads Madeira as a dynamic library can show it and pass it
URLs. The Madeira app itself behaves as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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