mirror of https://github.com/PrimeDecomp/prime.git
More CGameArea
This commit is contained in:
parent
977372a3cd
commit
9465f35d9a
|
@ -29,8 +29,8 @@ lbl_803DA234:
|
||||||
.4byte IGetNumAttachedAreas__9CGameAreaCFv
|
.4byte IGetNumAttachedAreas__9CGameAreaCFv
|
||||||
.4byte IGetAttachedAreaId__9CGameAreaCFi
|
.4byte IGetAttachedAreaId__9CGameAreaCFi
|
||||||
.4byte IIsActive__9CGameAreaCFv
|
.4byte IIsActive__9CGameAreaCFv
|
||||||
.4byte IGetAreaAssetID__9CGameAreaCFv
|
.4byte IGetAreaAssetId__9CGameAreaCFv
|
||||||
.4byte IGetAreaId__9CGameAreaCFv
|
.4byte IGetAreaSaveId__9CGameAreaCFv
|
||||||
.4byte IGetScriptingMemoryAlways__9CGameAreaCFv
|
.4byte IGetScriptingMemoryAlways__9CGameAreaCFv
|
||||||
|
|
||||||
.global lbl_803DA260
|
.global lbl_803DA260
|
||||||
|
@ -1237,13 +1237,13 @@ IGetScriptingMemoryAlways__9CGameAreaCFv:
|
||||||
/* 8005EB20 0005BA80 38 21 00 10 */ addi r1, r1, 0x10
|
/* 8005EB20 0005BA80 38 21 00 10 */ addi r1, r1, 0x10
|
||||||
/* 8005EB24 0005BA84 4E 80 00 20 */ blr
|
/* 8005EB24 0005BA84 4E 80 00 20 */ blr
|
||||||
|
|
||||||
.global IGetAreaId__9CGameAreaCFv
|
.global IGetAreaSaveId__9CGameAreaCFv
|
||||||
IGetAreaId__9CGameAreaCFv:
|
IGetAreaSaveId__9CGameAreaCFv:
|
||||||
/* 8005EB28 0005BA88 80 63 00 88 */ lwz r3, 0x88(r3)
|
/* 8005EB28 0005BA88 80 63 00 88 */ lwz r3, 0x88(r3)
|
||||||
/* 8005EB2C 0005BA8C 4E 80 00 20 */ blr
|
/* 8005EB2C 0005BA8C 4E 80 00 20 */ blr
|
||||||
|
|
||||||
.global IGetAreaAssetID__9CGameAreaCFv
|
.global IGetAreaAssetId__9CGameAreaCFv
|
||||||
IGetAreaAssetID__9CGameAreaCFv:
|
IGetAreaAssetId__9CGameAreaCFv:
|
||||||
/* 8005EB30 0005BA90 80 63 00 84 */ lwz r3, 0x84(r3)
|
/* 8005EB30 0005BA90 80 63 00 84 */ lwz r3, 0x84(r3)
|
||||||
/* 8005EB34 0005BA94 4E 80 00 20 */ blr
|
/* 8005EB34 0005BA94 4E 80 00 20 */ blr
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,7 @@ public:
|
||||||
void AsyncIdlePakLoading();
|
void AsyncIdlePakLoading();
|
||||||
bool AreAllPaksLoaded() const;
|
bool AreAllPaksLoaded() const;
|
||||||
CInputStream* LoadNewResourceSync(const SObjectTag& tag, char* extBuf);
|
CInputStream* LoadNewResourceSync(const SObjectTag& tag, char* extBuf);
|
||||||
|
CInputStream* LoadNewResourceSync(const SObjectTag& tag, int, int, char* extBuf);
|
||||||
CARAMDvdRequest* LoadResourcePartAsync(const SObjectTag& tag, int, int, char*);
|
CARAMDvdRequest* LoadResourcePartAsync(const SObjectTag& tag, int, int, char*);
|
||||||
|
|
||||||
FourCC GetResourceTypeById(CAssetId) const;
|
FourCC GetResourceTypeById(CAssetId) const;
|
||||||
|
|
|
@ -1,13 +1,42 @@
|
||||||
#include "MetroidPrime/CGameArea.hpp"
|
#include "MetroidPrime/CGameArea.hpp"
|
||||||
|
|
||||||
#include "Kyoto/CResFactory.hpp"
|
|
||||||
#include "Kyoto/CDvdRequest.hpp"
|
#include "Kyoto/CDvdRequest.hpp"
|
||||||
|
#include "Kyoto/CResFactory.hpp"
|
||||||
|
|
||||||
|
|
||||||
#define ROUND_UP_32(val) (((val) + 31) & ~31)
|
#define ROUND_UP_32(val) (((val) + 31) & ~31)
|
||||||
|
|
||||||
|
rstl::pair< rstl::auto_ptr< uchar >, int > GetScriptingMemoryAlways(const IGameArea& area) {
|
||||||
|
SObjectTag tag('MREA', area.IGetAreaAssetId());
|
||||||
|
|
||||||
|
rstl::auto_ptr< char > buf = new char[0x60];
|
||||||
|
CInputStream* resource = gpResourceFactory->GetResLoader().LoadNewResourceSync(tag, 0, 0x60, buf.get());
|
||||||
|
if (!resource || *(uint*)(buf.get()) != 0xdeadbeef) {
|
||||||
|
return rstl::pair< rstl::auto_ptr< uchar >, int >(nullptr, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
CGameArea::CPostConstructed::CPostConstructed() {}
|
CGameArea::CPostConstructed::CPostConstructed() {}
|
||||||
CGameArea::CPostConstructed::~CPostConstructed() {}
|
CGameArea::CPostConstructed::~CPostConstructed() {}
|
||||||
|
|
||||||
|
const CTransform4f& CGameArea::IGetTM() const { return xc_transform; }
|
||||||
|
|
||||||
|
CAssetId CGameArea::IGetStringTableAssetId() const { return x8_nameSTRG; }
|
||||||
|
|
||||||
|
uint CGameArea::IGetNumAttachedAreas() const { return x8c_attachedAreaIndices.size(); }
|
||||||
|
|
||||||
|
TAreaId CGameArea::IGetAttachedAreaId(int i) const { return x8c_attachedAreaIndices[i]; }
|
||||||
|
|
||||||
|
bool CGameArea::IIsActive() const { return xf0_25_active; }
|
||||||
|
|
||||||
|
CAssetId CGameArea::IGetAreaAssetId() const { return x84_mrea; }
|
||||||
|
|
||||||
|
int CGameArea::IGetAreaSaveId() const { return x88_areaId; }
|
||||||
|
|
||||||
|
rstl::pair< rstl::auto_ptr< uchar >, int > CGameArea::IGetScriptingMemoryAlways() const {
|
||||||
|
return GetScriptingMemoryAlways(*this);
|
||||||
|
}
|
||||||
|
|
||||||
bool CGameArea::StartStreamingMainArea() {
|
bool CGameArea::StartStreamingMainArea() {
|
||||||
if (xf0_24_postConstructed)
|
if (xf0_24_postConstructed)
|
||||||
return false;
|
return false;
|
||||||
|
@ -47,21 +76,23 @@ bool CGameArea::StartStreamingMainArea() {
|
||||||
int partSizes = GetNumPartSizes();
|
int partSizes = GetNumPartSizes();
|
||||||
SObjectTag tag('MREA', x84_mrea);
|
SObjectTag tag('MREA', x84_mrea);
|
||||||
|
|
||||||
// for (uint i = 0; i < secCount; ++i)
|
// for (uint i = 0; i < secCount; ++i)
|
||||||
// totalSz += CBasics::SwapBytes(reinterpret_cast<u32*>(x110_mreaSecBufs[1].first.get())[i]);
|
// totalSz +=
|
||||||
|
// CBasics::SwapBytes(reinterpret_cast<u32*>(x110_mreaSecBufs[1].first.get())[i]);
|
||||||
|
|
||||||
// AllocNewAreaData(x128_mreaDataOffset, totalSz);
|
// AllocNewAreaData(x128_mreaDataOffset, totalSz);
|
||||||
|
|
||||||
// m_resolvedBufs.reserve(secCount);
|
// m_resolvedBufs.reserve(secCount);
|
||||||
// m_resolvedBufs.emplace_back(x110_mreaSecBufs[0].first.get(), x110_mreaSecBufs[0].second);
|
// m_resolvedBufs.emplace_back(x110_mreaSecBufs[0].first.get(), x110_mreaSecBufs[0].second);
|
||||||
// m_resolvedBufs.emplace_back(x110_mreaSecBufs[1].first.get(), x110_mreaSecBufs[1].second);
|
// m_resolvedBufs.emplace_back(x110_mreaSecBufs[1].first.get(), x110_mreaSecBufs[1].second);
|
||||||
|
|
||||||
// uint curOff = 0;
|
// uint curOff = 0;
|
||||||
// for (uint i = 0; i < secCount; ++i) {
|
// for (uint i = 0; i < secCount; ++i) {
|
||||||
// uint size = CBasics::SwapBytes(reinterpret_cast<u32*>(x110_mreaSecBufs[1].first.get())[i]);
|
// uint size =
|
||||||
// m_resolvedBufs.emplace_back(x110_mreaSecBufs[2].first.get() + curOff, size);
|
// CBasics::SwapBytes(reinterpret_cast<u32*>(x110_mreaSecBufs[1].first.get())[i]);
|
||||||
// curOff += size;
|
// m_resolvedBufs.emplace_back(x110_mreaSecBufs[2].first.get() + curOff, size);
|
||||||
// }
|
// curOff += size;
|
||||||
|
// }
|
||||||
|
|
||||||
int dif = partSizes - secCount;
|
int dif = partSizes - secCount;
|
||||||
int targetSecCount = secCount;
|
int targetSecCount = secCount;
|
||||||
|
@ -73,15 +104,15 @@ bool CGameArea::StartStreamingMainArea() {
|
||||||
targetSecCount += 1;
|
targetSecCount += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
rstl::auto_ptr<char> buf = (char*) CMemory::Alloc(totalSz, IAllocator::kHI_RoundUpLen);
|
rstl::auto_ptr< char > buf = (char*)CMemory::Alloc(totalSz, IAllocator::kHI_RoundUpLen);
|
||||||
xf8_loadTransactions.push_back(
|
xf8_loadTransactions.push_back(
|
||||||
rstl::rc_ptr< CDvdRequest >(gpResourceFactory->GetResLoader().LoadResourcePartAsync(tag, x128_mreaDataOffset, totalSz, buf.get()))
|
rstl::rc_ptr< CDvdRequest >(gpResourceFactory->GetResLoader().LoadResourcePartAsync(
|
||||||
);
|
tag, x128_mreaDataOffset, totalSz, buf.get())));
|
||||||
x128_mreaDataOffset += totalSz;
|
x128_mreaDataOffset += totalSz;
|
||||||
x110_mreaSecBufs.push_back(rstl::pair< rstl::auto_ptr<char>, int>( buf, 0 ));
|
x110_mreaSecBufs.push_back(rstl::pair< rstl::auto_ptr< char >, int >(buf, 0));
|
||||||
|
|
||||||
for (int i = secCount + 1; i < targetSecCount; ++i) {
|
for (int i = secCount + 1; i < targetSecCount; ++i) {
|
||||||
x110_mreaSecBufs.push_back(rstl::pair< rstl::auto_ptr<char>, int>( nullptr, 0 ));
|
x110_mreaSecBufs.push_back(rstl::pair< rstl::auto_ptr< char >, int >(nullptr, 0));
|
||||||
}
|
}
|
||||||
x124_secCount = targetSecCount;
|
x124_secCount = targetSecCount;
|
||||||
if (targetSecCount == partSizes) {
|
if (targetSecCount == partSizes) {
|
||||||
|
|
Loading…
Reference in New Issue