CScannableObjectInfo progress (#20)

This commit is contained in:
Phillip Stephens 2025-05-08 07:59:01 -07:00 committed by GitHub
parent 878388e87b
commit 311c0b112d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 147 additions and 52 deletions

View File

@ -7791,10 +7791,10 @@ fn_801697D4 = .text:0x801697D4; // type:function size:0x18
fn_801697EC = .text:0x801697EC; // type:function size:0xA4
fn_80169890 = .text:0x80169890; // type:function size:0x8C
FScannableObjectInfoFactory__FRC10SObjectTagR12CInputStreamRC15CVParamTransfer = .text:0x8016991C; // type:function size:0x154 scope:global
fn_80169A70 = .text:0x80169A70; // type:function size:0xEC
__dt__48TObjOwnerDerivedFromIObj<20CScannableObjectInfo>Fv = .text:0x80169A70; // type:function size:0xEC
GetIObjObjectFor__30TToken<20CScannableObjectInfo>FRCQ24rstl32auto_ptr<20CScannableObjectInfo> = .text:0x80169B5C; // type:function size:0x2C scope:global
fn_80169B88 = .text:0x80169B88; // type:function size:0x9C
LoadVersion4or5__20CScannableObjectInfoFR12CInputStreamUi = .text:0x80169C24; // type:function size:0x1B4 scope:global
GetNewDerivedObject__48TObjOwnerDerivedFromIObj<20CScannableObjectInfo>FRCQ24rstl32auto_ptr<20CScannableObjectInfo> = .text:0x80169B88; // type:function size:0x9C
Load__20CScannableObjectInfoFR12CInputStreamUi = .text:0x80169C24; // type:function size:0x1B4 scope:global
__ct__20CScannableObjectInfoFR12CInputStreamUi = .text:0x80169DD8; // type:function size:0x198 scope:global
GetImagePaneName__20CScannableObjectInfoFUi = .text:0x80169F70; // type:function size:0x48 scope:global
GetSearchPath__8CMetroidFv = .text:0x80169FB8; // type:function size:0x8 scope:global
@ -17186,7 +17186,7 @@ lbl_803D04B9 = .rodata:0x803D04B9; // type:object size:0x3 data:string
lbl_803D04BC = .rodata:0x803D04BC; // type:object size:0x3 data:string
lbl_803D04BF = .rodata:0x803D04BF; // type:object size:0x4 data:string
lbl_803D04C3 = .rodata:0x803D04C3; // type:object size:0x4 data:string
lbl_803D04C7 = .rodata:0x803D04C7; // type:object size:0x11
@stringBase0 = .rodata:0x803D04C7; // type:object size:0x11 scope:local data:string_table
lbl_803D04D8 = .rodata:0x803D04D8; // type:object size:0x44 data:4byte
lbl_803D051C = .rodata:0x803D051C; // type:object size:0x14
lbl_803D0530 = .rodata:0x803D0530; // type:object size:0x20 align:4 data:float
@ -18360,7 +18360,7 @@ lbl_803E36A8 = .data:0x803E36A8; // type:object size:0x2E0
jumptable_803E3988 = .data:0x803E3988; // type:object size:0x40 scope:local
jumptable_803E39C8 = .data:0x803E39C8; // type:object size:0x90 scope:local
lbl_803E3A58 = .data:0x803E3A58; // type:object size:0x70
lbl_803E3AC8 = .data:0x803E3AC8; // type:object size:0x10
__vt__48TObjOwnerDerivedFromIObj<20CScannableObjectInfo> = .data:0x803E3AC8; // type:object size:0x10
lbl_803E3AD8 = .data:0x803E3AD8; // type:object size:0x2D0
__vt__12CScriptSteam = .data:0x803E3DA8; // type:object size:0x7C scope:global
__vt__13CScriptRipple = .data:0x803E3E28; // type:object size:0x20 scope:global
@ -19258,7 +19258,7 @@ kEnvBlendCTandCConCF = .bss:0x804BFCC0; // type:object size:0x50 scope:local
sLoadedTextures = .bss:0x804BFD10; // type:object size:0x20 scope:local
XAxis = .bss:0x804BFD30; // type:object size:0xC scope:local align:4 data:float
YAxis = .bss:0x804BFD3C; // type:object size:0xC scope:local align:4 data:float
ZAxis = .bss:0x804BFD48; // type:object size:0x10 scope:local align:4 data:float
ZAxis = .bss:0x804BFD48; // type:object size:0xC scope:local align:4 data:float
@49 = .bss:0x804BFD58; // type:object size:0xC scope:local
gGameAllocator = .bss:0x804BFD64; // type:object size:0xC0 scope:local
mStaticParticleList = .bss:0x804BFE28; // type:object size:0x20 scope:local data:4byte

View File

@ -7791,10 +7791,10 @@ fn_801697D4 = .text:0x80169850; // type:function size:0x18 scope:global
fn_801697EC = .text:0x80169868; // type:function size:0xA4 scope:global
fn_80169890 = .text:0x8016990C; // type:function size:0x8C scope:global
FScannableObjectInfoFactory__FRC10SObjectTagR12CInputStreamRC15CVParamTransfer = .text:0x80169998; // type:function size:0x154 scope:global
fn_80169A70 = .text:0x80169AEC; // type:function size:0xEC scope:global
__dt__48TObjOwnerDerivedFromIObj<20CScannableObjectInfo>Fv = .text:0x80169AEC; // type:function size:0xEC scope:global
GetIObjObjectFor__30TToken<20CScannableObjectInfo>FRCQ24rstl32auto_ptr<20CScannableObjectInfo> = .text:0x80169BD8; // type:function size:0x2C scope:global
fn_80169B88 = .text:0x80169C04; // type:function size:0x9C scope:global
LoadVersion4or5__20CScannableObjectInfoFR12CInputStreamUi = .text:0x80169CA0; // type:function size:0x1B4 scope:global
GetNewDerivedObject__48TObjOwnerDerivedFromIObj<20CScannableObjectInfo>FRCQ24rstl32auto_ptr<20CScannableObjectInfo> = .text:0x80169C04; // type:function size:0x9C scope:global
Load__20CScannableObjectInfoFR12CInputStreamUi = .text:0x80169CA0; // type:function size:0x1B4 scope:global
__ct__20CScannableObjectInfoFR12CInputStreamUi = .text:0x80169E54; // type:function size:0x198 scope:global
GetImagePaneName__20CScannableObjectInfoFUi = .text:0x80169FEC; // type:function size:0x48 scope:global
GetSearchPath__8CMetroidFv = .text:0x8016A034; // type:function size:0x8 scope:global

View File

@ -18829,10 +18829,10 @@ lbl_803EF838 = .data:0x803EF838; // type:object size:0x10
lbl_803EF848 = .data:0x803EF848; // type:object size:0x10
lbl_803EF858 = .data:0x803EF858; // type:object size:0x10
lbl_803EF868 = .data:0x803EF868; // type:object size:0x10
lbl_803EF878 = .data:0x803EF878; // type:object size:0x10
lbl_803EF888 = .data:0x803EF888; // type:object size:0x10
lbl_803EF898 = .data:0x803EF898; // type:object size:0x20
lbl_803EF8B8 = .data:0x803EF8B8; // type:object size:0x78
__vt__16CEESimpleEmitter = .data:0x803EF878; // type:object size:0x10
__vt__52TObjOwnerDerivedFromIObj<Q212CMidiManager9CMidiData> = .data:0x803EF888; // type:object size:0x10
__vt__17CImageInstruction = .data:0x803EF898; // type:object size:0x20
__vt__17CParticleElectric = .data:0x803EF8B8; // type:object size:0x78
__vt__44TObjOwnerDerivedFromIObj<16CDependencyGroup> = .data:0x803EF930; // type:object size:0xC scope:weak
...data.0 = .data:0x803EF940; // type:label scope:local
power2 = .data:0x803EF940; // type:object size:0x1E scope:local
@ -19086,8 +19086,8 @@ D54 = .data:0x803F6E50; // type:object size:0x2D scope:local data:byte
D35 = .data:0x803F6E80; // type:object size:0x380 scope:local
@12 = .data:0x803F7200; // type:object size:0x9 scope:local data:string
@13 = .data:0x803F720C; // type:object size:0x1A scope:local data:string
sGraphicsFifo = .bss:0x803F7240; // type:object size:0x60000 align:32
sMainSpace = .bss:0x80457240; // type:object size:0x168
sGraphicsFifo = .bss:0x803F7240; // type:object size:0x60000 scope:local align:32
sMainSpace = .bss:0x80457240; // type:object size:0x168 scope:local
lbl_804573A8 = .bss:0x804573A8; // type:object size:0xD0
lbl_80457478 = .bss:0x80457478; // type:object size:0x160
lbl_804575D8 = .bss:0x804575D8; // type:object size:0x10
@ -19180,48 +19180,48 @@ lbl_8046DDB8 = .bss:0x8046DDB8; // type:object size:0x18 data:4byte
lbl_8046DDD0 = .bss:0x8046DDD0; // type:object size:0x100 data:4byte
lbl_8046DED0 = .bss:0x8046DED0; // type:object size:0x10
lbl_8046DEE0 = .bss:0x8046DEE0; // type:object size:0xC
lbl_8046DEEC = .bss:0x8046DEEC; // type:object size:0x68 data:4byte
lbl_8046DF54 = .bss:0x8046DF54; // type:object size:0x4808 data:4byte
lbl_8047275C = .bss:0x8047275C; // type:object size:0x64D0 data:4byte
lbl_80478C2C = .bss:0x80478C2C; // type:object size:0x208 data:4byte
lbl_80478E34 = .bss:0x80478E34; // type:object size:0x18 data:4byte
lbl_80478E4C = .bss:0x80478E4C; // type:object size:0xC align:4 data:float
lbl_80478E58 = .bss:0x80478E58; // type:object size:0x320
lbl_80479178 = .bss:0x80479178; // type:object size:0x48 align:4 data:float
sBucketIndex__7Buckets = .bss:0x8046DEEC; // type:object size:0x68 data:4byte
sDataHolder$4374 = .bss:0x8046DF54; // type:object size:0x4808 data:4byte
sBucketsHolder$4375 = .bss:0x8047275C; // type:object size:0x64D0 data:4byte
sPlaneObjectDataHolder$4376 = .bss:0x80478C2C; // type:object size:0x208 data:4byte
sPlaneObjectBucketHolder$4377 = .bss:0x80478E34; // type:object size:0x18 data:4byte
sOptimalPlane$6479 = .bss:0x80478E4C; // type:object size:0xC align:4 data:float
sAllocSpace$9000 = .bss:0x80478E58; // type:object size:0x31C
normalTable = .bss:0x80479178; // type:object size:0x48 scope:local align:4 data:float
lbl_804791C0 = .bss:0x804791C0; // type:object size:0x30
lbl_804791F0 = .bss:0x804791F0; // type:object size:0x48 align:4 data:float
lbl_80479238 = .bss:0x80479238; // type:object size:0x48 align:4 data:float
normalTable = .bss:0x804791F0; // type:object size:0x48 scope:local align:4 data:float
normalTable = .bss:0x80479238; // type:object size:0x48 scope:local align:4 data:float
stringize_Buffer$11 = .bss:0x80479280; // type:object size:0x200
rs_debugger_buffer = .bss:0x80479480; // type:object size:0x400
lbl_80479880 = .bss:0x80479880; // type:object size:0x30
lbl_804798B0 = .bss:0x804798B0; // type:object size:0xF0 data:4byte
lbl_804799A0 = .bss:0x804799A0; // type:object size:0x46000
lbl_804BF9A0 = .bss:0x804BF9A0; // type:object size:0x50
sVtxDescList = .bss:0x804798B0; // type:object size:0xF0 data:4byte
sSpareFrameBuffer = .bss:0x804799A0; // type:object size:0x46000 align:32
kEnvBlendCTandCConCF = .bss:0x804BF9A0; // type:object size:0x50
sLoadedTextures = .bss:0x804BF9F0; // type:object size:0x20
lbl_804BFA10 = .bss:0x804BFA10; // type:object size:0xC align:4 data:float
lbl_804BFA1C = .bss:0x804BFA1C; // type:object size:0xC align:4 data:float
lbl_804BFA28 = .bss:0x804BFA28; // type:object size:0x10 align:4 data:float
XAxis = .bss:0x804BFA10; // type:object size:0xC align:4 data:float
YAxis = .bss:0x804BFA1C; // type:object size:0xC align:4 data:float
ZAxis = .bss:0x804BFA28; // type:object size:0xC align:4 data:float
lbl_804BFA38 = .bss:0x804BFA38; // type:object size:0xC
gGameAllocator = .bss:0x804BFA44; // type:object size:0xC0
lbl_804BFB08 = .bss:0x804BFB08; // type:object size:0x20 data:4byte
lbl_804BFB28 = .bss:0x804BFB28; // type:object size:0x20 data:4byte
lbl_804BFB48 = .bss:0x804BFB48; // type:object size:0x4C
lbl_804BFB94 = .bss:0x804BFB94; // type:object size:0x4C
mStaticParticleList = .bss:0x804BFB08; // type:object size:0x20 data:4byte
mStaticFreeList = .bss:0x804BFB28; // type:object size:0x20 data:4byte
ModulatePreviousTEVWithRasColor$6239 = .bss:0x804BFB48; // type:object size:0x4C
ModulatePreviousTEVWithRasColor$6760 = .bss:0x804BFB94; // type:object size:0x4C
lbl_804BFBE0 = .bss:0x804BFBE0; // type:object size:0x10
lbl_804BFBF0 = .bss:0x804BFBF0; // type:object size:0xC
lbl_804BFBFC = .bss:0x804BFBFC; // type:object size:0x14
lbl_804BFC10 = .bss:0x804BFC10; // type:object size:0x10
lbl_804BFC20 = .bss:0x804BFC20; // type:object size:0x10
lbl_804BFC30 = .bss:0x804BFC30; // type:object size:0xC align:4 data:float
lbl_804BFC3C = .bss:0x804BFC3C; // type:object size:0x34 align:4 data:float
sPlayerPosition = .bss:0x804BFC30; // type:object size:0xC align:4 data:float
sTextureProjectionTransform = .bss:0x804BFC3C; // type:object size:0x34 align:4 data:float
lbl_804BFC70 = .bss:0x804BFC70; // type:object size:0x10
lbl_804BFC80 = .bss:0x804BFC80; // type:object size:0xC
lbl_804BFC8C = .bss:0x804BFC8C; // type:object size:0x14
sStaticSkinningData__8Skinning = .bss:0x804BFCA0; // type:object size:0x8000C align:32
sSkinningBuffer__8Skinning = .bss:0x8053FCAC; // type:object size:0x28 data:byte
sStaticSkinningData__8Skinning = .bss:0x804BFCA0; // type:object size:0x80000 align:32
sSkinningBuffer__8Skinning = .bss:0x8053FCAC; // type:object size:0x1C data:byte
sAllocations__8Skinning = .bss:0x8053FCD4; // type:object size:0x1C
lbl_8053FCF0 = .bss:0x8053FCF0; // type:object size:0x10
lbl_8053FD00 = .bss:0x8053FD00; // type:object size:0x500
lbl_8053FCF0 = .bss:0x8053FCF0; // type:object size:0xC
lbl_8053FD00 = .bss:0x8053FD00; // type:object size:0x500 align:32
lbl_80540200 = .bss:0x80540200; // type:object size:0x30
lbl_80540230 = .bss:0x80540230; // type:object size:0x30
lbl_80540260 = .bss:0x80540260; // type:object size:0x64

View File

@ -1,14 +1,21 @@
#ifndef _CVECTOR2I
#define _CVECTOR2I
#include "Kyoto/Streams/CInputStream.hpp"
#include "types.h"
class CVector2i {
public:
CVector2i(int x, int y);
CVector2i(int x = 0, int y = 0);
CVector2i(CInputStream& in) {
mX = in.ReadLong();
mY = in.ReadLong();
}
int GetX() const { return mX; }
void SetX(const int x) { mX = x; }
int GetY() const { return mY; }
void SetY(const int y) { mY = y; }
int& operator[](int idx) { return *(&mX + idx); }
const int& operator[](int idx) const { return *(&mX + idx); }

View File

@ -2,6 +2,7 @@
#define _CSPAWNSYSTEMKEYFRAMEDATA
class CSpawnSystemKeyframeData {
public:
~CSpawnSystemKeyframeData();
private:

View File

@ -15,19 +15,40 @@ class CInputStream;
class CScannableObjectInfo {
public:
static const char* GetImagePaneName(uint pane);
CScannableObjectInfo(CInputStream& in, uint version);
CScannableObjectInfo(CInputStream& in, CAssetId id);
CAssetId GetScannableObjectId() const { return x0_scannableObjectId; }
float GetTotalDownloadTime() const { return x8_totalDownloadTime; }
void Load(CInputStream& in, uint version);
private:
struct SBucket {
CAssetId x0_texture;
float x4_appearanceRange;
uint x8_imagePos;
int x8_imagePos;
CVector2i xc_size;
float x14_interval;
float x18_fadeDuration;
SBucket(CAssetId textureId, float appearanceRange, int imagePos, const CVector2i& size, float interval, float fadeDuration)
: x0_texture(textureId), x4_appearanceRange(appearanceRange), x8_imagePos(imagePos), xc_size(size), x14_interval(interval), x18_fadeDuration(fadeDuration) {}
SBucket(CInputStream& in, uint version)
: x0_texture(in.ReadLong())
, x4_appearanceRange(in.ReadFloat())
, x8_imagePos(in.ReadLong())
, xc_size(version == 1 ? CVector2i() : CVector2i(in))
, x14_interval(version == 1 ? 0.f : in.ReadFloat())
, x18_fadeDuration(version < 3 ? 0.f : in.ReadFloat()) {
}
CAssetId GetTextureId() const { return x0_texture; }
void SetTextureId(const CAssetId textureId) { x0_texture = textureId; }
float GetAppearanceRange() const { return x4_appearanceRange; }
void SetAppearanceRange(const float range) { x4_appearanceRange = range; }
int GetImagePosition() const { return x8_imagePos; }
void SetImagePosition(int position) { x8_imagePos = position; }
};
CAssetId x0_scannableObjectId;
CAssetId x4_stringId;

View File

@ -149,6 +149,9 @@ public:
float GetHudLightAttMulConstant() const { return x2b8_hudLightAttMulConstant; }
float GetHudLightAttMulLinear() const { return x2bc_hudLightAttMulLinear; }
float GetHudLightAttMulQuadratic() const { return x2c0_hudLightAttMulQuadratic; }
float GetScanSpeed(uint speed) const {
return x2c4_scanSpeeds[speed];
}
const rstl::string& GetCreditsTable() const { return x2d0_creditsTable; }
const rstl::string& GetCreditsFont() const { return x2e0_creditsFont; }
const rstl::string& GetJapaneseCreditsFont() const { return x2f0_japaneseCreditsFont; }

View File

@ -2,6 +2,7 @@
#define _RSTL_SINGLE_PTR
#include "types.h"
#include <rstl/rmemory_allocator.hpp>
namespace rstl {
template < typename T >
@ -12,8 +13,9 @@ public:
single_ptr() : x0_ptr(nullptr) {}
single_ptr(T* ptr) : x0_ptr(ptr) {}
single_ptr(const single_ptr& other) : x0_ptr(other.x0_ptr) { other.x0_ptr = nullptr; }
~single_ptr() { delete x0_ptr; }
~single_ptr() {
delete x0_ptr;
}
single_ptr& operator=(single_ptr& other) {
if (&other == this) {
return *this;

View File

@ -109,4 +109,6 @@ CGenDescription::~CGenDescription() {
for (int i = 0; i < (int)(sizeof(skGenOffsets) / sizeof(size_t)); ++i) {
delete *element_from_desc(this, skGenOffsets[i]);
}
(void*)0;
}

View File

@ -1,17 +1,76 @@
#include "MetroidPrime/Factories/CScannableObjectInfo.hpp"
#include "Kyoto/Math/CVector2i.hpp"
#include "MetroidPrime/Tweaks/CTweakGui.hpp"
#include "Kyoto/Basics/CBasics.hpp"
#include "Kyoto/SObjectTag.hpp"
#include "Kyoto/Streams/CInputStream.hpp"
#include <limits.h>
const char* PaneSufixes[] = {"0", "1", "2", "3", "01", "12", "23", "012", "123", "0123",
"4", "5", "6", "7", "45", "56", "67", "456", "567", "4567"};
static const char kBasePaneName[] = "imagepane_pane";
static const char* const kPaneSufixes[] = {
"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]);
return CBasics::Stringize("%s%s", kBasePaneName, kPaneSufixes[pane]);
}
CScannableObjectInfo::CScannableObjectInfo(CInputStream& in, uint version) {}
CScannableObjectInfo::CScannableObjectInfo(CInputStream& in, CAssetId id)
: x0_scannableObjectId(id)
, x4_stringId(-1)
, x8_totalDownloadTime(0.f)
, xc_category(0)
, x10_important(false) {
Load(in, in.ReadLong());
for (int i = 0; i < x14_buckets.size(); ++i) {
x14_buckets[i].x4_appearanceRange *= x8_totalDownloadTime;
}
const float appearanceOffset = gpTweakGui->GetScanAppearanceDuration();
for (int i = 0; i < x14_buckets.size(); ++i) {
if (x14_buckets[i].GetImagePosition() == -1) {
continue;
}
x8_totalDownloadTime += appearanceOffset;
for (int j = i; j < x14_buckets.size(); j++) {
x14_buckets[j].x4_appearanceRange += appearanceOffset;
}
}
for (int i = 0; i < x14_buckets.size() - 1; ++i) {
const int& pos = x14_buckets[i].x8_imagePos;
for (int j = i + 1; j < x14_buckets.size(); ++j) {
SBucket& bucket = x14_buckets[j];
if (pos == bucket.x8_imagePos && pos != -1) {
bucket.x8_imagePos = -1;
}
}
}
}
void CScannableObjectInfo::Load(CInputStream& in, uint version) {
in.ReadLong();
in.ReadLong();
x4_stringId = in.ReadLong();
if (version < 4) {
x8_totalDownloadTime = in.ReadFloat();
} else {
x8_totalDownloadTime = gpTweakGui->GetScanSpeed(in.ReadLong());
}
xc_category = in.ReadLong();
if (version > 4) {
x10_important = in.ReadBool();
}
for (int i = 0; i < x14_buckets.capacity(); ++i) {
x14_buckets.push_back(SBucket(in, version));
}
}
template <>
inline CFactoryFnReturn::CFactoryFnReturn(CScannableObjectInfo* ptr)
: obj(TToken< CScannableObjectInfo >::GetIObjObjectFor(rstl::auto_ptr< CScannableObjectInfo >(ptr))
@ -19,5 +78,5 @@ inline CFactoryFnReturn::CFactoryFnReturn(CScannableObjectInfo* ptr)
CFactoryFnReturn FScannableObjectInfoFactory(const SObjectTag& tag, CInputStream& in,
const CVParamTransfer& xfer) {
return rs_new CScannableObjectInfo(in, in.GetBlockOffset());
return rs_new CScannableObjectInfo(in, tag.GetId());
}