mirror of
https://github.com/isledecomp/isle.git
synced 2026-01-28 10:41:15 +00:00
LegoTexturePresenter::Read
This commit is contained in:
parent
fb800db862
commit
4f888b601e
@ -1,8 +1,8 @@
|
|||||||
#ifndef ACT1STATE_H
|
#ifndef ACT1STATE_H
|
||||||
#define ACT1STATE_H
|
#define ACT1STATE_H
|
||||||
|
|
||||||
|
#include "legonamedtexture.h"
|
||||||
#include "legostate.h"
|
#include "legostate.h"
|
||||||
#include "legoutil.h"
|
|
||||||
#include "roi/legoroi.h"
|
#include "roi/legoroi.h"
|
||||||
|
|
||||||
// VTABLE: LEGO1 0x100d7028
|
// VTABLE: LEGO1 0x100d7028
|
||||||
@ -84,39 +84,39 @@ class Act1State : public LegoState {
|
|||||||
protected:
|
protected:
|
||||||
MxS32* m_unk0x008; // 0x008
|
MxS32* m_unk0x008; // 0x008
|
||||||
// FIXME: count for m_unk0x008
|
// FIXME: count for m_unk0x008
|
||||||
MxS16 m_unk0x00c; // 0x00c
|
MxS16 m_unk0x00c; // 0x00c
|
||||||
undefined2 m_unk0x00e; // 0x00e
|
undefined2 m_unk0x00e; // 0x00e
|
||||||
undefined2 m_unk0x010; // 0x010
|
undefined2 m_unk0x010; // 0x010
|
||||||
undefined m_unk0x012; // 0x012
|
undefined m_unk0x012; // 0x012
|
||||||
MxS32 m_unk0x014; // 0x014
|
MxS32 m_unk0x014; // 0x014
|
||||||
MxU32 m_unk0x018; // 0x018
|
MxU32 m_unk0x018; // 0x018
|
||||||
MxU16 m_unk0x01c; // 0x01c
|
MxU16 m_unk0x01c; // 0x01c
|
||||||
undefined m_unk0x01e; // 0x01e
|
undefined m_unk0x01e; // 0x01e
|
||||||
undefined m_unk0x01f; // 0x01f
|
undefined m_unk0x01f; // 0x01f
|
||||||
undefined m_unk0x020; // 0x020
|
undefined m_unk0x020; // 0x020
|
||||||
undefined m_unk0x021; // 0x021
|
undefined m_unk0x021; // 0x021
|
||||||
undefined m_unk0x022; // 0x022
|
undefined m_unk0x022; // 0x022
|
||||||
undefined m_unk0x023; // 0x023
|
undefined m_unk0x023; // 0x023
|
||||||
NamedPlane m_unk0x024; // 0x024
|
NamedPlane m_unk0x024; // 0x024
|
||||||
NamedPlane m_unk0x070; // 0x070
|
NamedPlane m_unk0x070; // 0x070
|
||||||
NamedPlane m_unk0x0bc; // 0x0bc
|
NamedPlane m_unk0x0bc; // 0x0bc
|
||||||
NamedPlane m_unk0x108; // 0x108
|
NamedPlane m_unk0x108; // 0x108
|
||||||
NamedTexture* m_unk0x154; // 0x154
|
LegoNamedTexture* m_unk0x154; // 0x154
|
||||||
NamedTexture* m_unk0x158; // 0x158
|
LegoNamedTexture* m_unk0x158; // 0x158
|
||||||
NamedTexture* m_unk0x15c; // 0x15c
|
LegoNamedTexture* m_unk0x15c; // 0x15c
|
||||||
MxCore* m_unk0x160; // 0x160
|
MxCore* m_unk0x160; // 0x160
|
||||||
NamedPlane m_unk0x164; // 0x164
|
NamedPlane m_unk0x164; // 0x164
|
||||||
NamedTexture* m_unk0x1b0; // 0x1b0
|
LegoNamedTexture* m_unk0x1b0; // 0x1b0
|
||||||
NamedTexture* m_unk0x1b4; // 0x1b4
|
LegoNamedTexture* m_unk0x1b4; // 0x1b4
|
||||||
MxCore* m_unk0x1b8; // 0x1b8
|
MxCore* m_unk0x1b8; // 0x1b8
|
||||||
NamedPlane m_unk0x1bc; // 0x1bc
|
NamedPlane m_unk0x1bc; // 0x1bc
|
||||||
NamedTexture* m_unk0x208; // 0x208
|
LegoNamedTexture* m_unk0x208; // 0x208
|
||||||
MxCore* m_unk0x20c; // 0x20c
|
MxCore* m_unk0x20c; // 0x20c
|
||||||
NamedPlane m_unk0x210; // 0x210
|
NamedPlane m_unk0x210; // 0x210
|
||||||
NamedTexture* m_unk0x25c; // 0x25c
|
LegoNamedTexture* m_unk0x25c; // 0x25c
|
||||||
NamedTexture* m_unk0x260; // 0x260
|
LegoNamedTexture* m_unk0x260; // 0x260
|
||||||
NamedTexture* m_unk0x264; // 0x264
|
LegoNamedTexture* m_unk0x264; // 0x264
|
||||||
MxCore* m_unk0x268; // 0x268
|
MxCore* m_unk0x268; // 0x268
|
||||||
};
|
};
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x10033a70
|
// FUNCTION: LEGO1 0x10033a70
|
||||||
|
|||||||
27
LEGO1/lego/legoomni/include/legonamedtexture.h
Normal file
27
LEGO1/lego/legoomni/include/legonamedtexture.h
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
#ifndef LEGONAMEDTEXTURE_H
|
||||||
|
#define LEGONAMEDTEXTURE_H
|
||||||
|
|
||||||
|
#include "misc/legotexture.h"
|
||||||
|
#include "mxstring.h"
|
||||||
|
|
||||||
|
// SIZE 0x14
|
||||||
|
class LegoNamedTexture {
|
||||||
|
public:
|
||||||
|
LegoNamedTexture(const char* p_textureName, LegoTexture* p_texture)
|
||||||
|
{
|
||||||
|
m_name = p_textureName;
|
||||||
|
m_texture = p_texture;
|
||||||
|
}
|
||||||
|
~LegoNamedTexture() { delete m_texture; }
|
||||||
|
|
||||||
|
// FUNCTION: LEGO1 0x1003f920
|
||||||
|
const MxString* GetName() const { return &m_name; }
|
||||||
|
|
||||||
|
LegoTexture* GetTexture() { return m_texture; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
MxString m_name; // 0x00
|
||||||
|
LegoTexture* m_texture; // 0x04
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // LEGONAMEDTEXTURE_H
|
||||||
53
LEGO1/lego/legoomni/include/legonamedtexturelist.h
Normal file
53
LEGO1/lego/legoomni/include/legonamedtexturelist.h
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
#ifndef LEGONAMEDTEXTURELIST_H
|
||||||
|
#define LEGONAMEDTEXTURELIST_H
|
||||||
|
|
||||||
|
#include "legonamedtexture.h"
|
||||||
|
#include "mxlist.h"
|
||||||
|
|
||||||
|
// VTABLE: LEGO1 0x100d8110
|
||||||
|
// class MxCollection<LegoNamedTexture *>
|
||||||
|
|
||||||
|
// VTABLE: LEGO1 0x100d8128
|
||||||
|
// class MxList<LegoNamedTexture *>
|
||||||
|
|
||||||
|
// VTABLE: LEGO1 0x100d8140
|
||||||
|
// class MxPtrList<LegoNamedTexture>
|
||||||
|
|
||||||
|
// VTABLE: LEGO1 0x100d8158
|
||||||
|
// SIZE 0x18
|
||||||
|
class LegoNamedTextureList : public MxPtrList<LegoNamedTexture> {
|
||||||
|
public:
|
||||||
|
LegoNamedTextureList() : MxPtrList<LegoNamedTexture>(TRUE) {}
|
||||||
|
|
||||||
|
// SYNTHETIC: LEGO1 0x1004f040
|
||||||
|
// LegoNamedTextureList::`scalar deleting destructor'
|
||||||
|
};
|
||||||
|
|
||||||
|
// TEMPLATE: LEGO1 0x1004eec0
|
||||||
|
// MxCollection<LegoNamedTexture *>::Compare
|
||||||
|
|
||||||
|
// TEMPLATE: LEGO1 0x1004eed0
|
||||||
|
// MxCollection<LegoNamedTexture *>::~MxCollection<LegoNamedTexture *>
|
||||||
|
|
||||||
|
// TEMPLATE: LEGO1 0x1004ef20
|
||||||
|
// MxCollection<LegoNamedTexture *>::Destroy
|
||||||
|
|
||||||
|
// TEMPLATE: LEGO1 0x1004ef30
|
||||||
|
// MxList<LegoNamedTexture *>::~MxList<LegoNamedTexture *>
|
||||||
|
|
||||||
|
// TEMPLATE: LEGO1 0x1004efc0
|
||||||
|
// MxPtrList<LegoNamedTexture>::Destroy
|
||||||
|
|
||||||
|
// TEMPLATE: LEGO1 0x1004f0b0
|
||||||
|
// MxPtrList<LegoNamedTexture>::~MxPtrList<LegoNamedTexture>
|
||||||
|
|
||||||
|
// SYNTHETIC: LEGO1 0x1004f100
|
||||||
|
// MxCollection<LegoNamedTexture *>::`scalar deleting destructor'
|
||||||
|
|
||||||
|
// SYNTHETIC: LEGO1 0x1004f170
|
||||||
|
// MxList<LegoNamedTexture *>::`scalar deleting destructor'
|
||||||
|
|
||||||
|
// SYNTHETIC: LEGO1 0x1004f220
|
||||||
|
// MxPtrList<LegoNamedTexture>::`scalar deleting destructor'
|
||||||
|
|
||||||
|
#endif // LEGONAMEDTEXTURELIST_H
|
||||||
@ -1,13 +1,14 @@
|
|||||||
#ifndef LEGOTEXTUREPRESENTER_H
|
#ifndef LEGOTEXTUREPRESENTER_H
|
||||||
#define LEGOTEXTUREPRESENTER_H
|
#define LEGOTEXTUREPRESENTER_H
|
||||||
|
|
||||||
|
#include "legonamedtexturelist.h"
|
||||||
#include "mxmediapresenter.h"
|
#include "mxmediapresenter.h"
|
||||||
|
|
||||||
// VTABLE: LEGO1 0x100d4d90
|
// VTABLE: LEGO1 0x100d4d90
|
||||||
// SIZE 0x54 (from inlined construction at 0x10009bb5)
|
// SIZE 0x54 (from inlined construction at 0x10009bb5)
|
||||||
class LegoTexturePresenter : public MxMediaPresenter {
|
class LegoTexturePresenter : public MxMediaPresenter {
|
||||||
public:
|
public:
|
||||||
LegoTexturePresenter() : m_textureData(NULL) {}
|
LegoTexturePresenter() : m_textures(NULL) {}
|
||||||
~LegoTexturePresenter() override;
|
~LegoTexturePresenter() override;
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x1000ce50
|
// FUNCTION: LEGO1 0x1000ce50
|
||||||
@ -34,7 +35,7 @@ class LegoTexturePresenter : public MxMediaPresenter {
|
|||||||
void FUN_1004f290();
|
void FUN_1004f290();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
MxDSChunk* m_textureData; // 0x54
|
LegoNamedTextureList* m_textures; // 0x50
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // LEGOTEXTUREPRESENTER_H
|
#endif // LEGOTEXTUREPRESENTER_H
|
||||||
|
|||||||
@ -13,23 +13,7 @@
|
|||||||
class MxAtomId;
|
class MxAtomId;
|
||||||
class LegoEntity;
|
class LegoEntity;
|
||||||
class LegoAnimPresenter;
|
class LegoAnimPresenter;
|
||||||
|
class LegoNamedTexture;
|
||||||
class LegoTexture;
|
|
||||||
|
|
||||||
// SIZE 0x14
|
|
||||||
class NamedTexture {
|
|
||||||
public:
|
|
||||||
~NamedTexture() { delete m_texture; }
|
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x1003f920
|
|
||||||
const MxString* GetName() const { return &m_name; }
|
|
||||||
|
|
||||||
LegoTexture* GetTexture() { return m_texture; }
|
|
||||||
|
|
||||||
private:
|
|
||||||
MxString m_name; // 0x00
|
|
||||||
LegoTexture* m_texture; // 0x04
|
|
||||||
};
|
|
||||||
|
|
||||||
void FUN_1003e050(LegoAnimPresenter* p_presenter);
|
void FUN_1003e050(LegoAnimPresenter* p_presenter);
|
||||||
Extra::ActionType MatchActionString(const char*);
|
Extra::ActionType MatchActionString(const char*);
|
||||||
@ -42,9 +26,9 @@ void SetAppCursor(WPARAM p_wparam);
|
|||||||
MxBool FUN_1003ef60();
|
MxBool FUN_1003ef60();
|
||||||
MxBool RemoveFromWorld(MxAtomId& p_atomId1, MxS32 p_id1, MxAtomId& p_atomId2, MxS32 p_id2);
|
MxBool RemoveFromWorld(MxAtomId& p_atomId1, MxS32 p_id1, MxAtomId& p_atomId2, MxS32 p_id2);
|
||||||
void SetLightPosition(MxU32);
|
void SetLightPosition(MxU32);
|
||||||
NamedTexture* ReadNamedTexture(LegoFile* p_file);
|
LegoNamedTexture* ReadNamedTexture(LegoFile* p_file);
|
||||||
void FUN_1003f540(LegoFile* p_file, const char* p_filename);
|
void FUN_1003f540(LegoFile* p_file, const char* p_filename);
|
||||||
void WriteNamedTexture(LegoFile* p_file, NamedTexture* p_texture);
|
void WriteNamedTexture(LegoFile* p_file, LegoNamedTexture* p_texture);
|
||||||
|
|
||||||
// SYNTHETIC: LEGO1 0x10034b40
|
// SYNTHETIC: LEGO1 0x10034b40
|
||||||
// LegoTexture::`scalar deleting destructor'
|
// LegoTexture::`scalar deleting destructor'
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
#include "act1state.h"
|
#include "act1state.h"
|
||||||
|
|
||||||
|
#include "legoutil.h"
|
||||||
|
|
||||||
DECOMP_SIZE_ASSERT(Act1State, 0x26c)
|
DECOMP_SIZE_ASSERT(Act1State, 0x26c)
|
||||||
DECOMP_SIZE_ASSERT(Act1State::NamedPlane, 0x4c)
|
DECOMP_SIZE_ASSERT(Act1State::NamedPlane, 0x4c)
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
#include "legoutil.h"
|
#include "legoutil.h"
|
||||||
|
|
||||||
#include "legoinputmanager.h"
|
#include "legoinputmanager.h"
|
||||||
|
#include "legonamedtexture.h"
|
||||||
#include "legoomni.h"
|
#include "legoomni.h"
|
||||||
#include "legoworld.h"
|
#include "legoworld.h"
|
||||||
#include "legoworldlist.h"
|
#include "legoworldlist.h"
|
||||||
@ -13,8 +14,6 @@
|
|||||||
#include <process.h>
|
#include <process.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
DECOMP_SIZE_ASSERT(NamedTexture, 0x14)
|
|
||||||
|
|
||||||
// STUB: LEGO1 0x1003e050
|
// STUB: LEGO1 0x1003e050
|
||||||
void FUN_1003e050(LegoAnimPresenter* p_presenter)
|
void FUN_1003e050(LegoAnimPresenter* p_presenter)
|
||||||
{
|
{
|
||||||
@ -297,7 +296,7 @@ void SetLightPosition(MxU32)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// STUB: LEGO1 0x1003f3b0
|
// STUB: LEGO1 0x1003f3b0
|
||||||
NamedTexture* ReadNamedTexture(LegoFile* p_file)
|
LegoNamedTexture* ReadNamedTexture(LegoFile* p_file)
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -308,7 +307,7 @@ void FUN_1003f540(LegoFile* p_file, const char* p_filename)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x1003f8a0
|
// FUNCTION: LEGO1 0x1003f8a0
|
||||||
void WriteNamedTexture(LegoFile* p_file, NamedTexture* p_texture)
|
void WriteNamedTexture(LegoFile* p_file, LegoNamedTexture* p_texture)
|
||||||
{
|
{
|
||||||
p_file->FUN_10006030(*p_texture->GetName());
|
p_file->FUN_10006030(*p_texture->GetName());
|
||||||
p_texture->GetTexture()->Write(p_file);
|
p_texture->GetTexture()->Write(p_file);
|
||||||
|
|||||||
@ -2,9 +2,12 @@
|
|||||||
|
|
||||||
#include "legoomni.h"
|
#include "legoomni.h"
|
||||||
#include "legovideomanager.h"
|
#include "legovideomanager.h"
|
||||||
|
#include "misc/legostorage.h"
|
||||||
#include "mxcompositepresenter.h"
|
#include "mxcompositepresenter.h"
|
||||||
|
|
||||||
DECOMP_SIZE_ASSERT(LegoTexturePresenter, 0x54)
|
DECOMP_SIZE_ASSERT(LegoTexturePresenter, 0x54)
|
||||||
|
DECOMP_SIZE_ASSERT(LegoNamedTexture, 0x14)
|
||||||
|
DECOMP_SIZE_ASSERT(LegoNamedTextureList, 0x18)
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x1004eb40
|
// FUNCTION: LEGO1 0x1004eb40
|
||||||
LegoTexturePresenter::~LegoTexturePresenter()
|
LegoTexturePresenter::~LegoTexturePresenter()
|
||||||
@ -19,11 +22,62 @@ MxResult LegoTexturePresenter::AddToManager()
|
|||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
// STUB: LEGO1 0x1004ebd0
|
// FUNCTION: LEGO1 0x1004ebd0
|
||||||
MxResult LegoTexturePresenter::Read(MxDSChunk& p_chunk)
|
MxResult LegoTexturePresenter::Read(MxDSChunk& p_chunk)
|
||||||
{
|
{
|
||||||
// TODO
|
MxResult result = FAILURE;
|
||||||
return SUCCESS;
|
LegoMemory storage(p_chunk.GetData());
|
||||||
|
LegoChar* textureName = NULL;
|
||||||
|
LegoS32 hardwareMode = VideoManager()->GetDirect3D()->AssignedDevice()->GetHardwareMode();
|
||||||
|
|
||||||
|
m_textures = new LegoNamedTextureList();
|
||||||
|
|
||||||
|
LegoU32 numTextures, i;
|
||||||
|
if (storage.Read(&numTextures, sizeof(numTextures)) != SUCCESS) {
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < numTextures; i++) {
|
||||||
|
LegoU32 textureNameLength;
|
||||||
|
LegoTexture* texture;
|
||||||
|
LegoNamedTexture* namedTexture;
|
||||||
|
|
||||||
|
if (storage.Read(&textureNameLength, sizeof(textureNameLength)) != SUCCESS) {
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
textureName = new LegoChar[textureNameLength + 1];
|
||||||
|
if (storage.Read(textureName, textureNameLength) != SUCCESS) {
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
textureName[textureNameLength] = '\0';
|
||||||
|
strlwr(textureName);
|
||||||
|
|
||||||
|
texture = new LegoTexture();
|
||||||
|
if (texture->Read(&storage, hardwareMode) != SUCCESS) {
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
namedTexture = new LegoNamedTexture(textureName, texture);
|
||||||
|
m_textures->Append(namedTexture);
|
||||||
|
|
||||||
|
delete[] textureName;
|
||||||
|
textureName = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
result = SUCCESS;
|
||||||
|
|
||||||
|
done:
|
||||||
|
if (textureName != NULL) {
|
||||||
|
delete[] textureName;
|
||||||
|
}
|
||||||
|
if (result != SUCCESS && m_textures != NULL) {
|
||||||
|
delete m_textures;
|
||||||
|
m_textures = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// STUB: LEGO1 0x1004f290
|
// STUB: LEGO1 0x1004f290
|
||||||
|
|||||||
@ -42,6 +42,9 @@ class MxMediaPresenter : public MxPresenter {
|
|||||||
void Enable(MxBool p_enable) override; // vtable+0x54
|
void Enable(MxBool p_enable) override; // vtable+0x54
|
||||||
virtual void LoopChunk(MxStreamChunk* p_chunk); // vtable+0x58
|
virtual void LoopChunk(MxStreamChunk* p_chunk); // vtable+0x58
|
||||||
|
|
||||||
|
MxStreamChunk* CurrentChunk();
|
||||||
|
MxStreamChunk* NextChunk();
|
||||||
|
|
||||||
// SYNTHETIC: LEGO1 0x1000c680
|
// SYNTHETIC: LEGO1 0x1000c680
|
||||||
// MxMediaPresenter::`scalar deleting destructor'
|
// MxMediaPresenter::`scalar deleting destructor'
|
||||||
|
|
||||||
@ -53,10 +56,6 @@ class MxMediaPresenter : public MxPresenter {
|
|||||||
|
|
||||||
void Init();
|
void Init();
|
||||||
void Destroy(MxBool p_fromDestructor);
|
void Destroy(MxBool p_fromDestructor);
|
||||||
|
|
||||||
public:
|
|
||||||
MxStreamChunk* CurrentChunk();
|
|
||||||
MxStreamChunk* NextChunk();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// SYNTHETIC: LEGO1 0x100b46e0
|
// SYNTHETIC: LEGO1 0x100b46e0
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user