main loop logic

This commit is contained in:
4am 2018-05-24 10:22:26 -04:00
parent deb27ebca9
commit 0b0eb4ae61

View File

@ -779,28 +779,30 @@ class BasePassportProcessor: # base class
# main loop - loop through disk from track $22 down to track $00 # main loop - loop through disk from track $22 down to track $00
for track_num in range(0x22, -1, -1): for track_num in range(0x22, -1, -1):
if track_num == 0 and self.g.tried_univ:
self.rwts = UniversalRWTSIgnoreEpilogues(self.logger)
should_run_patchers = False
self.g.track = track_num self.g.track = track_num
physical_sectors = self.rwts.decode_track(self.tracks[track_num], self.burn) try_again = True
if 0x0F not in physical_sectors: while try_again:
if self.SkipTrack(track_num, self.tracks[track_num]): try_again = False
self.save_track(track_num, None) physical_sectors = self.rwts.decode_track(self.tracks[track_num], self.burn)
if len(physical_sectors) == self.rwts.sectors_per_track:
continue
if (0x0F not in physical_sectors) and self.SkipTrack(track_num, self.tracks[track_num]):
physical_sectors = None
continue continue
if len(physical_sectors) < self.rwts.sectors_per_track:
# TODO wrong in case where we switch mid-track. # TODO wrong in case where we switch mid-track.
# Need to save the sectors that worked with the original RWTS # Need to save the sectors that worked with the original RWTS
# then append the ones that worked with the universal RWTS # then append the ones that worked with the universal RWTS
if self.g.tried_univ: if not self.g.tried_univ:
self.logger.PrintByID("fail") self.logger.PrintByID("switch", {"sector":0x0F}) # TODO find exact sector
return False self.rwts = UniversalRWTS(self.logger)
self.logger.PrintByID("switch", {"sector":0x0F}) # TODO find exact sector self.g.tried_univ = True
self.rwts = UniversalRWTS(self.logger) try_again = True
self.g.tried_univ = True continue
physical_sectors = self.rwts.decode_track(self.tracks[track_num], self.burn) if track_num == 0 and type(self.rwts) != UniversalRWTSIgnoreEpilogues:
if len(physical_sectors) < self.rwts.sectors_per_track: self.rwts = UniversalRWTSIgnoreEpilogues(self.logger)
self.logger.PrintByID("fail") # TODO find exact sector try_again = True
continue
self.logger.PrintByID("fail")
return False return False
self.save_track(track_num, physical_sectors) self.save_track(track_num, physical_sectors)
return True return True