MCPcopy Create free account
hub / github.com/SpecialKO/SpecialK / SK_Unity_PlugInCfg

Function SK_Unity_PlugInCfg

src/plugins/unity.cpp:95–436  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

93void SK_Unity_InitFixedDeltaTimeOverride (void);
94
95bool
96SK_Unity_PlugInCfg (void)
97{
98 bool show_controller_cfg = true;
99
100 if (! SK_Unity_FixablePlayStationRumble)
101 show_controller_cfg = false;
102
103 if (! (SK_ImGui_HasPlayStationController () || SK_XInput_PollController (0)))
104 show_controller_cfg = false;
105
106 SK_RunOnce (SK_Unity_InitFixedDeltaTimeOverride ());
107
108 const bool has_fixed_tick = SK_Unity_OriginalFixedDeltaTime != 0.0f;
109 const bool has_game_pacing = game_pace.isSupported ();
110
111 if (! (show_controller_cfg || has_fixed_tick || has_game_pacing))
112 {
113 ImGui::TextColored (ImVec4 (0.999f, 0.5f, 0.25f, 1.f), ICON_FA_INFO_CIRCLE);
114 ImGui::SameLine ();
115 ImGui::TextUnformatted ("No Unity-specific features are supported in this game.");
116 return true;
117 }
118
119 if (ImGui::CollapsingHeader ("Unity Engine", ImGuiTreeNodeFlags_DefaultOpen))
120 {
121 ImGui::TreePush ("");
122
123 if (SK_Unity_Cfg.time_fixed_delta_time == 0.0f && SK_Unity_OriginalFixedDeltaTime != 0.0f)
124 { SK_Unity_Cfg.time_fixed_delta_time = SK_Unity_OriginalFixedDeltaTime; }
125
126 float delta_hz =
127 (1.0f / SK_Unity_Cfg.time_fixed_delta_time);
128
129 if (has_fixed_tick)
130 {
131 if (SK_Unity_Cfg.fixed_delta_auto_sync)
132 ImGui::BeginDisabled ();
133
134 if (SK_Unity_Cfg.time_fixed_delta_time == SK_Unity_OriginalFixedDeltaTime)
135 {
136 ImGui::TextColored (ImVec4 (0.333f, 0.666f, 0.999f, 1.f), ICON_FA_INFO_CIRCLE);
137 ImGui::SameLine ();
138 ImGui::SetItemTooltip ("Unity games will run smoother if you match Framerate to Fixed Delta Time.");
139 ImGui::SameLine ();
140 }
141
142 if (! SK_Unity_FullIl2cppEngineTime)
143 {
144 ImGui::TextColored (ImVec4 (0.666f, 0.333f, 0.0f, 1.f), ICON_FA_EXCLAMATION_TRIANGLE);
145 ImGui::SameLine ();
146 ImGui::SetItemTooltip ("Game uses il2cpp and does not include UnityEngine.Time.set_fixedDeltaTime (...), this setting may have no effect.");
147 ImGui::SameLine ();
148 }
149
150 if (ImGui::SliderFloat ("Unity Fixed Delta Time", &delta_hz, 1.0f, 240.0f, "%.3f Hz"))
151 {
152 SK_Unity_Cfg.time_fixed_delta_time = delta_hz > 0.0f ? 1.0f / delta_hz : SK_Unity_OriginalFixedDeltaTime;

Callers

nothing calls this directly

Calls 15

SK_XInput_PollControllerFunction · 0.85
SK_RunOnceFunction · 0.85
TextColoredFunction · 0.85
ImVec4Class · 0.85
SameLineFunction · 0.85
TextUnformattedFunction · 0.85
CollapsingHeaderFunction · 0.85
TreePushFunction · 0.85
BeginDisabledFunction · 0.85
SetItemTooltipFunction · 0.85
SliderFloatFunction · 0.85

Tested by

no test coverage detected