libpsxsave/psxicontool.h

82 lines
1.7 KiB
C
Raw Normal View History

2010-08-10 13:40:01 +00:00
/**
Stores the header data from the first block of
playstation save data
*/
struct PSX_Save_Block_Header {
int block_type;
int save_size;
short next_block;
char territory_code[2];
char license_code[10];
char save_code[8];
char code_end;
char unused[94];
char xor_code;
};
/**
Stores the header data from the first frame of
playstation save data
*/
struct PSX_Save_Header {
char magic_number[2]; //!< "SC"
char icon_display; //!< 17 - static (1 frame), 18 - animated (2 frames), 19 - animated (3 frames)
char blocks_used;
char sjis_save_title[64]; //!< Save title in Shift-JIS character set, kanji only
char padding[28];
char palette[16][2]; //!< Stored as BBBBBGGGGGRRRRR
char icons[3][16][8]; //!< Three icons, sixteen rows of 8 bytes (4 bits per pixel)
};
/**
Structure for holding parsed icon data
*/
struct Icon {
struct _RGB {
int red;
int blue;
int green;
};
_RGB palette[16];
char pixels[16][16];
};
class PSXIconTool {
private:
struct _PSX_Save {
PSX_Save_Block_Header block_header;
PSX_Save_Header save_header;
} PSX_Save;
Icon icon;
char error[2048];
public:
/** Constructor */
PSXIconTool();
/**
* Load an MCS file (raw block data for a single playstation save file)
* @param filename
* @return True on success, False on failure.
* Use errorMessage() to determine the error that occurred upon failure.
*/
bool loadMCS( char* filename );
bool exportXPM( char* filename );
bool exportPCX( char* filename );
Icon *getIcon() { return &icon; }
void printInfo();
/**
*
* @return The message from the last error to occur.
*/
char* errorMessage();
};