From f04d8584d99b200392ff76be585591c16a8f5971 Mon Sep 17 00:00:00 2001 From: Chrys Date: Mon, 4 Nov 2019 22:52:38 +0100 Subject: [PATCH] get sure decode doesnt break --- .../screenDriver/vcsaDriver.py | 44 +++++++++++-------- 1 file changed, 26 insertions(+), 18 deletions(-) diff --git a/src/fenrirscreenreader/screenDriver/vcsaDriver.py b/src/fenrirscreenreader/screenDriver/vcsaDriver.py index b1d738cd..e25b1a8f 100644 --- a/src/fenrirscreenreader/screenDriver/vcsaDriver.py +++ b/src/fenrirscreenreader/screenDriver/vcsaDriver.py @@ -287,29 +287,37 @@ class driver(screenDriver): lineAttrib.append(charAttrib) lineText += ' ' continue - (sh,) = unpack("=H", data) - attr = (sh >> 8) & 0xFF - ch = sh & 0xFF - if self.hichar == 0x100: - attr >>= 1 - ink = attr & 0x0F - paper = (attr>>4) & 0x0F blink = 0 - if attr & 1: - blink = 1 - # blink seems to be set always, ignore for now - blink = 0 - bold = 0 - if attr & 16: - bold = 1 - #if (ink != 7) or (paper != 0): - # print(ink,paper) - if sh & self.hichar: - ch |= 0x100 + bold = 0 + ink = 7 + paper = 0 + ch = 32 + try: + (sh,) = unpack("=H", data) + attr = (sh >> 8) & 0xFF + ch = sh & 0xFF + if self.hichar == 0x100: + attr >>= 1 + ink = attr & 0x0F + paper = (attr>>4) & 0x0F + if attr & 1: + blink = 1 + # blink seems to be set always, ignore for now + blink = 0 + bold = 0 + if attr & 16: + bold = 1 + #if (ink != 7) or (paper != 0): + # print(ink,paper) + if sh & self.hichar: + ch |= 0x100 + except: + pass try: lineText += self.charmap[ch] except KeyError: lineText += '?' + charAttrib = [ self.fgColorValues[ink], self.bgColorValues[paper],