Add CScannableObjectInfo (this thing is a confusing mess)

This commit is contained in:
Phillip Stephens 2022-10-22 20:02:37 -07:00
parent dc4e515746
commit 8fad208125
8 changed files with 68 additions and 8 deletions

View File

@ -1747,7 +1747,7 @@ lbl_8007206C:
/* 80072088 0006EFE8 3B 3F 00 F4 */ addi r25, r31, 0xf4 /* 80072088 0006EFE8 3B 3F 00 F4 */ addi r25, r31, 0xf4
lbl_8007208C: lbl_8007208C:
/* 8007208C 0006EFEC 7F 43 D3 78 */ mr r3, r26 /* 8007208C 0006EFEC 7F 43 D3 78 */ mr r3, r26
/* 80072090 0006EFF0 48 0F 7E E1 */ bl GetImagePaneName__16CPauseScreenBaseFUi /* 80072090 0006EFF0 48 0F 7E E1 */ bl GetImagePaneName__20CScannableObjectInfoFUi
/* 80072094 0006EFF4 7C 64 1B 78 */ mr r4, r3 /* 80072094 0006EFF4 7C 64 1B 78 */ mr r4, r3
/* 80072098 0006EFF8 80 7F 00 08 */ lwz r3, 8(r31) /* 80072098 0006EFF8 80 7F 00 08 */ lwz r3, 8(r31)
/* 8007209C 0006EFFC 48 25 00 B9 */ bl FindWidget__9CGuiFrameCFPCc /* 8007209C 0006EFFC 48 25 00 B9 */ bl FindWidget__9CGuiFrameCFPCc

View File

@ -476,8 +476,8 @@ lbl_80169F44:
/* 80169F68 00166EC8 38 21 00 10 */ addi r1, r1, 0x10 /* 80169F68 00166EC8 38 21 00 10 */ addi r1, r1, 0x10
/* 80169F6C 00166ECC 4E 80 00 20 */ blr /* 80169F6C 00166ECC 4E 80 00 20 */ blr
.global GetImagePaneName__16CPauseScreenBaseFUi .global GetImagePaneName__20CScannableObjectInfoFUi
GetImagePaneName__16CPauseScreenBaseFUi: GetImagePaneName__20CScannableObjectInfoFUi:
/* 80169F70 00166ED0 94 21 FF F0 */ stwu r1, -0x10(r1) /* 80169F70 00166ED0 94 21 FF F0 */ stwu r1, -0x10(r1)
/* 80169F74 00166ED4 7C 08 02 A6 */ mflr r0 /* 80169F74 00166ED4 7C 08 02 A6 */ mflr r0
/* 80169F78 00166ED8 3C 80 80 3D */ lis r4, lbl_803D0440@ha /* 80169F78 00166ED8 3C 80 80 3D */ lis r4, lbl_803D0440@ha
@ -669,4 +669,3 @@ lbl_803D04C7:
.asciz "??(??)" .asciz "??(??)"
.byte 0x25 .byte 0x25
.4byte 0x73257300 .4byte 0x73257300

View File

@ -1719,7 +1719,7 @@ StartScan__12CScanDisplayF9TUniqueIdRC20CScannableObjectInfoP12CGuiTextPaneP10CG
/* 801741C0 00171120 3B FE 01 74 */ addi r31, r30, 0x174 /* 801741C0 00171120 3B FE 01 74 */ addi r31, r30, 0x174
lbl_801741C4: lbl_801741C4:
/* 801741C4 00171124 7F 83 E3 78 */ mr r3, r28 /* 801741C4 00171124 7F 83 E3 78 */ mr r3, r28
/* 801741C8 00171128 4B FF 5D A9 */ bl GetImagePaneName__16CPauseScreenBaseFUi /* 801741C8 00171128 4B FF 5D A9 */ bl GetImagePaneName__20CScannableObjectInfoFUi
/* 801741CC 0017112C 7C 64 1B 78 */ mr r4, r3 /* 801741CC 0017112C 7C 64 1B 78 */ mr r4, r3
/* 801741D0 00171130 38 61 00 3C */ addi r3, r1, 0x3c /* 801741D0 00171130 38 61 00 3C */ addi r3, r1, 0x3c
/* 801741D4 00171134 38 C1 00 0C */ addi r6, r1, 0xc /* 801741D4 00171134 38 C1 00 0C */ addi r6, r1, 0xc

