forked from hkc/cc-stuff
Finally print them normally
This commit is contained in:
parent
a8172db8f9
commit
42063e0271
|
@ -24,10 +24,18 @@ local function bytes2time(b)
|
|||
return string.format("%dm, %ds", math.floor(s / 60), s % 60)
|
||||
end
|
||||
|
||||
local screen_w, screen_h = term.getSize()
|
||||
|
||||
parallel.waitForAll(
|
||||
function()
|
||||
while running do
|
||||
for i = 1, math.min(screen_h, 48) do
|
||||
term.setCursorPos(1, i)
|
||||
local song = table_of_contents[i]
|
||||
if song then
|
||||
term.write(string.format("#%2d %9s %s", i, bytes2time(song.length), song.title))
|
||||
end
|
||||
end
|
||||
os.sleep(0.1)
|
||||
end
|
||||
end,
|
||||
|
@ -38,6 +46,8 @@ function()
|
|||
|
||||
if ev == "mouse_click" then
|
||||
local x, y = table.unpack(evd, 1)
|
||||
elseif ev == "term_resize" then
|
||||
screen_w, screen_h = term.getSize()
|
||||
elseif ev == "tape_present" then
|
||||
table_of_contents = {}
|
||||
if evd[1] then
|
||||
|
@ -47,9 +57,6 @@ function()
|
|||
local offset = read32()
|
||||
local length = read32()
|
||||
local title = drive.read(117)
|
||||
if length > 0 then
|
||||
print(string.format("%d: %d + %d %s", i, offset, length, title))
|
||||
end
|
||||
table.insert(table_of_contents, {
|
||||
title = length > 0 and title or nil,
|
||||
offset = offset,
|
||||
|
|
Loading…
Reference in New Issue