annotate src/xs_sidplay.h @ 359:b1a858b8cb1a

Re-indentation all (non-generated) code.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 07 Nov 2005 09:50:04 +0000
parents 608f31f6c095
children 684d09ff564b
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 */
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 230
diff changeset
6 t_xs_tuneinfo *TFUNCTION(gchar * pcFilename)
76
741291e14080 Added missing header
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
7 {
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 230
diff changeset
8 t_xs_sldb_node *tuneLength = NULL;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 230
diff changeset
9 t_xs_tuneinfo *pResult;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 230
diff changeset
10 TTUNEINFO tuneInfo;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 230
diff changeset
11 TTUNE *testTune;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 230
diff changeset
12 gboolean haveInfo = TRUE;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 230
diff changeset
13 gint i;
87
94497283affa Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
14
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 230
diff changeset
15 /* Check if the tune exists and is readable */
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 230
diff changeset
16 if ((testTune = new TTUNE(pcFilename)) == NULL)
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 230
diff changeset
17 return NULL;
87
94497283affa Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
18
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 230
diff changeset
19 if (!testTune->getStatus()) {
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 230
diff changeset
20 delete testTune;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 230
diff changeset
21 return NULL;
87
94497283affa Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
22 }
94497283affa Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
23
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 230
diff changeset
24 /* Get general tune information */
95
4e929bb71057 Fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 93
diff changeset
25 #ifdef _XS_SIDPLAY1_H
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 230
diff changeset
26 haveInfo = testTune->getInfo(tuneInfo);
95
4e929bb71057 Fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 93
diff changeset
27 #endif
4e929bb71057 Fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 93
diff changeset
28 #ifdef _XS_SIDPLAY2_H
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 230
diff changeset
29 testTune->getInfo(tuneInfo);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 230
diff changeset
30 haveInfo = TRUE;
95
4e929bb71057 Fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 93
diff changeset
31 #endif
4e929bb71057 Fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 93
diff changeset
32
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 230
diff changeset
33 /* Get length information (NOTE: Do not free this!) */
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 230
diff changeset
34 tuneLength = xs_songlen_get(pcFilename);
87
94497283affa Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
35
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 230
diff changeset
36 /* Allocate tuneinfo structure */
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 230
diff changeset
37 pResult = xs_tuneinfo_new(pcFilename,
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 230
diff changeset
38 tuneInfo.songs, tuneInfo.startSong,
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 230
diff changeset
39 tuneInfo.infoString[0], tuneInfo.infoString[1], tuneInfo.infoString[2],
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 230
diff changeset
40 tuneInfo.loadAddr, tuneInfo.initAddr, tuneInfo.playAddr, tuneInfo.dataFileLen);
106
98a72c44f56b Fileinfo now working with rudimentary informations. Slightly buggy.
Matti Hamalainen <ccr@tnsp.org>
parents: 100
diff changeset
41
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 230
diff changeset
42 if (!pResult) {
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 230
diff changeset
43 delete testTune;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 230
diff changeset
44 return NULL;
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
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 230
diff changeset
47 /* Get information for subtunes */
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 230
diff changeset
48 for (i = 0; i < pResult->nsubTunes; i++) {
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 230
diff changeset
49 /* Make the title */
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 230
diff changeset
50 if (haveInfo) {
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 230
diff changeset
51 pResult->subTunes[i].tuneTitle =
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 230
diff changeset
52 xs_make_titlestring(pcFilename, i + 1, tuneInfo.sidModel,
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 230
diff changeset
53 tuneInfo.formatString, tuneInfo.infoString[0],
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 230
diff changeset
54 tuneInfo.infoString[1], tuneInfo.infoString[2]);
202
fe684a2ccdc7 Reworking code.
Matti Hamalainen <ccr@tnsp.org>
parents: 130
diff changeset
55 } else
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 230
diff changeset
56 pResult->subTunes[i].tuneTitle = g_strdup(pcFilename);
87
94497283affa Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
57
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 230
diff changeset
58 /* Get song length */
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 230
diff changeset
59 if (tuneLength && (i < tuneLength->nLengths))
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 230
diff changeset
60 pResult->subTunes[i].tuneLength = tuneLength->sLengths[i];
87
94497283affa Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
61 else
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 230
diff changeset
62 pResult->subTunes[i].tuneLength = -1;
87
94497283affa Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
63 }
94497283affa Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
64
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 230
diff changeset
65 delete testTune;
87
94497283affa Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
66
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 230
diff changeset
67 return pResult;
87
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
95
4e929bb71057 Fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 93
diff changeset
70 /* Undefine these */
202
fe684a2ccdc7 Reworking code.
Matti Hamalainen <ccr@tnsp.org>
parents: 130
diff changeset
71 #undef TFUNCTION
95
4e929bb71057 Fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 93
diff changeset
72 #undef TTUNEINFO
4e929bb71057 Fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 93
diff changeset
73 #undef TTUNE