mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-08-30 08:49:59 +02:00
Update to v106r59 release.
byuu says: Changelog: - fixed bug in Emulator::Game::Memory::operator bool() - nall: renamed view<string> back to `string_view` - nall:: implemented `array_view` - Game Boy: split cartridge-specific input mappings (rumble, accelerometer) to their own separate ports - Game Boy: fixed MBC7 accelerometer x-axis - icarus: Game Boy, Super Famicom, Mega Drive cores output internal header game titles to heuristics manifests - higan, icarus, hiro/gtk: improve viewport geometry configuration; fixed higan crashing bug with XShm driver - higan: connect Video::poll(),update() functionality - hiro, ruby: several compilation / bugfixes, should get the macOS port compiling again, hopefully [Sintendo] - ruby/video/xshm: fix crashing bug on window resize - a bit hacky; it's throwing BadAccess Xlib warnings, but they're not fatal, so I am catching and ignoring them - bsnes: removed Application::Windows::onModalChange hook that's no longer needed [Screwtape]
This commit is contained in:
@@ -36,7 +36,7 @@ struct VideoCGL : VideoDriver, OpenGL {
|
||||
if(!view) return true;
|
||||
@autoreleasepool {
|
||||
[[view openGLContext] makeCurrentContext];
|
||||
int blocking = _blocking;
|
||||
int blocking = self.blocking;
|
||||
[[view openGLContext] setValues:&blocking forParameter:NSOpenGLCPSwapInterval];
|
||||
}
|
||||
return true;
|
||||
|
@@ -30,7 +30,6 @@ struct VideoDirect3D : VideoDriver {
|
||||
auto setShader(string shader) -> bool override { return updateFilter(); }
|
||||
|
||||
auto clear() -> void override {
|
||||
if(!ready()) return;
|
||||
if(_lost && !recover()) return;
|
||||
|
||||
D3DSURFACE_DESC surfaceDescription;
|
||||
@@ -38,7 +37,10 @@ struct VideoDirect3D : VideoDriver {
|
||||
_texture->GetSurfaceLevel(0, &_surface);
|
||||
|
||||
if(_surface) {
|
||||
_device->ColorFill(_surface, 0, D3DCOLOR_XRGB(0x00, 0x00, 0x00));
|
||||
D3DLOCKED_RECT lockedRectangle;
|
||||
_surface->LockRect(&lockedRectangle, 0, D3DLOCK_NOSYSLOCK | D3DLOCK_DISCARD);
|
||||
memory::fill(lockedRectangle.pBits, lockedRectangle.Pitch * surfaceDescription.Height);
|
||||
_surface->UnlockRect();
|
||||
_surface->Release();
|
||||
_surface = nullptr;
|
||||
}
|
||||
|
@@ -10,8 +10,8 @@
|
||||
|
||||
struct VideoXShm : VideoDriver {
|
||||
VideoXShm& self = *this;
|
||||
VideoXShm(Video& super) : VideoDriver(super) {}
|
||||
~VideoXShm() { terminate(); }
|
||||
VideoXShm(Video& super) : VideoDriver(super) { construct(); }
|
||||
~VideoXShm() { destruct(); }
|
||||
|
||||
auto create() -> bool override {
|
||||
return initialize();
|
||||
@@ -29,6 +29,8 @@ struct VideoXShm : VideoDriver {
|
||||
auto setShader(string shader) -> bool override { return true; }
|
||||
|
||||
auto configure(uint width, uint height, double inputFrequency, double outputFrequency) -> bool override {
|
||||
if(width == _outputWidth && height == _outputHeight) return true;
|
||||
|
||||
_outputWidth = width;
|
||||
_outputHeight = height;
|
||||
XResizeWindow(_display, _window, _outputWidth, _outputHeight);
|
||||
@@ -42,7 +44,7 @@ struct VideoXShm : VideoDriver {
|
||||
XShmAttach(_display, &_shmInfo);
|
||||
_outputBuffer = (uint32_t*)_shmInfo.shmaddr;
|
||||
_image = XShmCreateImage(_display, _visual, _depth, ZPixmap, _shmInfo.shmaddr, &_shmInfo, _outputWidth, _outputHeight);
|
||||
return true;
|
||||
return (bool)_image;
|
||||
}
|
||||
|
||||
auto clear() -> void override {
|
||||
@@ -69,8 +71,6 @@ struct VideoXShm : VideoDriver {
|
||||
}
|
||||
|
||||
auto output() -> void override {
|
||||
size();
|
||||
|
||||
float xratio = (float)_inputWidth / (float)_outputWidth;
|
||||
float yratio = (float)_inputHeight / (float)_outputHeight;
|
||||
|
||||
@@ -106,7 +106,7 @@ struct VideoXShm : VideoDriver {
|
||||
XEvent event;
|
||||
XNextEvent(_display, &event);
|
||||
if(event.type == Expose) {
|
||||
XWindowAttributes attributes;
|
||||
XWindowAttributes attributes{};
|
||||
XGetWindowAttributes(_display, _window, &attributes);
|
||||
super.doUpdate(attributes.width, attributes.height);
|
||||
}
|
||||
@@ -114,14 +114,21 @@ struct VideoXShm : VideoDriver {
|
||||
}
|
||||
|
||||
private:
|
||||
auto construct() -> void {
|
||||
_display = XOpenDisplay(nullptr);
|
||||
_screen = DefaultScreen(_display);
|
||||
XSetErrorHandler(errorHandler);
|
||||
}
|
||||
|
||||
auto destruct() -> void {
|
||||
XCloseDisplay(_display);
|
||||
}
|
||||
|
||||
auto initialize() -> bool {
|
||||
terminate();
|
||||
if(!self.context) return false;
|
||||
|
||||
_display = XOpenDisplay(nullptr);
|
||||
_screen = DefaultScreen(_display);
|
||||
|
||||
XWindowAttributes getAttributes;
|
||||
XWindowAttributes getAttributes{};
|
||||
XGetWindowAttributes(_display, (Window)self.context, &getAttributes);
|
||||
_depth = getAttributes.depth;
|
||||
_visual = getAttributes.visual;
|
||||
@@ -149,21 +156,11 @@ private:
|
||||
XNextEvent(_display, &event);
|
||||
}
|
||||
|
||||
if(!size()) return false;
|
||||
return _ready = true;
|
||||
}
|
||||
|
||||
auto terminate() -> void {
|
||||
free();
|
||||
if(_display) {
|
||||
XCloseDisplay(_display);
|
||||
_display = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
auto size() -> bool {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
auto free() -> void {
|
||||
@@ -185,6 +182,12 @@ private:
|
||||
return cr << 16 | cg << 8 | cb << 0;
|
||||
}
|
||||
|
||||
static auto errorHandler(Display* display, XErrorEvent* event) -> int {
|
||||
//catch occasional BadAccess errors during window resize events
|
||||
//currently, I'm unsure of the cause, but they're certainly not fatal
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool _ready = false;
|
||||
|
||||
uint32_t* _inputBuffer = nullptr;
|
||||
|
Reference in New Issue
Block a user