libsidplayfp  0.3.5
SidUsage.h
1 /***************************************************************************
2  SidUsage.h - sidusage file support
3  -------------------
4  begin : Tues Nov 19 2002
5  copyright : (C) 2002 by Simon White
6  email : sidplay2@yahoo.com
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef _SidUsage_h_
19 #define _SidUsage_h_
20 
21 #include "sidplayfp/sidusage.h"
22 #include "SidTuneMod.h"
23 
24 struct SidTuneInfo;
25 
29 struct sid2_usage_t: public sid_usage_t
30 {
31  uint_least16_t start;
32  uint_least16_t end;
33  char md5[SIDTUNE_MD5_LENGTH + 1];
34  uint_least16_t length;
35 
38  {
39  *((sid_usage_t *) this) = usage;
40  return *this;
41  }
42 };
43 
47 class SID_EXTERN SidUsage
48 {
49 private:
50  char m_decodeMAP[0x100][3];
51  // Ignore errors
52  uint_least8_t m_filterMAP[0x10000];
53 
54 protected:
55  bool m_status;
56  const char *m_errorString;
57 
58 private:
59  // Old obsolete MM file format
60  bool readMM (FILE *file, sid2_usage_t &usage, const char *ext);
61  // Sid Memory Map (MM file)
62  bool readSMM (FILE *file, sid2_usage_t &usage, const char *ext);
63  void writeSMM (FILE *file, const sid2_usage_t &usage);
64  void writeMAP (FILE *file, const sid2_usage_t &usage);
65  void filterMAP (int from, int to, uint_least8_t mask);
66 
67 public:
68  SidUsage ();
69 
70  // @FIXME@ add ext to these
71  void read (const char *filename, sid2_usage_t &usage);
72  void write (const char *filename, const sid2_usage_t &usage);
73  const char * error (void) { return m_errorString; }
74 
75  operator bool () { return m_status; }
76 };
77 
78 #endif // _SidUsage_h_