mirror of
https://github.com/isledecomp/isle-portable.git
synced 2026-01-13 03:01:16 +00:00
* Use strcasecmp, strncasecmp, strlwr, strupr and itoa from SDL * Use SDL_GetTicks instead of timeGetTime * Use MxDSFile::OPEN_READ instead of OF_READ * Use SDL_IOStream to read bitmaps * Use SDL_LogXXX instead of OutputDebugString * Undo mxvideoparam.h change * Revert "Undo mxvideoparam.h change" This reverts commit4a20cf6c46. * Fix _MxTrace * Reapply "Undo mxvideoparam.h change" This reverts commitb3a09dc520. * fix _MxTrace * Use __declspec(dllexport) for exporting symbols from dll Refactored CMake script such that all objects are passed to the lego1 library. * clang-format * fix msvc build * MSVC fixed for real now? * Forgot about d3drm_guid * Fix naming issue * Use Uint64 in LegoCarBuild::Tickle for dTime
45 lines
982 B
C++
45 lines
982 B
C++
#include "mxtimer.h"
|
|
|
|
#include <SDL3/SDL_timer.h>
|
|
|
|
// GLOBAL: LEGO1 0x10101414
|
|
// GLOBAL: BETA10 0x10201f84
|
|
MxLong MxTimer::g_lastTimeCalculated = 0;
|
|
|
|
// GLOBAL: LEGO1 0x10101418
|
|
MxLong MxTimer::g_lastTimeTimerStarted = 0;
|
|
|
|
// FUNCTION: LEGO1 0x100ae060
|
|
// FUNCTION: BETA10 0x1012bea0
|
|
MxTimer::MxTimer()
|
|
{
|
|
m_isRunning = FALSE;
|
|
m_startTime = SDL_GetTicks();
|
|
InitLastTimeCalculated();
|
|
}
|
|
|
|
// FUNCTION: LEGO1 0x100ae140
|
|
// FUNCTION: BETA10 0x1012bf23
|
|
MxLong MxTimer::GetRealTime()
|
|
{
|
|
MxTimer::g_lastTimeCalculated = SDL_GetTicks();
|
|
return MxTimer::g_lastTimeCalculated - m_startTime;
|
|
}
|
|
|
|
// FUNCTION: LEGO1 0x100ae160
|
|
void MxTimer::Start()
|
|
{
|
|
g_lastTimeTimerStarted = GetRealTime();
|
|
m_isRunning = TRUE;
|
|
}
|
|
|
|
// FUNCTION: LEGO1 0x100ae180
|
|
void MxTimer::Stop()
|
|
{
|
|
MxLong elapsed = GetRealTime();
|
|
MxLong startTime = elapsed - MxTimer::g_lastTimeTimerStarted;
|
|
m_isRunning = FALSE;
|
|
// this feels very stupid but it's what the assembly does
|
|
m_startTime = m_startTime + startTime - 5;
|
|
}
|