Match but don't link CSegIdList (rstl::vector inlining)

This commit is contained in:
Phillip Stephens 2022-10-14 22:22:32 -07:00
parent 20ccef8a33
commit dc69b9f2fd
11 changed files with 105 additions and 47 deletions

View File

@ -43,8 +43,8 @@ lbl_80350590:
/* 803505A8 0034D508 98 05 FF FF */ stb r0, -1(r5)
/* 803505AC 0034D50C 4E 80 00 20 */ blr
.global GetBlockOffset_18SMediumAllocPuddleFCPvCPv
GetBlockOffset_18SMediumAllocPuddleFCPvCPv:
.global GetBlockOffset__18SMediumAllocPuddleFCPvCPv
GetBlockOffset__18SMediumAllocPuddleFCPvCPv:
/* 803505B0 0034D510 7C 03 20 50 */ subf r0, r3, r4
/* 803505B4 0034D514 2C 00 00 01 */ cmpwi r0, 1
/* 803505B8 0034D518 40 81 00 0C */ ble lbl_803505C4
@ -73,8 +73,8 @@ lbl_80350604:
/* 80350604 0034D564 54 03 04 3E */ clrlwi r3, r0, 0x10
/* 80350608 0034D568 4E 80 00 20 */ blr
.global Free_18SMediumAllocPuddleFCPv
Free_18SMediumAllocPuddleFCPv:
.global Free__18SMediumAllocPuddleFCPv
Free__18SMediumAllocPuddleFCPv:
/* 8035060C 0034D56C 94 21 FF E0 */ stwu r1, -0x20(r1)
/* 80350610 0034D570 7C 08 02 A6 */ mflr r0
/* 80350614 0034D574 90 01 00 24 */ stw r0, 0x24(r1)
@ -139,7 +139,7 @@ lbl_803506DC:
/* 803506E8 0034D648 88 03 00 00 */ lbz r0, 0(r3)
/* 803506EC 0034D64C 54 00 06 31 */ rlwinm. r0, r0, 0, 0x18, 0x18
/* 803506F0 0034D650 40 81 00 10 */ ble lbl_80350700
/* 803506F4 0034D654 4B FF FE BD */ bl GetBlockOffset_18SMediumAllocPuddleFCPvCPv
/* 803506F4 0034D654 4B FF FE BD */ bl GetBlockOffset__18SMediumAllocPuddleFCPvCPv
/* 803506F8 0034D658 7C 1D 1A 14 */ add r0, r29, r3
/* 803506FC 0034D65C 54 1D 04 3E */ clrlwi r29, r0, 0x10
lbl_80350700:
@ -201,7 +201,7 @@ lbl_803507B0:
lbl_803507B8:
/* 803507B8 0034D718 7F 83 E3 78 */ mr r3, r28
/* 803507BC 0034D71C 7F A4 EB 78 */ mr r4, r29
/* 803507C0 0034D720 4B FF FD F1 */ bl GetBlockOffset_18SMediumAllocPuddleFCPvCPv
/* 803507C0 0034D720 4B FF FD F1 */ bl GetBlockOffset__18SMediumAllocPuddleFCPvCPv
/* 803507C4 0034D724 54 60 04 3E */ clrlwi r0, r3, 0x10
/* 803507C8 0034D728 7C 00 D8 40 */ cmplw r0, r27
/* 803507CC 0034D72C 41 80 00 24 */ blt lbl_803507F0
@ -509,7 +509,7 @@ lbl_80350BB0:
/* 80350BC0 0034DB20 54 00 28 34 */ slwi r0, r0, 5
/* 80350BC4 0034DB24 7C 05 00 40 */ cmplw r5, r0
/* 80350BC8 0034DB28 40 80 00 48 */ bge lbl_80350C10
/* 80350BCC 0034DB2C 4B FF FA 41 */ bl Free_18SMediumAllocPuddleFCPv
/* 80350BCC 0034DB2C 4B FF FA 41 */ bl Free__18SMediumAllocPuddleFCPv
/* 80350BD0 0034DB30 80 1F 00 20 */ lwz r0, 0x20(r31)
/* 80350BD4 0034DB34 28 00 00 00 */ cmplwi r0, 0
/* 80350BD8 0034DB38 40 82 00 30 */ bne lbl_80350C08
@ -698,4 +698,3 @@ lbl_803D8240:
# ROM: 0x3D5240
.asciz "??(??)"
.balign 4

