mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-08-25 19:51:08 +02:00
Update to 20180731 release.
byuu says: I've completed moving all the class objects from `unique_pointer<T>` to just T. The one exception is the Emulator::Interface instance. I can absolutely make that a global object, but only in bsnes where there's just the one emulation core. I also moved all the SettingsWindow and ToolsWindow panels out to their own global objects, and fixed a very difficult bug with GTK TabFrame controls. The configuration settings panel is now the emulator settings panel. And I added some spacing between bold label sections on both the emulator and driver settings panels. I gave fixing ComboButtonItem my best shot, given I can't reproduce the crash. Probably won't work, though. Also made a very slight consistency improvement to ruby and renamed driverName() to driver(). ... An important change ... as a result of moving bsnes to global objects, this means that the constructors for all windows run before the presentation window is displayed. Before this change, only the presentation window was constructed first berore displaying it, followed by the construction of the rest of the GUI windows. The upside to this is that as soon as you see the main window, the GUI is ready to go without a period where it's unresponsive. The downside to this is it takes about 1.5 seconds to show the main window, compared to around 0.75 seconds before. I've no intention of changing that back. So if the startup time becomes a problem, then we'll just have to work on optimizing hiro, so that it can construct all the global Window objects quicker. The main way to do that would be to not do calls to the Layout::setGeometry functions for every widget added, and instead wait until the window is displayed. But I don't have an easy way to do that, because you want the widget geometry values to be sane even before the window is visible to help size certain things.
This commit is contained in:
@@ -32,7 +32,7 @@ struct VideoGLX2 : VideoDriver {
|
||||
return initialize();
|
||||
}
|
||||
|
||||
auto driverName() -> string override { return "OpenGL2"; }
|
||||
auto driver() -> string override { return "OpenGL2"; }
|
||||
auto ready() -> bool override { return _ready; }
|
||||
|
||||
auto hasContext() -> bool override { return true; }
|
||||
|
@@ -37,74 +37,74 @@
|
||||
namespace ruby {
|
||||
|
||||
auto Video::setExclusive(bool exclusive) -> bool {
|
||||
if(driver->exclusive == exclusive) return true;
|
||||
if(!driver->hasExclusive()) return false;
|
||||
if(!driver->setExclusive(driver->exclusive = exclusive)) return false;
|
||||
if(instance->exclusive == exclusive) return true;
|
||||
if(!instance->hasExclusive()) return false;
|
||||
if(!instance->setExclusive(instance->exclusive = exclusive)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
auto Video::setContext(uintptr context) -> bool {
|
||||
if(driver->context == context) return true;
|
||||
if(!driver->hasContext()) return false;
|
||||
if(!driver->setContext(driver->context = context)) return false;
|
||||
if(instance->context == context) return true;
|
||||
if(!instance->hasContext()) return false;
|
||||
if(!instance->setContext(instance->context = context)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
auto Video::setBlocking(bool blocking) -> bool {
|
||||
if(driver->blocking == blocking) return true;
|
||||
if(!driver->hasBlocking()) return false;
|
||||
if(!driver->setBlocking(driver->blocking = blocking)) return false;
|
||||
if(instance->blocking == blocking) return true;
|
||||
if(!instance->hasBlocking()) return false;
|
||||
if(!instance->setBlocking(instance->blocking = blocking)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
auto Video::setFlush(bool flush) -> bool {
|
||||
if(driver->flush == flush) return true;
|
||||
if(!driver->hasFlush()) return false;
|
||||
if(!driver->setFlush(driver->flush = flush)) return false;
|
||||
if(instance->flush == flush) return true;
|
||||
if(!instance->hasFlush()) return false;
|
||||
if(!instance->setFlush(instance->flush = flush)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
auto Video::setFormat(string format) -> bool {
|
||||
if(driver->format == format) return true;
|
||||
if(!driver->hasFormat(format)) return false;
|
||||
if(!driver->setFormat(driver->format = format)) return false;
|
||||
if(instance->format == format) return true;
|
||||
if(!instance->hasFormat(format)) return false;
|
||||
if(!instance->setFormat(instance->format = format)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
auto Video::setSmooth(bool smooth) -> bool {
|
||||
if(driver->smooth == smooth) return true;
|
||||
if(!driver->hasSmooth()) return false;
|
||||
if(!driver->setSmooth(driver->smooth = smooth)) return false;
|
||||
if(instance->smooth == smooth) return true;
|
||||
if(!instance->hasSmooth()) return false;
|
||||
if(!instance->setSmooth(instance->smooth = smooth)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
auto Video::setShader(string shader) -> bool {
|
||||
if(driver->shader == shader) return true;
|
||||
if(!driver->hasShader()) return false;
|
||||
if(!driver->setShader(driver->shader = shader)) return false;
|
||||
if(instance->shader == shader) return true;
|
||||
if(!instance->hasShader()) return false;
|
||||
if(!instance->setShader(instance->shader = shader)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
auto Video::clear() -> void {
|
||||
return driver->clear();
|
||||
return instance->clear();
|
||||
}
|
||||
|
||||
auto Video::acquire(uint32_t*& data, uint& pitch, uint width, uint height) -> bool {
|
||||
return driver->acquire(data, pitch, width, height);
|
||||
return instance->acquire(data, pitch, width, height);
|
||||
}
|
||||
|
||||
auto Video::release() -> void {
|
||||
return driver->release();
|
||||
return instance->release();
|
||||
}
|
||||
|
||||
auto Video::output() -> void {
|
||||
return driver->output();
|
||||
return instance->output();
|
||||
}
|
||||
|
||||
auto Video::poll() -> void {
|
||||
return driver->poll();
|
||||
return instance->poll();
|
||||
}
|
||||
|
||||
//
|
||||
@@ -120,48 +120,48 @@ auto Video::doUpdate(uint width, uint height) -> void {
|
||||
//
|
||||
|
||||
auto Video::create(string driver) -> bool {
|
||||
reset();
|
||||
self.instance.reset();
|
||||
if(!driver) driver = optimalDriver();
|
||||
|
||||
#if defined(VIDEO_CGL)
|
||||
if(driver == "OpenGL") self.driver = new VideoCGL(*this);
|
||||
if(driver == "OpenGL") self.instance = new VideoCGL(*this);
|
||||
#endif
|
||||
|
||||
#if defined(VIDEO_DIRECT3D)
|
||||
if(driver == "Direct3D") self.driver = new VideoDirect3D(*this);
|
||||
if(driver == "Direct3D") self.instance = new VideoDirect3D(*this);
|
||||
#endif
|
||||
|
||||
#if defined(VIDEO_DIRECTDRAW)
|
||||
if(driver == "DirectDraw") self.driver = new VideoDirectDraw(*this);
|
||||
if(driver == "DirectDraw") self.instance = new VideoDirectDraw(*this);
|
||||
#endif
|
||||
|
||||
#if defined(VIDEO_GDI)
|
||||
if(driver == "GDI") self.driver = new VideoGDI(*this);
|
||||
if(driver == "GDI") self.instance = new VideoGDI(*this);
|
||||
#endif
|
||||
|
||||
#if defined(VIDEO_GLX)
|
||||
if(driver == "OpenGL") self.driver = new VideoGLX(*this);
|
||||
if(driver == "OpenGL") self.instance = new VideoGLX(*this);
|
||||
#endif
|
||||
|
||||
#if defined(VIDEO_GLX2)
|
||||
if(driver == "OpenGL2") self.driver = new VideoGLX2(*this);
|
||||
if(driver == "OpenGL2") self.instance = new VideoGLX2(*this);
|
||||
#endif
|
||||
|
||||
#if defined(VIDEO_WGL)
|
||||
if(driver == "OpenGL") self.driver = new VideoWGL(*this);
|
||||
if(driver == "OpenGL") self.instance = new VideoWGL(*this);
|
||||
#endif
|
||||
|
||||
#if defined(VIDEO_XSHM)
|
||||
if(driver == "XShm") self.driver = new VideoXShm(*this);
|
||||
if(driver == "XShm") self.instance = new VideoXShm(*this);
|
||||
#endif
|
||||
|
||||
#if defined(VIDEO_XVIDEO)
|
||||
if(driver == "XVideo") self.driver = new VideoXVideo(*this);
|
||||
if(driver == "XVideo") self.instance = new VideoXVideo(*this);
|
||||
#endif
|
||||
|
||||
if(!self.driver) self.driver = new VideoDriver(*this);
|
||||
if(!self.instance) self.instance = new VideoDriver(*this);
|
||||
|
||||
return self.driver->create();
|
||||
return self.instance->create();
|
||||
}
|
||||
|
||||
auto Video::hasDrivers() -> vector<string> {
|
||||
|
@@ -5,7 +5,7 @@ struct VideoDriver {
|
||||
virtual ~VideoDriver() = default;
|
||||
|
||||
virtual auto create() -> bool { return true; }
|
||||
virtual auto driverName() -> string { return "None"; }
|
||||
virtual auto driver() -> string { return "None"; }
|
||||
virtual auto ready() -> bool { return true; }
|
||||
|
||||
virtual auto hasExclusive() -> bool { return false; }
|
||||
@@ -51,30 +51,30 @@ struct Video {
|
||||
static auto optimalDriver() -> string;
|
||||
static auto safestDriver() -> string;
|
||||
|
||||
Video() : self(*this) {}
|
||||
explicit operator bool() const { return (bool)driver; }
|
||||
auto reset() -> void { driver.reset(); }
|
||||
Video() : self(*this) { reset(); }
|
||||
explicit operator bool() { return instance->driver() != "None"; }
|
||||
auto reset() -> void { instance = new VideoDriver(*this); }
|
||||
auto create(string driver = "") -> bool;
|
||||
auto driverName() -> string { return driver->driverName(); }
|
||||
auto ready() -> bool { return driver->ready(); }
|
||||
auto driver() -> string { return instance->driver(); }
|
||||
auto ready() -> bool { return instance->ready(); }
|
||||
|
||||
auto hasExclusive() -> bool { return driver->hasExclusive(); }
|
||||
auto hasContext() -> bool { return driver->hasContext(); }
|
||||
auto hasBlocking() -> bool { return driver->hasBlocking(); }
|
||||
auto hasFlush() -> bool { return driver->hasFlush(); }
|
||||
auto hasFormats() -> vector<string> { return driver->hasFormats(); }
|
||||
auto hasSmooth() -> bool { return driver->hasSmooth(); }
|
||||
auto hasShader() -> bool { return driver->hasShader(); }
|
||||
auto hasExclusive() -> bool { return instance->hasExclusive(); }
|
||||
auto hasContext() -> bool { return instance->hasContext(); }
|
||||
auto hasBlocking() -> bool { return instance->hasBlocking(); }
|
||||
auto hasFlush() -> bool { return instance->hasFlush(); }
|
||||
auto hasFormats() -> vector<string> { return instance->hasFormats(); }
|
||||
auto hasSmooth() -> bool { return instance->hasSmooth(); }
|
||||
auto hasShader() -> bool { return instance->hasShader(); }
|
||||
|
||||
auto hasFormat(string format) -> bool { return driver->hasFormat(format); }
|
||||
auto hasFormat(string format) -> bool { return instance->hasFormat(format); }
|
||||
|
||||
auto exclusive() -> bool { return driver->exclusive; }
|
||||
auto context() -> uintptr { return driver->context; }
|
||||
auto blocking() -> bool { return driver->blocking; }
|
||||
auto flush() -> bool { return driver->flush; }
|
||||
auto format() -> string { return driver->format; }
|
||||
auto smooth() -> bool { return driver->smooth; }
|
||||
auto shader() -> string { return driver->shader; }
|
||||
auto exclusive() -> bool { return instance->exclusive; }
|
||||
auto context() -> uintptr { return instance->context; }
|
||||
auto blocking() -> bool { return instance->blocking; }
|
||||
auto flush() -> bool { return instance->flush; }
|
||||
auto format() -> string { return instance->format; }
|
||||
auto smooth() -> bool { return instance->smooth; }
|
||||
auto shader() -> string { return instance->shader; }
|
||||
|
||||
auto setExclusive(bool exclusive) -> bool;
|
||||
auto setContext(uintptr context) -> bool;
|
||||
@@ -95,6 +95,6 @@ struct Video {
|
||||
|
||||
protected:
|
||||
Video& self;
|
||||
unique_pointer<VideoDriver> driver;
|
||||
unique_pointer<VideoDriver> instance;
|
||||
function<void (uint, uint)> update;
|
||||
};
|
||||
|
@@ -18,7 +18,7 @@ struct VideoXShm : VideoDriver {
|
||||
return initialize();
|
||||
}
|
||||
|
||||
auto driverName() -> string override { return "XShm"; }
|
||||
auto driver() -> string override { return "XShm"; }
|
||||
auto ready() -> bool override { return _ready; }
|
||||
|
||||
auto hasContext() -> bool override { return true; }
|
||||
|
Reference in New Issue
Block a user