summaryrefslogtreecommitdiff
path: root/src/KingSystem/System
diff options
context:
space:
mode:
authorecumber <ecumber05@gmail.com>2022-07-13 11:53:28 -0700
committerecumber <ecumber05@gmail.com>2022-07-24 22:03:55 -0700
commit3034895d2f5a02e7456c19442f0c8078d4df11ab (patch)
treecc61d4a07c2684328c85956fecfde71e680ab90d /src/KingSystem/System
parent9d3bc8cfe1c4ddd74c3b072bbe6418665aa06de1 (diff)
VideoRecorder added
Diffstat (limited to 'src/KingSystem/System')
-rw-r--r--src/KingSystem/System/CMakeLists.txt2
-rw-r--r--src/KingSystem/System/VideoRecorder.cpp18
-rw-r--r--src/KingSystem/System/VideoRecorder.h31
3 files changed, 51 insertions, 0 deletions
diff --git a/src/KingSystem/System/CMakeLists.txt b/src/KingSystem/System/CMakeLists.txt
index bfc41efe..5bf0cbc4 100644
--- a/src/KingSystem/System/CMakeLists.txt
+++ b/src/KingSystem/System/CMakeLists.txt
@@ -54,6 +54,8 @@ target_sources(uking PRIVATE
Timer.h
UIGlue.cpp
UIGlue.h
+ VideoRecorder.cpp
+ VideoRecorder.h
VFR.cpp
VFR.h
VFRValue.cpp
diff --git a/src/KingSystem/System/VideoRecorder.cpp b/src/KingSystem/System/VideoRecorder.cpp
new file mode 100644
index 00000000..53430f92
--- /dev/null
+++ b/src/KingSystem/System/VideoRecorder.cpp
@@ -0,0 +1,18 @@
+#include "KingSystem/System/VideoRecorder.h"
+
+namespace ksys {
+
+SEAD_SINGLETON_DISPOSER_IMPL(VideoRecorder)
+
+void VideoRecorder::postCalc() {
+ if (!isCaptureEnabled())
+ return;
+ u32 framenum = mFrameNumber;
+ sead::FixedSafeString<0x100> output;
+ output.format("%s/%04d.tga", mFilename.cstr(), framenum);
+ agl::utl::ScreenShotMgr::instance()->reserveCaptureWithDebugHeap(
+ true, agl::TextureDataSerializerTGA::TGAFormat::_1, output, false);
+ mFrameNumber++;
+}
+
+} // namespace ksys \ No newline at end of file
diff --git a/src/KingSystem/System/VideoRecorder.h b/src/KingSystem/System/VideoRecorder.h
new file mode 100644
index 00000000..79ab300f
--- /dev/null
+++ b/src/KingSystem/System/VideoRecorder.h
@@ -0,0 +1,31 @@
+#pragma once
+
+#include <agl/utl/aglScreenShotMgr.h>
+#include <basis/seadNew.h>
+#include <heap/seadDisposer.h>
+#include <prim/seadSafeString.h>
+#include "KingSystem/Utils/Types.h"
+
+namespace ksys {
+
+class VideoRecorder {
+ SEAD_SINGLETON_DISPOSER(VideoRecorder)
+ VideoRecorder() = default;
+ virtual ~VideoRecorder();
+
+public:
+ void postCalc();
+ bool isCaptureEnabled() const { return mCaptureEnabled; }
+ u32 getFrameNumber() const { return mFrameNumber; }
+ const sead::SafeString& getFileName() const { return mFilename; }
+
+private:
+ bool mCaptureEnabled = false;
+ bool _29 = true;
+ u32 mFrameNumber = 0;
+ sead::FixedSafeString<0x100> mFilename;
+};
+
+KSYS_CHECK_SIZE_NX150(VideoRecorder, 0x148);
+
+} // namespace ksys \ No newline at end of file