Refactor, annotations

This commit is contained in:
Christian Semmler 2024-01-19 15:16:15 -05:00
parent 751576a246
commit 21e81e944e
2 changed files with 21 additions and 22 deletions

View File

@ -11,13 +11,14 @@
#pragma warning(disable : 4237) #pragma warning(disable : 4237)
// SIZE 0x14
struct GifData { struct GifData {
public: public:
char* m_name; char* m_name; // 0x00
LPDIRECTDRAWSURFACE m_surface; LPDIRECTDRAWSURFACE m_surface; // 0x04
LPDIRECTDRAWPALETTE m_palette; LPDIRECTDRAWPALETTE m_palette; // 0x08
LPDIRECT3DRMTEXTURE2 m_texture; LPDIRECT3DRMTEXTURE2 m_texture; // 0x0c
MxU8* m_data; MxU8* m_data; // 0x10
~GifData(); ~GifData();
}; };
@ -26,6 +27,7 @@ struct GifMapComparator {
bool operator()(const char* const& p_key0, const char* const& p_key1) const { return strcmp(p_key0, p_key1) > 0; } bool operator()(const char* const& p_key0, const char* const& p_key1) const { return strcmp(p_key0, p_key1) > 0; }
}; };
// SIZE 0x10
class GifMap : public map<const char*, GifData*, GifMapComparator> { class GifMap : public map<const char*, GifData*, GifMapComparator> {
// SYNTHETIC: LEGO1 0x1005a400 // SYNTHETIC: LEGO1 0x1005a400
// GifMap::~GifMap // GifMap::~GifMap
@ -34,6 +36,7 @@ class GifMap : public map<const char*, GifData*, GifMapComparator> {
typedef list<GifData*> GifList; typedef list<GifData*> GifList;
// VTABLE: LEGO1 0x100d86d4 // VTABLE: LEGO1 0x100d86d4
// SIZE 0x18
class GifManagerBase { class GifManagerBase {
public: public:
// FUNCTION: LEGO1 0x1005b660 // FUNCTION: LEGO1 0x1005b660
@ -65,11 +68,12 @@ class GifManagerBase {
// GifManagerBase::`scalar deleting destructor' // GifManagerBase::`scalar deleting destructor'
protected: protected:
MxBool m_ownership; MxBool m_ownership; // 0x04
GifMap m_map; GifMap m_map; // 0x08
}; };
// VTABLE: LEGO1 0x100d86fc // VTABLE: LEGO1 0x100d86fc
// SIZE 0x24
class GifManager : public GifManagerBase { class GifManager : public GifManagerBase {
public: public:
GifManager() { m_ownership = TRUE; }; GifManager() { m_ownership = TRUE; };
@ -81,7 +85,7 @@ class GifManager : public GifManagerBase {
void FUN_10099cc0(GifData* p_data); void FUN_10099cc0(GifData* p_data);
protected: protected:
GifList m_list; GifList m_list; // 0x18
}; };
// TEMPLATE: LEGO1 0x10059c50 // TEMPLATE: LEGO1 0x10059c50

View File

@ -46,21 +46,16 @@ void GifManager::FUN_10099cc0(GifData* p_data)
#else #else
for (GifList::iterator it = m_list.begin(); it != m_list.end(); it++) { for (GifList::iterator it = m_list.begin(); it != m_list.end(); it++) {
#endif #endif
if (*it == p_data) if (*it == p_data) {
goto found; // TODO: This is wrong, but what is at +0xc on the iterator?
} *it = NULL;
// TODO: Maybe a function from <algorithm> would make this more idiomatic if (p_data->m_texture->Release() == TRUE) {
// and not require a goto? This is not the only place where we iterate on delete p_data;
// a <list> and return early if there is no match. m_list.erase(it);
return; }
found: return;
// 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);
} }
} }