diff options
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/build/complay.py | 95 | ||||
-rw-r--r-- | scripts/src/emu.lua | 1 | ||||
-rw-r--r-- | scripts/src/lib.lua | 3 |
3 files changed, 62 insertions, 37 deletions
diff --git a/scripts/build/complay.py b/scripts/build/complay.py index a88d0d9f4a5..3e9d6ed693c 100755 --- a/scripts/build/complay.py +++ b/scripts/build/complay.py @@ -225,6 +225,8 @@ class LayoutChecker(Minifyer): bottom = self.checkFloatAttribute('bounds', attrs, 'bottom', 1.0) x = self.checkFloatAttribute('bounds', attrs, 'x', 0.0) y = self.checkFloatAttribute('bounds', attrs, 'y', 0.0) + xc = self.checkFloatAttribute('bounds', attrs, 'xc', 0.0) + yc = self.checkFloatAttribute('bounds', attrs, 'yc', 0.0) width = self.checkFloatAttribute('bounds', attrs, 'width', 1.0) height = self.checkFloatAttribute('bounds', attrs, 'height', 1.0) if (left is not None) and (right is not None) and (left > right): @@ -239,12 +241,14 @@ class LayoutChecker(Minifyer): self.handleError('Element bounds attribute width "%s" is negative' % (attrs['width'], )) if (height is not None) and (0.0 > height): self.handleError('Element bounds attribute height "%s" is negative' % (attrs['height'], )) - if ('left' not in attrs) and ('x' not in attrs): - self.handleError('Element bounds has neither attribute left nor attribute x') - has_ltrb = ('left' in attrs) or ('top' in attrs) or ('right' in attrs) or ('bottom' in attrs) - has_origin_size = ('x' in attrs) or ('y' in attrs) or ('width' in attrs) or ('height' in attrs) - if has_ltrb and has_origin_size: - self.handleError('Element bounds has both left/top/right/bottom and origin/size attributes') + if (('left' in attrs) and (('x' in attrs) or ('xc' in attrs))) or (('x' in attrs) and ('xc' in attrs)): + self.handleError('Element bounds has multiple horizontal origin attributes (left/x/xc)') + if (('left' in attrs) and ('width' in attrs)) or ((('x' in attrs) or ('xc' in attrs)) and ('right' in attrs)): + self.handleError('Element bounds has both left/right and x/xc/width attributes') + if (('top' in attrs) and (('y' in attrs) or ('yc' in attrs))) or (('y' in attrs) and ('yc' in attrs)): + self.handleError('Element bounds has multiple vertical origin attributes (top/y/yc)') + if (('top' in attrs) and ('height' in attrs)) or ((('y' in attrs) or ('yc' in attrs)) and ('bottom' in attrs)): + self.handleError('Element bounds has both top/bottom and y/yc/height attributes') def checkOrientation(self, attrs): if self.have_orientation[-1]: @@ -291,8 +295,32 @@ class LayoutChecker(Minifyer): self.have_bounds.append({ }) self.have_color.append({ }) - def startObject(self, name): - self.handlers.append((self.objectStartHandler, self.objectEndHandler)) + def checkViewItem(self, name, attrs): + if ('blend' in attrs) and (attrs['blend'] not in self.BLENDMODES) and not self.VARPATTERN.match(attrs['blend']): + self.handleError('Element %s attribute blend "%s" is unsupported' % (name, attrs['blend'])) + if 'inputtag' in attrs: + if 'inputmask' not in attrs: + self.handleError('Element %s has inputtag attribute without inputmask attribute' % (name, )) + self.checkTag(attrs['inputtag'], name, 'inputtag') + elif 'inputmask' in attrs: + self.handleError('Element %s has inputmask attribute without inputtag attribute' % (name, )) + inputraw = None + if 'inputraw' in attrs: + if (attrs['inputraw'] not in self.YESNO) and (not self.VARPATTERN.match(attrs['inputraw'])): + self.handleError('Element %s attribute inputraw "%s" is not "yes" or "no"' % (name, attrs['inputraw'])) + else: + inputraw = 'yes' == attrs['inputraw'] + if 'inputmask' not in attrs: + self.handleError('Element %s has inputraw attribute without inputmask attribute' % (name, )) + if 'inputtag' not in attrs: + self.handleError('Element %s has inputraw attribute without inputtag attribute' % (name, )) + inputmask = self.checkIntAttribute(name, attrs, 'inputmask', None) + if (inputmask is not None) and (not inputmask): + if (inputraw is None) or (not inputraw): + self.handleError('Element %s attribute inputmask "%s" is zero' % (name, attrs['inputmask'])) + + def startViewItem(self, name): + self.handlers.append((self.viewItemStartHandler, self.viewItemEndHandler)) self.have_bounds.append(None if 'group' == name else { }) self.have_orientation.append(False) self.have_color.append(None if 'group' == name else { }) @@ -477,29 +505,8 @@ class LayoutChecker(Minifyer): self.handleError('Element %s missing attribute ref' % (name, )) elif attrs['ref'] not in self.referenced_elements: self.referenced_elements[attrs['ref']] = self.formatLocation() - if ('blend' in attrs) and (attrs['blend'] not in self.BLENDMODES) and not self.VARPATTERN.match(attrs['blend']): - self.handleError('Element %s attribute blend "%s" is unsupported' % (name, attrs['blend'])) - if 'inputtag' in attrs: - if 'inputmask' not in attrs: - self.handleError('Element %s has inputtag attribute without inputmask attribute' % (name, )) - self.checkTag(attrs['inputtag'], name, 'inputtag') - elif 'inputmask' in attrs: - self.handleError('Element %s has inputmask attribute without inputtag attribute' % (name, )) - inputraw = None - if 'inputraw' in attrs: - if (attrs['inputraw'] not in self.YESNO) and (not self.VARPATTERN.match(attrs['inputraw'])): - self.handleError('Element %s attribute inputraw "%s" is not "yes" or "no"' % (name, attrs['inputraw'])) - else: - inputraw = 'yes' == attrs['inputraw'] - if 'inputmask' not in attrs: - self.handleError('Element %s has inputraw attribute without inputmask attribute' % (name, )) - if 'inputtag' not in attrs: - self.handleError('Element %s has inputraw attribute without inputtag attribute' % (name, )) - inputmask = self.checkIntAttribute(name, attrs, 'inputmask', None) - if (inputmask is not None) and (0 == inputmask): - if (inputraw is None) or (0 == inputraw): - self.handleError('Element %s attribute inputmask "%s" is zero' % (name, attrs['inputmask'])) - self.startObject(name) + self.checkViewItem(name, attrs) + self.startViewItem(name) elif 'screen' == name: if 'index' in attrs: index = self.checkIntAttribute(name, attrs, 'index', None) @@ -512,7 +519,8 @@ class LayoutChecker(Minifyer): self.checkTag(tag, name, 'tag') if self.BADTAGPATTERN.search(tag): self.handleError('Element screen attribute tag "%s" contains invalid characters' % (tag, )) - self.startObject(name) + self.checkViewItem(name, attrs) + self.startViewItem(name) elif 'group' == name: if 'ref' not in attrs: self.handleError('Element group missing attribute ref') @@ -525,7 +533,7 @@ class LayoutChecker(Minifyer): self.current_collections[n] = l else: self.handleError('Element group instantiates collection with duplicate name "%s" from %s (previous %s)' % (n, l, self.current_collections[n])) - self.startObject(name) + self.startViewItem(name) elif 'repeat' == name: if 'count' not in attrs: self.handleError('Element repeat missing attribute count') @@ -577,8 +585,19 @@ class LayoutChecker(Minifyer): self.have_bounds.pop() self.handlers.pop() - def objectStartHandler(self, name, attrs): - if 'bounds' == name: + def viewItemStartHandler(self, name, attrs): + if 'animate' == name: + if isinstance(self.have_bounds[-1], dict): + if 'inputtag' in attrs: + if 'name' in attrs: + self.handleError('Element animate has both attribute inputtag and attribute name') + self.checkTag(attrs['inputtag'], name, 'inputtag') + elif 'name' not in attrs: + self.handleError('Element animate has neither attribute inputtag nor attribute name') + self.checkIntAttribute(name, attrs, 'mask', None) + else: + self.handleError('Encountered unexpected element %s' % (name, )) + elif 'bounds' == name: if self.have_bounds[-1] is None: self.have_bounds[-1] = self.formatLocation() elif isinstance(self.have_bounds[-1], dict): @@ -595,7 +614,7 @@ class LayoutChecker(Minifyer): self.checkBounds(attrs) elif 'orientation' == name: self.checkOrientation(attrs) - if 'color' == name: + elif 'color' == name: if self.have_color[-1] is None: self.have_color[-1] = self.formatLocation() elif isinstance(self.have_color[-1], dict): @@ -610,9 +629,11 @@ class LayoutChecker(Minifyer): else: self.handleError('Duplicate element color (previous %s)' % (self.have_color[-1], )) self.checkColor(attrs) + else: + self.handleError('Encountered unexpected element %s' % (name, )) self.ignored_depth = 1 - def objectEndHandler(self, name): + def viewItemEndHandler(self, name): self.have_bounds.pop() self.have_orientation.pop() self.have_color.pop() diff --git a/scripts/src/emu.lua b/scripts/src/emu.lua index 89c7d3ccd20..d65ea40c21d 100644 --- a/scripts/src/emu.lua +++ b/scripts/src/emu.lua @@ -181,6 +181,7 @@ files { MAME_DIR .. "src/emu/recording.h", MAME_DIR .. "src/emu/render.cpp", MAME_DIR .. "src/emu/render.h", + MAME_DIR .. "src/emu/rendertypes.h", MAME_DIR .. "src/emu/rendfont.cpp", MAME_DIR .. "src/emu/rendfont.h", MAME_DIR .. "src/emu/rendlay.cpp", diff --git a/scripts/src/lib.lua b/scripts/src/lib.lua index a5ce6180857..edc68ee3c13 100644 --- a/scripts/src/lib.lua +++ b/scripts/src/lib.lua @@ -74,7 +74,10 @@ project "utils" MAME_DIR .. "src/lib/util/jedparse.h", MAME_DIR .. "src/lib/util/md5.cpp", MAME_DIR .. "src/lib/util/md5.h", + MAME_DIR .. "src/lib/util/msdib.cpp", + MAME_DIR .. "src/lib/util/msdib.h", MAME_DIR .. "src/lib/util/nanosvg.cpp", + MAME_DIR .. "src/lib/util/nanosvg.h", MAME_DIR .. "src/lib/util/opresolv.cpp", MAME_DIR .. "src/lib/util/opresolv.h", MAME_DIR .. "src/lib/util/options.cpp", |