mirror of https://github.com/PrimeDecomp/prime.git
parent
61cf94d072
commit
7b4c11136f
|
@ -2549,7 +2549,7 @@ lbl_8005FC4C:
|
||||||
/* 8005FC88 0005CBE8 7C 64 1B 78 */ mr r4, r3
|
/* 8005FC88 0005CBE8 7C 64 1B 78 */ mr r4, r3
|
||||||
lbl_8005FC8C:
|
lbl_8005FC8C:
|
||||||
/* 8005FC8C 0005CBEC 38 7E 01 2C */ addi r3, r30, 0x12c
|
/* 8005FC8C 0005CBEC 38 7E 01 2C */ addi r3, r30, 0x12c
|
||||||
/* 8005FC90 0005CBF0 48 00 04 41 */ bl sub_800600d0
|
/* 8005FC90 0005CBF0 48 00 04 41 */ bl "Set__Q24rstl42single_ptr<Q29CGameArea16CPostConstructed>FPQ29CGameArea16CPostConstructed"
|
||||||
/* 8005FC94 0005CBF4 38 00 00 01 */ li r0, 1
|
/* 8005FC94 0005CBF4 38 00 00 01 */ li r0, 1
|
||||||
/* 8005FC98 0005CBF8 90 1E 00 F4 */ stw r0, 0xf4(r30)
|
/* 8005FC98 0005CBF8 90 1E 00 F4 */ stw r0, 0xf4(r30)
|
||||||
/* 8005FC9C 0005CBFC 48 00 04 1C */ b lbl_800600B8
|
/* 8005FC9C 0005CBFC 48 00 04 1C */ b lbl_800600B8
|
||||||
|
@ -2847,8 +2847,8 @@ lbl_800600BC:
|
||||||
/* 800600C8 0005D028 38 21 00 70 */ addi r1, r1, 0x70
|
/* 800600C8 0005D028 38 21 00 70 */ addi r1, r1, 0x70
|
||||||
/* 800600CC 0005D02C 4E 80 00 20 */ blr
|
/* 800600CC 0005D02C 4E 80 00 20 */ blr
|
||||||
|
|
||||||
.global sub_800600d0
|
.global "Set__Q24rstl42single_ptr<Q29CGameArea16CPostConstructed>FPQ29CGameArea16CPostConstructed"
|
||||||
sub_800600d0:
|
"Set__Q24rstl42single_ptr<Q29CGameArea16CPostConstructed>FPQ29CGameArea16CPostConstructed":
|
||||||
/* 800600D0 0005D030 94 21 FF F0 */ stwu r1, -0x10(r1)
|
/* 800600D0 0005D030 94 21 FF F0 */ stwu r1, -0x10(r1)
|
||||||
/* 800600D4 0005D034 7C 08 02 A6 */ mflr r0
|
/* 800600D4 0005D034 7C 08 02 A6 */ mflr r0
|
||||||
/* 800600D8 0005D038 90 01 00 14 */ stw r0, 0x14(r1)
|
/* 800600D8 0005D038 90 01 00 14 */ stw r0, 0x14(r1)
|
||||||
|
@ -3552,7 +3552,7 @@ lbl_80060A38:
|
||||||
lbl_80060A58:
|
lbl_80060A58:
|
||||||
/* 80060A58 0005D9B8 38 7D 01 2C */ addi r3, r29, 0x12c
|
/* 80060A58 0005D9B8 38 7D 01 2C */ addi r3, r29, 0x12c
|
||||||
/* 80060A5C 0005D9BC 38 80 00 00 */ li r4, 0
|
/* 80060A5C 0005D9BC 38 80 00 00 */ li r4, 0
|
||||||
/* 80060A60 0005D9C0 4B FF F6 71 */ bl sub_800600d0
|
/* 80060A60 0005D9C0 4B FF F6 71 */ bl "Set__Q24rstl42single_ptr<Q29CGameArea16CPostConstructed>FPQ29CGameArea16CPostConstructed"
|
||||||
/* 80060A64 0005D9C4 38 00 00 00 */ li r0, 0
|
/* 80060A64 0005D9C4 38 00 00 00 */ li r0, 0
|
||||||
/* 80060A68 0005D9C8 7F A3 EB 78 */ mr r3, r29
|
/* 80060A68 0005D9C8 7F A3 EB 78 */ mr r3, r29
|
||||||
/* 80060A6C 0005D9CC 90 1D 00 F4 */ stw r0, 0xf4(r29)
|
/* 80060A6C 0005D9CC 90 1D 00 F4 */ stw r0, 0xf4(r29)
|
||||||
|
@ -3578,7 +3578,7 @@ lbl_80060A9C:
|
||||||
/* 80060AB4 0005DA14 4B FF EC F9 */ bl RemoveStaticGeometry__9CGameAreaFv
|
/* 80060AB4 0005DA14 4B FF EC F9 */ bl RemoveStaticGeometry__9CGameAreaFv
|
||||||
/* 80060AB8 0005DA18 38 7D 01 2C */ addi r3, r29, 0x12c
|
/* 80060AB8 0005DA18 38 7D 01 2C */ addi r3, r29, 0x12c
|
||||||
/* 80060ABC 0005DA1C 38 80 00 00 */ li r4, 0
|
/* 80060ABC 0005DA1C 38 80 00 00 */ li r4, 0
|
||||||
/* 80060AC0 0005DA20 4B FF F6 11 */ bl sub_800600d0
|
/* 80060AC0 0005DA20 4B FF F6 11 */ bl "Set__Q24rstl42single_ptr<Q29CGameArea16CPostConstructed>FPQ29CGameArea16CPostConstructed"
|
||||||
/* 80060AC4 0005DA24 88 1D 00 F0 */ lbz r0, 0xf0(r29)
|
/* 80060AC4 0005DA24 88 1D 00 F0 */ lbz r0, 0xf0(r29)
|
||||||
/* 80060AC8 0005DA28 38 80 00 00 */ li r4, 0
|
/* 80060AC8 0005DA28 38 80 00 00 */ li r4, 0
|
||||||
/* 80060ACC 0005DA2C 50 80 3E 30 */ rlwimi r0, r4, 7, 0x18, 0x18
|
/* 80060ACC 0005DA2C 50 80 3E 30 */ rlwimi r0, r4, 7, 0x18, 0x18
|
||||||
|
|
|
@ -27,7 +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);
|
||||||
CARAMDvdRequest* LoadResourcePartAsync(const SObjectTag& tag, int, int, void*);
|
CARAMDvdRequest* LoadResourcePartAsync(const SObjectTag& tag, int, int, char*);
|
||||||
|
|
||||||
FourCC GetResourceTypeById(CAssetId) const;
|
FourCC GetResourceTypeById(CAssetId) const;
|
||||||
uint ResourceSize(const SObjectTag& tag) const;
|
uint ResourceSize(const SObjectTag& tag) const;
|
||||||
|
|
|
@ -122,7 +122,7 @@ public:
|
||||||
private:
|
private:
|
||||||
void AllocNewAreaData(int, int);
|
void AllocNewAreaData(int, int);
|
||||||
void CullDeadAreaRequests();
|
void CullDeadAreaRequests();
|
||||||
void VerifyHeader() const;
|
int VerifyHeader() const;
|
||||||
int GetNumPartSizes() const;
|
int GetNumPartSizes() const;
|
||||||
|
|
||||||
|
|
||||||
|
@ -169,6 +169,9 @@ public:
|
||||||
const CScriptAreaAttributes* x10d8_areaAttributes;
|
const CScriptAreaAttributes* x10d8_areaAttributes;
|
||||||
EOcclusionState x10dc_occlusionState;
|
EOcclusionState x10dc_occlusionState;
|
||||||
uchar x10e0_pad[0x60];
|
uchar x10e0_pad[0x60];
|
||||||
|
|
||||||
|
CPostConstructed();
|
||||||
|
~CPostConstructed();
|
||||||
};
|
};
|
||||||
|
|
||||||
CAssetId GetAreaAssetId() const { return x84_mrea; }
|
CAssetId GetAreaAssetId() const { return x84_mrea; }
|
||||||
|
|
|
@ -30,8 +30,17 @@ public:
|
||||||
x0_ptr = nullptr;
|
x0_ptr = nullptr;
|
||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This is certainly not real, but handy to force not-inline
|
||||||
|
single_ptr& Set(T* ptr);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
template < typename T >
|
||||||
|
single_ptr< T >& single_ptr< T >::Set(T* ptr) {
|
||||||
|
return *this = ptr;
|
||||||
|
}
|
||||||
|
|
||||||
typedef single_ptr< void > unk_singleptr;
|
typedef single_ptr< void > unk_singleptr;
|
||||||
CHECK_SIZEOF(unk_singleptr, 0x4);
|
CHECK_SIZEOF(unk_singleptr, 0x4);
|
||||||
} // namespace rstl
|
} // namespace rstl
|
||||||
|
|
|
@ -5,6 +5,9 @@
|
||||||
|
|
||||||
#define ROUND_UP_32(val) (((val) + 31) & ~31)
|
#define ROUND_UP_32(val) (((val) + 31) & ~31)
|
||||||
|
|
||||||
|
CGameArea::CPostConstructed::CPostConstructed() {}
|
||||||
|
CGameArea::CPostConstructed::~CPostConstructed() {}
|
||||||
|
|
||||||
bool CGameArea::StartStreamingMainArea() {
|
bool CGameArea::StartStreamingMainArea() {
|
||||||
if (xf0_24_postConstructed)
|
if (xf0_24_postConstructed)
|
||||||
return false;
|
return false;
|
||||||
|
@ -13,13 +16,13 @@ bool CGameArea::StartStreamingMainArea() {
|
||||||
case kP_LoadHeader: {
|
case kP_LoadHeader: {
|
||||||
x110_mreaSecBufs.reserve(3);
|
x110_mreaSecBufs.reserve(3);
|
||||||
AllocNewAreaData(0, 96);
|
AllocNewAreaData(0, 96);
|
||||||
x12c_postConstructed = new CPostConstructed();
|
x12c_postConstructed.Set(new CPostConstructed());
|
||||||
xf4_phase = kP_LoadSecSizes;
|
xf4_phase = kP_LoadSecSizes;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case kP_LoadSecSizes: {
|
case kP_LoadSecSizes: {
|
||||||
CullDeadAreaRequests();
|
CullDeadAreaRequests();
|
||||||
if (xf8_loadTransactions.size())
|
if (!xf8_loadTransactions.empty())
|
||||||
break;
|
break;
|
||||||
VerifyHeader();
|
VerifyHeader();
|
||||||
AllocNewAreaData(x110_mreaSecBufs[0].second, ROUND_UP_32(GetNumPartSizes() * 4));
|
AllocNewAreaData(x110_mreaSecBufs[0].second, ROUND_UP_32(GetNumPartSizes() * 4));
|
||||||
|
@ -28,7 +31,7 @@ bool CGameArea::StartStreamingMainArea() {
|
||||||
}
|
}
|
||||||
case kP_ReserveSections: {
|
case kP_ReserveSections: {
|
||||||
CullDeadAreaRequests();
|
CullDeadAreaRequests();
|
||||||
if (xf8_loadTransactions.size() == 0) {
|
if (xf8_loadTransactions.empty()) {
|
||||||
x110_mreaSecBufs.reserve(GetNumPartSizes() + 2);
|
x110_mreaSecBufs.reserve(GetNumPartSizes() + 2);
|
||||||
x124_secCount = 0;
|
x124_secCount = 0;
|
||||||
x128_mreaDataOffset = x110_mreaSecBufs[0].second + x110_mreaSecBufs[1].second;
|
x128_mreaDataOffset = x110_mreaSecBufs[0].second + x110_mreaSecBufs[1].second;
|
||||||
|
@ -39,8 +42,11 @@ bool CGameArea::StartStreamingMainArea() {
|
||||||
case kP_LoadDataSections: {
|
case kP_LoadDataSections: {
|
||||||
CullDeadAreaRequests();
|
CullDeadAreaRequests();
|
||||||
|
|
||||||
uint totalSz = 0;
|
int totalSz = 0;
|
||||||
uint secCount = GetNumPartSizes();
|
int secCount = x124_secCount;
|
||||||
|
int partSizes = GetNumPartSizes();
|
||||||
|
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]);
|
||||||
|
|
||||||
|
@ -57,22 +63,38 @@ bool CGameArea::StartStreamingMainArea() {
|
||||||
// curOff += size;
|
// curOff += size;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
SObjectTag tag('MREA', x84_mrea);
|
int dif = partSizes - secCount;
|
||||||
void* buf = CMemory::Alloc(totalSz, IAllocator::kHI_RoundUpLen);
|
int targetSecCount = secCount;
|
||||||
|
for (int i = secCount; i < partSizes; ++i) {
|
||||||
|
int size = x110_mreaSecBufs[i].second;
|
||||||
|
if (targetSecCount != secCount && 0x10000 < size + totalSz)
|
||||||
|
break;
|
||||||
|
totalSz += size;
|
||||||
|
targetSecCount += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
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))
|
rstl::rc_ptr< CDvdRequest >(gpResourceFactory->GetResLoader().LoadResourcePartAsync(tag, x128_mreaDataOffset, totalSz, buf.get()))
|
||||||
);
|
);
|
||||||
x128_mreaDataOffset += totalSz;
|
x128_mreaDataOffset += totalSz;
|
||||||
// x110_mreaSecBufs.push_back(buf);
|
x110_mreaSecBufs.push_back(rstl::pair< rstl::auto_ptr<char>, int>( buf, 0 ));
|
||||||
|
|
||||||
|
for (int i = secCount + 1; i < targetSecCount; ++i) {
|
||||||
|
x110_mreaSecBufs.push_back(rstl::pair< rstl::auto_ptr<char>, int>( nullptr, 0 ));
|
||||||
|
}
|
||||||
|
x124_secCount = targetSecCount;
|
||||||
|
if (targetSecCount == partSizes) {
|
||||||
|
x120_unk = x128_mreaDataOffset;
|
||||||
xf4_phase = kP_WaitForFinish;
|
xf4_phase = kP_WaitForFinish;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case kP_WaitForFinish: {
|
case kP_WaitForFinish: {
|
||||||
CullDeadAreaRequests();
|
CullDeadAreaRequests();
|
||||||
if (xf8_loadTransactions.size())
|
if (xf8_loadTransactions.empty())
|
||||||
break;
|
|
||||||
return false;
|
return false;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue