diff --git a/Runtime/CTimeProvider.cpp b/Runtime/CTimeProvider.cpp new file mode 100644 index 000000000..49f8e7803 --- /dev/null +++ b/Runtime/CTimeProvider.cpp @@ -0,0 +1,32 @@ +#include "CTimeProvider.hpp" +#if 0 +#include "CGraphics.hpp" +#endif + +namespace Retro +{ +CTimeProvider* g_TimeProvider = nullptr; +CTimeProvider::CTimeProvider(const float& time) + : x0_currentTime(time) +{ + x8_lastProvider = g_TimeProvider; + + if (x8_lastProvider != nullptr) + x8_lastProvider->x4_first = false; + +#if 0 + CGraphics::SetExternalTimeProvider(this); +#endif +} + +CTimeProvider::~CTimeProvider() +{ + g_TimeProvider = x8_lastProvider; + if (g_TimeProvider) + g_TimeProvider->x4_first = true; +#if 0 + CGraphics::SetExternalTimeProvider(g_TimeProvider); +#endif +} + +} diff --git a/Runtime/CTimeProvider.hpp b/Runtime/CTimeProvider.hpp new file mode 100644 index 000000000..9779e9276 --- /dev/null +++ b/Runtime/CTimeProvider.hpp @@ -0,0 +1,19 @@ +#ifndef __RETRO__CTIMEPROVIDER_HPP__ +#define __RETRO__CTIMEPROVIDER_HPP__ +namespace Retro +{ +class CTimeProvider; +extern CTimeProvider* g_TimeProvider; +class CTimeProvider +{ +public: + const float& x0_currentTime; // in seconds + bool x4_first = true; + CTimeProvider* x8_lastProvider = nullptr; + + CTimeProvider(const float& time); + ~CTimeProvider(); +}; +} + +#endif