def convert_to_raw(self,ofile): nb = len(self.PageDict) num_pages = self.get_number_of_pages() widgets = ['Convert: ', Percentage(), ' ', \ Bar(marker=RotatingMarker()),' ', ETA()] pbar = ProgressBar(widgets=widgets, maxval=num_pages).start() page_count = 0 for i,xb in enumerate(self.PageDict.keys()): nb = len(self.PageDict) size = self.PageDict[xb][0][1] data_z = self.base.read(xb+0x20,size) if size == 0x10000: data_uz = data_z else: data_uz = xpress_decode(data_z) for page,size,offset in self.PageDict[xb]: pbar.update(page_count) ofile.seek(page*0x1000) ofile.write(data_uz[offset*0x1000:offset*0x1000+0x1000]) page_count+=1 del data_z,data_uz pbar.finish()
def convert_to_raw(self, ofile): nb = len(self.PageDict) num_pages = self.get_number_of_pages() widgets = ['Convert: ', Percentage(), ' ', \ Bar(marker=RotatingMarker()),' ', ETA()] pbar = ProgressBar(widgets=widgets, maxval=num_pages).start() page_count = 0 for i, xb in enumerate(self.PageDict.keys()): nb = len(self.PageDict) size = self.PageDict[xb][0][1] data_z = self.base.read(xb + 0x20, size) if size == 0x10000: data_uz = data_z else: data_uz = xpress_decode(data_z) for page, size, offset in self.PageDict[xb]: pbar.update(page_count) ofile.seek(page * 0x1000) ofile.write(data_uz[offset * 0x1000:offset * 0x1000 + 0x1000]) page_count += 1 del data_z, data_uz pbar.finish()
def read_xpress(self,baddr,BlockSize): if not baddr in self.DataCache: data_read = self.base.read(baddr,BlockSize) if BlockSize == 0x10000: data_uz = data_read else: data_uz = xpress_decode(data_read) self.DataCache[baddr] = data_uz else: self.CacheHits += 1 data_uz = self.DataCache[baddr] return data_uz
def read_xpress(self, baddr, BlockSize): if not baddr in self.DataCache: data_read = self.base.read(baddr, BlockSize) if BlockSize == 0x10000: data_uz = data_read else: data_uz = xpress_decode(data_read) self.DataCache[baddr] = data_uz else: self.CacheHits += 1 data_uz = self.DataCache[baddr] return data_uz
def read_xpress(self, baddr, BlockSize): try: return self.PageCache.get(baddr) except KeyError: data_read = self.base.read(baddr, BlockSize) if BlockSize == 0x10000: data_uz = data_read else: data_uz = xpress_decode(data_read) self.PageCache.put(baddr, data_uz) return data_uz
def read_xpress(self,baddr,BlockSize): try: return self.PageCache.get(baddr) except KeyError: data_read = self.base.read(baddr,BlockSize) if BlockSize == 0x10000: data_uz = data_read else: data_uz = xpress_decode(data_read) self.PageCache.put(baddr, data_uz) return data_uz