annotate sidlib.h @ 367:f73270cabde2

Bump copyright years.
author Matti Hamalainen <ccr@tnsp.org>
date Sat, 02 Jan 2021 11:37:13 +0200
parents 5711c23e40cc
children 22e8ee2df9ac
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
70
4779bbec2f28 Split some functionality into sidlib.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1 /*
4779bbec2f28 Split some functionality into sidlib.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
2 * SIDInfoLib - Way too simplistic PSID/RSID file library
171
d86ade7d0dfd Change copyright blurbs slightly.
Matti Hamalainen <ccr@tnsp.org>
parents: 169
diff changeset
3 * Programmed and designed by Matti 'ccr' Hämäläinen <ccr@tnsp.org>
367
f73270cabde2 Bump copyright years.
Matti Hamalainen <ccr@tnsp.org>
parents: 361
diff changeset
4 * (C) Copyright 2014-2021 Tecnic Software productions (TNSP)
70
4779bbec2f28 Split some functionality into sidlib.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
5 */
4779bbec2f28 Split some functionality into sidlib.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
6 #ifndef SIDLIB_H
4779bbec2f28 Split some functionality into sidlib.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
7 #define SIDLIB_H 1
4779bbec2f28 Split some functionality into sidlib.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
8
4779bbec2f28 Split some functionality into sidlib.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
9 #include "th_util.h"
85
4c0ecb078591 Rename various variables and functions and change relevant places to use the
Matti Hamalainen <ccr@tnsp.org>
parents: 74
diff changeset
10 #include "th_ioctx.h"
70
4779bbec2f28 Split some functionality into sidlib.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
11 #include "th_crypto.h"
224
4bec78f45188 Use th_datastruct::th_llist_t instead of yet another linked list
Matti Hamalainen <ccr@tnsp.org>
parents: 223
diff changeset
12 #include "th_datastruct.h"
70
4779bbec2f28 Split some functionality into sidlib.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
13
85
4c0ecb078591 Rename various variables and functions and change relevant places to use the
Matti Hamalainen <ccr@tnsp.org>
parents: 74
diff changeset
14
72
d5a34a3a602d Add C++ include guards.
Matti Hamalainen <ccr@tnsp.org>
parents: 70
diff changeset
15 #ifdef __cplusplus
d5a34a3a602d Add C++ include guards.
Matti Hamalainen <ccr@tnsp.org>
parents: 70
diff changeset
16 extern "C" {
d5a34a3a602d Add C++ include guards.
Matti Hamalainen <ccr@tnsp.org>
parents: 70
diff changeset
17 #endif
d5a34a3a602d Add C++ include guards.
Matti Hamalainen <ccr@tnsp.org>
parents: 70
diff changeset
18
70
4779bbec2f28 Split some functionality into sidlib.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
19
220
e79a93971d27 Cosmetic reorganization.
Matti Hamalainen <ccr@tnsp.org>
parents: 214
diff changeset
20 //
70
4779bbec2f28 Split some functionality into sidlib.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
21 // Some constants
220
e79a93971d27 Cosmetic reorganization.
Matti Hamalainen <ccr@tnsp.org>
parents: 214
diff changeset
22 //
230
1e860046a4cc Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 227
diff changeset
23 #define SIDLIB_PSID_MAGIC_LEN (4)
1e860046a4cc Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 227
diff changeset
24 #define SIDLIB_PSID_STR_LEN (32)
1e860046a4cc Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 227
diff changeset
25 #define SIDLIB_BUFFER_SIZE (1024 * 16)
86
e1ff9cd27a84 Initial port of songlength database (SLDB) handling code from XMMS-SID to here.
Matti Hamalainen <ccr@tnsp.org>
parents: 85
diff changeset
26
e1ff9cd27a84 Initial port of songlength database (SLDB) handling code from XMMS-SID to here.
Matti Hamalainen <ccr@tnsp.org>
parents: 85
diff changeset
27
220
e79a93971d27 Cosmetic reorganization.
Matti Hamalainen <ccr@tnsp.org>
parents: 214
diff changeset
28 enum
e79a93971d27 Cosmetic reorganization.
Matti Hamalainen <ccr@tnsp.org>
parents: 214
diff changeset
29 {
e79a93971d27 Cosmetic reorganization.
Matti Hamalainen <ccr@tnsp.org>
parents: 214
diff changeset
30 // Player flags
e79a93971d27 Cosmetic reorganization.
Matti Hamalainen <ccr@tnsp.org>
parents: 214
diff changeset
31 PSF_PLAYER_TYPE = 0x01, // 0 = built-in, 1 = Compute! SIDPlayer MUS
e79a93971d27 Cosmetic reorganization.
Matti Hamalainen <ccr@tnsp.org>
parents: 214
diff changeset
32 PSF_PLAYSID_TUNE = 0x02, // 0 = Real C64-compatible, 1 = PlaySID specific (v2NG)
e79a93971d27 Cosmetic reorganization.
Matti Hamalainen <ccr@tnsp.org>
parents: 214
diff changeset
33
e79a93971d27 Cosmetic reorganization.
Matti Hamalainen <ccr@tnsp.org>
parents: 214
diff changeset
34 // Video standard used (v2NG+)
e79a93971d27 Cosmetic reorganization.
Matti Hamalainen <ccr@tnsp.org>
parents: 214
diff changeset
35 PSF_CLOCK_UNKNOWN = 0x00,
e79a93971d27 Cosmetic reorganization.
Matti Hamalainen <ccr@tnsp.org>
parents: 214
diff changeset
36 PSF_CLOCK_PAL = 0x01,
e79a93971d27 Cosmetic reorganization.
Matti Hamalainen <ccr@tnsp.org>
parents: 214
diff changeset
37 PSF_CLOCK_NTSC = 0x02,
e79a93971d27 Cosmetic reorganization.
Matti Hamalainen <ccr@tnsp.org>
parents: 214
diff changeset
38 PSF_CLOCK_ANY = 0x03,
e79a93971d27 Cosmetic reorganization.
Matti Hamalainen <ccr@tnsp.org>
parents: 214
diff changeset
39 PSF_CLOCK_MASK = 0x03,
e79a93971d27 Cosmetic reorganization.
Matti Hamalainen <ccr@tnsp.org>
parents: 214
diff changeset
40
e79a93971d27 Cosmetic reorganization.
Matti Hamalainen <ccr@tnsp.org>
parents: 214
diff changeset
41 // SID model (v2NG+)
e79a93971d27 Cosmetic reorganization.
Matti Hamalainen <ccr@tnsp.org>
parents: 214
diff changeset
42 PSF_MODEL_UNKNOWN = 0x00,
e79a93971d27 Cosmetic reorganization.
Matti Hamalainen <ccr@tnsp.org>
parents: 214
diff changeset
43 PSF_MODEL_MOS6581 = 0x01,
e79a93971d27 Cosmetic reorganization.
Matti Hamalainen <ccr@tnsp.org>
parents: 214
diff changeset
44 PSF_MODEL_MOS8580 = 0x02,
e79a93971d27 Cosmetic reorganization.
Matti Hamalainen <ccr@tnsp.org>
parents: 214
diff changeset
45 PSF_MODEL_ANY = 0x03,
e79a93971d27 Cosmetic reorganization.
Matti Hamalainen <ccr@tnsp.org>
parents: 214
diff changeset
46 PSF_MODEL_MASK = 0x03,
e79a93971d27 Cosmetic reorganization.
Matti Hamalainen <ccr@tnsp.org>
parents: 214
diff changeset
47 };
e79a93971d27 Cosmetic reorganization.
Matti Hamalainen <ccr@tnsp.org>
parents: 214
diff changeset
48
e79a93971d27 Cosmetic reorganization.
Matti Hamalainen <ccr@tnsp.org>
parents: 214
diff changeset
49
262
ef1d6d16718e s/SIDLibSTILSubNode/SIDLibSTILSubTune/g
Matti Hamalainen <ccr@tnsp.org>
parents: 260
diff changeset
50 // STIL database subtune fields, see SIDLibSTILSubTune
241
c9b57c8fd058 Begin work on STIL database parsing and handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 236
diff changeset
51 enum
c9b57c8fd058 Begin work on STIL database parsing and handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 236
diff changeset
52 {
c9b57c8fd058 Begin work on STIL database parsing and handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 236
diff changeset
53 STF_NAME,
c9b57c8fd058 Begin work on STIL database parsing and handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 236
diff changeset
54 STF_AUTHOR,
c9b57c8fd058 Begin work on STIL database parsing and handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 236
diff changeset
55 STF_TITLE,
c9b57c8fd058 Begin work on STIL database parsing and handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 236
diff changeset
56 STF_INFO,
242
537420ccd05b More work on STIL parser.
Matti Hamalainen <ccr@tnsp.org>
parents: 241
diff changeset
57 STF_ARTIST,
537420ccd05b More work on STIL parser.
Matti Hamalainen <ccr@tnsp.org>
parents: 241
diff changeset
58 STF_COMMENT,
241
c9b57c8fd058 Begin work on STIL database parsing and handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 236
diff changeset
59
c9b57c8fd058 Begin work on STIL database parsing and handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 236
diff changeset
60 STF_LAST
c9b57c8fd058 Begin work on STIL database parsing and handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 236
diff changeset
61 };
c9b57c8fd058 Begin work on STIL database parsing and handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 236
diff changeset
62
c9b57c8fd058 Begin work on STIL database parsing and handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 236
diff changeset
63
220
e79a93971d27 Cosmetic reorganization.
Matti Hamalainen <ccr@tnsp.org>
parents: 214
diff changeset
64 //
e79a93971d27 Cosmetic reorganization.
Matti Hamalainen <ccr@tnsp.org>
parents: 214
diff changeset
65 // Structures
e79a93971d27 Cosmetic reorganization.
Matti Hamalainen <ccr@tnsp.org>
parents: 214
diff changeset
66 //
224
4bec78f45188 Use th_datastruct::th_llist_t instead of yet another linked list
Matti Hamalainen <ccr@tnsp.org>
parents: 223
diff changeset
67 typedef struct
86
e1ff9cd27a84 Initial port of songlength database (SLDB) handling code from XMMS-SID to here.
Matti Hamalainen <ccr@tnsp.org>
parents: 85
diff changeset
68 {
224
4bec78f45188 Use th_datastruct::th_llist_t instead of yet another linked list
Matti Hamalainen <ccr@tnsp.org>
parents: 223
diff changeset
69 th_llist_t node;
4bec78f45188 Use th_datastruct::th_llist_t instead of yet another linked list
Matti Hamalainen <ccr@tnsp.org>
parents: 223
diff changeset
70
86
e1ff9cd27a84 Initial port of songlength database (SLDB) handling code from XMMS-SID to here.
Matti Hamalainen <ccr@tnsp.org>
parents: 85
diff changeset
71 th_md5hash_t hash; // MD5 hash-digest
e1ff9cd27a84 Initial port of songlength database (SLDB) handling code from XMMS-SID to here.
Matti Hamalainen <ccr@tnsp.org>
parents: 85
diff changeset
72 int nlengths; // Number of lengths
e1ff9cd27a84 Initial port of songlength database (SLDB) handling code from XMMS-SID to here.
Matti Hamalainen <ccr@tnsp.org>
parents: 85
diff changeset
73 int *lengths; // Lengths in seconds
e1ff9cd27a84 Initial port of songlength database (SLDB) handling code from XMMS-SID to here.
Matti Hamalainen <ccr@tnsp.org>
parents: 85
diff changeset
74 } SIDLibSLDBNode;
e1ff9cd27a84 Initial port of songlength database (SLDB) handling code from XMMS-SID to here.
Matti Hamalainen <ccr@tnsp.org>
parents: 85
diff changeset
75
e1ff9cd27a84 Initial port of songlength database (SLDB) handling code from XMMS-SID to here.
Matti Hamalainen <ccr@tnsp.org>
parents: 85
diff changeset
76
e1ff9cd27a84 Initial port of songlength database (SLDB) handling code from XMMS-SID to here.
Matti Hamalainen <ccr@tnsp.org>
parents: 85
diff changeset
77 typedef struct
e1ff9cd27a84 Initial port of songlength database (SLDB) handling code from XMMS-SID to here.
Matti Hamalainen <ccr@tnsp.org>
parents: 85
diff changeset
78 {
224
4bec78f45188 Use th_datastruct::th_llist_t instead of yet another linked list
Matti Hamalainen <ccr@tnsp.org>
parents: 223
diff changeset
79 SIDLibSLDBNode *nodes, **pindex;
4bec78f45188 Use th_datastruct::th_llist_t instead of yet another linked list
Matti Hamalainen <ccr@tnsp.org>
parents: 223
diff changeset
80 size_t nnodes;
86
e1ff9cd27a84 Initial port of songlength database (SLDB) handling code from XMMS-SID to here.
Matti Hamalainen <ccr@tnsp.org>
parents: 85
diff changeset
81 } SIDLibSLDB;
70
4779bbec2f28 Split some functionality into sidlib.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
82
4779bbec2f28 Split some functionality into sidlib.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
83
4779bbec2f28 Split some functionality into sidlib.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
84 typedef struct
4779bbec2f28 Split some functionality into sidlib.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
85 {
264
5afa6052f796 Change SIDLibSTILSubTune::fields to new SIDLibSTILField structure for
Matti Hamalainen <ccr@tnsp.org>
parents: 262
diff changeset
86 int ndata;
319
6d0143e43edf Add functionality and API changes for doing on-the-fly character set
Matti Hamalainen <ccr@tnsp.org>
parents: 311
diff changeset
87 char **data; // Converted through SIDLibChConvCtx if conversion is used
264
5afa6052f796 Change SIDLibSTILSubTune::fields to new SIDLibSTILField structure for
Matti Hamalainen <ccr@tnsp.org>
parents: 262
diff changeset
88 } SIDLibSTILField;
5afa6052f796 Change SIDLibSTILSubTune::fields to new SIDLibSTILField structure for
Matti Hamalainen <ccr@tnsp.org>
parents: 262
diff changeset
89
5afa6052f796 Change SIDLibSTILSubTune::fields to new SIDLibSTILField structure for
Matti Hamalainen <ccr@tnsp.org>
parents: 262
diff changeset
90
5afa6052f796 Change SIDLibSTILSubTune::fields to new SIDLibSTILField structure for
Matti Hamalainen <ccr@tnsp.org>
parents: 262
diff changeset
91 typedef struct
5afa6052f796 Change SIDLibSTILSubTune::fields to new SIDLibSTILField structure for
Matti Hamalainen <ccr@tnsp.org>
parents: 262
diff changeset
92 {
311
ee56f1f2b528 Change how the STIL subtune are handled internally. Also fix a bug that
Matti Hamalainen <ccr@tnsp.org>
parents: 310
diff changeset
93 int tune; // Subtune number this structure contains information for
264
5afa6052f796 Change SIDLibSTILSubTune::fields to new SIDLibSTILField structure for
Matti Hamalainen <ccr@tnsp.org>
parents: 262
diff changeset
94 SIDLibSTILField fields[STF_LAST];
262
ef1d6d16718e s/SIDLibSTILSubNode/SIDLibSTILSubTune/g
Matti Hamalainen <ccr@tnsp.org>
parents: 260
diff changeset
95 } SIDLibSTILSubTune;
241
c9b57c8fd058 Begin work on STIL database parsing and handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 236
diff changeset
96
c9b57c8fd058 Begin work on STIL database parsing and handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 236
diff changeset
97
c9b57c8fd058 Begin work on STIL database parsing and handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 236
diff changeset
98 typedef struct
c9b57c8fd058 Begin work on STIL database parsing and handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 236
diff changeset
99 {
c9b57c8fd058 Begin work on STIL database parsing and handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 236
diff changeset
100 th_llist_t node;
c9b57c8fd058 Begin work on STIL database parsing and handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 236
diff changeset
101
319
6d0143e43edf Add functionality and API changes for doing on-the-fly character set
Matti Hamalainen <ccr@tnsp.org>
parents: 311
diff changeset
102 char *filename; // HVSC path/filename (NOT converted through SIDLibChConvCtx)
311
ee56f1f2b528 Change how the STIL subtune are handled internally. Also fix a bug that
Matti Hamalainen <ccr@tnsp.org>
parents: 310
diff changeset
103 size_t nsubtunes; // Number of subtune information structures
319
6d0143e43edf Add functionality and API changes for doing on-the-fly character set
Matti Hamalainen <ccr@tnsp.org>
parents: 311
diff changeset
104 SIDLibSTILSubTune *subtunes; // NOTE! Subtunes are in undefined order here
6d0143e43edf Add functionality and API changes for doing on-the-fly character set
Matti Hamalainen <ccr@tnsp.org>
parents: 311
diff changeset
105 // (through with correct SIDLibSTILSubTune::tune number, of course)
6d0143e43edf Add functionality and API changes for doing on-the-fly character set
Matti Hamalainen <ccr@tnsp.org>
parents: 311
diff changeset
106 // unless sidlib_stildb_build_index() has been run on the SIDLibSTILDB
271
439d08a11365 Add support for STIL database in output. The output format is probably going
Matti Hamalainen <ccr@tnsp.org>
parents: 266
diff changeset
107
310
8a489e5a81d7 Comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 271
diff changeset
108 // Internal use only
271
439d08a11365 Add support for STIL database in output. The output format is probably going
Matti Hamalainen <ccr@tnsp.org>
parents: 266
diff changeset
109 SIDLibSLDBNode *lengths;
241
c9b57c8fd058 Begin work on STIL database parsing and handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 236
diff changeset
110 } SIDLibSTILNode;
c9b57c8fd058 Begin work on STIL database parsing and handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 236
diff changeset
111
c9b57c8fd058 Begin work on STIL database parsing and handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 236
diff changeset
112
c9b57c8fd058 Begin work on STIL database parsing and handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 236
diff changeset
113 typedef struct
c9b57c8fd058 Begin work on STIL database parsing and handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 236
diff changeset
114 {
c9b57c8fd058 Begin work on STIL database parsing and handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 236
diff changeset
115 SIDLibSTILNode *nodes, **pindex;
c9b57c8fd058 Begin work on STIL database parsing and handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 236
diff changeset
116 size_t nnodes;
c9b57c8fd058 Begin work on STIL database parsing and handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 236
diff changeset
117 } SIDLibSTILDB;
c9b57c8fd058 Begin work on STIL database parsing and handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 236
diff changeset
118
c9b57c8fd058 Begin work on STIL database parsing and handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 236
diff changeset
119
c9b57c8fd058 Begin work on STIL database parsing and handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 236
diff changeset
120 typedef struct
c9b57c8fd058 Begin work on STIL database parsing and handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 236
diff changeset
121 {
223
a76276ff7ba8 Rename PSID_* constant defines to SIDLIB_PSID_*.
Matti Hamalainen <ccr@tnsp.org>
parents: 222
diff changeset
122 char magic[SIDLIB_PSID_MAGIC_LEN + 1]; // "PSID" / "RSID" magic identifier
70
4779bbec2f28 Split some functionality into sidlib.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
123 uint16_t
4779bbec2f28 Split some functionality into sidlib.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
124 version, // Version number
4779bbec2f28 Split some functionality into sidlib.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
125 dataOffset, // Start of actual c64 data in file
4779bbec2f28 Split some functionality into sidlib.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
126 loadAddress, // Loading address
4779bbec2f28 Split some functionality into sidlib.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
127 initAddress, // Initialization address
4779bbec2f28 Split some functionality into sidlib.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
128 playAddress, // Play one frame
4779bbec2f28 Split some functionality into sidlib.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
129 nSongs, // Number of subsongs
4779bbec2f28 Split some functionality into sidlib.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
130 startSong; // Default starting song
4779bbec2f28 Split some functionality into sidlib.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
131 uint32_t speed; // Speed
319
6d0143e43edf Add functionality and API changes for doing on-the-fly character set
Matti Hamalainen <ccr@tnsp.org>
parents: 311
diff changeset
132
128
2636185649c6 Add si_fread_str() helper function.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
133 char *sidName; // Descriptive text-fields, ASCIIZ
319
6d0143e43edf Add functionality and API changes for doing on-the-fly character set
Matti Hamalainen <ccr@tnsp.org>
parents: 311
diff changeset
134 char *sidAuthor; // Converted through SIDLibChConvCtx if conversion is used
128
2636185649c6 Add si_fread_str() helper function.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
135 char *sidCopyright;
70
4779bbec2f28 Split some functionality into sidlib.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
136
144
6418286a7e4c Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
137 // PSIDv2+ data
70
4779bbec2f28 Split some functionality into sidlib.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
138 uint16_t flags; // Flags
4779bbec2f28 Split some functionality into sidlib.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
139 uint8_t startPage, pageLength;
133
9cfa0553e7f9 Add support for reading PSID/RSID v4 in sidlib.
Matti Hamalainen <ccr@tnsp.org>
parents: 132
diff changeset
140 uint8_t sid2Addr, sid3Addr;
70
4779bbec2f28 Split some functionality into sidlib.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
141
4779bbec2f28 Split some functionality into sidlib.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
142 // Extra data
4779bbec2f28 Split some functionality into sidlib.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
143 BOOL isRSID;
4779bbec2f28 Split some functionality into sidlib.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
144 size_t dataSize; // Total size of data - header
4779bbec2f28 Split some functionality into sidlib.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
145 th_md5hash_t hash; // Songlength database hash
4779bbec2f28 Split some functionality into sidlib.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
146
310
8a489e5a81d7 Comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 271
diff changeset
147 // Internal use only
8a489e5a81d7 Comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 271
diff changeset
148 BOOL allocated; // TRUE if structure has been allocated
88
c5ff71d64e53 More work on sidlib SLDB code.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
149 SIDLibSLDBNode *lengths; // Songlength information node pointer
271
439d08a11365 Add support for STIL database in output. The output format is probably going
Matti Hamalainen <ccr@tnsp.org>
parents: 266
diff changeset
150 SIDLibSTILNode *stil; // STIL database node pointer
226
c32015f4969e Rename PSIDHeader struct to SIDLibPSIDHeader to conform with the SIDLib
Matti Hamalainen <ccr@tnsp.org>
parents: 224
diff changeset
151 } SIDLibPSIDHeader;
70
4779bbec2f28 Split some functionality into sidlib.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
152
4779bbec2f28 Split some functionality into sidlib.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
153
319
6d0143e43edf Add functionality and API changes for doing on-the-fly character set
Matti Hamalainen <ccr@tnsp.org>
parents: 311
diff changeset
154 typedef struct SIDLibChConvCtx
6d0143e43edf Add functionality and API changes for doing on-the-fly character set
Matti Hamalainen <ccr@tnsp.org>
parents: 311
diff changeset
155 {
6d0143e43edf Add functionality and API changes for doing on-the-fly character set
Matti Hamalainen <ccr@tnsp.org>
parents: 311
diff changeset
156 void *data;
6d0143e43edf Add functionality and API changes for doing on-the-fly character set
Matti Hamalainen <ccr@tnsp.org>
parents: 311
diff changeset
157 char* (*convert)(struct SIDLibChConvCtx *ctx, const char *str);
6d0143e43edf Add functionality and API changes for doing on-the-fly character set
Matti Hamalainen <ccr@tnsp.org>
parents: 311
diff changeset
158 } SIDLibChConvCtx;
6d0143e43edf Add functionality and API changes for doing on-the-fly character set
Matti Hamalainen <ccr@tnsp.org>
parents: 311
diff changeset
159
6d0143e43edf Add functionality and API changes for doing on-the-fly character set
Matti Hamalainen <ccr@tnsp.org>
parents: 311
diff changeset
160
74
5d61d8dbc77f Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 73
diff changeset
161 //
266
254828e9213b Make sidlib_stil_fields[] public.
Matti Hamalainen <ccr@tnsp.org>
parents: 264
diff changeset
162 // Globals
254828e9213b Make sidlib_stil_fields[] public.
Matti Hamalainen <ccr@tnsp.org>
parents: 264
diff changeset
163 //
361
5711c23e40cc Oops, forgot to mark sidlib_stil_fields_{uc,lc} arrays extern in the header file. Fixed.
Matti Hamalainen <ccr@tnsp.org>
parents: 352
diff changeset
164 extern const char * sidlib_stil_fields_uc[STF_LAST];
5711c23e40cc Oops, forgot to mark sidlib_stil_fields_{uc,lc} arrays extern in the header file. Fixed.
Matti Hamalainen <ccr@tnsp.org>
parents: 352
diff changeset
165 extern const char * sidlib_stil_fields_lc[STF_LAST];
319
6d0143e43edf Add functionality and API changes for doing on-the-fly character set
Matti Hamalainen <ccr@tnsp.org>
parents: 311
diff changeset
166
266
254828e9213b Make sidlib_stil_fields[] public.
Matti Hamalainen <ccr@tnsp.org>
parents: 264
diff changeset
167
254828e9213b Make sidlib_stil_fields[] public.
Matti Hamalainen <ccr@tnsp.org>
parents: 264
diff changeset
168 //
74
5d61d8dbc77f Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 73
diff changeset
169 // Functions
5d61d8dbc77f Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 73
diff changeset
170 //
319
6d0143e43edf Add functionality and API changes for doing on-the-fly character set
Matti Hamalainen <ccr@tnsp.org>
parents: 311
diff changeset
171 int sidlib_read_sid_file(th_ioctx *ctx, SIDLibPSIDHeader *psid, const BOOL newSLDB, SIDLibChConvCtx *chconv);
6d0143e43edf Add functionality and API changes for doing on-the-fly character set
Matti Hamalainen <ccr@tnsp.org>
parents: 311
diff changeset
172 int sidlib_read_sid_file_alloc(th_ioctx *ctx, SIDLibPSIDHeader **ppsid, const BOOL newSLDB, SIDLibChConvCtx *chconv);
226
c32015f4969e Rename PSIDHeader struct to SIDLibPSIDHeader to conform with the SIDLib
Matti Hamalainen <ccr@tnsp.org>
parents: 224
diff changeset
173 void sidlib_free_sid_file(SIDLibPSIDHeader *psid);
74
5d61d8dbc77f Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 73
diff changeset
174
222
3a01518fffe0 Rename sidlib functions from si_* prefix to sidlib_*.
Matti Hamalainen <ccr@tnsp.org>
parents: 221
diff changeset
175 const char * sidlib_get_sid_clock_str(const int flags);
3a01518fffe0 Rename sidlib functions from si_* prefix to sidlib_*.
Matti Hamalainen <ccr@tnsp.org>
parents: 221
diff changeset
176 const char * sidlib_get_sid_model_str(const int flags);
70
4779bbec2f28 Split some functionality into sidlib.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
177
236
609bfc1bd628 Change sidlib_sldb_new() API to int sidlib_sldb_new(SIDLibSLDB **pdbh).
Matti Hamalainen <ccr@tnsp.org>
parents: 231
diff changeset
178 int sidlib_sldb_new(SIDLibSLDB **pdbh);
222
3a01518fffe0 Rename sidlib functions from si_* prefix to sidlib_*.
Matti Hamalainen <ccr@tnsp.org>
parents: 221
diff changeset
179 int sidlib_sldb_read(th_ioctx *ctx, SIDLibSLDB *dbh);
3a01518fffe0 Rename sidlib functions from si_* prefix to sidlib_*.
Matti Hamalainen <ccr@tnsp.org>
parents: 221
diff changeset
180 int sidlib_sldb_build_index(SIDLibSLDB *dbh);
3a01518fffe0 Rename sidlib functions from si_* prefix to sidlib_*.
Matti Hamalainen <ccr@tnsp.org>
parents: 221
diff changeset
181 void sidlib_sldb_free(SIDLibSLDB *dbh);
3a01518fffe0 Rename sidlib functions from si_* prefix to sidlib_*.
Matti Hamalainen <ccr@tnsp.org>
parents: 221
diff changeset
182 SIDLibSLDBNode * sidlib_sldb_get_by_hash(SIDLibSLDB *dbh, th_md5hash_t hash);
86
e1ff9cd27a84 Initial port of songlength database (SLDB) handling code from XMMS-SID to here.
Matti Hamalainen <ccr@tnsp.org>
parents: 85
diff changeset
183
245
6cb01bf6c8c8 Make the STILdb functions public.
Matti Hamalainen <ccr@tnsp.org>
parents: 242
diff changeset
184 int sidlib_stildb_new(SIDLibSTILDB **pdbh);
319
6d0143e43edf Add functionality and API changes for doing on-the-fly character set
Matti Hamalainen <ccr@tnsp.org>
parents: 311
diff changeset
185 int sidlib_stildb_read(th_ioctx *ctx, SIDLibSTILDB *dbh, SIDLibChConvCtx *chconv);
245
6cb01bf6c8c8 Make the STILdb functions public.
Matti Hamalainen <ccr@tnsp.org>
parents: 242
diff changeset
186 int sidlib_stildb_build_index(SIDLibSTILDB *dbh);
6cb01bf6c8c8 Make the STILdb functions public.
Matti Hamalainen <ccr@tnsp.org>
parents: 242
diff changeset
187 void sidlib_stildb_free(SIDLibSTILDB *dbh);
6cb01bf6c8c8 Make the STILdb functions public.
Matti Hamalainen <ccr@tnsp.org>
parents: 242
diff changeset
188 SIDLibSTILNode * sidlib_stildb_get_node(SIDLibSTILDB *dbh, const char *filename);
311
ee56f1f2b528 Change how the STIL subtune are handled internally. Also fix a bug that
Matti Hamalainen <ccr@tnsp.org>
parents: 310
diff changeset
189 SIDLibSTILSubTune *sidlib_stildb_find_subtune(SIDLibSTILNode *node, const int nsubtune);
101
9d4d1783800b Add si_sldb_{read,write}_bin() functions to write and read a binary format
Matti Hamalainen <ccr@tnsp.org>
parents: 100
diff changeset
190
70
4779bbec2f28 Split some functionality into sidlib.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
191
72
d5a34a3a602d Add C++ include guards.
Matti Hamalainen <ccr@tnsp.org>
parents: 70
diff changeset
192 #ifdef __cplusplus
d5a34a3a602d Add C++ include guards.
Matti Hamalainen <ccr@tnsp.org>
parents: 70
diff changeset
193 }
d5a34a3a602d Add C++ include guards.
Matti Hamalainen <ccr@tnsp.org>
parents: 70
diff changeset
194 #endif
70
4779bbec2f28 Split some functionality into sidlib.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
195 #endif // SIDLIB_H