mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-02-23 14:42:33 +01:00
byuu says: Changelog: - Emulator::Interface::videoResolution() -\> VideoResolution renamed to videoInformation() -\> VideoInformation - added double VideoInformation::refreshRate - higan: added `binary := (application|library)` — set this to `library` to produce a dynamic link library - higan: removed `-march=native` for macOS application builds; and for all library builds - higan: removed `console` build flag; uncomment `link += -mwindows` instead - nall/GNUmakefile: `macosx` platform renamed `macos` - still need to do this for nall/intrinsics.hpp - Game Gear: return region=NTSC as the only option, so that the system frequency is always set correctly - hiro/cocoa: fixed typo [Sintendo] - hiro/Windows: removed GetDpiForMonitor, as it's Windows 8+ only; DPI is no longer per-monitor aware - icarus: core Icarus class now has virtual functions for directory::create, <file::exists>, <file::copy>, <file::write> - icarus: Sufami Turbo can import save RAM files now - icarus: setting `ICARUS_LIBRARY` define will compile icarus without main(), GUI components - ruby/video/Direct3D: choose the current monitor instead of top-left monitor for fullscreen exclusive [Cydrak] - ruby/video/Direct3D: do not set `WS_EX_TOPMOST` on fullscreen exclusive window [Cydrak] - this isn't necessary for exclusive mode, and it just makes getting out of the application more difficult
55 lines
1.5 KiB
C++
55 lines
1.5 KiB
C++
#if defined(Hiro_Monitor)
|
|
|
|
namespace hiro {
|
|
|
|
struct MonitorInfo {
|
|
uint monitor = 0;
|
|
uint primary = 0;
|
|
Geometry geometry;
|
|
uint index = 0;
|
|
};
|
|
|
|
static auto CALLBACK MonitorEnumProc(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData) -> BOOL {
|
|
MonitorInfo& info = *(MonitorInfo*)dwData;
|
|
MONITORINFOEX mi{};
|
|
mi.cbSize = sizeof(MONITORINFOEX);
|
|
GetMonitorInfo(hMonitor, &mi);
|
|
string displayName = (const char*)utf8_t(mi.szDevice);
|
|
if(displayName.beginsWith(R"(\\.\DISPLAYV)")) return true; //ignore pseudo-monitors
|
|
if(mi.dwFlags & MONITORINFOF_PRIMARY) info.primary = info.index;
|
|
if(info.monitor == info.index) {
|
|
info.geometry = {lprcMonitor->left, lprcMonitor->top, lprcMonitor->right - lprcMonitor->left, lprcMonitor->bottom - lprcMonitor->top};
|
|
}
|
|
info.index++;
|
|
return true;
|
|
}
|
|
|
|
auto pMonitor::count() -> uint {
|
|
return GetSystemMetrics(SM_CMONITORS);
|
|
}
|
|
|
|
auto pMonitor::dpi(uint monitor) -> Position {
|
|
HDC hdc = GetDC(0);
|
|
auto dpiX = (float)GetDeviceCaps(hdc, LOGPIXELSX);
|
|
auto dpiY = (float)GetDeviceCaps(hdc, LOGPIXELSY);
|
|
ReleaseDC(0, hdc);
|
|
return {dpiX, dpiY};
|
|
}
|
|
|
|
auto pMonitor::geometry(uint monitor) -> Geometry {
|
|
MonitorInfo info;
|
|
info.monitor = monitor;
|
|
EnumDisplayMonitors(nullptr, nullptr, MonitorEnumProc, (LPARAM)&info);
|
|
return info.geometry;
|
|
}
|
|
|
|
auto pMonitor::primary() -> uint {
|
|
MonitorInfo info;
|
|
EnumDisplayMonitors(nullptr, nullptr, MonitorEnumProc, (LPARAM)&info);
|
|
return info.primary;
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|