Add frame advance option to developer tools (#3435)

This commit is contained in:
Garrett Cox 2023-12-27 00:08:37 +00:00 committed by GitHub
parent 6a7bcc4a5e
commit 70e1017923
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 1 deletions

View File

@ -1475,6 +1475,26 @@ void DrawDeveloperToolsMenu() {
UIWidgets::Tooltip("Optimized debug warp screen, with the added ability to chose entrances and time of day");
UIWidgets::PaddedEnhancementCheckbox("Debug Warp Screen Translation", "gDebugWarpScreenTranslation", true, false, false, "", UIWidgets::CheckboxGraphics::Cross, true);
UIWidgets::Tooltip("Translate the Debug Warp Screen based on the game language");
if (gPlayState != NULL) {
UIWidgets::PaddedSeparator();
ImGui::Checkbox("Frame Advance##frameAdvance", (bool*)&gPlayState->frameAdvCtx.enabled);
if (gPlayState->frameAdvCtx.enabled) {
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(12.0f, 6.0f));
ImGui::PushStyleVar(ImGuiStyleVar_ButtonTextAlign, ImVec2(0,0));
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1.0f);
ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0.22f, 0.38f, 0.56f, 1.0f));
if (ImGui::Button("Advance 1", ImVec2(ImGui::GetContentRegionAvail().x / 2.0f, 0.0f))) {
CVarSetInteger("gFrameAdvance", 1);
}
ImGui::SameLine();
ImGui::Button("Advance (Hold)");
if (ImGui::IsItemActive()) {
CVarSetInteger("gFrameAdvance", 1);
}
ImGui::PopStyleVar(3);
ImGui::PopStyleColor(1);
}
}
UIWidgets::PaddedSeparator();
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(12.0f, 6.0f));
ImGui::PushStyleVar(ImGuiStyleVar_ButtonTextAlign, ImVec2(0,0));

View File

@ -18,9 +18,10 @@ s32 FrameAdvance_Update(FrameAdvanceContext* frameAdvCtx, Input* input) {
frameAdvCtx->enabled = !frameAdvCtx->enabled;
}
if (!frameAdvCtx->enabled || (CHECK_BTN_ALL(input->cur.button, BTN_Z) &&
if (!frameAdvCtx->enabled || CVarGetInteger("gFrameAdvance", 0) || (CHECK_BTN_ALL(input->cur.button, BTN_Z) &&
(CHECK_BTN_ALL(input->press.button, BTN_R) ||
(CHECK_BTN_ALL(input->cur.button, BTN_R) && (++frameAdvCtx->timer >= 9))))) {
CVarClear("gFrameAdvance");
frameAdvCtx->timer = 0;
return true;
}