mirror of
https://github.com/spice2x/spice2x.github.io.git
synced 2026-08-01 22:30:42 -07:00
util: print dimensions and refresh rate of monitors (#314)
## Link to GitHub Issue, if one exists n/a ## Description of change Dump monitor resolution and refresh rate to the log on launch. ## Testing Tested with two monitors.
This commit is contained in:
@@ -217,21 +217,40 @@ namespace sysutils {
|
||||
if (is_monitor) {
|
||||
prefix = " adapter";
|
||||
}
|
||||
log_misc("gpuinfo", "{} {} name : {}", prefix.c_str(), index, adapter->DeviceName);
|
||||
log_misc("gpuinfo", "{} {} string : {}", prefix.c_str(), index, adapter->DeviceString);
|
||||
log_misc("gpuinfo", "{} {} device name : {}", prefix.c_str(), index, adapter->DeviceName);
|
||||
log_misc("gpuinfo", "{} {} device string : {}", prefix.c_str(), index, adapter->DeviceString);
|
||||
log_dbug("gpuinfo", "{} {} flags : 0x{:x}", prefix.c_str(), index, adapter->StateFlags);
|
||||
|
||||
if (!is_monitor) {
|
||||
DEVMODEA devmode = {};
|
||||
devmode.dmSize = sizeof(devmode);
|
||||
if (EnumDisplaySettingsA(adapter->DeviceName, ENUM_CURRENT_SETTINGS, &devmode)) {
|
||||
log_misc(
|
||||
"gpuinfo",
|
||||
"{} {} resolution : {}px * {}px @ {}Hz",
|
||||
prefix.c_str(),
|
||||
index,
|
||||
devmode.dmPelsWidth, devmode.dmPelsHeight,
|
||||
devmode.dmDisplayFrequency);
|
||||
} else {
|
||||
log_misc("gpuinfo", "EnumDisplaySettingsA failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void print_gpus() {
|
||||
DWORD device_index = 0;
|
||||
DISPLAY_DEVICEA device;
|
||||
DISPLAY_DEVICEA device = {};
|
||||
device.cb = sizeof(device);
|
||||
log_misc("smbios", "dumping GPU/monitor information...");
|
||||
log_misc(
|
||||
"gpuinfo",
|
||||
"dumping GPU/monitor information... "
|
||||
"(note: these are current values **before** launching the game)");
|
||||
while (EnumDisplayDevicesA(nullptr, device_index, &device, 0)) {
|
||||
print_adapter(device_index, &device, false);
|
||||
|
||||
DWORD monitor_index = 0;
|
||||
DISPLAY_DEVICEA monitor;
|
||||
DISPLAY_DEVICEA monitor = {};
|
||||
monitor.cb = sizeof(monitor);
|
||||
while (EnumDisplayDevicesA((PCHAR)device.DeviceName, monitor_index, &monitor, 0)) {
|
||||
print_adapter(monitor_index, &monitor, true);
|
||||
|
||||
Reference in New Issue
Block a user