SMG-Decomp
A decompilation of Super Mario Galaxy 1
Loading...
Searching...
No Matches
CaptureScreenDirector.cpp
1#include "Game/Screen/CaptureScreenDirector.hpp"
2#include "Game/Util/MemoryUtil.hpp"
3#include "Game/Util/ObjUtil.hpp"
4#include "Game/Util/ScreenUtil.hpp"
5#include "JSystem/JUtility/JUTVideo.hpp"
6#include <cstring>
7
8CaptureScreenDirector::CaptureScreenDirector() : NameObj("画面キャプチャ") {
9 _C = nullptr;
10 mTimingType = "Indirect";
11 mTexture = nullptr;
12 _18 = 0;
13 MR::CurrentHeapRestorer heap_restorer((JKRHeap*)MR::getStationedHeapGDDR3());
14 mTexture = new JUTTexture(JUTVideo::sManager->mRenderModeObj->fbWidth, JUTVideo::sManager->mRenderModeObj->efbHeight, GX_TF_RGB565);
15}
16
17void CaptureScreenDirector::captureIfAllow(const char *pName) {
18 const TimingInfo* info = findFromName(pName);
19 if (getUsingTiming() == info && (!getUsingTiming()->_C || _18)) {
20 capture();
21 _18 = 0;
22 }
23}
24
25void CaptureScreenDirector::capture() {
26 _GXRenderModeObj* renderObj = JUTVideo::sManager->mRenderModeObj;
27 GXSetCopyFilter(GX_FALSE, renderObj->sample_pattern, GX_FALSE, renderObj->vfilter);
28 mTexture->capture(0, 0, GX_TF_RGB565, false, 0);
29 GXSetCopyFilter(GX_FALSE, renderObj->sample_pattern, GX_TRUE, renderObj->vfilter);
30}
31
32void CaptureScreenDirector::requestCaptureTiming(const char *pName) {
33 const TimingInfo* info = findFromName(pName);
34 if (!getCurrentTiming() || getCurrentTiming()->timing < info->timing) {
35 _C = pName;
36 _18 = 1;
37 }
38}
39
40void CaptureScreenDirector::invalidateCaptureTiming(const char *pName) {
41 const TimingInfo* info = getCurrentTiming();
42 if (info) {
43 if (strcmp(info->name, pName) == 0) {
44 _C = 0;
45 }
46 }
47}
48
49ResTIMG* CaptureScreenDirector::getResTIMG() const {
50 return mTexture->_20;
51}
52
53ResTIMG* CaptureScreenDirector::getTexImage() const {
54 return mTexture->_24;
55}
56
57const TimingInfo* CaptureScreenDirector::getUsingTiming() const {
58 if (_C) {
59 return findFromName(_C);
60 }
61
62 return findFromName(mTimingType);
63}
64
65const TimingInfo* CaptureScreenDirector::getCurrentTiming() const {
66 if (_C) {
67 return findFromName(_C);
68 }
69
70 return nullptr;
71}
72
73const TimingInfo* CaptureScreenDirector::findFromName(const char *pName) const {
74 for (u32 i = 0; i < 6; i++) {
75 if (strcmp(cTimingInfo[i].name, pName) == 0) {
76 return &cTimingInfo[i];
77 }
78 }
79
80 return nullptr;
81}
82
83CaptureScreenActor::CaptureScreenActor(u32 scene_arg, const char *pCameraName) : NameObj("画面キャプチャ") {
84 mCameraName = pCameraName;
85 MR::connectToScene(this, -1, -1, -1, scene_arg);
86}
87
89 MR::captureScreenIfAllow(mCameraName);
90}
91
92CaptureScreenDirector::~CaptureScreenDirector() {
93
94}
95
96CaptureScreenActor::~CaptureScreenActor() {
97
98}
virtual void draw() const
Draws the object. Does nothing until overridden.
The most basic form of an object.
Definition NameObj.hpp:11