feat(display): add display mode remapping option (#3529)
Co-authored-by: ReenigneArcher <42013603+ReenigneArcher@users.noreply.github.com>
This commit is contained in:
@@ -379,6 +379,38 @@ namespace config {
|
||||
#undef _CONVERT_2_ARG_
|
||||
return video_t::dd_t::hdr_option_e::disabled; // Default to this if value is invalid
|
||||
}
|
||||
|
||||
video_t::dd_t::mode_remapping_t
|
||||
mode_remapping_from_view(const std::string_view value) {
|
||||
const auto parse_entry_list { [](const auto &entry_list, auto &output_field) {
|
||||
for (auto &[_, entry] : entry_list) {
|
||||
auto requested_resolution = entry.template get_optional<std::string>("requested_resolution"s);
|
||||
auto requested_fps = entry.template get_optional<std::string>("requested_fps"s);
|
||||
auto final_resolution = entry.template get_optional<std::string>("final_resolution"s);
|
||||
auto final_refresh_rate = entry.template get_optional<std::string>("final_refresh_rate"s);
|
||||
|
||||
output_field.push_back(video_t::dd_t::mode_remapping_entry_t {
|
||||
requested_resolution.value_or(""),
|
||||
requested_fps.value_or(""),
|
||||
final_resolution.value_or(""),
|
||||
final_refresh_rate.value_or("") });
|
||||
}
|
||||
} };
|
||||
|
||||
// We need to add a wrapping object to make it valid JSON, otherwise ptree cannot parse it.
|
||||
std::stringstream json_stream;
|
||||
json_stream << "{\"dd_mode_remapping\":" << value << "}";
|
||||
|
||||
boost::property_tree::ptree json_tree;
|
||||
boost::property_tree::read_json(json_stream, json_tree);
|
||||
|
||||
video_t::dd_t::mode_remapping_t output;
|
||||
parse_entry_list(json_tree.get_child("dd_mode_remapping.mixed"), output.mixed);
|
||||
parse_entry_list(json_tree.get_child("dd_mode_remapping.resolution_only"), output.resolution_only);
|
||||
parse_entry_list(json_tree.get_child("dd_mode_remapping.refresh_rate_only"), output.refresh_rate_only);
|
||||
|
||||
return output;
|
||||
}
|
||||
} // namespace dd
|
||||
|
||||
video_t video {
|
||||
@@ -447,6 +479,7 @@ namespace config {
|
||||
{}, // manual_refresh_rate
|
||||
video_t::dd_t::hdr_option_e::automatic, // hdr_option
|
||||
3s, // config_revert_delay
|
||||
{}, // mode_remapping
|
||||
{} // wa
|
||||
}, // display_device
|
||||
|
||||
@@ -1105,6 +1138,7 @@ namespace config {
|
||||
video.dd.config_revert_delay = std::chrono::milliseconds { value };
|
||||
}
|
||||
}
|
||||
generic_f(vars, "dd_mode_remapping", video.dd.mode_remapping, dd::mode_remapping_from_view);
|
||||
bool_f(vars, "dd_wa_hdr_toggle", video.dd.wa.hdr_toggle);
|
||||
|
||||
int_between_f(vars, "min_fps_factor", video.min_fps_factor, { 1, 3 });
|
||||
|
||||
Reference in New Issue
Block a user