#pragma once #ifdef MT_NATIVE_HAS_LIVE_CLIENT #include namespace mt_host { // Command-line overrides, defined in frame_policy.cpp. extern int g_fps_cap; extern int g_refresh_rate; extern int g_fps_mode; extern int g_idle_fps; extern double g_idle_after_s; // The frame-rate setting (system option dialog, platform/EterBase/FrameRateMode.h) turned into a frame // rate, a display refresh rate and the ADPF budget; --fps-cap / --refresh-rate pin those for a test run. // Frames the player does not watch closely cost the same power as the ones they do, so after a while // without input (and no auto hunt running) the rate drops to --idle-fps until the next touch. The display // is asked for 60 Hz unless the setting wants more: a 120 Hz panel scanning out a 60 fps game costs power // for nothing. class FrameRatePolicy { public: struct Decision { int mode = -1; int fps = 0; // frames per second the loop aims at int display_hz = 0; // the refresh rate asked of the display bool idle = false; bool operator==(const Decision&) const = default; }; bool pinned() const { return g_fps_cap > 0 || g_refresh_rate > 0; } void load(); Decision decide(double idle_seconds, bool auto_hunt); int max_hz() const { return max_hz_; } private: static std::string settings_path(); void save(int mode); std::string path_; int saved_mode_ = -1; int max_hz_ = 60; }; } // namespace mt_host #endif