SpaceCadetPinball/SpaceCadetPinball/partman.h

74 lines
1.3 KiB
C
Raw Permalink Normal View History

2020-10-18 17:08:41 +02:00
#pragma once
struct zmap_header_type;
struct gdrv_bitmap8;
2020-10-24 17:30:45 +02:00
2021-01-28 16:01:26 +01:00
enum class bmp8Flags : unsigned char
{
RawBmpUnaligned = 1 << 0,
DibBitmap = 1 << 1,
Spliced = 1 << 2,
2021-01-28 16:01:26 +01:00
};
#pragma pack(push, 1)
2020-10-24 17:30:45 +02:00
struct datFileHeader
2020-10-18 17:08:41 +02:00
{
char FileSignature[21];
char AppName[50];
char Description[100];
int FileSize;
unsigned short NumberOfGroups;
int SizeOfBody;
unsigned short Unknown;
};
2020-10-24 17:30:45 +02:00
struct dat8BitBmpHeader
2020-10-18 17:08:41 +02:00
{
uint8_t Resolution;
int16_t Width;
int16_t Height;
int16_t XPosition;
int16_t YPosition;
2020-10-24 17:30:45 +02:00
int Size;
2021-01-28 16:01:26 +01:00
bmp8Flags Flags;
bool IsFlagSet(bmp8Flags flag) const
2021-01-28 16:01:26 +01:00
{
return static_cast<char>(Flags) & static_cast<char>(flag);
}
2020-10-18 17:08:41 +02:00
};
struct dat16BitBmpHeader
{
int16_t Width;
int16_t Height;
int16_t Stride;
int Unknown0;
int16_t Unknown1_0;
int16_t Unknown1_1;
};
#pragma pack(pop)
static_assert(sizeof(dat8BitBmpHeader) == 14, "Wrong size of dat8BitBmpHeader");
static_assert(sizeof(datFileHeader) == 183, "Wrong size of datFileHeader");
static_assert(sizeof(dat16BitBmpHeader) == 14, "Wrong size of zmap_header_type");
2020-10-18 17:08:41 +02:00
class partman
{
public:
static class DatFile* load_records(LPCSTR lpFileName, bool fullTiltMode);
2020-10-18 17:08:41 +02:00
private:
static short _field_size[];
template <typename T>
static T LRead(FILE* file)
{
T Buffer{};
fread(&Buffer, 1, sizeof(T), file);
return Buffer;
}
2020-10-18 17:08:41 +02:00
};