diff --git a/data/uking_functions.csv b/data/uking_functions.csv index 374ed3bc..8232917e 100644 --- a/data/uking_functions.csv +++ b/data/uking_functions.csv @@ -88649,11 +88649,11 @@ 0x00000071010b6558,sub_71010B6558,24, 0x00000071010b6570,sub_71010B6570,200, 0x00000071010b6638,sub_71010B6638,376, -0x00000071010b67b0,sub_71010B67B0,96, -0x00000071010b6810,sub_71010B6810,104, -0x00000071010b6878,AutoDim::createInstance,136, -0x00000071010b6900,AutoDim::__auto1,84, -0x00000071010b6954,AutoDim::__auto0,8, +0x00000071010b67b0,sub_71010B67B0,96,_ZN4ksys7AutoDim18SingletonDisposer_D1Ev +0x00000071010b6810,sub_71010B6810,104,_ZN4ksys7AutoDim18SingletonDisposer_D0Ev +0x00000071010b6878,AutoDim::createInstance,136,_ZN4ksys7AutoDim14createInstanceEPN4sead4HeapE +0x00000071010b6900,AutoDim::__auto1,84,_ZN4ksys7AutoDim10setEnabledEb +0x00000071010b6954,AutoDim::__auto0,8,_ZNK4ksys7AutoDim9isEnabledEv 0x00000071010b695c,sub_71010B695C,384, 0x00000071010b6adc,sub_71010B6ADC,68, 0x00000071010b6b20,sub_71010B6B20,64, 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