You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Request: Add BOOT callback for compiled/WASM runtimesΒ #1773
Many compile languages can't have a concept "top-level" code (all the code must be in functions)... so there is no opportunity to perform start-ups tasks... having to do a manual check in TIC isn't terrible, but is kind of an ugly pattern IMHO. If we supported a init or start or boot hook or something like PICO-8 we would eliminate this problem.
For example from my Zig cartridge:
exportfnTIC() void {
if (!started) { start(); }
// actual TIC code here
}
It could be nice if this wasn't necessary and we could instead do:
changed the title [-]Request: Add `start` callback for compiled/WASM runtimes[/-][+]Request: Add `BOOT` callback for compiled/WASM runtimes[/+]on Jan 2, 2022
Can we get an INIT() for regular cartridges using Lua etc?
Yes, the callback will work everywhere, if we add it, INIT() or BOOT() doesn't matter.
INIT() would be my preference - that's the function name used by many other 'game engines' (eg Defold, Godot, Pico, Love2d, Unreal. 'Boot' implies loading the system itself (and out of the user's control).
You boot a cartridge in my thinking... I think many early systems didn't have much of an OS, so I actually think it's a nice throwback name... but also I think if many other engines use 'INIT' that would be enough of an argument for me.
I see this as useful for, but entirely separate from the WASM work... so if someone else wanted to pick this up and run with it, that'd be fine. It's also not required for WASM, but just a "very nice to have"... so may not be something I get to myself.
Activity
nesbox commentedon Jan 2, 2022
Ok, let's add
BOOT()function.[-]Request: Add `start` callback for compiled/WASM runtimes[/-][+]Request: Add `BOOT` callback for compiled/WASM runtimes[/+]paul59 commentedon Jan 3, 2022
Can we get an INIT() for regular cartridges using Lua etc?
nesbox commentedon Jan 3, 2022
Yes, the callback will work everywhere, if we add it,
INIT()orBOOT()doesn't matter.paul59 commentedon Jan 3, 2022
INIT() would be my preference - that's the function name used by many other 'game engines' (eg Defold, Godot, Pico, Love2d, Unreal. 'Boot' implies loading the system itself (and out of the user's control).
joshgoebel commentedon Jan 3, 2022
You boot a cartridge in my thinking... I think many early systems didn't have much of an OS, so I actually think it's a nice throwback name... but also I think if many other engines use 'INIT' that would be enough of an argument for me.
I see this as useful for, but entirely separate from the WASM work... so if someone else wanted to pick this up and run with it, that'd be fine. It's also not required for WASM, but just a "very nice to have"... so may not be something I get to myself.
added BOOT() callback for all the scripts/wasm #1773
nesbox commentedon Mar 21, 2022
Added
BOOT()callback to all the supported scripts and WASM aeffb6d