Typically, when using an external editor, I do cp -f cart.p64 src
and then work on src
externally. Every time I make a change, I need to load src
before running. Then, I can put it back in the cart by doing cp -f src cart.p64
.
The suggested way of using external editors in the docs is to have the code externally, and simply include it from inside the cart. This will automatically use the latest external change, but it makes it harder to switch back to editing inside Picotron, as you need to change parts of your code to put everything back in the cart.
I made a quick utility to make loading an external folders easier.
extload
is a modified version of /system/util/load.lua
that loads a folder for external editing. It saves the path of the folder in /ram/extcart.pod
and loads extrunner
instead of the actual folder. (It also loads the workspaces from the folder, though this is a little janky.)
extrunner
is a dummy cart that cds into the external folder (from /ram/extcart.pod
), loads the graphics and sfx (by including /system/lib/resources.lua
), and runs it (by including main.lua
).
So, to set up an external project:
- Create a cart for the project (
cart.p64
) - Extract the cart (
cp -f cart.p64 src
) - Load the extracted cart (
extload src
) - Make any changes with an external editor, test those changes with Ctrl+R
- When done, rebuild the cart (
cp -f src cart.p64
)
This lets you work on any cart externally without having to load src
every time you make an external change and without needing to make any code changes!
extload.lua
extrunner main.lua
https://gist.github.com/Rayquaza01/574a21a168aa38dc4c0b8b3ec2caf69b
[Please log in to post a comment]