-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexapunks_solution.lua
More file actions
107 lines (86 loc) · 2.96 KB
/
exapunks_solution.lua
File metadata and controls
107 lines (86 loc) · 2.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
-- This is a generated file! Please edit source .ksy file and use kaitai-struct-compiler to rebuild
--
-- This file is compatible with Lua 5.3
package.path = package.path .. ";./kaitai-runtime/?.lua"
local class = require("class")
require("kaitaistruct")
local enum = require("enum")
local str_decode = require("string_decode")
ExapunksSolution = class.class(KaitaiStruct)
ExapunksSolution.WinValueType = enum.Enum {
cycles = 0,
size = 1,
activity = 2,
}
ExapunksSolution.EditorDisplayStatus = enum.Enum {
unrolled = 0,
collapsed = 1,
other = 2,
}
ExapunksSolution.MemoryScope = enum.Enum {
global = 0,
_local = 1,
}
function ExapunksSolution:_init(io, parent, root)
KaitaiStruct._init(self, io)
self._parent = parent
self._root = root or self
self:_read()
end
function ExapunksSolution:_read()
self.version = self._io:read_u4le()
self.file_id = ExapunksSolution.Pstr(self._io, self, self._root)
self.name = ExapunksSolution.Pstr(self._io, self, self._root)
self.competition_wins = self._io:read_u4le()
self.redshift_program_size = self._io:read_u4le()
self.win_stats_count = self._io:read_u4le()
self.win_stats = {}
for i = 0, self.win_stats_count - 1 do
self.win_stats[i + 1] = ExapunksSolution.WinValuePair(self._io, self, self._root)
end
self.exa_instances_count = self._io:read_u4le()
self.exa_instances = {}
for i = 0, self.exa_instances_count - 1 do
self.exa_instances[i + 1] = ExapunksSolution.ExaInstance(self._io, self, self._root)
end
end
ExapunksSolution.Pstr = class.class(KaitaiStruct)
function ExapunksSolution.Pstr:_init(io, parent, root)
KaitaiStruct._init(self, io)
self._parent = parent
self._root = root or self
self:_read()
end
function ExapunksSolution.Pstr:_read()
self.length = self._io:read_u4le()
self.string = str_decode.decode(self._io:read_bytes(self.length), "ASCII")
end
ExapunksSolution.WinValuePair = class.class(KaitaiStruct)
function ExapunksSolution.WinValuePair:_init(io, parent, root)
KaitaiStruct._init(self, io)
self._parent = parent
self._root = root or self
self:_read()
end
function ExapunksSolution.WinValuePair:_read()
self.type = ExapunksSolution.WinValueType(self._io:read_u4le())
self.value = self._io:read_u4le()
end
ExapunksSolution.ExaInstance = class.class(KaitaiStruct)
function ExapunksSolution.ExaInstance:_init(io, parent, root)
KaitaiStruct._init(self, io)
self._parent = parent
self._root = root or self
self:_read()
end
function ExapunksSolution.ExaInstance:_read()
self._unnamed0 = self._io:read_bytes(1)
if not(self._unnamed0 == "\010") then
error("not equal, expected " .. "\010" .. ", but got " .. self._unnamed0)
end
self.name = ExapunksSolution.Pstr(self._io, self, self._root)
self.code = ExapunksSolution.Pstr(self._io, self, self._root)
self.editor_display_status = ExapunksSolution.EditorDisplayStatus(self._io:read_u1())
self.memory_scope = ExapunksSolution.MemoryScope(self._io:read_u1())
self.bitmap = self._io:read_bytes(100)
end