forked from hkc/cc-stuff
1
0
Fork 0

Forgot to store new state

Also printing titles now!
This commit is contained in:
Casey 2023-10-17 16:07:54 +03:00
parent 99d5f95757
commit a8172db8f9
Signed by: hkc
GPG Key ID: F0F6CFE11CDB0960
1 changed files with 6 additions and 2 deletions

View File

@ -47,9 +47,11 @@ function()
local offset = read32() local offset = read32()
local length = read32() local length = read32()
local title = drive.read(117) local title = drive.read(117)
print(string.format("%d: %d + %d", i, offset, length)) if length > 0 then
print(string.format("%d: %d + %d %s", i, offset, length, title))
end
table.insert(table_of_contents, { table.insert(table_of_contents, {
title = length and title or nil, title = length > 0 and title or nil,
offset = offset, offset = offset,
length = length, length = length,
ending = offset + length ending = offset + length
@ -66,11 +68,13 @@ function()
local tape_present = drive.isReady() local tape_present = drive.isReady()
if tape_present ~= tape_was_present then if tape_present ~= tape_was_present then
os.queueEvent("tape_present", tape_present) os.queueEvent("tape_present", tape_present)
tape_was_present = tape_present
end end
local drive_state = drive.getState() local drive_state = drive.getState()
if drive_old_state ~= drive_state then if drive_old_state ~= drive_state then
os.queueEvent("drive_state", drive_state) os.queueEvent("drive_state", drive_state)
drive_old_state = drive_state
end end
os.sleep(0.25) os.sleep(0.25)