Skip to content

Commit

Permalink
MasterTrack: Fix weak region running from the very start of the track
Browse files Browse the repository at this point in the history
This is seen in some BBC HFEv3 images, eg. Crazy Tracer by Acornsoft
downloadable here:
https://drive.google.com/drive/mobile/folders/140xzJarpb3HX04MaqR_m8AzDoG3Bdyky

Also disallow ridiculously short weak regions to avoid any further crashes
in the weak-flux generator due to reasonable assumptions about minimum
lengths of the weak region and the overall track.
  • Loading branch information
keirf committed Oct 13, 2023
1 parent 92c20c9 commit e4e3ee9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/greaseweazle/track.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,10 @@ def _flux(self, for_writeout, cue_at_index) -> Union[Flux, WriteoutFlux]:
ticks_to_index = sum(bit_ticks)

# Weak regions need special processing for correct flux representation.
for s,n in self.weak:
for s, n in self.weak:
if n < 2: continue # Too short to reliably weaken
e = s + n
assert 0 < s < e <= bitlen
assert 0 <= s < e <= bitlen
pattern = bitarray(endian="big")
if n < 400 or self.force_random_weak:
# Short weak regions are written with no flux transitions.
Expand Down

0 comments on commit e4e3ee9

Please sign in to comment.