Implement SAVE (1)

This commit is contained in:
otya128 committed 2016-12-27 15:41:07 +09:00
1 parent ab86a9fb4e
commit 618a145c9c
2 files changed
+23 -1

No files matched your search

+20 -1
View File
@@ -2269,7 +2269,7 @@ class BuiltinFunction
}
if(resname == "" || resname.indexOf("PRG") == 0)
{
int lot;
int lot = p.currentSlot;
if(resname != "" && resname != "PRG")
{
auto num = resname[3..$];
@@ -2294,6 +2294,25 @@ class BuiltinFunction
flag.setDefaultValue(0);
throw new IllegalFunctionCall("NOTIMPL:LOAD");
}
static void SAVE(PetitComputer p, wstring name)
{
auto file = Projects.parseFileName(name);
if (file.resource != Resource.program && file.resource != Resource.none)
{
throw new IllegalFunctionCall("SAVE"/*, 1*/);
}
auto slot = p.currentSlot;
if (file.hasResourceNumber)
{
slot = file.resourceNumber;
}
if (slot >= p.slotSize)
{
throw new IllegalFunctionCall("SAVE"/*, 1*/);
}
auto str = cast(immutable)p.slot[slot].text;
p.project.saveTextFile(file, str);
}
static void SAVE(PetitComputer p, wstring name, Value data)
{
auto file = Projects.parseFileName(name);
+3
View File
@@ -1671,6 +1671,9 @@ class PetitComputer
currentDisplay.yoffset = currentDisplay.windowSize.height;
updateWindowSize();
}
int currentSlot;
int slotSize = 4;
//プチコン内部表現はRGB5_A1
static uint toGLColor(GLenum format, ubyte r, ubyte g, ubyte b, ubyte a)
{