mirror of
https://github.com/isledecomp/isle.git
synced 2026-01-28 10:41:15 +00:00
Minor changes
This commit is contained in:
parent
3b159eab86
commit
13f61c7971
@ -98,13 +98,16 @@ LegoResult LegoImage::Read(LegoStorage* p_storage, LegoU32 p_square)
|
||||
if ((result = p_storage->Read(m_bits, m_width * m_height)) != SUCCESS) {
|
||||
return result;
|
||||
}
|
||||
|
||||
if (p_square && m_width != m_height) {
|
||||
LegoU8* newBits;
|
||||
|
||||
if (m_height < m_width) {
|
||||
LegoU32 aspect = m_width / m_height;
|
||||
newBits = new LegoU8[m_width * m_width];
|
||||
LegoU8* src = m_bits;
|
||||
LegoU8* dst = newBits;
|
||||
|
||||
for (LegoU32 row = 0; row < m_height; row++) {
|
||||
for (LegoU32 dup = aspect; dup; dup--) {
|
||||
memcpy(dst, src, m_width);
|
||||
@ -112,6 +115,7 @@ LegoResult LegoImage::Read(LegoStorage* p_storage, LegoU32 p_square)
|
||||
}
|
||||
src += m_width;
|
||||
}
|
||||
|
||||
m_height = m_width;
|
||||
}
|
||||
else {
|
||||
@ -119,20 +123,25 @@ LegoResult LegoImage::Read(LegoStorage* p_storage, LegoU32 p_square)
|
||||
newBits = new LegoU8[m_height * m_height];
|
||||
LegoU8* src = m_bits;
|
||||
LegoU8* dst = newBits;
|
||||
|
||||
for (LegoU32 row = 0; row < m_height; row++) {
|
||||
for (LegoU32 col = 0; col < m_width; col++) {
|
||||
for (LegoU32 dup = aspect; dup; dup--) {
|
||||
*dst = *src;
|
||||
dst++;
|
||||
}
|
||||
|
||||
src++;
|
||||
}
|
||||
}
|
||||
|
||||
m_width = m_height;
|
||||
}
|
||||
|
||||
delete m_bits;
|
||||
m_bits = newBits;
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
|
||||
class LegoStorage;
|
||||
|
||||
// SIZE 0x3
|
||||
class LegoPaletteEntry {
|
||||
public:
|
||||
LegoPaletteEntry();
|
||||
@ -19,11 +20,12 @@ class LegoPaletteEntry {
|
||||
LegoResult Write(LegoStorage* p_storage);
|
||||
|
||||
protected:
|
||||
LegoU8 m_red;
|
||||
LegoU8 m_green;
|
||||
LegoU8 m_blue;
|
||||
LegoU8 m_red; // 0x00
|
||||
LegoU8 m_green; // 0x01
|
||||
LegoU8 m_blue; // 0x02
|
||||
};
|
||||
|
||||
// 0x310
|
||||
class LegoImage {
|
||||
public:
|
||||
LegoImage();
|
||||
@ -42,11 +44,11 @@ class LegoImage {
|
||||
LegoResult Write(LegoStorage* p_storage);
|
||||
|
||||
protected:
|
||||
LegoU32 m_width;
|
||||
LegoU32 m_height;
|
||||
LegoU32 m_count;
|
||||
LegoPaletteEntry m_palette[256];
|
||||
LegoU8* m_bits;
|
||||
LegoU32 m_width; // 0x00
|
||||
LegoU32 m_height; // 0x04
|
||||
LegoU32 m_count; // 0x08
|
||||
LegoPaletteEntry m_palette[256]; // 0x0c
|
||||
LegoU8* m_bits; // 0x30c
|
||||
};
|
||||
|
||||
#endif // __LEGOIMAGE_H
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
|
||||
DECOMP_SIZE_ASSERT(LegoStorage, 0x8);
|
||||
DECOMP_SIZE_ASSERT(LegoMemory, 0x10);
|
||||
DECOMP_SIZE_ASSERT(LegoFile, 0xC);
|
||||
DECOMP_SIZE_ASSERT(LegoFile, 0xc);
|
||||
|
||||
// FUNCTION: LEGO1 0x10099080
|
||||
LegoMemory::LegoMemory(void* p_buffer) : LegoStorage()
|
||||
@ -105,12 +105,12 @@ LegoResult LegoFile::Open(const char* p_name, LegoU32 p_mode)
|
||||
char mode[4];
|
||||
mode[0] = '\0';
|
||||
if (p_mode & c_read) {
|
||||
m_mode = LEGOSTREAM_MODE_READ;
|
||||
m_mode = c_read;
|
||||
strcat(mode, "r");
|
||||
}
|
||||
if (p_mode & c_write) {
|
||||
if (m_mode != LEGOSTREAM_MODE_READ)
|
||||
m_mode = LEGOSTREAM_MODE_WRITE;
|
||||
if (m_mode != c_read)
|
||||
m_mode = c_write;
|
||||
strcat(mode, "w");
|
||||
}
|
||||
if ((p_mode & c_text) != 0)
|
||||
@ -130,6 +130,7 @@ LegoResult LegoMemory::GetPosition(LegoU32& p_position)
|
||||
p_position = m_position;
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100994b0
|
||||
LegoResult LegoMemory::SetPosition(LegoU32 p_position)
|
||||
{
|
||||
|
||||
@ -6,33 +6,41 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#define LEGOSTREAM_MODE_READ 1
|
||||
#define LEGOSTREAM_MODE_WRITE 2
|
||||
|
||||
// VTABLE: LEGO1 0x100d7d80
|
||||
// SIZE 0x08
|
||||
class LegoStorage {
|
||||
public:
|
||||
enum OpenFlags {
|
||||
c_read = 1,
|
||||
c_write = 2,
|
||||
c_text = 4
|
||||
};
|
||||
|
||||
LegoStorage() : m_mode(0) {}
|
||||
|
||||
// FUNCTION: LEGO1 0x10045ad0
|
||||
virtual ~LegoStorage(){};
|
||||
|
||||
virtual LegoResult Read(void* p_buffer, LegoU32 p_size) = 0;
|
||||
virtual LegoResult Write(const void* p_buffer, LegoU32 p_size) = 0;
|
||||
virtual LegoResult GetPosition(LegoU32& p_position) = 0;
|
||||
virtual LegoResult SetPosition(LegoU32 p_position) = 0;
|
||||
|
||||
// FUNCTION: LEGO1 0x10045ae0
|
||||
virtual LegoBool IsWriteMode() { return m_mode == LEGOSTREAM_MODE_WRITE; }
|
||||
virtual LegoBool IsWriteMode() { return m_mode == c_read; }
|
||||
|
||||
// FUNCTION: LEGO1 0x10045af0
|
||||
virtual LegoBool IsReadMode() { return m_mode == LEGOSTREAM_MODE_READ; }
|
||||
virtual LegoBool IsReadMode() { return m_mode == c_write; }
|
||||
|
||||
// SYNTHETIC: LEGO1 0x10045b00
|
||||
// LegoStorage::`scalar deleting destructor'
|
||||
|
||||
protected:
|
||||
LegoU8 m_mode;
|
||||
LegoU8 m_mode; // 0x04
|
||||
};
|
||||
|
||||
// VTABLE: LEGO1 0x100db710
|
||||
// SIZE 0x10
|
||||
class LegoMemory : public LegoStorage {
|
||||
public:
|
||||
LegoMemory(void* p_buffer);
|
||||
@ -45,18 +53,14 @@ class LegoMemory : public LegoStorage {
|
||||
// LegoMemory::`scalar deleting destructor'
|
||||
|
||||
protected:
|
||||
LegoU8* m_buffer;
|
||||
LegoU32 m_position;
|
||||
LegoU8* m_buffer; // 0x04
|
||||
LegoU32 m_position; // 0x08
|
||||
};
|
||||
|
||||
// VTABLE: LEGO1 0x100db730
|
||||
// SIZE 0x0c
|
||||
class LegoFile : public LegoStorage {
|
||||
public:
|
||||
enum OpenFlags {
|
||||
c_read = 1,
|
||||
c_write = 2,
|
||||
c_text = 4
|
||||
};
|
||||
LegoFile();
|
||||
virtual ~LegoFile();
|
||||
virtual LegoResult Read(void* p_buffer, LegoU32 p_size);
|
||||
@ -82,7 +86,7 @@ class LegoFile : public LegoStorage {
|
||||
// LegoFile::`scalar deleting destructor'
|
||||
|
||||
protected:
|
||||
FILE* m_file;
|
||||
FILE* m_file; // 0x08
|
||||
};
|
||||
|
||||
#endif // __LEGOSTORAGE_H
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
class LegoImage;
|
||||
class LegoStorage;
|
||||
|
||||
// SIZE 0x04
|
||||
class LegoTexture {
|
||||
public:
|
||||
LegoTexture();
|
||||
@ -16,7 +17,7 @@ class LegoTexture {
|
||||
LegoResult Write(LegoStorage* p_storage);
|
||||
|
||||
protected:
|
||||
LegoImage* m_image;
|
||||
LegoImage* m_image; // 0x00
|
||||
};
|
||||
|
||||
#endif // __LEGOTEXTURE_H
|
||||
|
||||
Loading…
Reference in New Issue
Block a user