You've already forked PrimeRemasterStructs
mirror of
https://github.com/PrimeDecomp/PrimeRemasterStructs.git
synced 2026-03-31 14:23:23 -07:00
86 lines
1.4 KiB
Plaintext
86 lines
1.4 KiB
Plaintext
#ifndef _COMMON
|
|
#define _COMMON
|
|
|
|
typedef uchar bool;
|
|
|
|
typedef struct
|
|
{
|
|
string text;
|
|
} CString <bgcolor=0xCDE6FF, read=StringRead>;
|
|
|
|
typedef struct
|
|
{
|
|
uint size;
|
|
char text[size];
|
|
} CStringFixed <bgcolor=0xCDE6FF, read=StringReadFixed>;
|
|
|
|
string StringRead(CString &str)
|
|
{
|
|
return str.text;
|
|
}
|
|
|
|
string StringReadFixed(CStringFixed &str)
|
|
{
|
|
return str.text;
|
|
}
|
|
|
|
typedef char FourCC[4] <fgcolor=cLtGreen>;
|
|
|
|
FourCC FourCCInt(uint32 in)
|
|
{
|
|
FourCC fcc;
|
|
fcc[0] = (in >> 24) & 0xFF;
|
|
fcc[1] = (in >> 16) & 0xFF;
|
|
fcc[2] = (in >> 8) & 0xFF;
|
|
fcc[3] = (in >> 0) & 0xFF;
|
|
return fcc;
|
|
}
|
|
|
|
string FormatBytes(uint64 size)
|
|
{
|
|
byte order = 0;
|
|
while (size >= 1024 && order < 5)
|
|
{
|
|
order++;
|
|
size /= 1024;
|
|
}
|
|
string suffix;
|
|
switch (order)
|
|
{
|
|
case 0:
|
|
suffix = "";
|
|
break;
|
|
case 1:
|
|
suffix = " KiB";
|
|
break;
|
|
case 2:
|
|
suffix = " MiB";
|
|
break;
|
|
case 3:
|
|
suffix = " GiB";
|
|
break;
|
|
case 4:
|
|
suffix = " TiB";
|
|
break;
|
|
}
|
|
return Str("%d%s", size, suffix);
|
|
}
|
|
|
|
string SizeComment(uint64 size)
|
|
{
|
|
return Str("Size: %s (0x%X)", FormatBytes(size), size);
|
|
}
|
|
|
|
local GUID GUIDZero <hidden=true>;
|
|
|
|
typedef enum <byte>
|
|
{
|
|
NONE = 0x0,
|
|
LZSS_8 = 0x1,
|
|
LZSS_16 = 0x2,
|
|
LZSS_32 = 0x3,
|
|
ZLIB = 0xD,
|
|
} CompressionType;
|
|
|
|
#endif// _COMMON
|