add modify interpolation target fps in menu

This commit is contained in:
coco875
2025-05-25 22:18:57 +02:00
parent c2e913a626
commit 037ab3a121
2 changed files with 72 additions and 52 deletions
+4 -1
View File
@@ -354,7 +354,10 @@ void GameEngine::RunCommands(Gfx* Commands, const std::vector<std::unordered_map
void GameEngine::ProcessGfxCommands(Gfx* commands) {
std::vector<std::unordered_map<Mtx*, MtxF>> mtx_replacements;
int target_fps = 200; // GameEngine::Instance->GetInterpolationFPS();
int target_fps = GameEngine::Instance->GetInterpolationFPS();
if (CVarGetInteger("gModifyInterpolationTargetFPS", 0)) {
target_fps = CVarGetInteger("gInterpolationTargetFPS", 60);
}
static int last_fps;
static int last_update_rate;
static int time;
+68 -51
View File
@@ -15,10 +15,10 @@
#endif
extern "C" {
extern s32 gGamestateNext;
extern s32 gMenuSelection;
#include "audio/external.h"
#include "defines.h"
extern s32 gGamestateNext;
extern s32 gMenuSelection;
#include "audio/external.h"
#include "defines.h"
}
namespace GameUI {
@@ -158,9 +158,8 @@ void PortMenu::AddSettings() {
.IsPercentage());
AddWidget(path, "Main Music Volume: %.0f%%", WIDGET_CVAR_SLIDER_FLOAT)
.CVar("gMainMusicVolume")
.Callback([](WidgetInfo& info) {
audio_set_player_volume(SEQ_PLAYER_LEVEL, CVarGetFloat("gMainMusicVolume", 1.0f));
})
.Callback(
[](WidgetInfo& info) { audio_set_player_volume(SEQ_PLAYER_LEVEL, CVarGetFloat("gMainMusicVolume", 1.0f)); })
.Options(FloatSliderOptions()
.Tooltip("Adjust the background music volume.")
.ShowButtons(false)
@@ -168,16 +167,17 @@ void PortMenu::AddSettings() {
.IsPercentage());
AddWidget(path, "Sound Effects Volume: %.0f%%", WIDGET_CVAR_SLIDER_FLOAT)
.CVar("gSFXMusicVolume")
.Callback([](WidgetInfo& info) {
audio_set_player_volume(SEQ_PLAYER_SFX, CVarGetFloat("gSFXMusicVolume", 1.0f));
})
.Options(
FloatSliderOptions().Tooltip("Adjust the sound effects volume.").ShowButtons(false).Format("").IsPercentage());
.Callback(
[](WidgetInfo& info) { audio_set_player_volume(SEQ_PLAYER_SFX, CVarGetFloat("gSFXMusicVolume", 1.0f)); })
.Options(FloatSliderOptions()
.Tooltip("Adjust the sound effects volume.")
.ShowButtons(false)
.Format("")
.IsPercentage());
AddWidget(path, "Sound Effects Volume: %.0f%%", WIDGET_CVAR_SLIDER_FLOAT)
.CVar("gEnvironmentVolume")
.Callback([](WidgetInfo& info) {
audio_set_player_volume(SEQ_PLAYER_ENV, CVarGetFloat("gEnvironmentVolume", 1.0f));
})
.Callback(
[](WidgetInfo& info) { audio_set_player_volume(SEQ_PLAYER_ENV, CVarGetFloat("gEnvironmentVolume", 1.0f)); })
.Options(FloatSliderOptions()
.Tooltip("Adjust the environment volume.")
.ShowButtons(false)
@@ -332,31 +332,36 @@ void PortMenu::AddEnhancements() {
AddMenuEntry("Enhancements", "gSettings.Menu.EnhancementsSidebarSection");
WidgetPath path = { "Enhancements", "General", SECTION_COLUMN_1 };
AddSidebarEntry("Enhancements", "General", 3);
//UIWidgets::WindowButton("Multiplayer", "gMultiplayerWindowEnabled", GameUI::mMultiplayerWindow,
// { .tooltip = "Shows the multiplayer window" });
// UIWidgets::WindowButton("Freecam", "gFreecam", GameUI::mFreecamWindow,
// { .tooltip = "Allows you to fly around the course" });
// UIWidgets::WindowButton("Multiplayer", "gMultiplayerWindowEnabled", GameUI::mMultiplayerWindow,
// { .tooltip = "Shows the multiplayer window" });
// UIWidgets::WindowButton("Freecam", "gFreecam", GameUI::mFreecamWindow,
// { .tooltip = "Allows you to fly around the course" });
AddWidget(path, "No multiplayer feature cuts", WIDGET_CVAR_CHECKBOX)
.CVar("gMultiplayerNoFeatureCuts")
.Options(CheckboxOptions().Tooltip("Allows full train and jumbotron in multiplayer, etc."));
AddWidget(path, "General Improvements", WIDGET_CVAR_CHECKBOX)
.CVar("gImprovements").Options(CheckboxOptions().Tooltip("General improvements to the game experience."));
.CVar("gImprovements")
.Options(CheckboxOptions().Tooltip("General improvements to the game experience."));
AddWidget(path, "No Level of Detail (LOD)", WIDGET_CVAR_CHECKBOX)
.CVar("gDisableLod")
.Options(CheckboxOptions().Tooltip("Disable Level of Detail (LOD) to avoid models using lower poly versions at a distance"));
.Options(CheckboxOptions().Tooltip(
"Disable Level of Detail (LOD) to avoid models using lower poly versions at a distance"));
AddWidget(path, "Disable Culling", WIDGET_CVAR_CHECKBOX)
.CVar("gNoCulling").Options(CheckboxOptions().Tooltip("Disable original culling of mk64"));
.CVar("gNoCulling")
.Options(CheckboxOptions().Tooltip("Disable original culling of mk64"));
AddWidget(path, "Far Frustrum", WIDGET_CVAR_SLIDER_FLOAT)
.CVar("gFarFrustrum")
.Options(FloatSliderOptions().Min(0.0f).Max(10000.0f).DefaultValue(10000.0f)
.Tooltip("Say how Far the Frustrum are when 'Disable Culling' are enable").Step(10.0f));
.Options(FloatSliderOptions()
.Min(0.0f)
.Max(10000.0f)
.DefaultValue(10000.0f)
.Tooltip("Say how Far the Frustrum are when 'Disable Culling' are enable")
.Step(10.0f));
path = { "Enhancements", "Cheats", SECTION_COLUMN_1 };
AddSidebarEntry("Enhancements", "Cheats", 3);
AddWidget(path, "Moon Jump", WIDGET_CVAR_CHECKBOX)
.CVar("gEnableMoonJump");
AddWidget(path, "Enable Custom CC", WIDGET_CVAR_CHECKBOX)
.CVar("gEnableCustomCC");
AddWidget(path, "Moon Jump", WIDGET_CVAR_CHECKBOX).CVar("gEnableMoonJump");
AddWidget(path, "Enable Custom CC", WIDGET_CVAR_CHECKBOX).CVar("gEnableCustomCC");
AddWidget(path, "Custom CC", WIDGET_CVAR_SLIDER_FLOAT)
.CVar("gCustomCC")
.Options(FloatSliderOptions().Min(0.0f).Max(1000.0f).DefaultValue(150.0f).Step(10.0f));
@@ -365,23 +370,23 @@ void PortMenu::AddEnhancements() {
.Options(CheckboxOptions().Tooltip("Disable wall collision."));
AddWidget(path, "Min Height", WIDGET_CVAR_SLIDER_FLOAT)
.CVar("gMinHeight")
.Options(FloatSliderOptions().Min(-50.0f).Max(50.0f).DefaultValue(0.0f)
.Tooltip("When Disable Wall Collision are enable what is the minimal height you can get."));
.Options(FloatSliderOptions().Min(-50.0f).Max(50.0f).DefaultValue(0.0f).Tooltip(
"When Disable Wall Collision are enable what is the minimal height you can get."));
#if not defined(__SWITCH__) and not defined(__WIIU__)
#if not defined(__SWITCH__) and not defined(__WIIU__)
path = { "Enhancements", "HM64 Lab", SECTION_COLUMN_1 };
AddSidebarEntry("Enhancements", "HM64 Lab", 4);
AddWidget(path, "Enable HM64 Labs", WIDGET_CVAR_CHECKBOX)
.CVar("gEditorEnabled")
.Callback([](WidgetInfo& info) {
Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGuiWindow("Tools")->ToggleVisibility();
Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGuiWindow("Scene Explorer")->ToggleVisibility();
Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGuiWindow("Content Browser")->ToggleVisibility();
Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGuiWindow("Track Properties")->ToggleVisibility();
Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGuiWindow("Properties")->ToggleVisibility();
})
.Options(UIWidgets::CheckboxOptions({{ .tooltip = "Edit the universe!"}}));
#endif
.CVar("gEditorEnabled")
.Callback([](WidgetInfo& info) {
Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGuiWindow("Tools")->ToggleVisibility();
Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGuiWindow("Scene Explorer")->ToggleVisibility();
Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGuiWindow("Content Browser")->ToggleVisibility();
Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGuiWindow("Track Properties")->ToggleVisibility();
Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGuiWindow("Properties")->ToggleVisibility();
})
.Options(UIWidgets::CheckboxOptions({ { .tooltip = "Edit the universe!" } }));
#endif
}
#ifdef __SWITCH__
@@ -402,11 +407,11 @@ void PortMenu::AddDevTools() {
WidgetPath path = { "Developer", "General", SECTION_COLUMN_1 };
#ifdef __SWITCH__
AddWidget(path, "Switch CPU Profile", WIDGET_CVAR_COMBOBOX)
.CVar("gSwitchPerfMode")
.Options(ComboboxOptions()
.Tooltip("Switches the CPU profile to a different one")
.ComboMap(switchCPUProfiles)
.DefaultIndex(Ship::SwitchProfiles::STOCK))
.CVar("gSwitchPerfMode")
.Options(ComboboxOptions()
.Tooltip("Switches the CPU profile to a different one")
.ComboMap(switchCPUProfiles)
.DefaultIndex(Ship::SwitchProfiles::STOCK))
.Callback([](WidgetInfo& info) { Ship::Switch::ApplyOverclock(); });
#endif
AddWidget(path, "Popout Menu", WIDGET_CVAR_CHECKBOX)
@@ -415,6 +420,17 @@ void PortMenu::AddDevTools() {
AddWidget(path, "Debug Mode", WIDGET_CVAR_CHECKBOX)
.CVar("gEnableDebugMode")
.Options(CheckboxOptions().Tooltip("Enables Debug Mode."));
AddWidget(path, "Modify Interpolation Target FPS", WIDGET_CVAR_CHECKBOX)
.CVar("gModifyInterpolationTargetFPS")
.Options(CheckboxOptions().Tooltip("Enables Debug Mode."));
AddWidget(path, "Interpolation Target FPS", WIDGET_CVAR_SLIDER_INT)
.CVar("gInterpolationTargetFPS")
.PreFunc([](WidgetInfo& info) { info.isHidden = !CVarGetInteger("gModifyInterpolationTargetFPS", 0); })
.Options(IntSliderOptions()
.Tooltip("Sets the target FPS for interpolation. When Modify Interpolation Target FPS are enable")
.Min(15)
.Max(360)
.DefaultValue(60));
AddWidget(path, "Render Collision", WIDGET_CVAR_CHECKBOX)
.CVar("gRenderCollisionMesh")
.Options(CheckboxOptions().Tooltip("Renders the collision mesh instead of the course mesh"));
@@ -431,7 +447,8 @@ void PortMenu::AddDevTools() {
AddSidebarEntry("Developer", "Stats", 1);
AddWidget(path, "Popout Stats", WIDGET_WINDOW_BUTTON)
.CVar("gStatsEnabled")
.Options(ButtonOptions().Tooltip("Shows the stats window, with your FPS and frametimes, and the OS you're playing on"))
.Options(ButtonOptions().Tooltip(
"Shows the stats window, with your FPS and frametimes, and the OS you're playing on"))
.WindowName("Stats");
path = { "Developer", "Console", SECTION_COLUMN_1 };
@@ -447,9 +464,9 @@ PortMenu::PortMenu(const std::string& consoleVariable, const std::string& name)
: Menu(consoleVariable, name, 0, UIWidgets::Colors::LightBlue) {
}
//bool CheckNetworkConnected(disabledInfo& info) {
// return gNetwork.isConnected;
//}
// bool CheckNetworkConnected(disabledInfo& info) {
// return gNetwork.isConnected;
// }
void PortMenu::InitElement() {
Ship::Menu::InitElement();
@@ -533,4 +550,4 @@ void PortMenu::Draw() {
void PortMenu::DrawElement() {
Ship::Menu::DrawElement();
}
} // namespace BenGui
} // namespace GameUI