2019-07-07 09:44:09 +00:00
|
|
|
static LRESULT CALLBACK VideoGDI_WindowProcedure(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) {
|
|
|
|
return DefWindowProc(hwnd, msg, wparam, lparam);
|
|
|
|
}
|
|
|
|
|
2018-08-05 09:00:15 +00:00
|
|
|
struct VideoGDI : VideoDriver {
|
|
|
|
VideoGDI& self = *this;
|
2019-07-07 09:44:09 +00:00
|
|
|
VideoGDI(Video& super) : VideoDriver(super) { construct(); }
|
|
|
|
~VideoGDI() { destruct(); }
|
2010-08-09 13:28:56 +00:00
|
|
|
|
2018-08-05 09:00:15 +00:00
|
|
|
auto create() -> bool override {
|
2018-08-21 03:17:12 +00:00
|
|
|
super.setShader("None");
|
2018-08-05 09:00:15 +00:00
|
|
|
return initialize();
|
|
|
|
}
|
|
|
|
|
Update to 20180729 release.
byuu wrote:
Sigh ...
asio.hpp needs #include <nall/windows/registry.hpp>
[Since the last WIP, byuu also posted the following message. -Ed.]
ruby drivers have all been updated (but not tested outside of BSD), and
I redesigned the settings window. The driver functionality all exists on
a new "Drivers" panel, the emulator/hack settings go to a
"Configuration" panel, and the video/audio panels lose driver settings.
As does the settings menu and its synchronize options.
I want to start pushing toward a v107 release. Critically, I will need
DirectSound and ALSA to support dynamic rate control. I'd also like to
eliminate the other system manifest.bml files. I need to update the
cheat code database format, and bundle at least a few quark shaders --
although I still need to default to Direct3D on Windows.
Turbo keys would be nice, if it's not too much effort. Aside from
netplay, it's the last significant feature I'm missing.
I think for v107, higan is going to be a bit rough around the edges
compared to bsnes. And I don't think it's practical to finish the bsnes
localization support.
I'm thinking we probably want another WIP to iron out any critical
issues, but this time there should be a feature freeze with the next
WIP.
2018-07-29 13:24:38 +00:00
|
|
|
auto driver() -> string override { return "GDI"; }
|
|
|
|
auto ready() -> bool override { return _ready; }
|
2010-08-09 13:28:56 +00:00
|
|
|
|
2019-07-07 09:44:09 +00:00
|
|
|
auto hasExclusive() -> bool override { return true; }
|
Update to 20180729 release.
byuu wrote:
Sigh ...
asio.hpp needs #include <nall/windows/registry.hpp>
[Since the last WIP, byuu also posted the following message. -Ed.]
ruby drivers have all been updated (but not tested outside of BSD), and
I redesigned the settings window. The driver functionality all exists on
a new "Drivers" panel, the emulator/hack settings go to a
"Configuration" panel, and the video/audio panels lose driver settings.
As does the settings menu and its synchronize options.
I want to start pushing toward a v107 release. Critically, I will need
DirectSound and ALSA to support dynamic rate control. I'd also like to
eliminate the other system manifest.bml files. I need to update the
cheat code database format, and bundle at least a few quark shaders --
although I still need to default to Direct3D on Windows.
Turbo keys would be nice, if it's not too much effort. Aside from
netplay, it's the last significant feature I'm missing.
I think for v107, higan is going to be a bit rough around the edges
compared to bsnes. And I don't think it's practical to finish the bsnes
localization support.
I'm thinking we probably want another WIP to iron out any critical
issues, but this time there should be a feature freeze with the next
WIP.
2018-07-29 13:24:38 +00:00
|
|
|
auto hasContext() -> bool override { return true; }
|
2010-08-09 13:28:56 +00:00
|
|
|
|
2019-07-07 09:44:09 +00:00
|
|
|
auto setExclusive(bool exclusive) -> bool override { return initialize(); }
|
2018-08-05 09:00:15 +00:00
|
|
|
auto setContext(uintptr context) -> bool override { return initialize(); }
|
2010-08-09 13:28:56 +00:00
|
|
|
|
2019-07-07 09:44:09 +00:00
|
|
|
auto size(uint& width, uint& height) -> void override {
|
|
|
|
RECT rectangle;
|
|
|
|
GetClientRect(_context, &rectangle);
|
|
|
|
width = rectangle.right - rectangle.left;
|
|
|
|
height = rectangle.bottom - rectangle.top;
|
|
|
|
}
|
|
|
|
|
Update to 20180729 release.
byuu wrote:
Sigh ...
asio.hpp needs #include <nall/windows/registry.hpp>
[Since the last WIP, byuu also posted the following message. -Ed.]
ruby drivers have all been updated (but not tested outside of BSD), and
I redesigned the settings window. The driver functionality all exists on
a new "Drivers" panel, the emulator/hack settings go to a
"Configuration" panel, and the video/audio panels lose driver settings.
As does the settings menu and its synchronize options.
I want to start pushing toward a v107 release. Critically, I will need
DirectSound and ALSA to support dynamic rate control. I'd also like to
eliminate the other system manifest.bml files. I need to update the
cheat code database format, and bundle at least a few quark shaders --
although I still need to default to Direct3D on Windows.
Turbo keys would be nice, if it's not too much effort. Aside from
netplay, it's the last significant feature I'm missing.
I think for v107, higan is going to be a bit rough around the edges
compared to bsnes. And I don't think it's practical to finish the bsnes
localization support.
I'm thinking we probably want another WIP to iron out any critical
issues, but this time there should be a feature freeze with the next
WIP.
2018-07-29 13:24:38 +00:00
|
|
|
auto acquire(uint32_t*& data, uint& pitch, uint width, uint height) -> bool override {
|
2017-07-24 05:23:40 +00:00
|
|
|
if(!_buffer || _width != width || _height != height) {
|
|
|
|
if(_buffer) delete[] _buffer;
|
|
|
|
if(_bitmap) DeleteObject(_bitmap);
|
|
|
|
if(_dc) DeleteObject(_dc);
|
|
|
|
|
|
|
|
_buffer = new uint32_t[width * height]();
|
|
|
|
_width = width;
|
|
|
|
_height = height;
|
|
|
|
|
2019-07-07 09:44:09 +00:00
|
|
|
HDC hdc = GetDC(_context);
|
2017-07-24 05:23:40 +00:00
|
|
|
_dc = CreateCompatibleDC(hdc);
|
|
|
|
_bitmap = CreateCompatibleBitmap(hdc, width, height);
|
|
|
|
SelectObject(_dc, _bitmap);
|
2019-07-07 09:44:09 +00:00
|
|
|
ReleaseDC(_context, hdc);
|
2017-07-24 05:23:40 +00:00
|
|
|
|
|
|
|
memory::fill(&_info, sizeof(BITMAPINFO));
|
|
|
|
_info.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
|
|
|
_info.bmiHeader.biWidth = width;
|
|
|
|
_info.bmiHeader.biHeight = -height;
|
|
|
|
_info.bmiHeader.biPlanes = 1;
|
|
|
|
_info.bmiHeader.biBitCount = 32;
|
|
|
|
_info.bmiHeader.biCompression = BI_RGB;
|
|
|
|
_info.bmiHeader.biSizeImage = width * height * sizeof(uint32_t);
|
2017-05-30 07:48:41 +00:00
|
|
|
}
|
2010-08-09 13:28:56 +00:00
|
|
|
|
2017-07-24 05:23:40 +00:00
|
|
|
pitch = _width * sizeof(uint32_t);
|
|
|
|
return data = _buffer;
|
2010-08-09 13:28:56 +00:00
|
|
|
}
|
|
|
|
|
Update to 20180729 release.
byuu wrote:
Sigh ...
asio.hpp needs #include <nall/windows/registry.hpp>
[Since the last WIP, byuu also posted the following message. -Ed.]
ruby drivers have all been updated (but not tested outside of BSD), and
I redesigned the settings window. The driver functionality all exists on
a new "Drivers" panel, the emulator/hack settings go to a
"Configuration" panel, and the video/audio panels lose driver settings.
As does the settings menu and its synchronize options.
I want to start pushing toward a v107 release. Critically, I will need
DirectSound and ALSA to support dynamic rate control. I'd also like to
eliminate the other system manifest.bml files. I need to update the
cheat code database format, and bundle at least a few quark shaders --
although I still need to default to Direct3D on Windows.
Turbo keys would be nice, if it's not too much effort. Aside from
netplay, it's the last significant feature I'm missing.
I think for v107, higan is going to be a bit rough around the edges
compared to bsnes. And I don't think it's practical to finish the bsnes
localization support.
I'm thinking we probably want another WIP to iron out any critical
issues, but this time there should be a feature freeze with the next
WIP.
2018-07-29 13:24:38 +00:00
|
|
|
auto release() -> void override {
|
2017-07-24 05:23:40 +00:00
|
|
|
}
|
2010-08-09 13:28:56 +00:00
|
|
|
|
2019-07-07 09:44:09 +00:00
|
|
|
auto output(uint width, uint height) -> void override {
|
|
|
|
uint windowWidth, windowHeight;
|
|
|
|
size(windowWidth, windowHeight);
|
2010-08-09 13:28:56 +00:00
|
|
|
|
2017-07-24 05:23:40 +00:00
|
|
|
SetDIBits(_dc, _bitmap, 0, _height, (void*)_buffer, &_info, DIB_RGB_COLORS);
|
2019-07-07 09:44:09 +00:00
|
|
|
HDC hdc = GetDC(_context);
|
|
|
|
StretchBlt(hdc,
|
|
|
|
((int)windowWidth - (int)width) / 2, ((int)windowHeight - (int)height) / 2, width, height, _dc,
|
|
|
|
0, 0, _width, _height, SRCCOPY
|
|
|
|
);
|
|
|
|
ReleaseDC(_context, hdc);
|
2010-08-09 13:28:56 +00:00
|
|
|
}
|
|
|
|
|
2017-07-24 05:23:40 +00:00
|
|
|
private:
|
2019-07-07 09:44:09 +00:00
|
|
|
auto construct() -> void {
|
|
|
|
WNDCLASS windowClass{};
|
|
|
|
windowClass.cbClsExtra = 0;
|
|
|
|
windowClass.cbWndExtra = 0;
|
|
|
|
windowClass.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
|
|
|
|
windowClass.hCursor = LoadCursor(0, IDC_ARROW);
|
|
|
|
windowClass.hIcon = LoadIcon(nullptr, IDI_APPLICATION);
|
|
|
|
windowClass.hInstance = GetModuleHandle(0);
|
|
|
|
windowClass.lpfnWndProc = VideoGDI_WindowProcedure;
|
|
|
|
windowClass.lpszClassName = L"VideoGDI_Window";
|
|
|
|
windowClass.lpszMenuName = 0;
|
|
|
|
windowClass.style = CS_HREDRAW | CS_VREDRAW;
|
|
|
|
RegisterClass(&windowClass);
|
|
|
|
}
|
|
|
|
|
|
|
|
auto destruct() -> void {
|
|
|
|
terminate();
|
|
|
|
}
|
|
|
|
|
2017-07-24 05:23:40 +00:00
|
|
|
auto initialize() -> bool {
|
|
|
|
terminate();
|
2019-07-07 09:44:09 +00:00
|
|
|
if(!self.exclusive && !self.context) return false;
|
|
|
|
|
|
|
|
POINT point{0, 0};
|
|
|
|
HMONITOR monitor = MonitorFromPoint(point, MONITOR_DEFAULTTOPRIMARY);
|
|
|
|
MONITORINFOEX information{};
|
|
|
|
information.cbSize = sizeof(MONITORINFOEX);
|
|
|
|
GetMonitorInfo(monitor, &information);
|
|
|
|
uint monitorWidth = information.rcMonitor.right - information.rcMonitor.left;
|
|
|
|
uint monitorHeight = information.rcMonitor.bottom - information.rcMonitor.top;
|
|
|
|
|
|
|
|
if(self.exclusive) {
|
|
|
|
_context = _exclusive = CreateWindowEx(WS_EX_TOPMOST, L"VideoGDI_Window", L"", WS_VISIBLE | WS_POPUP,
|
|
|
|
information.rcMonitor.left, information.rcMonitor.top, monitorWidth, monitorHeight,
|
|
|
|
nullptr, nullptr, GetModuleHandle(0), nullptr);
|
|
|
|
} else {
|
|
|
|
_context = (HWND)self.context;
|
|
|
|
}
|
2017-07-24 05:23:40 +00:00
|
|
|
|
|
|
|
_width = 0;
|
|
|
|
_height = 0;
|
|
|
|
return _ready = true;
|
2010-08-09 13:28:56 +00:00
|
|
|
}
|
|
|
|
|
2017-07-24 05:23:40 +00:00
|
|
|
auto terminate() -> void {
|
|
|
|
_ready = false;
|
|
|
|
if(_buffer) { delete[] _buffer; _buffer = nullptr; }
|
|
|
|
if(_bitmap) { DeleteObject(_bitmap); _bitmap = nullptr; }
|
|
|
|
if(_dc) { DeleteDC(_dc); _dc = nullptr; }
|
2019-07-07 09:44:09 +00:00
|
|
|
if(_exclusive) { DestroyWindow(_exclusive); _exclusive = nullptr; }
|
|
|
|
_context = nullptr;
|
2010-08-09 13:28:56 +00:00
|
|
|
}
|
2017-07-24 05:23:40 +00:00
|
|
|
|
|
|
|
bool _ready = false;
|
|
|
|
|
|
|
|
uint32_t* _buffer = nullptr;
|
|
|
|
uint _width = 0;
|
|
|
|
uint _height = 0;
|
|
|
|
|
2019-07-07 09:44:09 +00:00
|
|
|
HWND _exclusive = nullptr;
|
|
|
|
HWND _context = nullptr;
|
2017-07-24 05:23:40 +00:00
|
|
|
HBITMAP _bitmap = nullptr;
|
|
|
|
HDC _dc = nullptr;
|
|
|
|
BITMAPINFO _info = {};
|
2010-08-09 13:28:56 +00:00
|
|
|
};
|