annotate src/xs_sidplay.h @ 230:608f31f6c095

Raw cleanup.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 21 Dec 2004 09:25:03 +0000
parents fe684a2ccdc7
children b1a858b8cb1a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
76
741291e14080 Added missing header
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1 /*
87
94497283affa Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
2 * Here comes the really ugly code...
202
fe684a2ccdc7 Reworking code.
Matti Hamalainen <ccr@tnsp.org>
parents: 130
diff changeset
3 * Get all SID-tune information (for all sub-tunes)
fe684a2ccdc7 Reworking code.
Matti Hamalainen <ccr@tnsp.org>
parents: 130
diff changeset
4 * including name, length, etc.
76
741291e14080 Added missing header
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
5 */
230
608f31f6c095 Raw cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 202
diff changeset
6 t_xs_tuneinfo * TFUNCTION(gchar *pcFilename)
76
741291e14080 Added missing header
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
7 {
202
fe684a2ccdc7 Reworking code.
Matti Hamalainen <ccr@tnsp.org>
parents: 130
diff changeset
8 t_xs_sldb_node *tuneLength = NULL;
230
608f31f6c095 Raw cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 202
diff changeset
9 t_xs_tuneinfo *pResult;
87
94497283affa Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
10 TTUNEINFO tuneInfo;
94497283affa Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
11 TTUNE *testTune;
100
426e443240b8 Minor tweaks
Matti Hamalainen <ccr@tnsp.org>
parents: 95
diff changeset
12 gboolean haveInfo = TRUE;
87
94497283affa Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
13 gint i;
94497283affa Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
14
94497283affa Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
15 /* Check if the tune exists and is readable */
94497283affa Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
16 if ((testTune = new TTUNE(pcFilename)) == NULL)
94497283affa Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
17 return NULL;
94497283affa Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
18
94497283affa Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
19 if (!testTune->getStatus())
94497283affa Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
20 {
94497283affa Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
21 delete testTune;
94497283affa Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
22 return NULL;
94497283affa Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
23 }
94497283affa Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
24
94497283affa Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
25 /* Get general tune information */
95
4e929bb71057 Fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 93
diff changeset
26 #ifdef _XS_SIDPLAY1_H
92
2607683bc9eb Improvements in length- and title handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
27 haveInfo = testTune->getInfo(tuneInfo);
95
4e929bb71057 Fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 93
diff changeset
28 #endif
4e929bb71057 Fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 93
diff changeset
29 #ifdef _XS_SIDPLAY2_H
100
426e443240b8 Minor tweaks
Matti Hamalainen <ccr@tnsp.org>
parents: 95
diff changeset
30 testTune->getInfo(tuneInfo);
95
4e929bb71057 Fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 93
diff changeset
31 haveInfo = TRUE;
4e929bb71057 Fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 93
diff changeset
32 #endif
4e929bb71057 Fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 93
diff changeset
33
87
94497283affa Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
34 /* Get length information (NOTE: Do not free this!) */
202
fe684a2ccdc7 Reworking code.
Matti Hamalainen <ccr@tnsp.org>
parents: 130
diff changeset
35 tuneLength = xs_songlen_get(pcFilename);
87
94497283affa Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
36
94497283affa Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
37 /* Allocate tuneinfo structure */
230
608f31f6c095 Raw cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 202
diff changeset
38 pResult = xs_tuneinfo_new(pcFilename,
202
fe684a2ccdc7 Reworking code.
Matti Hamalainen <ccr@tnsp.org>
parents: 130
diff changeset
39 tuneInfo.songs, tuneInfo.startSong,
fe684a2ccdc7 Reworking code.
Matti Hamalainen <ccr@tnsp.org>
parents: 130
diff changeset
40 tuneInfo.infoString[0], tuneInfo.infoString[1], tuneInfo.infoString[2],
fe684a2ccdc7 Reworking code.
Matti Hamalainen <ccr@tnsp.org>
parents: 130
diff changeset
41 tuneInfo.loadAddr, tuneInfo.initAddr, tuneInfo.playAddr,
fe684a2ccdc7 Reworking code.
Matti Hamalainen <ccr@tnsp.org>
parents: 130
diff changeset
42 tuneInfo.dataFileLen);
106
98a72c44f56b Fileinfo now working with rudimentary informations. Slightly buggy.
Matti Hamalainen <ccr@tnsp.org>
parents: 100
diff changeset
43
98a72c44f56b Fileinfo now working with rudimentary informations. Slightly buggy.
Matti Hamalainen <ccr@tnsp.org>
parents: 100
diff changeset
44 if (!pResult)
87
94497283affa Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
45 {
94497283affa Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
46 delete testTune;
94497283affa Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
47 return NULL;
94497283affa Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
48 }
94497283affa Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
49
94497283affa Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
50 /* Get information for subtunes */
94497283affa Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
51 for (i = 0; i < pResult->nsubTunes; i++)
94497283affa Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
52 {
94497283affa Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
53 /* Make the title */
92
2607683bc9eb Improvements in length- and title handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
54 if (haveInfo)
202
fe684a2ccdc7 Reworking code.
Matti Hamalainen <ccr@tnsp.org>
parents: 130
diff changeset
55 {
fe684a2ccdc7 Reworking code.
Matti Hamalainen <ccr@tnsp.org>
parents: 130
diff changeset
56 pResult->subTunes[i].tuneTitle =
fe684a2ccdc7 Reworking code.
Matti Hamalainen <ccr@tnsp.org>
parents: 130
diff changeset
57 xs_make_titlestring(pcFilename, i+1, tuneInfo.sidModel,
fe684a2ccdc7 Reworking code.
Matti Hamalainen <ccr@tnsp.org>
parents: 130
diff changeset
58 tuneInfo.formatString, tuneInfo.infoString[0],
fe684a2ccdc7 Reworking code.
Matti Hamalainen <ccr@tnsp.org>
parents: 130
diff changeset
59 tuneInfo.infoString[1], tuneInfo.infoString[2]);
fe684a2ccdc7 Reworking code.
Matti Hamalainen <ccr@tnsp.org>
parents: 130
diff changeset
60 } else
92
2607683bc9eb Improvements in length- and title handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
61 pResult->subTunes[i].tuneTitle = g_strdup(pcFilename);
87
94497283affa Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
62
94497283affa Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
63 /* Get song length */
202
fe684a2ccdc7 Reworking code.
Matti Hamalainen <ccr@tnsp.org>
parents: 130
diff changeset
64 if (tuneLength && (i < tuneLength->nLengths))
fe684a2ccdc7 Reworking code.
Matti Hamalainen <ccr@tnsp.org>
parents: 130
diff changeset
65 pResult->subTunes[i].tuneLength = tuneLength->sLengths[i];
87
94497283affa Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
66 else
94497283affa Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
67 pResult->subTunes[i].tuneLength = -1;
94497283affa Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
68 }
94497283affa Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
69
94497283affa Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
70 delete testTune;
94497283affa Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
71
94497283affa Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
72 return pResult;
94497283affa Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
73 }
94497283affa Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
74
95
4e929bb71057 Fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 93
diff changeset
75 /* Undefine these */
202
fe684a2ccdc7 Reworking code.
Matti Hamalainen <ccr@tnsp.org>
parents: 130
diff changeset
76 #undef TFUNCTION
95
4e929bb71057 Fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 93
diff changeset
77 #undef TTUNEINFO
4e929bb71057 Fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 93
diff changeset
78 #undef TTUNE