Skip to content

Commit cc68c8e

Browse files
committed
Overlay: add "Globals" window with some info/settings
1 parent 021dc0c commit cc68c8e

File tree

3 files changed

+75
-9
lines changed

3 files changed

+75
-9
lines changed

src/hooks_drawdistance.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ bool EnablePauseMenu = true;
1616

1717
bool DrawDist_ReadExclusions();
1818

19-
void Overlay_DrawDistOverlay()
19+
void DrawDist_DrawOverlay()
2020
{
2121
ImGui::Begin("Draw Distance Debugger");
2222

src/hooks_framerate.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,6 @@ class ReplaceGameUpdateLoop : public Hook
148148
inline static double FramelimiterFrequency = 0;
149149
inline static double FramelimiterPrevCounter = 0;
150150

151-
inline static double FramelimiterTargetFrametime = double(1000.f) / double(60.f);
152-
153-
inline static double FramelimiterMaxDeviation = FramelimiterTargetFrametime / (16.f * 1000.f);
154151
inline static double FramelimiterDeviation = 0;
155152

156153
inline static SafetyHookMid dest_hook = {};
@@ -212,6 +209,9 @@ class ReplaceGameUpdateLoop : public Hook
212209
double timeCurrent = 0;
213210
LARGE_INTEGER counter;
214211

212+
double FramelimiterTargetFrametime = double(1000.f) / double(Settings::FramerateLimit);
213+
double FramelimiterMaxDeviation = FramelimiterTargetFrametime / (16.f * 1000.f);
214+
215215
do
216216
{
217217
if (Settings::FramerateFastLoad == 3)
@@ -354,9 +354,6 @@ class ReplaceGameUpdateLoop : public Hook
354354
FramelimiterFrequency = double(frequency.QuadPart) / double(1000.f);
355355
QueryPerformanceCounter(&counter);
356356
FramelimiterPrevCounter = double(counter.QuadPart) / FramelimiterFrequency;
357-
358-
FramelimiterTargetFrametime = double(1000.f) / double(Settings::FramerateLimit);
359-
FramelimiterMaxDeviation = FramelimiterTargetFrametime / (16.f * 1000.f);
360357
}
361358

362359
constexpr int HookAddr = 0x17C7B;

src/hooks_overlay.cpp

Lines changed: 71 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,73 @@ bool f11_prev_state = false; // previously seen F11 state
1515
bool overlay_visible = false; // user wants overlay to show?
1616
bool overlay_showing = false;
1717

18+
void Overlay_GlobalsWindow()
19+
{
20+
extern bool EnablePauseMenu;
21+
22+
ImGui::Begin("Globals");
23+
24+
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.51f, 0.00f, 0.14f, 0.00f));
25+
if (ImGui::Button("-"))
26+
{
27+
if (ImGui::GetIO().FontGlobalScale > 1.0f)
28+
{
29+
ImGui::GetIO().FontGlobalScale -= 0.05f;
30+
}
31+
}
32+
33+
ImGui::SameLine();
34+
35+
if (ImGui::Button("+"))
36+
{
37+
if (ImGui::GetIO().FontGlobalScale < 4.0f)
38+
{
39+
ImGui::GetIO().FontGlobalScale += 0.05f;
40+
}
41+
}
42+
43+
ImGui::PopStyleColor();
44+
ImGui::SameLine();
45+
ImGui::Text("Overlay Font Size");
46+
47+
ImGui::Separator();
48+
ImGui::Text("Info");
49+
EVWORK_CAR* car = Game::event(8)->data<EVWORK_CAR>();
50+
ImGui::Text("Car position: %.3f %.3f %.3f", car->position_14.x, car->position_14.y, car->position_14.z);
51+
ImGui::Text("OnRoadPlace coli %d, stg %d, section %d",
52+
car->OnRoadPlace_5C.loadColiType_0,
53+
car->OnRoadPlace_5C.curStageIdx_C,
54+
car->OnRoadPlace_5C.roadSectionNum_8);
55+
56+
int cur_stage_num = *Game::stg_stage_num;
57+
const char* cur_stage_name = Game::GetStageUniqueName(cur_stage_num);
58+
ImGui::Text("Loaded Stage: %d (%s)", cur_stage_num, cur_stage_name);
59+
60+
ImGui::Separator();
61+
ImGui::Text("Gameplay");
62+
63+
ImGui::Checkbox("Countdown timer enabled", Game::Sumo_CountdownTimerEnable);
64+
ImGui::Checkbox("Pause menu enabled", &EnablePauseMenu);
65+
ImGui::Checkbox("HUD enabled", (bool*)Game::navipub_disp_flg);
66+
67+
ImGui::Separator();
68+
ImGui::Text("Controls");
69+
70+
ImGui::SliderFloat("SteeringDeadZone", &Settings::SteeringDeadZone, 0.01, 1.0f);
71+
ImGui::SliderInt("VibrationStrength", &Settings::VibrationStrength, 0, 10);
72+
ImGui::SliderFloat("ImpulseVibrationLeftMultiplier", &Settings::ImpulseVibrationLeftMultiplier, 0.1, 1);
73+
ImGui::SliderFloat("ImpulseVibrationRightMultiplier", &Settings::ImpulseVibrationRightMultiplier, 0.1, 1);
74+
75+
ImGui::Separator();
76+
ImGui::Text("Graphics");
77+
78+
ImGui::SliderInt("FramerateLimit", &Settings::FramerateLimit, 30, 300);
79+
ImGui::SliderInt("DrawDistanceIncrease", &Settings::DrawDistanceIncrease, 0, 4096);
80+
ImGui::SliderInt("DrawDistanceBehind", &Settings::DrawDistanceBehind, 0, 4096);
81+
82+
ImGui::End();
83+
}
84+
1885
bool Overlay_Update()
1986
{
2087
bool f11_pressed = (GetAsyncKeyState(VK_F11) & 1);
@@ -46,8 +113,10 @@ bool Overlay_Update()
46113
}
47114
#endif
48115

49-
void Overlay_DrawDistOverlay();
50-
Overlay_DrawDistOverlay();
116+
Overlay_GlobalsWindow();
117+
118+
void DrawDist_DrawOverlay();
119+
DrawDist_DrawOverlay();
51120

52121
ImGui::EndFrame();
53122

0 commit comments

Comments
 (0)