mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-08-21 05:51:55 +02:00
Update to v106r39 release.
byuu says: Changelog: - ruby/video: implement onUpdate() callback to signal when redraws are necessary - ruby/video/GLX,GLX2,XVideo,XShm: implement onUpdate() support - bsnes: implement Video::onUpdate() support to redraw Viewport icon as needed - bsnes: save RAM before ruby driver changes - sfc/sa1: clip signed multiplication to 32-bit [Jonas Quinn] - sfc/sa1: handle negative dividends in division [Jonas Quinn] - hiro/gtk3: a few improvements - bsnes: added empty stub video and audio settings panels - bsnes: restructured advanced settings panel - bsnes: experiment: input/hotkeys name column bolded and colored for increased visual distinction - bsnes: added save button to state manager
This commit is contained in:
@@ -33,9 +33,16 @@ struct Video {
|
||||
virtual auto lock(uint32_t*& data, uint& pitch, uint width, uint height) -> bool { return false; }
|
||||
virtual auto unlock() -> void {}
|
||||
virtual auto output() -> void {}
|
||||
virtual auto poll() -> void {}
|
||||
|
||||
auto onUpdate(const nall::function<void (uint, uint)>& callback) { _onUpdate = callback; }
|
||||
auto doUpdate(uint width, uint height) -> void {
|
||||
if(_onUpdate) return _onUpdate(width, height);
|
||||
}
|
||||
|
||||
private:
|
||||
nall::string _driver;
|
||||
nall::function<void (uint, uint)> _onUpdate;
|
||||
};
|
||||
|
||||
struct Audio {
|
||||
@@ -100,7 +107,7 @@ struct Input {
|
||||
|
||||
auto onChange(const nall::function<void (nall::shared_pointer<nall::HID::Device>, uint, uint, int16_t, int16_t)>& callback) { _onChange = callback; }
|
||||
auto doChange(nall::shared_pointer<nall::HID::Device> device, uint group, uint input, int16_t oldValue, int16_t newValue) -> void {
|
||||
if(_onChange) _onChange(device, group, input, oldValue, newValue);
|
||||
if(_onChange) return _onChange(device, group, input, oldValue, newValue);
|
||||
}
|
||||
|
||||
private:
|
||||
|
@@ -91,6 +91,18 @@ struct VideoGLX : Video, OpenGL {
|
||||
if(_doubleBuffer) glXSwapBuffers(_display, _glXWindow);
|
||||
}
|
||||
|
||||
auto poll() -> void {
|
||||
while(XPending(_display)) {
|
||||
XEvent event;
|
||||
XNextEvent(_display, &event);
|
||||
if(event.type == Expose) {
|
||||
XWindowAttributes attributes;
|
||||
XGetWindowAttributes(_display, _window, &attributes);
|
||||
doUpdate(attributes.width, attributes.height);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
auto initialize() -> bool {
|
||||
terminate();
|
||||
@@ -136,6 +148,7 @@ private:
|
||||
/* x = */ 0, /* y = */ 0, windowAttributes.width, windowAttributes.height,
|
||||
/* border_width = */ 0, vi->depth, InputOutput, vi->visual,
|
||||
CWColormap | CWBorderPixel, &attributes);
|
||||
XSelectInput(_display, _window, ExposureMask);
|
||||
XSetWindowBackground(_display, _window, /* color = */ 0);
|
||||
XMapWindow(_display, _window);
|
||||
XFlush(_display);
|
||||
|
@@ -111,6 +111,18 @@ struct VideoGLX2 : Video {
|
||||
if(_isDoubleBuffered) glXSwapBuffers(_display, _glXWindow);
|
||||
}
|
||||
|
||||
auto poll() -> void {
|
||||
while(XPending(_display)) {
|
||||
XEvent event;
|
||||
XNextEvent(_display, &event);
|
||||
if(event.type == Expose) {
|
||||
XWindowAttributes attributes;
|
||||
XGetWindowAttributes(_display, _window, &attributes);
|
||||
doUpdate(attributes.width, attributes.height);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
auto initialize() -> bool {
|
||||
terminate();
|
||||
@@ -147,6 +159,7 @@ private:
|
||||
attributes.border_pixel = 0;
|
||||
_window = XCreateWindow(_display, (Window)_context, 0, 0, windowAttributes.width, windowAttributes.height,
|
||||
0, vi->depth, InputOutput, vi->visual, CWColormap | CWBorderPixel, &attributes);
|
||||
XSelectInput(_display, _window, ExposureMask);
|
||||
XSetWindowBackground(_display, _window, 0);
|
||||
XMapWindow(_display, _window);
|
||||
XFlush(_display);
|
||||
|
@@ -88,12 +88,24 @@ struct VideoXShm : Video {
|
||||
XFlush(_display);
|
||||
}
|
||||
|
||||
auto poll() -> void override {
|
||||
while(XPending(_display)) {
|
||||
XEvent event;
|
||||
XNextEvent(_display, &event);
|
||||
if(event.type == Expose) {
|
||||
XWindowAttributes attributes;
|
||||
XGetWindowAttributes(_display, _window, &attributes);
|
||||
doUpdate(attributes.width, attributes.height);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
auto initialize() -> bool {
|
||||
terminate();
|
||||
if(!_context) return false;
|
||||
|
||||
_display = XOpenDisplay(0);
|
||||
_display = XOpenDisplay(nullptr);
|
||||
_screen = DefaultScreen(_display);
|
||||
|
||||
XWindowAttributes getAttributes;
|
||||
@@ -109,12 +121,12 @@ private:
|
||||
|
||||
XSetWindowAttributes setAttributes = {};
|
||||
setAttributes.border_pixel = 0;
|
||||
setAttributes.event_mask = ExposureMask;
|
||||
_window = XCreateWindow(_display, (Window)_context,
|
||||
0, 0, 256, 256, 0,
|
||||
getAttributes.depth, InputOutput, getAttributes.visual,
|
||||
CWBorderPixel, &setAttributes
|
||||
);
|
||||
XSelectInput(_display, _window, ExposureMask);
|
||||
XSetWindowBackground(_display, _window, 0);
|
||||
XMapWindow(_display, _window);
|
||||
XFlush(_display);
|
||||
|
@@ -91,6 +91,18 @@ struct VideoXVideo : Video {
|
||||
true);
|
||||
}
|
||||
|
||||
auto poll() -> void {
|
||||
while(XPending(_display)) {
|
||||
XEvent event;
|
||||
XNextEvent(_display, &event);
|
||||
if(event.type == Expose) {
|
||||
XWindowAttributes attributes;
|
||||
XGetWindowAttributes(_display, _window, &attributes);
|
||||
doUpdate(attributes.width, attributes.height);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
auto initialize() -> bool {
|
||||
terminate();
|
||||
@@ -148,11 +160,11 @@ private:
|
||||
XSetWindowAttributes attributes;
|
||||
attributes.colormap = _colormap;
|
||||
attributes.border_pixel = 0;
|
||||
attributes.event_mask = StructureNotifyMask;
|
||||
_window = XCreateWindow(_display, /* parent = */ (Window)_context,
|
||||
/* x = */ 0, /* y = */ 0, window_attributes.width, window_attributes.height,
|
||||
/* border_width = */ 0, _depth, InputOutput, visualInfo->visual,
|
||||
CWColormap | CWBorderPixel | CWEventMask, &attributes);
|
||||
XSelectInput(_display, _window, ExposureMask);
|
||||
XFree(visualInfo);
|
||||
XSetWindowBackground(_display, _window, /* color = */ 0);
|
||||
XMapWindow(_display, _window);
|
||||
|
Reference in New Issue
Block a user