no longer strip nulls from the end of all sectors, only the last one. still trying to figure out a nice way to handle it properly.

This commit is contained in:
Izaya 2023-08-06 11:10:13 +10:00
parent afbf6eaa7a
commit ad8a4813ee

View File

@ -392,14 +392,16 @@ function proxy:writeHandle(h,s)
return true return true
end end
function proxy:readHandle(h,s) function proxy:readHandle(h,s)
local handle = self.handles[h] local handle, rb = self.handles[h]
if handle.currentSector <= handle.ft[3] - 1 then if handle.currentSector < handle.ft[3] - 1 then
local rb = self.d.readSector(handle.ft[2] + handle.currentSector)
if handle.currentSector == handle.ft[3] - 1 then
local rb = self.d.readSector(handle.ft[2] + handle.currentSector):gsub("\0+$","") local rb = self.d.readSector(handle.ft[2] + handle.currentSector):gsub("\0+$","")
handle.currentSector = handle.currentSector + 1
return rb
else else
return nil return nil
end end
handle.currentSector = handle.currentSector + 1
return rb
end end
-- primarily for debugging -- primarily for debugging