View File

@ -653,7 +653,7 @@ LIBS = [
"Kyoto/Graphics/CCubeMaterial",
"Kyoto/Graphics/CCubeSurface",
"Kyoto/Animation/CCharAnimTime",
"Kyoto/Animation/CSegIdList",
["Kyoto/Animation/CSegIdList", False],
["Kyoto/Input/CFinalInput", True],
["Kyoto/Graphics/CColor", True],
"Kyoto/Audio/DolphinCAudioGroupSet",

View File

@ -0,0 +1,17 @@
#ifndef _CCHARANIMMEMORYMETRICS
#define _CCHARANIMMEMORYMETRICS
#include <types.h>
class CCharAnimMemoryMetrics {
public:
enum EAnimSubSystem {
kASS_Zero,
kASS_One,
kASS_Two,
};
static void AddToTotalSize(uint size, EAnimSubSystem subSystem);
};
#endif // _CCHARANIMMEMORYMETRICS

View File

@ -0,0 +1,15 @@
#ifndef _CSEGID
#define _CSEGID
#include <types.h>
#include "Kyoto/Streams/CInputStream.hpp"
class CSegId {
public:
CSegId(CInputStream& in) : x0_id(in.Get<uint>()) {}
private:
uchar x0_id;
};
#endif // _CSEGID

View File

@ -0,0 +1,15 @@
#ifndef _CSEGIDLIST
#define _CSEGIDLIST
#include "Kyoto/Animation/CSegId.hpp"
#include "rstl/vector.hpp"
class CInputStream;
class CSegIdList {
public:
CSegIdList(CInputStream& in);
public:
rstl::vector<CSegId> x0_segList;
};
#endif // _CSEGIDLIST

View File

@ -7,7 +7,7 @@ class CInputStream;
template < typename T >
struct TType {};
template < typename T >
inline T cinput_stream_helper(const TType< T >& type, CInputStream& in);
T cinput_stream_helper(const TType< T >& type, CInputStream& in);
class CInputStream {
public:
@ -52,6 +52,11 @@ private:
uint x20_bitOffset;
};
template <typename T>
inline T cinput_stream_helper(const TType<T>& type, CInputStream& in) {
return T(in);
}
template <>
inline int cinput_stream_helper(const TType< int >& type, CInputStream& in) {
return in.ReadLong();
@ -89,8 +94,8 @@ inline rstl::pair< L, R > cinput_stream_helper(const TType< rstl::pair< L, R > >
}
#include "rstl/vector.hpp"
template < typename T, typename A >
inline rstl::vector< T, A >::vector(CInputStream& in)
template < typename T, typename Alloc >
inline rstl::vector< T, Alloc >::vector(CInputStream& in, const Alloc& allocator)
: x4_count(0), x8_capacity(0), xc_items(nullptr) {
int count = in.ReadInt32();
reserve(count);

View File

@ -5,6 +5,8 @@
#include "MetroidPrime/TGameTypes.hpp"
#include "Kyoto/Animation/CSegId.hpp"
#include "Kyoto/Math/CQuaternion.hpp"
#include "Kyoto/Math/CVector3f.hpp"
#include "Kyoto/TToken.hpp"

View File

@ -67,11 +67,6 @@ CHECK_SIZEOF(TUniqueId, 0x2)
typedef ushort TSfxId;
static TSfxId InvalidSfxId = 0xFFFFu;
class CSegId {
private:
uchar x0_id;
};
#define ALIGN_UP(x, a) (((x) + (a - 1)) & ~(a - 1))
#endif // _TGAMETYPES

View File

@ -37,12 +37,12 @@ public:
typedef pointer_iterator< T, vector< T, Alloc >, Alloc > iterator;
typedef const_pointer_iterator< T, vector< T, Alloc >, Alloc > const_iterator;
inline iterator begin() { return iterator(xc_items); }
inline const_iterator begin() const { return const_iterator(xc_items); }
inline iterator end() { return iterator(xc_items + x4_count); }
inline const_iterator end() const { return const_iterator(xc_items + x4_count); }
inline vector() : x4_count(0), x8_capacity(0), xc_items(NULL) {}
inline vector(int count) : x4_count(0), x8_capacity(0), xc_items(0) { reserve(count); }
iterator begin() { return iterator(xc_items); }
const_iterator begin() const { return const_iterator(xc_items); }
iterator end() { return iterator(xc_items + x4_count); }
const_iterator end() const { return const_iterator(xc_items + x4_count); }
vector() : x4_count(0), x8_capacity(0), xc_items(NULL) {}
vector(int count) : x4_count(0), x8_capacity(0), xc_items(0) { reserve(count); }
vector(int count, const T& v) : x4_count(count), x8_capacity(count) {
x0_allocator.allocate(xc_items, x4_count);
uninitialized_fill_n(xc_items, count, v);
@ -55,7 +55,7 @@ public:
uninitialized_copy_n(other.xc_items, x4_count, xc_items);
}
}
vector(CInputStream& in);
vector(CInputStream& in, const Alloc& alloc = Alloc());
~vector() {
destroy(begin(), end());
x0_allocator.deallocate(xc_items);
@ -99,19 +99,19 @@ public:
x4_count = 0;
}
inline T* data() { return xc_items; }
inline const T* data() const { return xc_items; }
inline int size() const { return x4_count; }
inline bool empty() const { return x4_count == 0; }
inline int capacity() const { return x8_capacity; }
inline T& at(int idx) { return xc_items[idx]; }
inline const T& at(int idx) const { return xc_items[idx]; }
inline T& front() { return at(0); }
inline const T& front() const { return at(0); }
inline T& back() { return at(x4_count - 1); }
inline const T& back() const { return at(x4_count - 1); }
inline T& operator[](int idx) { return xc_items[idx]; }
inline const T& operator[](int idx) const { return xc_items[idx]; }
T* data() { return xc_items; }
const T* data() const { return xc_items; }
int size() const { return x4_count; }
bool empty() const { return x4_count == 0; }
int capacity() const { return x8_capacity; }
T& at(int idx) { return xc_items[idx]; }
const T& at(int idx) const { return xc_items[idx]; }
T& front() { return at(0); }
const T& front() const { return at(0); }
T& back() { return at(x4_count - 1); }
const T& back() const { return at(x4_count - 1); }
T& operator[](int idx) { return xc_items[idx]; }
const T& operator[](int idx) const { return xc_items[idx]; }
protected:
template < typename In >

View File

@ -144,7 +144,6 @@ void* CGameAllocator::Alloc(size_t size, EHint hint, EScope scope, EType type,
void* mediumBuf = nullptr;
if (x58_oomCallback) {
x58_oomCallback(x5c_oomTarget, size);
}
static bool bTriedCallback = false;
if (!bTriedCallback) {
@ -154,7 +153,7 @@ void* CGameAllocator::Alloc(size_t size, EHint hint, EScope scope, EType type,
} else {
return nullptr;
}
}
if (mediumBuf == nullptr) {
callstack.GetFileAndLineText();
callstack.GetTypeText();
@ -192,7 +191,9 @@ CGameAllocator::SGameMemInfo* CGameAllocator::FindFreeBlockFromTopOfHeap(uint si
return ret;
}
uint CGameAllocator::FixupAllocPtrs(SGameMemInfo*, uint, uint, EHint, const CCallStack&) { return 0; }
uint CGameAllocator::FixupAllocPtrs(SGameMemInfo*, uint, uint, EHint, const CCallStack&) {
return 0;
}
void CGameAllocator::UpdateAllocDebugStats(uint len, uint roundedLen, uint offset) {
++x84_;

View File

@ -0,0 +1,9 @@
#include "Kyoto/Animation/CSegIdList.hpp"
#include "Kyoto/Animation/CCharAnimMemoryMetrics.hpp"
#include "Kyoto/Streams/CInputStream.hpp"
CSegIdList::CSegIdList(CInputStream& in)
: x0_segList(in) {
CCharAnimMemoryMetrics::AddToTotalSize(x0_segList.capacity(), CCharAnimMemoryMetrics::kASS_Two);
}