mirror of
https://github.com/isledecomp/isle-portable.git
synced 2025-09-26 14:13:55 -04:00
MxTimer touch-up (#1096)
This commit is contained in:
parent
f242130382
commit
2af5f87051
@ -4,6 +4,7 @@
|
|||||||
#include "mxcore.h"
|
#include "mxcore.h"
|
||||||
|
|
||||||
// VTABLE: LEGO1 0x100dc0e0
|
// VTABLE: LEGO1 0x100dc0e0
|
||||||
|
// VTABLE: BETA10 0x101c1bb0
|
||||||
// SIZE 0x10
|
// SIZE 0x10
|
||||||
class MxTimer : public MxCore {
|
class MxTimer : public MxCore {
|
||||||
public:
|
public:
|
||||||
@ -14,19 +15,23 @@ public:
|
|||||||
|
|
||||||
MxLong GetRealTime();
|
MxLong GetRealTime();
|
||||||
|
|
||||||
|
// FUNCTION: BETA10 0x1012bf50
|
||||||
|
void InitLastTimeCalculated() { g_lastTimeCalculated = m_startTime; }
|
||||||
|
|
||||||
// FUNCTION: BETA10 0x10017810
|
// FUNCTION: BETA10 0x10017810
|
||||||
MxLong GetTime()
|
MxLong GetTime()
|
||||||
{
|
{
|
||||||
// Note that the BETA10 implementation differs - it only consists of the second branch of this `if` call
|
// Note that the BETA10 implementation differs - it only consists of the second branch of this `if` call
|
||||||
if (this->m_isRunning) {
|
if (m_isRunning) {
|
||||||
return g_lastTimeTimerStarted;
|
return g_lastTimeTimerStarted;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return g_lastTimeCalculated - this->m_startTime;
|
return g_lastTimeCalculated - m_startTime;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// SYNTHETIC: LEGO1 0x100ae0d0
|
// SYNTHETIC: LEGO1 0x100ae0d0
|
||||||
|
// SYNTHETIC: BETA10 0x1012bf80
|
||||||
// MxTimer::`scalar deleting destructor'
|
// MxTimer::`scalar deleting destructor'
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -37,4 +42,7 @@ private:
|
|||||||
static MxLong g_lastTimeTimerStarted;
|
static MxLong g_lastTimeTimerStarted;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// SYNTHETIC: BETA10 0x1012bfc0
|
||||||
|
// MxTimer::~MxTimer
|
||||||
|
|
||||||
#endif // MXTIMER_H
|
#endif // MXTIMER_H
|
||||||
|
@ -3,40 +3,42 @@
|
|||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
// GLOBAL: LEGO1 0x10101414
|
// GLOBAL: LEGO1 0x10101414
|
||||||
|
// GLOBAL: BETA10 0x10201f84
|
||||||
MxLong MxTimer::g_lastTimeCalculated = 0;
|
MxLong MxTimer::g_lastTimeCalculated = 0;
|
||||||
|
|
||||||
// GLOBAL: LEGO1 0x10101418
|
// GLOBAL: LEGO1 0x10101418
|
||||||
MxLong MxTimer::g_lastTimeTimerStarted = 0;
|
MxLong MxTimer::g_lastTimeTimerStarted = 0;
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x100ae060
|
// FUNCTION: LEGO1 0x100ae060
|
||||||
|
// FUNCTION: BETA10 0x1012bea0
|
||||||
MxTimer::MxTimer()
|
MxTimer::MxTimer()
|
||||||
{
|
{
|
||||||
this->m_isRunning = FALSE;
|
m_isRunning = FALSE;
|
||||||
m_startTime = timeGetTime();
|
m_startTime = timeGetTime();
|
||||||
// yeah this is somehow what the asm is
|
InitLastTimeCalculated();
|
||||||
g_lastTimeCalculated = m_startTime;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x100ae140
|
// FUNCTION: LEGO1 0x100ae140
|
||||||
|
// FUNCTION: BETA10 0x1012bf23
|
||||||
MxLong MxTimer::GetRealTime()
|
MxLong MxTimer::GetRealTime()
|
||||||
{
|
{
|
||||||
MxTimer::g_lastTimeCalculated = timeGetTime();
|
MxTimer::g_lastTimeCalculated = timeGetTime();
|
||||||
return MxTimer::g_lastTimeCalculated - this->m_startTime;
|
return MxTimer::g_lastTimeCalculated - m_startTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x100ae160
|
// FUNCTION: LEGO1 0x100ae160
|
||||||
void MxTimer::Start()
|
void MxTimer::Start()
|
||||||
{
|
{
|
||||||
g_lastTimeTimerStarted = this->GetRealTime();
|
g_lastTimeTimerStarted = GetRealTime();
|
||||||
this->m_isRunning = TRUE;
|
m_isRunning = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x100ae180
|
// FUNCTION: LEGO1 0x100ae180
|
||||||
void MxTimer::Stop()
|
void MxTimer::Stop()
|
||||||
{
|
{
|
||||||
MxLong elapsed = this->GetRealTime();
|
MxLong elapsed = GetRealTime();
|
||||||
MxLong startTime = elapsed - MxTimer::g_lastTimeTimerStarted;
|
MxLong startTime = elapsed - MxTimer::g_lastTimeTimerStarted;
|
||||||
this->m_isRunning = FALSE;
|
m_isRunning = FALSE;
|
||||||
// this feels very stupid but it's what the assembly does
|
// this feels very stupid but it's what the assembly does
|
||||||
this->m_startTime = this->m_startTime + startTime - 5;
|
m_startTime = m_startTime + startTime - 5;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user