Merge pull request #57 from MonsterDruide1/PlacementGlobal

ksys: Add SystemTimers
This commit is contained in:
Léo Lam 2021-08-06 15:16:55 +02:00 committed by GitHub
commit 90caa37360
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 93 additions and 11 deletions

View File

@ -80052,17 +80052,17 @@ Address,Quality,Size,Name
0x0000007100eda27c,O,000288,_ZNK5uking6action19SystemSetWindAction27checkDerivedRuntimeTypeInfoEPKN4sead15RuntimeTypeInfo9InterfaceE
0x0000007100eda39c,O,000092,_ZNK5uking6action19SystemSetWindAction18getRuntimeTypeInfoEv
0x0000007100eda3f8,O,000052,_ZN5uking6action19SystemSetWindActionD0Ev
0x0000007100eda42c,U,000100,PlacementGlobal::Disposer::dtor
0x0000007100eda490,U,000108,PlacementGlobal::Disposer::dtorDelete
0x0000007100eda4fc,U,000152,PlacementGlobal::createInstance
0x0000007100eda594,U,000088,PlacementGlobal::deleteInstance
0x0000007100eda5ec,U,000004,nullsub_4054
0x0000007100eda5f0,U,000004,j__ZdlPv_960
0x0000007100eda5f4,U,000012,PlacementGlobal::init
0x0000007100eda600,U,000012,PlacementGlobal::__auto0
0x0000007100eda60c,U,000004,nullsub_4055
0x0000007100eda610,U,000236,PlacementGlobal::incrementCountersAndUpdate
0x0000007100eda6fc,U,000028,PlacementGlobal::incrementCounters
0x0000007100eda42c,O,000100,_ZN4ksys12SystemTimers18SingletonDisposer_D1Ev
0x0000007100eda490,O,000108,_ZN4ksys12SystemTimers18SingletonDisposer_D0Ev
0x0000007100eda4fc,O,000152,_ZN4ksys12SystemTimers14createInstanceEPN4sead4HeapE
0x0000007100eda594,O,000088,_ZN4ksys12SystemTimers14deleteInstanceEv
0x0000007100eda5ec,O,000004,_ZN4ksys12SystemTimersD1Ev
0x0000007100eda5f0,O,000004,_ZN4ksys12SystemTimersD0Ev
0x0000007100eda5f4,O,000012,_ZN4ksys12SystemTimers4initEv
0x0000007100eda600,O,000012,_ZN4ksys12SystemTimers5init2Ev
0x0000007100eda60c,O,000004,_ZN4ksys12SystemTimers18prepareStageUnloadEv
0x0000007100eda610,O,000236,_ZN4ksys12SystemTimers26incrementCountersAndUpdateEv
0x0000007100eda6fc,O,000028,_ZN4ksys12SystemTimers17incrementCountersEv
0x0000007100eda718,U,000104,System::construct
0x0000007100eda780,U,000004,j_Actor::m0_4
0x0000007100eda784,U,000008,

Can't render this file because it is too large.

View File

@ -35,6 +35,8 @@ target_sources(uking PRIVATE
StringBoard.h
SystemPauseMgr.cpp
SystemPauseMgr.h
SystemTimers.cpp
SystemTimers.h
Timer.cpp
Timer.h
UIGlue.cpp

View File

@ -0,0 +1,49 @@
#include "KingSystem/System/SystemTimers.h"
#include "KingSystem/System/VFR.h"
namespace ksys {
SEAD_SINGLETON_DISPOSER_IMPL(SystemTimers)
SystemTimers::~SystemTimers() = default;
void SystemTimers::init() {
mVfrTimer = 0;
mFrameCounterB = 0;
mVfrTimer2 = 0;
mFrameCounterB2 = 0;
mFrameCounter = 0;
mFrameCounter2 = 0;
}
void SystemTimers::init2() {
init();
}
void SystemTimers::prepareStageUnload() {}
void SystemTimers::incrementCountersAndUpdate() {
mFrameCounter++;
mFrameCounter2++;
f32 deltaTime = VFR::instance()->getDeltaTime();
mVfrTimer += deltaTime;
while (mVfrTimer >= 1) {
mFrameCounterB++;
mVfrTimer--;
}
mVfrTimer2 += deltaTime;
while (mVfrTimer2 >= 1) {
mFrameCounterB2++;
mVfrTimer2--;
}
}
void SystemTimers::incrementCounters() {
mFrameCounter++;
mFrameCounterB++;
}
} // namespace ksys

View File

@ -0,0 +1,31 @@
#pragma once
#include <heap/seadDisposer.h>
#include <heap/seadHeap.h>
#include "KingSystem/Utils/Types.h"
namespace ksys {
class SystemTimers {
SEAD_SINGLETON_DISPOSER(SystemTimers);
SystemTimers() = default;
virtual ~SystemTimers();
public:
void init();
void init2();
void prepareStageUnload();
void incrementCountersAndUpdate();
void incrementCounters();
unsigned int mFrameCounter = 0;
int mFrameCounter2 = 0;
float mVfrTimer = 0;
int mFrameCounterB = 0;
float mVfrTimer2 = 0;
int mFrameCounterB2 = 0;
};
KSYS_CHECK_SIZE_NX150(SystemTimers, 0x40);
} // namespace ksys