Skip to content

[Fix] [Export] prefer local native template for same-platform export#2916

Open
RDeckard wants to merge 2 commits into
nesbox:mainfrom
RDeckard:fix/2615-native-export-local-template-fallback
Open

[Fix] [Export] prefer local native template for same-platform export#2916
RDeckard wants to merge 2 commits into
nesbox:mainfrom
RDeckard:fix/2615-native-export-local-template-fallback

Conversation

@RDeckard

@RDeckard RDeckard commented Mar 26, 2026

Copy link
Copy Markdown
Contributor

Why

Original issue: #2615

Native export templates fetched from the server can become stale and may ship outdated runtime behavior.
This PR does not change the server export pipeline itself; it mitigates the issue on the client side for same-platform native exports.

What

  • Added a same-platform local-template path in src/studio/screens/console.c:
    • win on Windows
    • linux on Linux
    • mac on macOS
  • Same-platform native export now tries embedding into the local executable template (fs_apppath()) first.
  • If local template use is not applicable or unavailable, behavior falls back to the existing server export flow.
  • Added explicit console messages to show whether export used:
    • local native template
    • server fallback template

Impact

Same-platform native exports are less sensitive to stale server artifacts, while cross-platform export behavior remains unchanged.

Reviewer question: should we also enable local-template fallback for rpi on Raspberry Pi builds, or keep rpi strictly server-backed for now?

@RDeckard RDeckard force-pushed the fix/2615-native-export-local-template-fallback branch from f618df9 to 14b4c19 Compare May 10, 2026 18:42
@RDeckard RDeckard force-pushed the fix/2615-native-export-local-template-fallback branch from 14b4c19 to 34daaa1 Compare May 10, 2026 19:16
@RDeckard RDeckard marked this pull request as ready for review May 10, 2026 19:33
@computermouth

Copy link
Copy Markdown

Tested good for me on armhf linux 👍

@imsys

imsys commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

I have not tested this, but I think @nesbox uses templates compiled with BUILD_EDITORS=OFF, so the exported final game doesn't include the console, code editor and other studio tools. So I think the solution would have to be a bit different to point to a different binary template path.

@computermouth

Copy link
Copy Markdown

Maybe that toggle could instead be something that's packed into the binary also, rather than pulling the compiled builds. The binaries would be larger with dead code, but it would make the feature much more portable with way less infrastructure required.

@computermouth

Copy link
Copy Markdown

I just tested desktop linux export, and it still ships the editor. I think no-editor-export is actually reserved for the pro version's exports.

@imsys

imsys commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Another option could be to have the export feature look for template binaries in the TIC-80 data directory, perhaps under a template-export subfolder. The app could optionally online fetch and drop the Windows, macOS, and Linux templates on that folder. (ideally covering multiple architectures, and possibly Android as well)

Users who want custom builds could simply replace those template binaries with their own compiled versions.

I would probably prefer the online download mechanism to be kept, since the infrastructure already exists and avoids increasing the application size, that I personally would prefer to not increase further, specially when targeting lower end devices.

@RDeckard

Copy link
Copy Markdown
Contributor Author

Updated the PR to make the local-template path best-effort only.

If embedding or writing the local executable template fails, export now falls back to the existing server template flow instead of reporting a local export failure. The fallback message is also only shown for same-platform exports, so cross-platform exports keep the previous behavior/noise level.

This is still intended as a narrow mitigation for stale same-platform server templates, not as a replacement for the server/template pipeline.

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.

3 participants