#pragma once
const int PSID_MIN_HEADER_LENGTH = 118; const int PSID_MAX_HEADER_LENGTH = 124;
enum {
PSID_ID = 0, PSID_VERSION = 4, PSID_LENGTH = 6, PSID_START = 8, PSID_INIT = 10, PSID_MAIN = 12, PSID_NUMBER = 14, PSID_DEFSONG = 16, PSID_SPEED = 18, PSID_NAME = 22, PSID_AUTHOR = 54, PSID_COPYRIGHT = 86, PSID_FLAGS = 118, PSID_RESERVED = 120
};
struct PsidHeader {
std::string fileName;
unsigned int tracks;
unsigned int initAddress;
unsigned int replayAddress;
unsigned int loadAddress;
unsigned int defaultTune;
char title[512];
char author[512];
char copyright[512];
char model[32];
unsigned int type;
std::string typeName;
unsigned int version;
unsigned int current;
unsigned char *playerCode;
unsigned int *playerLength;
};
inline unsigned short readPsid16(const unsigned char *p, int offset)
{
return (p[offset] << 8) | p[offset + 1];
}
inline unsigned int readPsid32(const unsigned char *p, int offset)
{
return (p[offset] << 24) | (p[offset + 1] << 16) | (p[offset + 2] << 8) | p[offset + 3];
}
extern bool psidChangeTrack(int direction);
extern void printPsidInfo(PsidHeader &psidHdr_);
extern PsidHeader &getPsidHeader();
extern void getPsidProperties(PsidHeader &psidHdr_, char *text);