Makes Picotron (the app itself) crash if your cartridge crashes (intended for when exporting only).
create_process("picotronCrash.lua",{id=pid(),interval=1}) creates a process that will check that the id (your cartridge) is still running every (interval) seconds.
If there's a way to detect a crash instantly, I will update this.
picotronCrash.lua
local crashcheckinterval=env().interval or 5
local tocheck=time()+crashcheckinterval
local id=env().id or -1
function _update()
if (time()>tocheck) then
local processes=fetch("/ram/system/processes.pod")
local crash=true
for i=1, #processes do
if (processes[i].id==id) crash=false break
end
if (crash) then
send_message(2, {event="kill_process",proc_id=2}) -- crash picotron
end
tocheck=time()+crashcheckinterval
end
flip()
end |
this can help you make your source files a little safer aswell for exports, since when you crash you'd be able to see all the source files - alongside crashing the picotron instead of sending people to an unfamiliar environment if it crashes (presuming they dont use picotron)
Tested with windows .bin exports, doesn't seem to work on BBS (possibly means html won't work)
Notice
Unfortunately, you can rip p64.roms from exports - this just helps deter an easier way of stealing the source files.
We pray zep makes it easier/possible to actually close source our stuff
iii could - i forgot it existed at the time
both work though
ill make it use shutdown if i ever update this (e.g: if a better way than checking pids at an interval is found)
The shutdown message works on the BBS and on HTML exports. Just tested it.
oh no, i know it works i just forgot that it existed
i'm just going to update the code if there's a more optimum way for the crash check
ofc!
i should mention it is (unfortunately) possible to rip a p64.rom from the html and bin exports of stuff, i wish it was possible to properly close source stuff
part of the reason ive been less into working on my game
Thanks. I would like a better way to protect the source files too. I hope the Dev of picotron can do something to improve that.
Nothing is infallible, but any serious game engine has some form of protection for those who want it.
[Please log in to post a comment]




