diff options
author | couriersud <couriersud@arcor.de> | 2015-02-22 02:52:01 +0100 |
---|---|---|
committer | couriersud <couriersud@arcor.de> | 2015-02-22 02:52:01 +0100 |
commit | 99d7d21bdef13f828212f4390f98aef0a3df0ecd (patch) | |
tree | 17854e79f8e4ee2fde3b8bc8d2c353b85519027b | |
parent | 96ff550552b72e22648516460e66a20253bdd0b8 (diff) | |
parent | 01bfefa3360f5f7c276f400243162ea9947d4071 (diff) |
Merge branch 'master' of https://github.com/mamedev/mame.git
-rw-r--r-- | src/build/verinfo.py | 146 | ||||
-rw-r--r-- | src/mess/osd/windows/windows.mak | 2 | ||||
-rw-r--r-- | src/osd/modules/debugger/osx/debugview.h | 4 | ||||
-rw-r--r-- | src/osd/modules/debugger/osx/debugview.m | 116 | ||||
-rw-r--r-- | src/osd/sdl/sdl.mak | 2 | ||||
-rw-r--r-- | src/osd/windows/windows.mak | 2 | ||||
-rw-r--r-- | src/ume/osd/windows/windows.mak | 2 |
7 files changed, 172 insertions, 102 deletions
diff --git a/src/build/verinfo.py b/src/build/verinfo.py index 465f8d0e3cb..b6bb2f65e80 100644 --- a/src/build/verinfo.py +++ b/src/build/verinfo.py @@ -9,25 +9,32 @@ import sys def parse_args(): def usage(): - sys.stderr.write('Usage: verinfo.py [-b mame|mess|ume] [-r|-p] <filename>\n') + sys.stderr.write('Usage: verinfo.py [-b mame|mess|ume] [-r|-p] [-o <outfile>] <srcfile>\n') sys.exit(1) flags = True target = 'mame' + format = 'rc' input = None - output = 'rc' + output = None i = 1 while i < len(sys.argv): if flags and (sys.argv[i] == '-r'): - output = 'rc' + format = 'rc' elif flags and (sys.argv[i] == '-p'): - output = 'plist' + format = 'plist' elif flags and (sys.argv[i] == '-b'): i += 1; if (i >= len(sys.argv)) or (sys.argv[i] not in ('mame', 'mess', 'ume')): usage() else: target = sys.argv[i] + elif flags and (sys.argv[i] == '-o'): + i += 1; + if (i >= len(sys.argv)) or (output is not None): + usage() + else: + output = sys.argv[i] elif flags and (sys.argv[i] == '--'): flags = False elif flags and sys.argv[i].startswith('-'): @@ -39,7 +46,7 @@ def parse_args(): i += 1 if input is None: usage() - return target, input, output + return target, format, input, output def extract_version(input): @@ -51,10 +58,10 @@ def extract_version(input): return None, None, None -build, srcfile, outfmt = parse_args() +build, outfmt, srcfile, dstfile = parse_args() try: - fp = open(srcfile, 'rb') + fp = open(srcfile, 'rU') except IOError: sys.stderr.write("Unable to open source file '%s'\n" % srcfile) sys.exit(1) @@ -65,6 +72,16 @@ version_subbuild = "0" if not version_string: sys.stderr.write("Unable to extract version from source file '%s'\n" % srcfile) sys.exit(1) +fp.close() + +if dstfile is not None: + try: + fp = open(dstfile, 'w') + except IOError: + sys.stderr.write("Unable to open output file '%s'\n" % dstfile) + sys.exit(1) +else: + fp = sys.stdout if build == "mess": # MESS @@ -100,61 +117,62 @@ else: legal_copyright = "Copyright Nicola Salmoria and the MAME team" if outfmt == 'rc': - print("VS_VERSION_INFO VERSIONINFO") - print("\tFILEVERSION %s,%s,%s,%s" % (version_major, version_minor, version_build, version_subbuild)) - print("\tPRODUCTVERSION %s,%s,%s,%s" % (version_major, version_minor, version_build, version_subbuild)) - print("\tFILEFLAGSMASK 0x3fL") - if (version_build == 0) : - print("\tFILEFLAGS 0x0L") - else : - print("\tFILEFLAGS VS_FF_PRERELEASE") - print("\tFILEOS VOS_NT_WINDOWS32") - print("\tFILETYPE VFT_APP") - print("\tFILESUBTYPE VFT2_UNKNOWN") - print("BEGIN") - print("\tBLOCK \"StringFileInfo\"") - print("\tBEGIN") - print("#ifdef UNICODE") - print("\t\tBLOCK \"040904b0\"") - print("#else") - print("\t\tBLOCK \"040904E4\"") - print("#endif") - print("\t\tBEGIN") - print("\t\t\tVALUE \"Author\", \"%s\\0\"" % author) - print("\t\t\tVALUE \"Comments\", \"%s\\0\"" % comments) - print("\t\t\tVALUE \"CompanyName\", \"%s\\0\"" % company_name) - print("\t\t\tVALUE \"FileDescription\", \"%s\\0\"" % file_description) - print("\t\t\tVALUE \"FileVersion\", \"%s, %s, %s, %s\\0\"" % (version_major, version_minor, version_build, version_subbuild)) - print("\t\t\tVALUE \"InternalName\", \"%s\\0\"" % internal_name) - print("\t\t\tVALUE \"LegalCopyright\", \"%s\\0\"" % legal_copyright) - print("\t\t\tVALUE \"OriginalFilename\", \"%s\\0\"" % original_filename) - print("\t\t\tVALUE \"ProductName\", \"%s\\0\"" % product_name) - print("\t\t\tVALUE \"ProductVersion\", \"%s\\0\"" % version_string) - print("\t\tEND") - print("\tEND") - print("\tBLOCK \"VarFileInfo\"") - print("\tBEGIN") - print("#ifdef UNICODE") - print("\t\tVALUE \"Translation\", 0x409, 1200") - print("#else") - print("\t\tVALUE \"Translation\", 0x409, 1252") - print("#endif") - print("\tEND") - print("END") + fp.write('VS_VERSION_INFO VERSIONINFO\n') + fp.write('\tFILEVERSION %s,%s,%s,%s\n' % (version_major, version_minor, version_build, version_subbuild)) + fp.write('\tPRODUCTVERSION %s,%s,%s,%s\n' % (version_major, version_minor, version_build, version_subbuild)) + fp.write('\tFILEFLAGSMASK 0x3fL\n') + if (version_build == 0): + fp.write('\tFILEFLAGS 0x0L\n') + else: + fp.write('\tFILEFLAGS VS_FF_PRERELEASE\n') + fp.write('\tFILEOS VOS_NT_WINDOWS32\n') + fp.write('\tFILETYPE VFT_APP\n') + fp.write('\tFILESUBTYPE VFT2_UNKNOWN\n') + fp.write('BEGIN\n') + fp.write('\tBLOCK "StringFileInfo"\n') + fp.write('\tBEGIN\n') + fp.write('#ifdef UNICODE\n') + fp.write('\t\tBLOCK "040904b0"\n') + fp.write('#else\n') + fp.write('\t\tBLOCK "040904E4"\n') + fp.write('#endif\n') + fp.write('\t\tBEGIN\n') + fp.write('\t\t\tVALUE "Author", "%s\\0"\n' % author) + fp.write('\t\t\tVALUE "Comments", "%s\\0"\n' % comments) + fp.write('\t\t\tVALUE "CompanyName", "%s\\0"\n' % company_name) + fp.write('\t\t\tVALUE "FileDescription", "%s\\0"\n' % file_description) + fp.write('\t\t\tVALUE "FileVersion", "%s, %s, %s, %s\\0"\n' % (version_major, version_minor, version_build, version_subbuild)) + fp.write('\t\t\tVALUE "InternalName", "%s\\0"\n' % internal_name) + fp.write('\t\t\tVALUE "LegalCopyright", "%s\\0"\n' % legal_copyright) + fp.write('\t\t\tVALUE "OriginalFilename", "%s\\0"\n' % original_filename) + fp.write('\t\t\tVALUE "ProductName", "%s\\0"\n' % product_name) + fp.write('\t\t\tVALUE "ProductVersion", "%s\\0"\n' % version_string) + fp.write('\t\tEND\n') + fp.write('\tEND\n') + fp.write('\tBLOCK "VarFileInfo"\n') + fp.write('\tBEGIN\n') + fp.write('#ifdef UNICODE\n') + fp.write('\t\tVALUE "Translation", 0x409, 1200\n') + fp.write('#else\n') + fp.write('\t\tVALUE "Translation", 0x409, 1252\n') + fp.write('#endif\n') + fp.write('\tEND\n') + fp.write('END\n') elif outfmt == 'plist': - print('<?xml version="1.0" encoding="UTF-8"?>') - print('<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">') - print('<plist version="1.0">') - print('<dict>') - print('\t<key>CFBundleDisplayName</key>') - print('\t<string>%s</string>' % product_name) - print('\t<key>CFBundleIdentifier</key>') - print('\t<string>%s</string>' % bundle_identifier) - print('\t<key>CFBundleInfoDictionaryVersion</key>') - print('\t<string>6.0</string>') - print('\t<key>CFBundleName</key>') - print('\t<string>%s</string>' % product_name) - print('\t<key>CFBundleShortVersionString</key>') - print('\t<string>%s.%s.%s</string>' % (version_major, version_minor, version_build)) - print('</dict>') - print('</plist>') + fp.write('<?xml version="1.0" encoding="UTF-8"?>\n') + fp.write('<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">\n') + fp.write('<plist version="1.0">\n') + fp.write('<dict>\n') + fp.write('\t<key>CFBundleDisplayName</key>\n') + fp.write('\t<string>%s</string>\n' % product_name) + fp.write('\t<key>CFBundleIdentifier</key>\n') + fp.write('\t<string>%s</string>\n' % bundle_identifier) + fp.write('\t<key>CFBundleInfoDictionaryVersion</key>\n') + fp.write('\t<string>6.0</string>\n') + fp.write('\t<key>CFBundleName</key>\n') + fp.write('\t<string>%s</string>\n' % product_name) + fp.write('\t<key>CFBundleShortVersionString</key>\n') + fp.write('\t<string>%s.%s.%s</string>\n' % (version_major, version_minor, version_build)) + fp.write('</dict>\n') + fp.write('</plist>\n') +fp.flush() diff --git a/src/mess/osd/windows/windows.mak b/src/mess/osd/windows/windows.mak index 4461c6d14bb..01b209b936b 100644 --- a/src/mess/osd/windows/windows.mak +++ b/src/mess/osd/windows/windows.mak @@ -38,4 +38,4 @@ $(RESFILE): $(MESS_WINSRC)/mess.rc $(MESS_WINOBJ)/messvers.rc $(MESS_WINOBJ)/messvers.rc: $(SRC)/build/verinfo.py $(SRC)/version.c @echo Emitting $@... - $(PYTHON) $(SRC)/build/verinfo.py -b mess $(SRC)/version.c > $@
\ No newline at end of file + $(PYTHON) $(SRC)/build/verinfo.py -b mess -o $@ $(SRC)/version.c diff --git a/src/osd/modules/debugger/osx/debugview.h b/src/osd/modules/debugger/osx/debugview.h index 6d393072bb4..b6b63547032 100644 --- a/src/osd/modules/debugger/osx/debugview.h +++ b/src/osd/modules/debugger/osx/debugview.h @@ -23,7 +23,7 @@ running_machine *machine; debug_view *view; - INT32 totalWidth, totalHeight, originLeft, originTop; + INT32 totalWidth, totalHeight, originTop; NSFont *font; CGFloat fontWidth, fontHeight, fontAscent; @@ -51,6 +51,8 @@ - (IBAction)copyVisible:(id)sender; - (IBAction)paste:(id)sender; +- (void)viewBoundsDidChange:(NSNotification *)notification; + - (void)windowDidBecomeKey:(NSNotification *)notification; - (void)windowDidResignKey:(NSNotification *)notification; diff --git a/src/osd/modules/debugger/osx/debugview.m b/src/osd/modules/debugger/osx/debugview.m index 06f18232dd4..abedc1c3170 100644 --- a/src/osd/modules/debugger/osx/debugview.m +++ b/src/osd/modules/debugger/osx/debugview.m @@ -165,26 +165,22 @@ static void debugwin_view_update(debug_view &view, void *osdprivate) - (void)recomputeVisible { - if ([self window] != nil) - { - // this gets all the lines that are at least partially visible - debug_view_xy origin(0, 0), size(totalWidth, totalHeight); - [self convertBounds:[self visibleRect] toFirstAffectedLine:&origin.y count:&size.y]; - - // tell them what we think - view->set_visible_size(size); - view->set_visible_position(origin); - originLeft = origin.x; - originTop = origin.y; - } + // this gets all the lines that are at least partially visible + debug_view_xy origin(0, 0), size(totalWidth, totalHeight); + [self convertBounds:[self visibleRect] toFirstAffectedLine:&origin.y count:&size.y]; + + // tell the underlying view how much real estate is available + view->set_visible_size(size); + view->set_visible_position(origin); + originTop = origin.y; } - (void)typeCharacterAndScrollToCursor:(char)ch { - if (view->cursor_supported()) + debug_view_xy const oldPos = view->cursor_position(); + view->process_char(ch); + if (view->cursor_supported() && view->cursor_visible()) { - debug_view_xy const oldPos = view->cursor_position(); - view->process_char(ch); debug_view_xy const newPos = view->cursor_position(); if ((newPos.x != oldPos.x) || (newPos.y != oldPos.y)) { @@ -194,8 +190,6 @@ static void debugwin_view_update(debug_view &view, void *osdprivate) fontWidth, fontHeight)]; } - } else { - view->process_char(ch); } } @@ -216,7 +210,7 @@ static void debugwin_view_update(debug_view &view, void *osdprivate) return nil; } totalWidth = totalHeight = 0; - originLeft = originTop = 0; + originTop = 0; text = [[NSTextStorage alloc] init]; textContainer = [[NSTextContainer alloc] init]; @@ -261,12 +255,15 @@ static void debugwin_view_update(debug_view &view, void *osdprivate) debug_view_xy const newOrigin = view->visible_position(); if (newOrigin.y != originTop) { - [self scrollPoint:NSMakePoint([self visibleRect].origin.x, newOrigin.y * fontHeight)]; + NSRect const visible = [self visibleRect]; + NSPoint scroll = NSMakePoint(visible.origin.x, newOrigin.y * fontHeight); + if ((newOrigin.y + view->visible_size().y) == totalHeight) + scroll.y += (view->visible_size().y * fontHeight) - visible.size.height; + [self scrollPoint:scroll]; originTop = newOrigin.y; } - // recompute the visible area and mark as dirty - [self recomputeVisible]; + // mark as dirty [self setNeedsDisplay:YES]; } @@ -389,20 +386,40 @@ static void debugwin_view_update(debug_view &view, void *osdprivate) NSData *const data = [[board stringForType:avail] dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES]; char const *const bytes = (char const *)[data bytes]; + debug_view_xy const oldPos = view->cursor_position(); for (NSUInteger i = 0, l = [data length]; i < l; i++) view->process_char(bytes[i]); + if (view->cursor_supported() && view->cursor_visible()) + { + debug_view_xy const newPos = view->cursor_position(); + if ((newPos.x != oldPos.x) || (newPos.y != oldPos.y)) + { + // FIXME - use proper font metrics + [self scrollRectToVisible:NSMakeRect((newPos.x * fontWidth) + [textContainer lineFragmentPadding], + newPos.y * fontHeight, + fontWidth, + fontHeight)]; + } + } +} + + +- (void)viewBoundsDidChange:(NSNotification *)notification { + NSView *const changed = [notification object]; + if (changed == [[self enclosingScrollView] contentView]) + [self recomputeVisible]; } - (void)windowDidBecomeKey:(NSNotification *)notification { - NSWindow *win = [notification object]; + NSWindow *const win = [notification object]; if ((win == [self window]) && ([win firstResponder] == self) && view->cursor_supported()) [self setNeedsDisplay:YES]; } - (void)windowDidResignKey:(NSNotification *)notification { - NSWindow *win = [notification object]; + NSWindow *const win = [notification object]; if ((win == [self window]) && ([win firstResponder] == self) && view->cursor_supported()) [self setNeedsDisplay:YES]; } @@ -429,14 +446,17 @@ static void debugwin_view_update(debug_view &view, void *osdprivate) - (BOOL)becomeFirstResponder { - if (view->cursor_supported()) { + if (view->cursor_supported()) + { debug_view_xy pos; view->set_cursor_visible(true); pos = view->cursor_position(); [self scrollRectToVisible:NSMakeRect((pos.x * fontWidth) + [textContainer lineFragmentPadding], pos.y * fontHeight, fontWidth, fontHeight)]; // FIXME: metrics [self setNeedsDisplay:YES]; return [super becomeFirstResponder]; - } else { + } + else + { return NO; } } @@ -450,15 +470,37 @@ static void debugwin_view_update(debug_view &view, void *osdprivate) - (void)viewDidMoveToSuperview { - [[self enclosingScrollView] setLineScroll:fontHeight]; [super viewDidMoveToSuperview]; + + [[NSNotificationCenter defaultCenter] removeObserver:self + name:NSViewBoundsDidChangeNotification + object:nil]; + + NSScrollView *const scroller = [self enclosingScrollView]; + if (scroller != nil) + { + [scroller setLineScroll:fontHeight]; + [[scroller contentView] setPostsBoundsChangedNotifications:YES]; + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(viewBoundsDidChange:) + name:NSViewBoundsDidChangeNotification + object:[scroller contentView]]; + } } - (void)viewDidMoveToWindow { - [[NSNotificationCenter defaultCenter] removeObserver:self name:NSWindowDidBecomeKeyNotification object:nil]; - [[NSNotificationCenter defaultCenter] removeObserver:self name:NSWindowDidResignKeyNotification object:nil]; - if ([self window] != nil) { + [super viewDidMoveToWindow]; + + [[NSNotificationCenter defaultCenter] removeObserver:self + name:NSWindowDidBecomeKeyNotification + object:nil]; + [[NSNotificationCenter defaultCenter] removeObserver:self + name:NSWindowDidResignKeyNotification + object:nil]; + + if ([self window] != nil) + { [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(windowDidBecomeKey:) name:NSWindowDidBecomeKeyNotification @@ -467,7 +509,7 @@ static void debugwin_view_update(debug_view &view, void *osdprivate) selector:@selector(windowDidResignKey:) name:NSWindowDidResignKeyNotification object:[self window]]; - [self recomputeVisible]; + [self setNeedsDisplay:YES]; } } @@ -483,12 +525,13 @@ static void debugwin_view_update(debug_view &view, void *osdprivate) - (void)drawRect:(NSRect)dirtyRect { - INT32 position, clip; - - // work out how much we need to draw + // work out what's available [self recomputeVisible]; debug_view_xy const origin = view->visible_position(); debug_view_xy const size = view->visible_size(); + + // work out how much we need to draw + INT32 position, clip; [self convertBounds:dirtyRect toFirstAffectedLine:&position count:&clip]; // this gets the text for the whole visible area @@ -500,7 +543,14 @@ static void debugwin_view_update(debug_view &view, void *osdprivate) for (UINT32 row = position; row < position + clip; row++, data += size.x) { if ((row < origin.y) || (row >= origin.y + size.y)) + { + [DefaultBackground set]; + [NSBezierPath fillRect:NSMakeRect(0, + row * fontHeight, + [self bounds].size.width, + fontHeight)]; continue; + } // render entire lines to get character alignment right int attr = -1; diff --git a/src/osd/sdl/sdl.mak b/src/osd/sdl/sdl.mak index e30dc4812ad..778cec9661e 100644 --- a/src/osd/sdl/sdl.mak +++ b/src/osd/sdl/sdl.mak @@ -557,7 +557,7 @@ LDFLAGSEMULATOR += -sectcreate __TEXT __info_plist $(INFOPLIST) $(EMULATOR): $(INFOPLIST) $(INFOPLIST): $(SRC)/build/verinfo.py $(SRC)/version.c @echo Emitting $@... - $(PYTHON) $(SRC)/build/verinfo.py -b $(TARGET) -p $(SRC)/version.c > $@ + $(PYTHON) $(SRC)/build/verinfo.py -b $(TARGET) -p -o $@ $(SRC)/version.c endif ifndef MACOSX_USE_LIBSDL diff --git a/src/osd/windows/windows.mak b/src/osd/windows/windows.mak index f8e109f0d08..631c70dc3bb 100644 --- a/src/osd/windows/windows.mak +++ b/src/osd/windows/windows.mak @@ -532,4 +532,4 @@ $(RESFILE): $(WINSRC)/mame.rc $(WINOBJ)/mamevers.rc $(WINOBJ)/mamevers.rc: $(SRC)/build/verinfo.py $(SRC)/version.c @echo Emitting $@... - $(PYTHON) $(SRC)/build/verinfo.py -b mame $(SRC)/version.c > $@ + $(PYTHON) $(SRC)/build/verinfo.py -b mame -o $@ $(SRC)/version.c diff --git a/src/ume/osd/windows/windows.mak b/src/ume/osd/windows/windows.mak index 5163e0e8c93..894595b0cbe 100644 --- a/src/ume/osd/windows/windows.mak +++ b/src/ume/osd/windows/windows.mak @@ -38,4 +38,4 @@ $(RESFILE): $(UME_WINSRC)/ume.rc $(UME_WINOBJ)/umevers.rc $(UME_WINOBJ)/umevers.rc: $(SRC)/build/verinfo.py $(SRC)/version.c @echo Emitting $@... - $(PYTHON) $(SRC)/build/verinfo.py -b ume $(SRC)/version.c > $@
\ No newline at end of file + $(PYTHON) $(SRC)/build/verinfo.py -b ume -o $@ $(SRC)/version.c |