show display refresh rate in description

This commit is contained in:
thecozies 2024-04-22 08:11:13 -05:00
parent 73ea635f9c
commit 4fef9d9203
6 changed files with 27 additions and 1 deletions

View File

@ -283,7 +283,10 @@
Sets the game's output framerate. This option does not affect gameplay.
<br />
<br />
Note: If you have issues with Display mode while using an external frame limiter, use Manual mode instead and configure it to that same frame limit.
Note: If you have issues with <b>Display</b> mode while using an external frame limiter, use <b>Manual</b> mode instead and configure it to that same frame limit.
<br />
<br />
<b>Detected display refresh rate: {{display_refresh_rate}}hz</b>
</p>
<p data-if="cur_config_index == 5">
Sets the multisample anti-aliasing (MSAA) quality level. This reduces jagged edges in the final image at the expense of rendering performance.

View File

@ -72,6 +72,7 @@ namespace recomp {
void set_cursor_visible(bool visible);
void update_supported_options();
void toggle_fullscreen();
void update_rml_display_refresh_rate();
extern const std::unordered_map<ButtonVariant, std::string> button_variants;

View File

@ -377,6 +377,17 @@ struct DebugContext {
}
};
void recomp::update_rml_display_refresh_rate() {
static uint32_t lastRate = 0;
if (!graphics_model_handle) return;
uint32_t curRate = ultramodern::get_display_refresh_rate();
if (curRate != lastRate) {
graphics_model_handle.DirtyVariable("display_refresh_rate");
}
lastRate = curRate;
}
DebugContext debug_context;
class ConfigMenu : public recomp::MenuController {
@ -523,6 +534,11 @@ public:
graphics_model_handle.DirtyVariable("ds_info");
});
constructor.BindFunc("display_refresh_rate",
[](Rml::Variant& out) {
out = ultramodern::get_display_refresh_rate();
});
constructor.BindFunc("options_changed",
[](Rml::Variant& out) {
out = (ultramodern::get_graphics_config() != new_options);

View File

@ -956,6 +956,7 @@ struct UIContext {
void update_config_menu_loop(bool menu_changed) {
static int prevTab = -1;
if (menu_changed) prevTab = -1;
recomp::update_rml_display_refresh_rate();
Rml::ElementTabSet *tabset = (Rml::ElementTabSet *)current_document->GetElementById("config_tabset");
if (tabset == nullptr) return;

View File

@ -292,6 +292,10 @@ uint32_t ultramodern::get_target_framerate(uint32_t original) {
}
}
uint32_t ultramodern::get_display_refresh_rate() {
return display_refresh_rate.load();
}
void gfx_thread_func(uint8_t* rdram, std::atomic_flag* thread_ready, ultramodern::WindowHandle window_handle) {
bool enabled_instant_present = false;
using namespace std::chrono_literals;

View File

@ -96,6 +96,7 @@ std::chrono::high_resolution_clock::time_point get_start();
std::chrono::high_resolution_clock::duration time_since_start();
void get_window_size(uint32_t& width, uint32_t& height);
uint32_t get_target_framerate(uint32_t original);
uint32_t get_display_refresh_rate();
void measure_input_latency();
void sleep_milliseconds(uint32_t millis);
void sleep_until(const std::chrono::high_resolution_clock::time_point& time_point);