1
0

Implement HARDWARE sytem variable

This commit is contained in:
otya128
2016-12-16 23:04:17 +09:00
parent 97d057aabc
commit e106374bb6
3 changed files with 16 additions and 0 deletions

View File

@@ -227,6 +227,7 @@ class Compiler
addSystemVariable("FREEMEM", new FreeMem()); addSystemVariable("FREEMEM", new FreeMem());
addSystemVariable("TABSTEP", new TabStep()); addSystemVariable("TABSTEP", new TabStep());
addSystemVariable("RESULT", new Result()); addSystemVariable("RESULT", new Result());
addSystemVariable("HARDWARE", new Hardware());
} }
void addSystemVariable(wstring name, SystemVariable var) void addSystemVariable(wstring name, SystemVariable var)
{ {

View File

@@ -213,6 +213,12 @@ class RingBuffer(T)
return buffer[(start != -1 ? start + index : index) % buffer.length]; return buffer[(start != -1 ? start + index : index) % buffer.length];
} }
} }
enum Hardware
{
threeDS = 0,
new3DS = 1,
wiiU = 2,
}
class PetitComputer class PetitComputer
{ {
this() this()
@@ -1463,6 +1469,7 @@ class PetitComputer
std.stdio.stderr.writefln("Unknown XON %s", func); std.stdio.stderr.writefln("Unknown XON %s", func);
} }
} }
Hardware hardware = Hardware.wiiU;
//プチコン内部表現はRGB5_A1 //プチコン内部表現はRGB5_A1
static uint toGLColor(GLenum format, ubyte r, ubyte g, ubyte b, ubyte a) static uint toGLColor(GLenum format, ubyte r, ubyte g, ubyte b, ubyte a)
{ {

View File

@@ -116,3 +116,11 @@ class Result : SystemVariable
return Value(vm.petitcomputer.project.result); return Value(vm.petitcomputer.project.result);
} }
} }
class Hardware : SystemVariable
{
@property
override Value value()
{
return Value(cast(int)vm.petitcomputer.hardware);
}
}