summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortheo3 <arisstephenson2@gmail.com>2021-06-24 23:50:52 -0700
committertheo3 <arisstephenson2@gmail.com>2021-06-25 20:29:11 -0700
commitd12508cfce49ca4bf620c688aea7f14f1e161ca7 (patch)
tree252ad40be49298c67c5c1e2ba970d3191a7a3e09 /src
parent24cc84add75663b733efa704e3d20e3f31b462a0 (diff)
AutoDim decompiled
Diffstat (limited to 'src')
-rw-r--r--src/KingSystem/System/AutoDim.cpp22
-rw-r--r--src/KingSystem/System/AutoDim.h19
-rw-r--r--src/KingSystem/System/CMakeLists.txt2
3 files changed, 43 insertions, 0 deletions
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 <nn/oe.h>
+#include <prim/seadScopedLock.h>
+
+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 <heap/seadDisposer.h>
+#include <thread/seadCriticalSection.h>
+
+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