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
1 changed files with 6 additions and 4 deletions

View File

@ -392,14 +392,16 @@ function proxy:writeHandle(h,s)
return true
end
function proxy:readHandle(h,s)
local handle = self.handles[h]
if handle.currentSector <= handle.ft[3] - 1 then
local handle, rb = self.handles[h]
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+$","")
handle.currentSector = handle.currentSector + 1
return rb
else
return nil
end
handle.currentSector = handle.currentSector + 1
return rb
end
-- primarily for debugging