Initial CMediumAllocPool, rstl::list fixes

This commit is contained in:
Phillip Stephens 2023-10-01 12:28:38 -07:00
parent 4b17ab1f4d
commit bda8099994
3 changed files with 10 additions and 14 deletions

View File

@ -655,7 +655,7 @@ LIBS = [
["Kyoto/Input/DolphinIController", True], ["Kyoto/Input/DolphinIController", True],
["Kyoto/Input/CDolphinController", True], ["Kyoto/Input/CDolphinController", True],
["Kyoto/DolphinCDvdFile", False], ["Kyoto/DolphinCDvdFile", False],
"Kyoto/Alloc/CMediumAllocPool", ["Kyoto/Alloc/CMediumAllocPool", False],
["Kyoto/Alloc/CSmallAllocPool", True], ["Kyoto/Alloc/CSmallAllocPool", True],
["Kyoto/Alloc/CGameAllocator", False], ["Kyoto/Alloc/CGameAllocator", False],
"Kyoto/Animation/DolphinCSkinnedModel", "Kyoto/Animation/DolphinCSkinnedModel",

View File

@ -17,8 +17,8 @@ public:
}; };
rstl::list< SMediumAllocPuddle > x0_list; rstl::list< SMediumAllocPuddle > x0_list;
/*rstl::list_node<SMediumAllocPuddle>* x18_lastNodePrev; */ const rstl::list< SMediumAllocPuddle >::node* x18_lastNodePrev;
void* x18_lastNodePrev; CMediumAllocPool();
void* Alloc(uint size); void* Alloc(uint size);
bool HasPuddles() const; bool HasPuddles() const;
void AddPuddle(uint, void*, int); void AddPuddle(uint, void*, int);
@ -29,6 +29,8 @@ public:
uint GetTotalEntries(); uint GetTotalEntries();
uint GetNumBlocksAvailable(); uint GetNumBlocksAvailable();
uint GetNumAllocs(); uint GetNumAllocs();
static CMediumAllocPool* gMediumAllocPtr;
}; };
#endif // _CMEDIUMALLOCPOOL #endif // _CMEDIUMALLOCPOOL

View File

@ -51,7 +51,6 @@ public:
return iterator(it); return iterator(it);
} }
private:
struct node { struct node {
node* x0_prev; node* x0_prev;
node* x4_next; node* x4_next;
@ -92,7 +91,7 @@ public:
typedef T* value_type; typedef T* value_type;
const_iterator() : current(nullptr) {} const_iterator() : current(nullptr) {}
const_iterator(const node* begin) : current(begin) {} const_iterator(node* begin) : current(begin) {}
const_iterator& operator++() { const_iterator& operator++() {
this->current = this->current->x4_next; this->current = this->current->x4_next;
return *this; return *this;
@ -109,13 +108,13 @@ public:
bool operator==(const const_iterator& other) const { return current == other.current; } bool operator==(const const_iterator& other) const { return current == other.current; }
bool operator!=(const const_iterator& other) const { return current != other.current; } bool operator!=(const const_iterator& other) const { return current != other.current; }
const node* get_node() const { return current; } node* get_node() const { return current; }
protected: protected:
const node* current; node* current;
}; };
class iterator : const_iterator { class iterator : public const_iterator {
public: public:
typedef T* value_type; typedef T* value_type;
@ -140,14 +139,9 @@ public:
T* operator->() const { return current->get_value(); } T* operator->() const { return current->get_value(); }
bool operator==(const iterator& other) const { return current == other.current; } bool operator==(const iterator& other) const { return current == other.current; }
bool operator!=(const iterator& other) const { return current != other.current; } bool operator!=(const iterator& other) const { return current != other.current; }
node* get_node() const { return current; }
protected:
node* current;
}; };
private: public:
Alloc x0_allocator; Alloc x0_allocator;
node* x4_start; node* x4_start;
node* x8_end; node* x8_end;