Skip to content
4 changes: 4 additions & 0 deletions IntelPresentMon/AppCef/CefNano.args.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@
"Id": "fc633c46-6b09-43e6-9c02-3e4817ef382e",
"Command": "--p2c-debug-wait-render"
},
{
"Id": "f556bf27-cb7e-4a17-a7cb-3c0400aeb7d1",
"Command": "--p2c-debug-wait-client"
},
{
"Id": "92d25458-0b38-4e99-a582-49f0c90979c2",
"Command": "--help"
Expand Down
50 changes: 49 additions & 1 deletion IntelPresentMon/CommonUtilities/ref/StaticReflection.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <optional>
#include "WrapReflect.h"
#include "../Meta.h"
#include <bitset>


namespace pmon::util::ref
Expand Down Expand Up @@ -36,7 +37,7 @@ namespace pmon::util::ref
oss << "{unknown}";
}
else if constexpr (std::is_enum_v<S>) {
oss << reflect::enum_name(s);
oss << reflect::type_name<S>() << "::" << reflect::enum_name(s);
}
else if constexpr (std::is_class_v<S>) {
oss << "struct " << reflect::type_name(s) << " { ";
Expand Down Expand Up @@ -64,4 +65,51 @@ namespace pmon::util::ref
DumpStaticImpl_(s, oss);
return oss.str();
}

template<typename E, size_t N>
std::string DumpEnumBitset(const std::bitset<N>& set)
{
std::ostringstream oss;
oss << "| ";
for (size_t n = 0; n < N; n++) {
if (!set.test(n)) {
continue;
}
const auto name = reflect::enum_name(E(n));
if (!name.length()) {
continue;
}
oss << name << ", ";
}
oss << "|";
return oss.str();
}

