2018-07-31 02:23:12 +00:00
|
|
|
struct Video;
|
|
|
|
|
|
|
|
struct VideoDriver {
|
|
|
|
VideoDriver(Video& super) : super(super) {}
|
|
|
|
virtual ~VideoDriver() = default;
|
|
|
|
|
|
|
|
virtual auto create() -> bool { return true; }
|
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.
2018-07-31 10:56:45 +00:00
|
|
|
virtual auto driver() -> string { return "None"; }
|
2018-07-31 02:23:12 +00:00
|
|
|
virtual auto ready() -> bool { return true; }
|
|
|
|
|
2019-08-16 10:44:16 +00:00
|
|
|
virtual auto hasFullScreen() -> bool { return false; }
|
|
|
|
virtual auto hasMonitor() -> bool { return false; }
|
2018-07-31 02:23:12 +00:00
|
|
|
virtual auto hasExclusive() -> bool { return false; }
|
|
|
|
virtual auto hasContext() -> bool { return false; }
|
|
|
|
virtual auto hasBlocking() -> bool { return false; }
|
|
|
|
virtual auto hasFlush() -> bool { return false; }
|
2019-08-16 10:44:16 +00:00
|
|
|
virtual auto hasFormats() -> vector<string> { return {"ARGB24"}; }
|
2018-07-31 02:23:12 +00:00
|
|
|
virtual auto hasShader() -> bool { return false; }
|
|
|
|
|
|
|
|
auto hasFormat(string format) -> bool { return (bool)hasFormats().find(format); }
|
|
|
|
|
2019-08-16 10:44:16 +00:00
|
|
|
virtual auto setFullScreen(bool fullScreen) -> bool { return true; }
|
|
|
|
virtual auto setMonitor(string monitor) -> bool { return true; }
|
2018-07-31 02:23:12 +00:00
|
|
|
virtual auto setExclusive(bool exclusive) -> bool { return true; }
|
|
|
|
virtual auto setContext(uintptr context) -> bool { return true; }
|
|
|
|
virtual auto setBlocking(bool blocking) -> bool { return true; }
|
|
|
|
virtual auto setFlush(bool flush) -> bool { return true; }
|
|
|
|
virtual auto setFormat(string format) -> bool { return true; }
|
|
|
|
virtual auto setShader(string shader) -> bool { return true; }
|
|
|
|
|
2020-02-23 11:23:25 +00:00
|
|
|
virtual auto focused() -> bool { return true; }
|
2018-07-31 02:23:12 +00:00
|
|
|
virtual auto clear() -> void {}
|
2019-07-07 09:44:09 +00:00
|
|
|
virtual auto size(uint& width, uint& height) -> void {}
|
2018-07-31 02:23:12 +00:00
|
|
|
virtual auto acquire(uint32_t*& data, uint& pitch, uint width, uint height) -> bool { return false; }
|
|
|
|
virtual auto release() -> void {}
|
2019-07-07 09:44:09 +00:00
|
|
|
virtual auto output(uint width = 0, uint height = 0) -> void {}
|
2018-07-31 02:23:12 +00:00
|
|
|
virtual auto poll() -> void {}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
Video& super;
|
|
|
|
friend class Video;
|
|
|
|
|
2019-08-16 10:44:16 +00:00
|
|
|
bool fullScreen = false;
|
|
|
|
string monitor = "Primary";
|
2018-07-31 02:23:12 +00:00
|
|
|
bool exclusive = false;
|
|
|
|
uintptr context = 0;
|
|
|
|
bool blocking = false;
|
|
|
|
bool flush = false;
|
2019-08-16 10:44:16 +00:00
|
|
|
string format = "ARGB24";
|
2018-08-21 03:17:12 +00:00
|
|
|
string shader = "Blur";
|
2018-07-31 02:23:12 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct Video {
|
|
|
|
static auto hasDrivers() -> vector<string>;
|
|
|
|
static auto hasDriver(string driver) -> bool { return (bool)hasDrivers().find(driver); }
|
|
|
|
static auto optimalDriver() -> string;
|
|
|
|
static auto safestDriver() -> string;
|
|
|
|
|
2019-08-16 10:44:16 +00:00
|
|
|
struct Monitor {
|
|
|
|
string name;
|
|
|
|
bool primary = false;
|
|
|
|
int x = 0;
|
|
|
|
int y = 0;
|
|
|
|
int width = 0;
|
|
|
|
int height = 0;
|
|
|
|
};
|
|
|
|
static auto monitor(string name) -> Monitor;
|
|
|
|
static auto hasMonitors() -> vector<Monitor>;
|
|
|
|
static auto hasMonitor(string name) -> bool {
|
|
|
|
for(auto& monitor : hasMonitors()) {
|
|
|
|
if(monitor.name == name) return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
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.
2018-07-31 10:56:45 +00:00
|
|
|
Video() : self(*this) { reset(); }
|
|
|
|
explicit operator bool() { return instance->driver() != "None"; }
|
|
|
|
auto reset() -> void { instance = new VideoDriver(*this); }
|
2018-07-31 02:23:12 +00:00
|
|
|
auto create(string driver = "") -> bool;
|
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.
2018-07-31 10:56:45 +00:00
|
|
|
auto driver() -> string { return instance->driver(); }
|
|
|
|
auto ready() -> bool { return instance->ready(); }
|
|
|
|
|
2019-08-16 10:44:16 +00:00
|
|
|
auto hasFullScreen() -> bool { return instance->hasFullScreen(); }
|
|
|
|
auto hasMonitor() -> bool { return instance->hasMonitor(); }
|
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.
2018-07-31 10:56:45 +00:00
|
|
|
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 hasShader() -> bool { return instance->hasShader(); }
|
|
|
|
|
|
|
|
auto hasFormat(string format) -> bool { return instance->hasFormat(format); }
|
|
|
|
|
2019-08-16 10:44:16 +00:00
|
|
|
auto fullScreen() -> bool { return instance->fullScreen; }
|
|
|
|
auto monitor() -> string { return instance->monitor; }
|
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.
2018-07-31 10:56:45 +00:00
|
|
|
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 shader() -> string { return instance->shader; }
|
2018-07-31 02:23:12 +00:00
|
|
|
|
2019-08-16 10:44:16 +00:00
|
|
|
auto setMonitor(string monitor) -> bool;
|
|
|
|
auto setFullScreen(bool fullScreen) -> bool;
|
2018-07-31 02:23:12 +00:00
|
|
|
auto setExclusive(bool exclusive) -> bool;
|
|
|
|
auto setContext(uintptr context) -> bool;
|
|
|
|
auto setBlocking(bool blocking) -> bool;
|
|
|
|
auto setFlush(bool flush) -> bool;
|
|
|
|
auto setFormat(string format) -> bool;
|
|
|
|
auto setShader(string shader) -> bool;
|
|
|
|
|
2020-02-23 11:23:25 +00:00
|
|
|
auto focused() -> bool;
|
2018-07-31 02:23:12 +00:00
|
|
|
auto clear() -> void;
|
2019-07-07 09:44:09 +00:00
|
|
|
struct Size {
|
|
|
|
uint width = 0;
|
|
|
|
uint height = 0;
|
|
|
|
};
|
|
|
|
auto size() -> Size;
|
2019-01-16 00:46:42 +00:00
|
|
|
struct Acquire {
|
|
|
|
explicit operator bool() const { return data; }
|
|
|
|
uint32_t* data = nullptr;
|
|
|
|
uint pitch = 0;
|
|
|
|
};
|
|
|
|
auto acquire(uint width, uint height) -> Acquire;
|
2018-07-31 02:23:12 +00:00
|
|
|
auto release() -> void;
|
2019-07-07 09:44:09 +00:00
|
|
|
auto output(uint width = 0, uint height = 0) -> void;
|
2018-07-31 02:23:12 +00:00
|
|
|
auto poll() -> void;
|
|
|
|
|
|
|
|
auto onUpdate(const function<void (uint, uint)>&) -> void;
|
|
|
|
auto doUpdate(uint width, uint height) -> void;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
Video& self;
|
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.
2018-07-31 10:56:45 +00:00
|
|
|
unique_pointer<VideoDriver> instance;
|
2018-07-31 02:23:12 +00:00
|
|
|
function<void (uint, uint)> update;
|
|
|
|
};
|