View File

@ -230,7 +230,7 @@ LIBS = [
["MetroidPrime/ScriptObjects/CScriptPointOfInterest", True], ["MetroidPrime/ScriptObjects/CScriptPointOfInterest", True],
"MetroidPrime/Enemies/CDrone", "MetroidPrime/Enemies/CDrone",
"MetroidPrime/CMapWorldInfo", "MetroidPrime/CMapWorldInfo",
"MetroidPrime/Factories/CScannableObjectInfo", ["MetroidPrime/Factories/CScannableObjectInfo", False],
"MetroidPrime/Enemies/CMetroid", "MetroidPrime/Enemies/CMetroid",
"MetroidPrime/Player/CScanDisplay", "MetroidPrime/Player/CScanDisplay",
["MetroidPrime/ScriptObjects/CScriptSteam", False], ["MetroidPrime/ScriptObjects/CScriptSteam", False],

View File

@ -40,6 +40,8 @@ public:
// why? // why?
int ReadInt32() { return static_cast< uint >(Get(TType< int >())); } int ReadInt32() { return static_cast< uint >(Get(TType< int >())); }
uint GetBlockOffset() const { return x4_blockOffset; }
private: private:
bool GrabAnotherBlock(); bool GrabAnotherBlock();
bool InternalReadNext(); bool InternalReadNext();

View File

@ -0,0 +1,35 @@
#ifndef _CSCANNABLEOBJECTINFO
#define _CSCANNABLEOBJECTINFO
#include "types.h"
#include "Kyoto/Math/CVector2i.hpp"
#include "Kyoto/SObjectTag.hpp"
#include "rstl/reserved_vector.hpp"
#include "rstl/string.hpp"
class CInputStream;
class CScannableObjectInfo {
public:
static const char* GetImagePaneName(uint pane);
CScannableObjectInfo(CInputStream& in, uint version);
private:
struct SBucket {
CAssetId x0_texture;
float x4_appearanceRange;
uint x8_imagePos;
CVector2i xc_size;
float x14_interval;
float x18_fadeDuration;
};
CAssetId x0_scannableObjectId;
CAssetId x4_stringId;
float x8_totalDownloadTime;
uint xc_category;
bool x10_important;
rstl::reserved_vector< SBucket, 4 > x14_buckets;
};
#endif // _CSCANNABLEOBJECTINFO

View File

@ -0,0 +1,24 @@
#include "MetroidPrime/Factories/CScannableObjectInfo.hpp"
#include "Kyoto/CFactoryMgr.hpp"
#include "Kyoto/Basics/CBasics.hpp"
#include "Kyoto/Streams/CInputStream.hpp"
const char* PaneSufixes[] = {"0", "1", "2", "3", "01", "12", "23", "012", "123", "0123",
"4", "5", "6", "7", "45", "56", "67", "456", "567", "4567"};
const char* CScannableObjectInfo::GetImagePaneName(uint pane) {
return CBasics::Stringize("%s%s", "image_pane", PaneSufixes[pane]);
}
CScannableObjectInfo::CScannableObjectInfo(CInputStream& in, uint version) {}
template <>
inline CFactoryFnReturn::CFactoryFnReturn(CScannableObjectInfo* ptr)
: obj(TToken< CScannableObjectInfo >::GetIObjObjectFor(rstl::auto_ptr< CScannableObjectInfo >(ptr))
.release()) {}
CFactoryFnReturn FScannableObjectInfoFactory(const SObjectTag& tag, CInputStream& in,
const CVParamTransfer& xfer) {
return new CScannableObjectInfo(in, in.GetBlockOffset());
}

View File

@ -2,7 +2,7 @@
#include "Kyoto/Streams/CInputStream.hpp" #include "Kyoto/Streams/CInputStream.hpp"
CHUDMemoParms::CHUDMemoParms(CInputStream& in) CHUDMemoParms::CHUDMemoParms(CInputStream& in)
: mDispTime(in.Get(TType< float >())) : mDispTime(in.Get< float >())
, mClearMemoWindow(in.ReadBool()) , mClearMemoWindow(in.Get< bool >())
, mFadeOutOnly(false) , mFadeOutOnly(false)
, mHintMemo(false) {} , mHintMemo(false) {}