From e403f961aafd66d071d5f3b3dc797a7c60793930 Mon Sep 17 00:00:00 2001 From: Skyth <19259897+blueskythlikesclouds@users.noreply.github.com> Date: Wed, 20 Nov 2024 10:31:22 +0300 Subject: [PATCH] Cherry pick of global delta time from 'options-menu' branch. Co-authored-by: Hyper <34012267+hyperbx@users.noreply.github.com> --- UnleashedRecomp/CMakeLists.txt | 1 + UnleashedRecomp/app.cpp | 19 +++++++++++++++++++ UnleashedRecomp/app.h | 3 +++ UnleashedRecomp/ui/window.cpp | 13 ------------- 4 files changed, 23 insertions(+), 13 deletions(-) create mode 100644 UnleashedRecomp/app.cpp create mode 100644 UnleashedRecomp/app.h diff --git a/UnleashedRecomp/CMakeLists.txt b/UnleashedRecomp/CMakeLists.txt index ff8536d..43a7956 100644 --- a/UnleashedRecomp/CMakeLists.txt +++ b/UnleashedRecomp/CMakeLists.txt @@ -79,6 +79,7 @@ set(SWA_UI_CXX_SOURCES ) set(SWA_CXX_SOURCES + "app.cpp" "main.cpp" "misc_impl.cpp" "stdafx.cpp" diff --git a/UnleashedRecomp/app.cpp b/UnleashedRecomp/app.cpp new file mode 100644 index 0000000..722429f --- /dev/null +++ b/UnleashedRecomp/app.cpp @@ -0,0 +1,19 @@ +#include +#include +#include + +double g_deltaTime; + +// CApplication::Update +PPC_FUNC_IMPL(__imp__sub_822C1130); +PPC_FUNC(sub_822C1130) +{ + g_deltaTime = ctx.f1.f64; + + SDL_PumpEvents(); + SDL_FlushEvents(SDL_FIRSTEVENT, SDL_LASTEVENT); + + Window::Update(); + + __imp__sub_822C1130(ctx, base); +} diff --git a/UnleashedRecomp/app.h b/UnleashedRecomp/app.h new file mode 100644 index 0000000..4e1d379 --- /dev/null +++ b/UnleashedRecomp/app.h @@ -0,0 +1,3 @@ +#pragma once + +extern double g_deltaTime; diff --git a/UnleashedRecomp/ui/window.cpp b/UnleashedRecomp/ui/window.cpp index 7f58704..2df7597 100644 --- a/UnleashedRecomp/ui/window.cpp +++ b/UnleashedRecomp/ui/window.cpp @@ -1,7 +1,6 @@ #include "window.h" #include "sdl_listener.h" #include -#include #include bool m_isFullscreenKeyReleased = true; @@ -175,15 +174,3 @@ void Window::Update() Config::WindowHeight = Window::s_height; } } - -// CApplication::Update -PPC_FUNC_IMPL(__imp__sub_822C1130); -PPC_FUNC(sub_822C1130) -{ - SDL_PumpEvents(); - SDL_FlushEvents(SDL_FIRSTEVENT, SDL_LASTEVENT); - - Window::Update(); - - __imp__sub_822C1130(ctx, base); -}