From 523d3045d250616fa8cf558ac0f4b2738e9af55a Mon Sep 17 00:00:00 2001 From: Kelvin Sherlock Date: Sat, 1 Aug 2020 15:32:35 -0400 Subject: [PATCH] custom resource ranges --- base.py | 3 ++- menu.py | 7 +++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/base.py b/base.py index ee0d027..d4fbd87 100644 --- a/base.py +++ b/base.py @@ -15,6 +15,7 @@ __all__ = ["rObject", "rText", "rTextBlock", "rTextForLETextBox2", class rObject: rName = None rType = None + rRange = range(1,0x07FF0000) _rmap = {} _resources = {} @@ -63,7 +64,7 @@ class rObject: used.sort() - rr = range(1,0x07FEFFFF) + rr = self.rRange if type(rID) == range: rr = rID diff --git a/menu.py b/menu.py index 5455d6a..a68fd49 100644 --- a/menu.py +++ b/menu.py @@ -35,8 +35,9 @@ _menu_item_ids = {} def _to_char_string(x): if not x: return '""' - if x in (0x0a, 0x0d): return "\\n" - if x == ord('"'): return "\"" + if x == 0x0d: return "\\n" # intentionally backwards + if x == 0x0a: return "\\r" # + if chr(x) in "\\\\'" : return "\\" + x if x >= 32 and x < 0x7e: return '"' + chr(x) + '"' return "\\${:02x}".format(x) @@ -72,6 +73,7 @@ class rMenuBar(rObject): class rMenu(rObject): rName = "rMenu" rType = 0x8009 + rRange = range(0x0001,0xffff) # /*-------------------------------------------------------*/ # /* Equates for Menu Flags @@ -147,6 +149,7 @@ miClose = 0xff class rMenuItem(rObject): rName = "rMenuItem" rType = 0x800a + rRange = range(0x100,0xffff) # /* --------------------------------------------------*/ # /* flag word for menu item