diff --git a/config/SOUE01/symbols.txt b/config/SOUE01/symbols.txt index 9d2d1bfd..09c67879 100644 --- a/config/SOUE01/symbols.txt +++ b/config/SOUE01/symbols.txt @@ -7494,7 +7494,7 @@ fn_8012D6D0__16dLytMapCapture_cFP7mVec3_c = .text:0x8012D6D0; // type:function s fn_8012D6F0__16dLytMapCapture_cFv = .text:0x8012D6F0; // type:function size:0xE4 execute__16dLytMapCapture_cFv = .text:0x8012D7E0; // type:function size:0x10 isBusyRendering__16dLytMapCapture_cCFv = .text:0x8012D7F0; // type:function size:0x8 -fn_8012D800__16dLytMapCapture_cFPQ34nw4r3lyt4PanePC9_GXTexObj = .text:0x8012D800; // type:function size:0xEC +fn_8012D800__16dLytMapCapture_cFPQ34nw4r3lyt4PaneP9_GXTexObj = .text:0x8012D800; // type:function size:0xEC finalizeState__31sFStateID_c<16dLytMapCapture_c>CFR16dLytMapCapture_c = .text:0x8012D8F0; // type:function size:0x30 executeState__31sFStateID_c<16dLytMapCapture_c>CFR16dLytMapCapture_c = .text:0x8012D920; // type:function size:0x30 initializeState__31sFStateID_c<16dLytMapCapture_c>CFR16dLytMapCapture_c = .text:0x8012D950; // type:function size:0x30 @@ -11000,14 +11000,14 @@ fn_801B4B60 = .text:0x801B4B60; // type:function size:0xC fn_801B4B70 = .text:0x801B4B70; // type:function size:0xC fn_801B4B80 = .text:0x801B4B80; // type:function size:0xE8 fn_801B4C70 = .text:0x801B4C70; // type:function size:0x1C -fn_801B4C90 = .text:0x801B4C90; // type:function size:0x1C -fn_801B4CB0 = .text:0x801B4CB0; // type:function size:0x1C +fn_801B4C90__10MapRelatedCFv = .text:0x801B4C90; // type:function size:0x1C +fn_801B4CB0__10MapRelatedCFv = .text:0x801B4CB0; // type:function size:0x1C fn_801B4CD0 = .text:0x801B4CD0; // type:function size:0x78 fn_801B4D50 = .text:0x801B4D50; // type:function size:0x1BC fn_801B4F10__10MapRelatedCFlRC7mVec3_c = .text:0x801B4F10; // type:function size:0x1AC -fn_801B50C0 = .text:0x801B50C0; // type:function size:0xB8 +fn_801B50C0__10MapRelatedFl = .text:0x801B50C0; // type:function size:0xB8 fn_801B5180 = .text:0x801B5180; // type:function size:0x7F0 -fn_801B5970 = .text:0x801B5970; // type:function size:0x38 +fn_801B5970__10MapRelatedCFP9_GXTexObj = .text:0x801B5970; // type:function size:0x38 fn_801B59B0 = .text:0x801B59B0; // type:function size:0x58 fn_801B5A10 = .text:0x801B5A10; // type:function size:0x58 __dt__8dStage_cFv = .text:0x801B5A70; // type:function size:0x94 diff --git a/configure.py b/configure.py index cebe17da..dc9fe3b3 100644 --- a/configure.py +++ b/configure.py @@ -561,7 +561,7 @@ config.libs = [ Object(Matching, "d/lyt/d_lyt_auto_caption.cpp"), Object(Matching, "d/lyt/d_lyt_auto_explain.cpp"), Object(Matching, "d/lyt/d_lyt_map_global.cpp"), - Object(NonMatching, "d/lyt/d_lyt_map_capture.cpp"), + Object(Matching, "d/lyt/d_lyt_map_capture.cpp"), Object(NonMatching, "d/lyt/d_lyt_map.cpp"), Object(Matching, "d/lyt/d_lyt_note.cpp"), Object(Matching, "d/lyt/d_lyt_battery.cpp"), diff --git a/include/d/d_stage.h b/include/d/d_stage.h index 60c79aa5..1c238c2f 100644 --- a/include/d/d_stage.h +++ b/include/d/d_stage.h @@ -42,12 +42,10 @@ class MapRelated { bool c; }; - - public: MapRelated(); ~MapRelated(); - int fn_801B5970(const GXTexObj*); + bool fn_801B5970(GXTexObj *) const; /* 0x000 */ mHeapAllocator_c mAllocator; /* 0x01C */ Child mChildren[8]; /* 0x0FC */ mVec3_c field_0x0FC; @@ -57,7 +55,7 @@ public: /* 0x12C */ f32 field_0x12C; /* 0x130 */ EGG::ScreenEffectBlur mScreenEffect; /* 0x168 */ EGG::PostEffectBlur mPostEffect; - /* 0x1E0 */ u32 field_0x1E0; + /* 0x1E0 */ EGG::CpuTexture *mpCpuTexture; /* 0x1E4 */ u16 field_0x1E4; /* 0x1E6 */ u16 field_0x1E6; /* 0x1E8 */ u8 field_0x1E8; @@ -65,7 +63,7 @@ public: /* 0x1EA */ s8 field_0x1EA; /* 0x1EB */ u8 field_0x1EB; /* 0x1EC */ s8 field_0x1EC; - /* 0x1ED */ u8 field_0x1ED; + /* 0x1ED */ s8 field_0x1ED; /* 0x1EE */ u8 field_0x1EE; /* 0x1EF */ u8 field_0x1EF; /* 0x1F0 */ u8 field_0x1F0; @@ -87,11 +85,15 @@ public: field_0x1EF = v; } + Child *getChildForFloor(s32 floor) { + return &mChildren[floor + 3]; + } + void init(MapRelated *); void fn_801b4900(); void fn_801B4B80(u32 mapParams, const mVec3_c ¢er, const mVec3_c &size); void fn_801B4C70(const mVec3_c &); - void fn_801B50C0(s32); + bool fn_801B50C0(s32); const mVec3_c &fn_801B4C90() const; const mVec3_c &fn_801B4CB0() const; s32 fn_801B4F10(s32 roomid, const mVec3_c &position) const; diff --git a/include/d/lyt/d_lyt_map_capture.h b/include/d/lyt/d_lyt_map_capture.h index 4dec80a2..b227270c 100644 --- a/include/d/lyt/d_lyt_map_capture.h +++ b/include/d/lyt/d_lyt_map_capture.h @@ -2,14 +2,14 @@ #define D_LYT_MAP_CAPTURE_H #include "common.h" +#include "m/m_vec.h" #include "nw4r/lyt/lyt_picture.h" #include "s/s_State.hpp" #include "s/s_StateID.hpp" -#include "m/m_vec.h" class dLytMapCapture_c { public: - dLytMapCapture_c() :mStateMgr(*this), mpPicture(nullptr) { + dLytMapCapture_c() : mStateMgr(*this), mpPicture(nullptr) { mRenderRequest = false; mIsBusyRendering = false; field_0x06C = 0.0f; @@ -25,11 +25,11 @@ public: void renderRequest() { mRenderRequest = true; } - + void setPicture(nw4r::lyt::Picture *pic) { mpPicture = pic; } - + void execute(); bool isBusyRendering() const; void fn_8012D610(mVec3_c *out); @@ -38,7 +38,7 @@ public: private: void fn_8012D6F0(); - void fn_8012D800(nw4r::lyt::Pane *pane, const GXTexObj *texObj); + void fn_8012D800(nw4r::lyt::Pane *pane, GXTexObj *texObj); /* 0x004 */ UI_STATE_MGR_DECLARE(dLytMapCapture_c); /* 0x040 */ nw4r::lyt::Picture *mpPicture; diff --git a/src/d/d_stage.cpp b/src/d/d_stage.cpp index 0e3a74b9..57089d1a 100644 --- a/src/d/d_stage.cpp +++ b/src/d/d_stage.cpp @@ -14,6 +14,7 @@ #include "d/flag/sceneflag_manager.h" #include "d/flag/storyflag_manager.h" #include "d/snd/d_snd_source_mgr.h" +#include "egg/gfx/eggCpuTexture.h" #include "f/f_base.h" #include "f/f_profile.h" #include "f/f_profile_name.h" @@ -23,6 +24,7 @@ #include "nw4r/g3d/res/g3d_resmat.h" #include "nw4r/g3d/res/g3d_resmdl.h" #include "nw4r/math/math_types.h" +#include "rvl/GX/GXTexture.h" #include "s/s_FPhase.h" #include "toBeSorted/arc_managers/current_stage_arc_manager.h" #include "toBeSorted/arc_managers/layout_arc_manager.h" @@ -364,7 +366,7 @@ MapRelated::MapRelated() field_0x114(0.0f, 0.0f, 0.0f), field_0x120(0.0f, 0.0f, 0.0f), field_0x12C(0.0f), - field_0x1E0(0), + mpCpuTexture(NULL), field_0x1E6(0), field_0x1E8(0), field_0x1E9(4), @@ -394,3 +396,50 @@ extern "C" void fn_801B4AE0(); MapRelated::~MapRelated() { fn_801B4AE0(); } + +const mVec3_c &MapRelated::fn_801B4C90() const { + return mChildren[3 + field_0x1ED].a; +} + +const mVec3_c &MapRelated::fn_801B4CB0() const { + return mChildren[3 + field_0x1ED].b; +} + +extern "C" u32 lbl_805732F0; + +bool MapRelated::fn_801B50C0(s32 s) { + if (s < 0) { + if (s < -3) { + return false; + } + } else { + if (s > 4) { + return false; + } + } + + if (!getChildForFloor(s)->c) { + return false; + } + + field_0x1ED = s; + + if (getChildForFloor(field_0x1ED)->c) { + field_0x108 = getChildForFloor(field_0x1ED)->a; + field_0x114 = getChildForFloor(field_0x1ED)->b; + field_0x120 = field_0x108; + + field_0x1E6 = lbl_805732F0; + } + + return true; +} + +bool MapRelated::fn_801B5970(GXTexObj *tex) const { + if (mpCpuTexture == NULL) { + return false; + } + + mpCpuTexture->getTexObj(tex); + return true; +} diff --git a/src/d/lyt/d_lyt_map_capture.cpp b/src/d/lyt/d_lyt_map_capture.cpp index 20936865..657e40bd 100644 --- a/src/d/lyt/d_lyt_map_capture.cpp +++ b/src/d/lyt/d_lyt_map_capture.cpp @@ -1,4 +1,5 @@ #include "d/lyt/d_lyt_map_capture.h" + #include "common.h" #include "d/d_stage.h" #include "d/lyt/d_lyt_map_global.h" @@ -19,7 +20,8 @@ void dLytMapCapture_c::finalizeState_RenderingWait() {} void dLytMapCapture_c::initializeState_RenderingWaitStep2() {} void dLytMapCapture_c::executeState_RenderingWaitStep2() { - if (mIsBusyRendering && dStage_c::GetInstance() != nullptr && !dStage_c::GetInstance()->getMapRelated()->getField_0x1EE()) { + if (mIsBusyRendering && dStage_c::GetInstance() != nullptr && + !dStage_c::GetInstance()->getMapRelated()->getField_0x1EE()) { mIsBusyRendering = false; if (mRenderRequest) { fn_8012D6F0(); @@ -32,45 +34,25 @@ void dLytMapCapture_c::executeState_RenderingWaitStep2() { } void dLytMapCapture_c::finalizeState_RenderingWaitStep2() {} -bool dLytMapCapture_c::isBusyRendering() const{ - return mIsBusyRendering; +void dLytMapCapture_c::fn_8012D610(mVec3_c *out) { + dStage_c::GetInstance()->getMapRelated()->fn_801B50C0(0); + *out = dStage_c::GetInstance()->getMapRelated()->fn_801B4CB0(); } -void dLytMapCapture_c::execute() { - mStateMgr.executeState(); +void dLytMapCapture_c::fn_8012D670(mVec3_c *out) { + dStage_c::GetInstance()->getMapRelated()->fn_801B50C0(0); + *out = dStage_c::GetInstance()->getMapRelated()->fn_801B4C90(); } void dLytMapCapture_c::fn_8012D6D0(mVec3_c *out) { *out = dStage_c::GetInstance()->getMapRelated()->field_0x0FC; } -void dLytMapCapture_c::fn_8012D610(mVec3_c *out){ - dStage_c::GetInstance()->getMapRelated()->fn_801B50C0(0); - *out = dStage_c::GetInstance()->getMapRelated()->fn_801B4CB0(); -} +void dLytMapCapture_c::fn_8012D6F0() { + dStage_c *pStage = dStage_c::GetInstance(); -void dLytMapCapture_c::fn_8012D670(mVec3_c *out){ - dStage_c::GetInstance()->getMapRelated()->fn_801B50C0(0); - *out = dStage_c::GetInstance()->getMapRelated()->fn_801B4C90(); -} - - -void dLytMapCapture_c::fn_8012D800(nw4r::lyt::Pane *param_2, const GXTexObj *param_3) { - if (param_3 != nullptr && dStage_c::GetInstance() != nullptr && dStage_c::GetInstance()->getMapRelated()->fn_801B5970(param_3)) { - field_0x070.width = GXGetTexObjWidth(param_3); - field_0x070.height = GXGetTexObjHeight(param_3); - param_2->SetSize(field_0x070); - param_2->GetMaterial()->GetTexMapAry()->ReplaceImage(*param_3); - } -} - - -void dLytMapCapture_c::fn_8012D6F0(){ - - dStage_c * pStage = dStage_c::GetInstance(); - if (pStage != nullptr) { - dLytMapGlobal_c* pLytMap = dLytMapGlobal_c::GetInstance(); + dLytMapGlobal_c *pLytMap = dLytMapGlobal_c::GetInstance(); f32 zoom = pLytMap->getZoomFrame(); f32 inv = 1.0f / pLytMap->getField_0x44(); @@ -79,16 +61,33 @@ void dLytMapCapture_c::fn_8012D6F0(){ mVec3_c v(field_0x064 * inv, 1, field_0x06C * inv); pStage->getMapRelated()->fn_801B50C0(floor); - + pStage->getMapRelated()->field_0x108 = pLytMap->getMapScroll(); pStage->getMapRelated()->field_0x114 = v; - - pStage->getMapRelated()->field_0x120 = pLytMap->getMapRotationCenter(); - - + + pStage->getMapRelated()->field_0x120 = pLytMap->getMapRotationCenter(); + pStage->getMapRelated()->field_0x1E6 = (u16)(-pLytMap->getMapRotation()); pStage->getMapRelated()->field_0x12C = zoom; pStage->getMapRelated()->field_0x1EE = 1; } return; -} +} + +void dLytMapCapture_c::execute() { + mStateMgr.executeState(); +} + +bool dLytMapCapture_c::isBusyRendering() const { + return mIsBusyRendering; +} + +void dLytMapCapture_c::fn_8012D800(nw4r::lyt::Pane *param_2, GXTexObj *param_3) { + if (param_3 != nullptr && dStage_c::GetInstance() != nullptr && + dStage_c::GetInstance()->getMapRelated()->fn_801B5970(param_3)) { + field_0x070.width = GXGetTexObjWidth(param_3); + field_0x070.height = GXGetTexObjHeight(param_3); + param_2->SetSize(field_0x070); + param_2->GetMaterial()->GetTexMapAry()->ReplaceImage(*param_3); + } +}