From 0542fa53b51af9359cbdf7c58df031edf4a17b31 Mon Sep 17 00:00:00 2001 From: Brian Savage Date: Fri, 31 Dec 2021 09:39:42 -0500 Subject: [PATCH] Add ksysDebugInput Singleton --- data/uking_functions.csv | 8 ++++---- src/KingSystem/CMakeLists.txt | 2 ++ src/KingSystem/ksysDebugInput.cpp | 17 +++++++++++++++++ src/KingSystem/ksysDebugInput.h | 21 +++++++++++++++++++++ 4 files changed, 44 insertions(+), 4 deletions(-) create mode 100644 src/KingSystem/ksysDebugInput.cpp create mode 100644 src/KingSystem/ksysDebugInput.h diff --git a/data/uking_functions.csv b/data/uking_functions.csv index 43e53939..74beccdd 100644 --- a/data/uking_functions.csv +++ b/data/uking_functions.csv @@ -94367,10 +94367,10 @@ Address,Quality,Size,Name 0x0000007101266ea0,U,000004,nullsub_4747 0x0000007101266ea4,U,000040, 0x0000007101266ecc,U,000060, -0x0000007101266f08,U,000100, -0x0000007101266f6c,U,000108, -0x0000007101266fd8,U,000152,DebugInput::createInstance -0x0000007101267070,U,000160, +0x0000007101266f08,O,000100,_ZN4ksys10DebugInput18SingletonDisposer_D1Ev +0x0000007101266f6c,O,000108,_ZN4ksys10DebugInput18SingletonDisposer_D0Ev +0x0000007101266fd8,O,000152,_ZN4ksys10DebugInput14createInstanceEPN4sead4HeapE +0x0000007101267070,O,000160,_ZN4ksys10DebugInput6updateEv 0x0000007101267110,U,000004,j__ZdlPv_1269 0x0000007101267114,U,000004,nullsub_4748 0x0000007101267118,U,000004,nullsub_4749 diff --git a/src/KingSystem/CMakeLists.txt b/src/KingSystem/CMakeLists.txt index 9c40f3ff..550bad89 100644 --- a/src/KingSystem/CMakeLists.txt +++ b/src/KingSystem/CMakeLists.txt @@ -24,4 +24,6 @@ add_subdirectory(XLink) target_sources(uking PRIVATE ksys.cpp ksys.h + ksysDebugInput.cpp + ksysDebugInput.h ) diff --git a/src/KingSystem/ksysDebugInput.cpp b/src/KingSystem/ksysDebugInput.cpp new file mode 100644 index 00000000..b1af1435 --- /dev/null +++ b/src/KingSystem/ksysDebugInput.cpp @@ -0,0 +1,17 @@ +#include "KingSystem/ksysDebugInput.h" +#include "KingSystem/System/VFR.h" + +namespace ksys { + +SEAD_SINGLETON_DISPOSER_IMPL(DebugInput) + +void DebugInput::update() { + if (mFlags.isOnBit(0)) { + mLastDelta += VFR::instance()->getDeltaTime(); + while (mLastDelta > 30.0) { + mLastDelta -= 30.0; + } + } +} + +} // namespace ksys diff --git a/src/KingSystem/ksysDebugInput.h b/src/KingSystem/ksysDebugInput.h new file mode 100644 index 00000000..bdf67465 --- /dev/null +++ b/src/KingSystem/ksysDebugInput.h @@ -0,0 +1,21 @@ +#pragma once + +#include +#include + +namespace ksys { + +class DebugInput { + SEAD_SINGLETON_DISPOSER(DebugInput) + +public: + DebugInput() = default; + virtual ~DebugInput() = default; + void update(); + +private: + sead::BitFlag8 mFlags; + float mLastDelta = 0; +}; + +} // namespace ksys