Mercurial > hg > sidinfo
diff sidlib.h @ 70:4779bbec2f28
Split some functionality into sidlib.[ch].
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Fri, 01 Jan 2016 03:32:42 +0200 |
parents | |
children | d5a34a3a602d |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sidlib.h Fri Jan 01 03:32:42 2016 +0200 @@ -0,0 +1,71 @@ +/* + * SIDInfoLib - Way too simplistic PSID/RSID file library + * Written by Matti 'ccr' Hämäläinen <ccr@tnsp.org> + * (C) Copyright 2014-2015 Tecnic Software productions (TNSP) + */ +#ifndef SIDLIB_H +#define SIDLIB_H 1 + +#include "th_util.h" +#include "th_crypto.h" + + +// Some constants +#define PSID_MAGIC_LEN 4 +#define PSID_STR_LEN 32 +#define PSID_BUFFER_SIZE (1024 * 16) + + +typedef struct +{ + char magic[PSID_MAGIC_LEN + 1]; // "PSID" / "RSID" magic identifier + uint16_t + version, // Version number + dataOffset, // Start of actual c64 data in file + loadAddress, // Loading address + initAddress, // Initialization address + playAddress, // Play one frame + nSongs, // Number of subsongs + startSong; // Default starting song + uint32_t speed; // Speed + char sidName[PSID_STR_LEN + 1]; // Descriptive text-fields, ASCIIZ + char sidAuthor[PSID_STR_LEN + 1]; + char sidCopyright[PSID_STR_LEN + 1]; + + // PSIDv2 data + uint16_t flags; // Flags + uint8_t startPage, pageLength; + uint16_t reserved; + + // Extra data + BOOL isRSID; + size_t dataSize; // Total size of data - header + th_md5hash_t hash; // Songlength database hash + +} PSIDHeader; + + +enum +{ + PSF_PLAYER_TYPE = 0x0001, // 0 = built-in, 1 = Compute! SIDPlayer MUS + PSF_PLAYSID_TUNE = 0x0002, // 0 = Real C64-compatible, 1 = PlaySID specific (v2NG) + + PSF_CLOCK_UNKNOWN = 0x0000, // Video standard used (v2NG) + PSF_CLOCK_PAL = 0x0004, + PSF_CLOCK_NTSC = 0x0008, + PSF_CLOCK_ANY = 0x000c, + PSF_CLOCK_MASK = 0x000c, + + PSF_MODEL_UNKNOWN = 0x0000, // SID model (v2NG) + PSF_MODEL_MOS6581 = 0x0010, + PSF_MODEL_MOS8580 = 0x0020, + PSF_MODEL_ANY = 0x0030, + PSF_MODEL_MASK = 0x0030, +}; + +int siReadPSIDFile(FILE *inFile, PSIDHeader *psid); +const char *siGetSIDClockStr(const int flags); +const char *siGetSIDModelStr(const int flags); + + +#endif // SIDLIB_H