diff --git a/bsnes/target-bsnes/program/game.cpp b/bsnes/target-bsnes/program/game.cpp index 1790fff9..a3d86b54 100644 --- a/bsnes/target-bsnes/program/game.cpp +++ b/bsnes/target-bsnes/program/game.cpp @@ -294,6 +294,13 @@ auto Program::reset() -> void { auto Program::unload() -> void { if(!emulator->loaded()) return; + //todo: video.clear() is not working on macOS/OpenGL 3.2 + if(auto [output, length] = video.acquire(1, 1); output) { + *output = 0; + video.release(); + video.output(); + } + audio.clear(); rewindReset(); //free up memory that is no longer needed movieStop(); //in case a movie is currently being played or recorded cheatEditor.saveCheats(); diff --git a/hiro/cocoa/action/menu-radio-item.cpp b/hiro/cocoa/action/menu-radio-item.cpp index a1fa7735..424c6fc8 100755 --- a/hiro/cocoa/action/menu-radio-item.cpp +++ b/hiro/cocoa/action/menu-radio-item.cpp @@ -7,7 +7,9 @@ menuRadioItem = &menuRadioItemReference; [self setTarget:self]; - [self setOnStateImage:[NSImage imageNamed:@"NSMenuRadio"]]; + //todo: the default image is a check mark, which is not indicative of radio states. + //however, NSMenuRadio does not respect macOS' dark theme, and is barely visible. + //[self setOnStateImage:[NSImage imageNamed:@"NSMenuRadio"]]; } return self; } diff --git a/hiro/cocoa/utility.cpp b/hiro/cocoa/utility.cpp index 3bd0e4b1..9d696239 100755 --- a/hiro/cocoa/utility.cpp +++ b/hiro/cocoa/utility.cpp @@ -3,9 +3,9 @@ auto NSMakeColor(const hiro::Color& color) -> NSColor* { } auto NSMakeCursor(const hiro::MouseCursor& mouseCursor) -> NSCursor* { - if(mouseCursor == MouseCursor::Hand) return [NSCursor pointingHandCursor]; - if(mouseCursor == MouseCursor::HorizontalResize) return [NSCursor resizeLeftRightCursor]; - if(mouseCursor == MouseCursor::VerticalResize) return [NSCursor resizeUpDownCursor]; + if(mouseCursor == hiro::MouseCursor::Hand) return [NSCursor pointingHandCursor]; + if(mouseCursor == hiro::MouseCursor::HorizontalResize) return [NSCursor resizeLeftRightCursor]; + if(mouseCursor == hiro::MouseCursor::VerticalResize) return [NSCursor resizeUpDownCursor]; return nil; } diff --git a/hiro/cocoa/widget/canvas.cpp b/hiro/cocoa/widget/canvas.cpp index 7d067173..3a8a74f4 100755 --- a/hiro/cocoa/widget/canvas.cpp +++ b/hiro/cocoa/widget/canvas.cpp @@ -16,7 +16,7 @@ } -(void) resetCursorRects { - if(auto mouseCursor = NSMakeCursor(label->mouseCursor())) { + if(auto mouseCursor = NSMakeCursor(canvas->mouseCursor())) { [self addCursorRect:self.bounds cursor:mouseCursor]; } } diff --git a/hiro/cocoa/widget/label.cpp b/hiro/cocoa/widget/label.cpp index c055e2c0..6fbe7075 100755 --- a/hiro/cocoa/widget/label.cpp +++ b/hiro/cocoa/widget/label.cpp @@ -16,13 +16,10 @@ } -(void) drawRect:(NSRect)dirtyRect { - auto geometry = label->geometry(); - NSRect rect = {{geometry.x(), geometry.y()}, {geometry.width(), geometry.height()}}; - if(auto backgroundColor = label->backgroundColor()) { NSColor* color = NSMakeColor(backgroundColor); [color setFill]; - NSRectFill(rect); + NSRectFill(dirtyRect); } NSFont* font = hiro::pFont::create(label->font(true)); @@ -43,6 +40,8 @@ auto alignment = label->alignment(); if(!alignment) alignment = {0.0, 0.5}; + auto geometry = label->geometry(); + NSRect rect = {{geometry.x(), geometry.y()}, {geometry.width(), geometry.height()}}; rect.origin.x = max(0, (geometry.width() - size.width()) * alignment.horizontal()); rect.origin.y = max(0, (geometry.height() - size.height()) * alignment.vertical()); rect.size.width = min(geometry.width(), size.width()); @@ -128,8 +127,8 @@ auto pLabel::construct() -> void { pWidget::construct(); setAlignment(state().alignment); - setBackgroundColor(state().backgroundColor()); - setForegroundColor(state().foregroundColor()); + setBackgroundColor(state().backgroundColor); + setForegroundColor(state().foregroundColor); setText(state().text); } } diff --git a/hiro/cocoa/widget/viewport.cpp b/hiro/cocoa/widget/viewport.cpp index 3edc1dda..51cfe599 100755 --- a/hiro/cocoa/widget/viewport.cpp +++ b/hiro/cocoa/widget/viewport.cpp @@ -10,7 +10,7 @@ } -(void) resetCursorRects { - if(auto mouseCursor = NSMakeCursor(label->mouseCursor())) { + if(auto mouseCursor = NSMakeCursor(viewport->mouseCursor())) { [self addCursorRect:self.bounds cursor:mouseCursor]; } } diff --git a/nall/run.hpp b/nall/run.hpp index 2c11a8bf..14f92ec4 100755 --- a/nall/run.hpp +++ b/nall/run.hpp @@ -98,7 +98,11 @@ template inline auto invoke(const string& name, P&&... p) -> void *argp++ = nullptr; if(execvp(name, (char* const*)argv) < 0) { + #if defined(PLATFORM_MACOS) + execlp("open", "open", (const char*)name, nullptr); + #else execlp("xdg-open", "xdg-open", (const char*)name, nullptr); + #endif } exit(0); }