GifManager: use STL members (#460)

* Truncate symbol names to 255 characters when matching

* GifManager refactor

* Refactor, annotations

---------

Co-authored-by: Christian Semmler <mail@csemmler.com>
This commit is contained in:
MS
2024-01-19 15:23:12 -05:00
committed by GitHub
parent 35e5a62ff7
commit ee7241f73d
4 changed files with 158 additions and 58 deletions

View File

@@ -1,32 +1,61 @@
#include "gifmanager.h"
DECOMP_SIZE_ASSERT(GifData, 0x14);
DECOMP_SIZE_ASSERT(GifMapEntry, 0x14);
DECOMP_SIZE_ASSERT(GifMap, 0x08);
DECOMP_SIZE_ASSERT(GifManagerBase, 0x14);
DECOMP_SIZE_ASSERT(GifManager, 0x30);
DECOMP_SIZE_ASSERT(GifMap, 0x10);
DECOMP_SIZE_ASSERT(GifManagerBase, 0x18);
DECOMP_SIZE_ASSERT(GifManager, 0x24);
// GLOBAL: LEGO1 0x100f0100
GifMapEntry* g_unk0x100f0100;
// FUNCTION: LEGO1 0x10001cc0
GifMapEntry* GifMap::FindNode(const char*& p_string)
// FUNCTION: LEGO1 0x10065c00
GifData::~GifData()
{
GifMapEntry* ret = m_unk0x4;
GifMapEntry* current = ret->m_parent;
while (current != g_unk0x100f0100) {
if (strcmp(current->m_key, p_string) <= 0) {
ret = current;
current = current->m_right;
}
else
current = current->m_left;
if (m_name) {
delete[] m_name;
m_name = NULL;
}
if (m_palette) {
m_palette->Release();
m_palette = NULL;
}
if (m_surface) {
m_surface->Release();
m_surface = NULL;
}
if (m_texture) {
m_texture->Release();
m_texture = NULL;
}
return ret;
}
// STUB: LEGO1 0x10099870
// FUNCTION: LEGO1 0x10099870
GifManager::~GifManager()
{
// TODO
}
// FUNCTION: LEGO1 0x10099cc0
void GifManager::FUN_10099cc0(GifData* p_data)
{
if (p_data == NULL)
return;
#ifdef COMPAT_MODE
GifList::iterator it;
for (it = m_list.begin(); it != m_list.end(); it++) {
#else
for (GifList::iterator it = m_list.begin(); it != m_list.end(); it++) {
#endif
if (*it == p_data) {
// TODO: This is wrong, but what is at +0xc on the iterator?
*it = NULL;
if (p_data->m_texture->Release() == TRUE) {
delete p_data;
m_list.erase(it);
}
return;
}
}
}

View File

@@ -227,8 +227,7 @@ void Score::VTable0x68(MxBool p_add)
// FUNCTION: LEGO1 0x100019d0
void Score::Paint()
{
GifManager* gm = GetGifManager();
GifData* gd = gm->Get("bigcube.gif");
GifData* gd = GetGifManager()->Get("bigcube.gif");
if (gd) {
RaceState* l78 = (RaceState*) GameState()->GetState("JetskiRaceState");