This repository has been archived by the owner on Sep 19, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
startup
104 lines (87 loc) · 2.6 KB
/
startup
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
fs.open("log", "w").close()
local _print = print
function _G.print( ... )
_print( ... )
log(tostring(... or ""))
end
function _G.log( text )
local h = fs.open("log", "a")
h.write( tostring(text ) .. '\n')
h.close()
end
function _G.log2( text )
local h = fs.open("log2", "a")
h.write( tostring(text ) .. '\n')
h.close()
end
local _error = error
function _G.logtraceback( level )
level = 2 + ( level or 1 )
local traceback, trace, source, line = {}
repeat
traceback[#traceback + 1] = trace
trace = select( 2, pcall( _error, "@", level ) ):match "^(.+) @"
if trace and trace:find "^.+%.lua:%d+:$" then
trace = trace:match "^(.+)%.lua:%d+:$" .. " on line " .. trace:match "^.+%.lua:(%d+):$"
end
level = level + 1
if trace == "startup:55:" then
break
end
until not trace
log( "Start of traceback:\n" .. ("-"):rep( 20 ) .. "\nin " .. table.concat( traceback, "\nin ") .. "\n" .. ("-"):rep( 20 ) .. "\nEnd of traceback" )
end
-- if not fs.exists( "oeed" ) then
-- shell.run "NewRendering/test.lua"
-- read()
-- os.reboot()
-- do return end
-- end
-- os.loadAPI( 'src/debug' )
-- _G.debug = debug
term.redirect(term.native())
-- setmetatable( _G, {
-- __newindex = function( self, k, v )
-- rawset( self, k, v )
-- if k:sub(1,1):upper() ~= k:sub(1,1) then
-- print( "Set _G." .. k .. " to: " .. tostring( v ) )
-- end
-- -- logtraceback()
-- end
-- } )
if fs.exists("Silica.resourcepkg") then
log("Using built package")
local _, err = pcall(function() dofile( "Silica.resourcepkg" ) end)
fs.delete("OldSilica.resourcepkg")
fs.move("Silica.resourcepkg","OldSilica.resourcepkg")
if err then error(err,2) end
else
log("Using old style package")
shell.run( "package /src Silica" )
dofile( "Silica" )
log("Building")
local folder = Folder( "/src" )
log(folder)
local package = folder:package( "/Silica.resourcepkg", true, true )
log("packaged!")
os.reboot()
end
-- shell.run( "package /application app" )
--
-- the emulator only seems to want to draw after the first yield, so this just yields before we begin
os.queueEvent("damn_emulator")
os.pullEvent("damn_emulator")
-- dofile( "app" )
Application.static:load( "/testapplication" )
-- BitmapFont.convertFile( "font src/auckland", "src/fonts/Auckland.sfont", 32, 8, {
-- name = "Auckland";
-- author = "oeed";
-- version = 0.9;
-- fontType = "bitmap";
-- } )
-- -- this is essentially what the startup file will look like
-- ExampleApplication():run( ... )
-- Program functions...
-- FontStudioApplication():run( ... )
-- FilesApplication():run( ... )
TestApplication():run( ... )