diff --git a/README.md b/README.md index bbf895c..8405100 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,7 @@ With the following arguments meaning: ``` ## Changelog ``` +07/12/2020 2.01 Improved collage creation under Python3. 04/12/2020 2.00 Now compatible with both Python2 and Python3. 23/11/2020 1.04 Fixed Bitmap size field. 30/04/2018 1.03 Added extra aggregated bitmap/collage output. diff --git a/bmc-tools.py b/bmc-tools.py index 4d715d5..29e5305 100755 --- a/bmc-tools.py +++ b/bmc-tools.py @@ -186,13 +186,11 @@ def b_export(self, dname): w = self.STRIPE_WIDTH*64 h*=len(self.bmps)//self.STRIPE_WIDTH c_bmp = b"" if not self.pal else self.PALETTE - for i in range(h//64): - for j in range(64): - for k in range(w//64): - if self.btype == self.BIN_CONTAINER: - c_bmp+=self.bmps[self.STRIPE_WIDTH*(i+1)-1-k][64*len(pad)*j:64*len(pad)*(j+1)] - else: - c_bmp+=self.bmps[self.STRIPE_WIDTH*i+k][64*len(pad)*j:64*len(pad)*(j+1)] + if self.btype == self.BIN_CONTAINER: + collage_builder = (lambda x, a=self, PAD=len(pad), WIDTH=range(w // 64): b''.join([b''.join([a.bmps[a.STRIPE_WIDTH*(x+1)-1-k][64*PAD*j:64*PAD*(j+1)] for k in WIDTH]) for j in range(64)])) + else: + collage_builder = (lambda x, a=self, PAD=len(pad), WIDTH=range(w // 64): b''.join([b''.join([a.bmps[a.STRIPE_WIDTH*x+k][64*PAD*j:64*PAD*(j+1)] for k in WIDTH]) for j in range(64)])) + c_bmp += b''.join(map(collage_builder, range(h//64))) self.b_write(os.path.join(dname, "%s_collage.bmp" % (self.fname)), self.b_export_bmp(w, h, c_bmp)) self.b_log(sys.stdout, False, 0, "Successfully exported collage file.") return True @@ -212,7 +210,7 @@ def b_flush(self): return True if __name__ == "__main__": - prs = argparse.ArgumentParser(description="RDP Bitmap Cache parser (v. 2.00, 04/12/2020)") + prs = argparse.ArgumentParser(description="RDP Bitmap Cache parser (v. 2.01, 2020/12/07)") prs.add_argument("-s", "--src", help="Specify the BMCache file or directory to process.", required=True) prs.add_argument("-d", "--dest", help="Specify the directory where to store the extracted bitmaps.", required=True) prs.add_argument("-c", "--count", help="Only extract the given number of bitmaps.", type=int, default=-1)