mirror of
https://github.com/litruv/picoGraph.git
synced 2026-07-24 02:36:04 +10:00
37 lines
1015 B
JavaScript
37 lines
1015 B
JavaScript
import { createNodeModule } from "../../nodeTypes.js";
|
|
|
|
/**
|
|
* Persists the active cartridge to disk.
|
|
*/
|
|
export const saveNode = createNodeModule(
|
|
{
|
|
id: "system_save",
|
|
title: "Save Cartridge",
|
|
category: "System",
|
|
description: "Save the current cartridge to the specified filename.",
|
|
searchTags: ["save", "cartridge", "system", "cart"],
|
|
inputs: [
|
|
{ id: "exec_in", name: "Exec", direction: "input", kind: "exec" },
|
|
{
|
|
id: "filename",
|
|
name: "Filename",
|
|
direction: "input",
|
|
kind: "string",
|
|
defaultValue: "cart.p8",
|
|
},
|
|
],
|
|
outputs: [
|
|
{ id: "exec_out", name: "Exec", direction: "output", kind: "exec" },
|
|
],
|
|
properties: [],
|
|
},
|
|
{
|
|
emitExec: ({ indent, indentLevel, resolveValueInput, emitNextExec }) => {
|
|
const filename = resolveValueInput("filename", '""');
|
|
const lines = [`${indent(indentLevel)}save(${filename})`];
|
|
lines.push(...emitNextExec("exec_out"));
|
|
return lines;
|
|
},
|
|
}
|
|
);
|