template<typename E>
std::string DumpEnumFlagSet(uint64_t bits)
{
// simple hacky impl assumes 32-bit ints, logically unsigned for flags
// unless underlying type is 8-bytes, then assume 64-bit
size_t nBits;
if constexpr (sizeof(std::underlying_type_t<E>) == 8) {
nBits = 64;
}
else {
nBits = 32;
}
std::ostringstream oss;
oss << "| ";
// loop over n-bits, shifting a 1-hot bit value to test all positions
for (size_t n = 0, b = 1; n < nBits; n++, b<<1) {
if (!(bits & b)) {
continue;
}
const auto name = reflect::enum_name(E(b));
if (!name.length()) {
continue;
}
oss << name << ", ";
}
oss << "|";
}
}
48 changes: 48 additions & 0 deletions IntelPresentMon/CommonUtilities/ref/gen/GeneratedReflection.h
Original file line number Diff line number Diff line change
Expand Up @@ -1364,6 +1364,43 @@ namespace pmon::util::ref::gen
<< " }";
return oss.str();
};
dumpers[typeid(_ctl_led_properties_t)] = [](const void* pStruct) {
const auto& s = *static_cast<const _ctl_led_properties_t*>(pStruct);
std::ostringstream oss;
oss << std::boolalpha << "struct _ctl_led_properties_t {"
<< " .Size = " << s.Size
<< " .Version = " << (int)s.Version
<< " .canControl = " << s.canControl
<< " .isI2C = " << s.isI2C
<< " .isPWM = " << s.isPWM
<< " .haveRGB = " << s.haveRGB
<< " }";
return oss.str();
};
dumpers[typeid(_ctl_led_color_t)] = [](const void* pStruct) {
const auto& s = *static_cast<const _ctl_led_color_t*>(pStruct);
std::ostringstream oss;
oss << std::boolalpha << "struct _ctl_led_color_t {"
<< " .Size = " << s.Size
<< " .Version = " << (int)s.Version
<< " .red = " << s.red
<< " .green = " << s.green
<< " .blue = " << s.blue
<< " }";
return oss.str();
};
dumpers[typeid(_ctl_led_state_t)] = [](const void* pStruct) {
const auto& s = *static_cast<const _ctl_led_state_t*>(pStruct);
std::ostringstream oss;
oss << std::boolalpha << "struct _ctl_led_state_t {"
<< " .Size = " << s.Size
<< " .Version = " << (int)s.Version
<< " .isOn = " << s.isOn
<< " .pwm = " << s.pwm
<< " .color = " << DumpGenerated(s.color)
<< " }";
return oss.str();
};
dumpers[typeid(_ctl_video_processing_super_resolution_info_t)] = [](const void* pStruct) {
const auto& s = *static_cast<const _ctl_video_processing_super_resolution_info_t*>(pStruct);
std::ostringstream oss;
Expand Down Expand Up @@ -1689,6 +1726,15 @@ namespace pmon::util::ref::gen
<< " .totalCardEnergyCounter = " << DumpGenerated(s.totalCardEnergyCounter)
<< " .psu = " << DumpArray_<ctl_psu_info_t, 5, false>(s.psu)
<< " .fanSpeed = " << DumpArray_<ctl_oc_telemetry_item_t, 5, false>(s.fanSpeed)
<< " .gpuVrTemp = " << DumpGenerated(s.gpuVrTemp)
<< " .vramVrTemp = " << DumpGenerated(s.vramVrTemp)
<< " .saVrTemp = " << DumpGenerated(s.saVrTemp)
<< " .gpuEffectiveClock = " << DumpGenerated(s.gpuEffectiveClock)
<< " .gpuOverVoltagePercent = " << DumpGenerated(s.gpuOverVoltagePercent)
<< " .gpuPowerPercent = " << DumpGenerated(s.gpuPowerPercent)
<< " .gpuTemperaturePercent = " << DumpGenerated(s.gpuTemperaturePercent)
<< " .vramReadBandwidth = " << DumpGenerated(s.vramReadBandwidth)
<< " .vramWriteBandwidth = " << DumpGenerated(s.vramWriteBandwidth)
<< " }";
return oss.str();
};
Expand Down Expand Up @@ -2041,6 +2087,7 @@ namespace pmon::util::ref::gen
case _ctl_units_t::CTL_UNITS_PERCENT: return "CTL_UNITS_PERCENT"s;
case _ctl_units_t::CTL_UNITS_MEM_SPEED_GBPS: return "CTL_UNITS_MEM_SPEED_GBPS"s;
case _ctl_units_t::CTL_UNITS_VOLTAGE_MILLIVOLTS: return "CTL_UNITS_VOLTAGE_MILLIVOLTS"s;
case _ctl_units_t::CTL_UNITS_BANDWIDTH_MBPS: return "CTL_UNITS_BANDWIDTH_MBPS"s;
case _ctl_units_t::CTL_UNITS_UNKNOWN: return "CTL_UNITS_UNKNOWN"s;
case _ctl_units_t::CTL_UNITS_MAX: return "CTL_UNITS_MAX"s;
default: return "{ unknown }"s;
Expand Down Expand Up @@ -2602,6 +2649,7 @@ namespace pmon::util::ref::gen
dumpers[typeid(_ctl_3d_feature_misc_flag_t)] = [](const void* pEnum) {
const auto& e = *static_cast<const _ctl_3d_feature_misc_flag_t*>(pEnum);
switch (e) {
case _ctl_3d_feature_misc_flag_t::CTL_3D_FEATURE_MISC_FLAG_DX9: return "CTL_3D_FEATURE_MISC_FLAG_DX9"s;
case _ctl_3d_feature_misc_flag_t::CTL_3D_FEATURE_MISC_FLAG_DX11: return "CTL_3D_FEATURE_MISC_FLAG_DX11"s;
case _ctl_3d_feature_misc_flag_t::CTL_3D_FEATURE_MISC_FLAG_DX12: return "CTL_3D_FEATURE_MISC_FLAG_DX12"s;
case _ctl_3d_feature_misc_flag_t::CTL_3D_FEATURE_MISC_FLAG_VULKAN: return "CTL_3D_FEATURE_MISC_FLAG_VULKAN"s;
Expand Down
Loading