Update to bsnes v107r4 beta release.

byuu says:

  - bsnes: added video filters from bsnes v082
  - bsnes: added ZSNES snow effect option when games paused or unloaded
    (no, I'm not joking)
  - bsnes: added 7-zip support (LZMA 19.00 SDK)

[Recent higan WIPs have also mentioned bsnes changes, although the higan code
no longer includes the bsnes code. These changes include:

  - higan, bsnes: added EXLOROM, EXLOROM-RAM, EXHIROM mappings
  - higan, bsnes: focus the viewport after leaving fullscreen exclusive
    mode
  - bsnes: re-added mightymo's cheat code database
  - bsnes: improved make install rules for the game and cheat code
    databases
  - bsnes: delayed construction of hiro::Window objects to properly show
    bsnes window icons

- Ed.]
This commit is contained in:
Tim Allen
2019-07-07 19:44:09 +10:00
parent becbca47d4
commit d87a0f633d
280 changed files with 120826 additions and 1521 deletions

View File

@@ -9,12 +9,18 @@ auto pMonitor::count() -> uint {
}
auto pMonitor::dpi(uint monitor) -> Position {
//macOS includes built-in HiDPI scaling support.
//it may be better to rely on per-application scaling,
//but for now we'll let macOS handle it so it works in all hiro applications.
#if 0
@autoreleasepool {
NSScreen* screen = [[NSScreen screens] objectAtIndex:monitor];
NSDictionary* dictionary = [screen deviceDescription];
NSSize dpi = [[dictionary objectForKey:NSDeviceSize] sizeValue];
return {dpi.width, dpi.height};
}
#endif
return {96.0, 96.0};
}
auto pMonitor::geometry(uint monitor) -> Geometry {
@@ -30,7 +36,7 @@ auto pMonitor::geometry(uint monitor) -> Geometry {
}
auto pMonitor::primary() -> uint {
//on macOS, the primary monitor is always the first monitor
//on macOS, the primary monitor is always the first monitor.
return 0;
}

View File

@@ -96,8 +96,6 @@ auto pCanvas::construct() -> void {
@autoreleasepool {
cocoaView = cocoaCanvas = [[CocoaCanvas alloc] initWith:self()];
pWidget::construct();
setDroppable(state().droppable);
}
}
@@ -131,6 +129,10 @@ auto pCanvas::setDroppable(bool droppable) -> void {
}
}
auto pCanvas::setFocusable(bool focusable) -> void {
//TODO
}
auto pCanvas::setGeometry(Geometry geometry) -> void {
pWidget::setGeometry(geometry);
update();
@@ -168,7 +170,6 @@ auto pCanvas::_rasterize() -> void {
if(width != surfaceWidth || height != surfaceHeight) {
[cocoaView setImage:nil];
[surface release];
surface = nullptr;
bitmap = nullptr;
}

View File

@@ -29,7 +29,8 @@ struct pCanvas : pWidget {
auto minimumSize() const -> Size;
auto setAlignment(Alignment) -> void;
auto setColor(Color color) -> void;
auto setDroppable(bool droppable) -> void;
auto setDroppable(bool droppable) -> void override;
auto setFocusable(bool focusable) -> void override;
auto setGeometry(Geometry geometry) -> void override;
auto setGradient(Gradient gradient) -> void;
auto setIcon(const image& icon) -> void;

View File

@@ -53,7 +53,7 @@ auto pTextEdit::construct() -> void {
setEditable(state().editable);
setWordWrap(state().wordWrap);
setText(state().text);
setCursor(state().cursor);
setTextCursor(state().textCursor);
}
}
@@ -67,15 +67,6 @@ auto pTextEdit::destruct() -> void {
auto pTextEdit::setBackgroundColor(Color color) -> void {
}
auto pTextEdit::setCursor(Cursor cursor) -> void {
@autoreleasepool {
//todo: handle text selection (cursor.length())
string text = [[[cocoaView content] string] UTF8String];
auto offset = min(cursor.offset(), text.length());
[[cocoaView content] setSelectedRange:NSMakeRange(offset, 0)];
}
}
auto pTextEdit::setEditable(bool editable) -> void {
@autoreleasepool {
[[cocoaView content] setEditable:(editable && self().enabled(true))];
@@ -102,6 +93,15 @@ auto pTextEdit::setText(const string& text) -> void {
}
}
auto pTextEdit::setTextCursor(TextCursor cursor) -> void {
@autoreleasepool {
//todo: handle text selection (cursor.length())
string text = [[[cocoaView content] string] UTF8String];
auto offset = min(cursor.offset(), text.length());
[[cocoaView content] setSelectedRange:NSMakeRange(offset, 0)];
}
}
auto pTextEdit::setWordWrap(bool wordWrap) -> void {
@autoreleasepool {
[cocoaView configure];
@@ -114,6 +114,11 @@ auto pTextEdit::text() const -> string {
}
}
auto pTextEdit::textCursor() const -> TextCursor {
//TODO
return state().textCursor;
}
}
#endif

View File

@@ -17,14 +17,15 @@ struct pTextEdit : pWidget {
Declare(TextEdit, Widget)
auto setBackgroundColor(Color color) -> void;
auto setCursor(Cursor cursor) -> void;
auto setEditable(bool editable) -> void;
auto setEnabled(bool enabled) -> void override;
auto setFont(const Font& font) -> void override;
auto setForegroundColor(Color color) -> void;
auto setText(const string& text) -> void;
auto setTextCursor(TextCursor textCursor) -> void;
auto setWordWrap(bool wordWrap) -> void;
auto text() const -> string;
auto textCursor() const -> TextCursor;
CocoaTextEdit* cocoaTextEdit = nullptr;
};

View File

@@ -67,6 +67,8 @@ auto pViewport::setDroppable(bool droppable) -> void {
}
}
auto pViewport::setFocusable(bool focusable) -> void {
//TODO
}
#endif

View File

@@ -19,7 +19,8 @@ struct pViewport : pWidget {
Declare(Viewport, Widget)
auto handle() const -> uintptr_t;
auto setDroppable(bool droppable) -> void;
auto setDroppable(bool droppable) -> void override;
auto setFocusable(bool focusable) -> void override;
CocoaViewport* cocoaViewport = nullptr;
};

View File

@@ -12,8 +12,11 @@ auto pWidget::construct() -> void {
if(auto window = self().parentWindow(true)) {
if(auto p = window->self()) p->_append(self());
setDroppable(self().droppable());
setEnabled(self().enabled(true));
setFocusable(self().focusable());
setFont(self().font(true));
setMouseCursor(self().mouseCursor());
setToolTip(self().toolTip());
setVisible(self().visible(true));
}
@@ -33,6 +36,10 @@ auto pWidget::focused() const -> bool {
}
}
auto pWidget::setDroppable(bool droppable) -> void {
//virtual
}
auto pWidget::setEnabled(bool enabled) -> void {
if(abstract) enabled = false;
@@ -43,6 +50,10 @@ auto pWidget::setEnabled(bool enabled) -> void {
}
}
auto pWidget::setFocusable(bool focusable) -> void {
//virtual
}
auto pWidget::setFocused() -> void {
@autoreleasepool {
[[cocoaView window] makeFirstResponder:cocoaView];
@@ -66,6 +77,10 @@ auto pWidget::setGeometry(Geometry geometry) -> void {
pSizable::setGeometry(geometry);
}
auto pWidget::setMouseCursor(const MouseCursor& mouseCursor) -> void {
//TODO
}
auto pWidget::setToolTip(const string& toolTip) -> void {
//TODO
}

View File

@@ -6,10 +6,13 @@ struct pWidget : pSizable {
Declare(Widget, Sizable)
auto focused() const -> bool;
virtual auto setDroppable(bool droppable) -> void;
auto setEnabled(bool enabled) -> void override;
virtual auto setFocusable(bool focusable) -> void;
auto setFocused() -> void override;
auto setFont(const Font& font) -> void override;
auto setGeometry(Geometry geometry) -> void override;
auto setMouseCursor(const MouseCursor& mouseCursor) -> void;
auto setToolTip(const string& toolTip) -> void;
auto setVisible(bool visible) -> void override;