From d12508cfce49ca4bf620c688aea7f14f1e161ca7 Mon Sep 17 00:00:00 2001 From: theo3 Date: Thu, 24 Jun 2021 23:50:52 -0700 Subject: AutoDim decompiled --- src/KingSystem/System/AutoDim.cpp | 22 ++++++++++++++++++++++ src/KingSystem/System/AutoDim.h | 19 +++++++++++++++++++ src/KingSystem/System/CMakeLists.txt | 2 ++ 3 files changed, 43 insertions(+) create mode 100644 src/KingSystem/System/AutoDim.cpp create mode 100644 src/KingSystem/System/AutoDim.h (limited to 'src/KingSystem/System') diff --git a/src/KingSystem/System/AutoDim.cpp b/src/KingSystem/System/AutoDim.cpp new file mode 100644 index 00000000..c222f790 --- /dev/null +++ b/src/KingSystem/System/AutoDim.cpp @@ -0,0 +1,22 @@ +#include "KingSystem/System/AutoDim.h" +#include +#include + +namespace ksys { + +SEAD_SINGLETON_DISPOSER_IMPL(AutoDim) + +void AutoDim::setEnabled(bool enable) { + const auto lock = sead::makeScopedLock(mCS); + mEnabled = enable; + if (enable) + nn::oe::SetUserInactivityDetectionTimeExtended(false); + else + nn::oe::SetUserInactivityDetectionTimeExtended(true); +} + +bool AutoDim::isEnabled() const { + return mEnabled; +} + +} // namespace ksys diff --git a/src/KingSystem/System/AutoDim.h b/src/KingSystem/System/AutoDim.h new file mode 100644 index 00000000..b893da53 --- /dev/null +++ b/src/KingSystem/System/AutoDim.h @@ -0,0 +1,19 @@ +#include +#include + +namespace ksys { + +class AutoDim { + SEAD_SINGLETON_DISPOSER(AutoDim) + AutoDim() = default; + +public: + void setEnabled(bool enable); + bool isEnabled() const; + +private: + bool mEnabled = true; + sead::CriticalSection mCS{}; +}; + +} // namespace ksys diff --git a/src/KingSystem/System/CMakeLists.txt b/src/KingSystem/System/CMakeLists.txt index d59a029b..6bc04a57 100644 --- a/src/KingSystem/System/CMakeLists.txt +++ b/src/KingSystem/System/CMakeLists.txt @@ -1,6 +1,8 @@ target_sources(uking PRIVATE Account.cpp Account.h + AutoDim.cpp + AutoDim.h BasicProfiler.cpp BasicProfiler.h CameraEditor.cpp -- cgit v1.2.3