annotate src/xs_sidplay.h @ 472:3f02945a0c48

Cleanups.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 25 Jan 2007 05:58:05 +0000
parents 6963982fcbb6
children 99f05a74de5b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
402
f997b79a7251 More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents: 373
diff changeset
1 /* Here comes the really ugly code... Get all SID-tune information
f997b79a7251 More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents: 373
diff changeset
2 * for all sub-tunes, including name, length, etc.
76
741291e14080 Added missing header
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
3 */
460
9e683fb666ba Updates
Matti Hamalainen <ccr@tnsp.org>
parents: 445
diff changeset
4 t_xs_tuneinfo *TFUNCTION(gchar *pcFilename)
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 *pResult;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 230
diff changeset
7 TTUNEINFO tuneInfo;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 230
diff changeset
8 TTUNE *testTune;
87
94497283affa Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
9
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 230
diff changeset
10 /* Check if the tune exists and is readable */
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 230
diff changeset
11 if ((testTune = new TTUNE(pcFilename)) == NULL)
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 230
diff changeset
12 return NULL;
87
94497283affa Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
13
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 230
diff changeset
14 if (!testTune->getStatus()) {
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 230
diff changeset
15 delete testTune;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 230
diff changeset
16 return NULL;
87
94497283affa Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
17 }
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 /* Get general tune information */
95
4e929bb71057 Fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 93
diff changeset
20 #ifdef _XS_SIDPLAY1_H
445
f277dad3180f Working on the localization and fixing up the breakage in song information
Matti Hamalainen <ccr@tnsp.org>
parents: 412
diff changeset
21 testTune->getInfo(tuneInfo);
95
4e929bb71057 Fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 93
diff changeset
22 #endif
4e929bb71057 Fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 93
diff changeset
23 #ifdef _XS_SIDPLAY2_H
412
7f694e5a1493 Updated GNU GPL (new FSF address) and some cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 402
diff changeset
24 tuneInfo = testTune->getInfo();
95
4e929bb71057 Fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 93
diff changeset
25 #endif
4e929bb71057 Fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 93
diff changeset
26
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 230
diff changeset
27 /* Allocate tuneinfo structure */
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 230
diff changeset
28 pResult = xs_tuneinfo_new(pcFilename,
402
f997b79a7251 More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents: 373
diff changeset
29 tuneInfo.songs, tuneInfo.startSong,
f997b79a7251 More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents: 373
diff changeset
30 tuneInfo.infoString[0], tuneInfo.infoString[1], tuneInfo.infoString[2],
f997b79a7251 More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents: 373
diff changeset
31 tuneInfo.loadAddr, tuneInfo.initAddr, tuneInfo.playAddr,
468
6963982fcbb6 New songinfo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 460
diff changeset
32 tuneInfo.dataFileLen, tuneInfo.formatString, -1);
87
94497283affa Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
33
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 230
diff changeset
34 delete testTune;
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 return pResult;
87
94497283affa Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
37 }
94497283affa Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
38
445
f277dad3180f Working on the localization and fixing up the breakage in song information
Matti Hamalainen <ccr@tnsp.org>
parents: 412
diff changeset
39
460
9e683fb666ba Updates
Matti Hamalainen <ccr@tnsp.org>
parents: 445
diff changeset
40 gboolean TFUNCTION2(t_xs_status *myStatus)
445
f277dad3180f Working on the localization and fixing up the breakage in song information
Matti Hamalainen <ccr@tnsp.org>
parents: 412
diff changeset
41 {
468
6963982fcbb6 New songinfo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 460
diff changeset
42 TTUNEINFO myInfo;
6963982fcbb6 New songinfo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 460
diff changeset
43 TTUNE *myTune;
6963982fcbb6 New songinfo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 460
diff changeset
44 TENGINE *myEngine;
6963982fcbb6 New songinfo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 460
diff changeset
45 t_xs_tuneinfo *i;
6963982fcbb6 New songinfo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 460
diff changeset
46
6963982fcbb6 New songinfo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 460
diff changeset
47 /* Check if we have required structures initialized */
6963982fcbb6 New songinfo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 460
diff changeset
48 if (!myStatus || !myStatus->tuneInfo || !myStatus->sidEngine)
6963982fcbb6 New songinfo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 460
diff changeset
49 return FALSE;
460
9e683fb666ba Updates
Matti Hamalainen <ccr@tnsp.org>
parents: 445
diff changeset
50
468
6963982fcbb6 New songinfo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 460
diff changeset
51 myEngine = (TENGINE *) myStatus->sidEngine;
6963982fcbb6 New songinfo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 460
diff changeset
52 myTune = myEngine->currTune;
6963982fcbb6 New songinfo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 460
diff changeset
53 if (!myTune)
460
9e683fb666ba Updates
Matti Hamalainen <ccr@tnsp.org>
parents: 445
diff changeset
54 return FALSE;
445
f277dad3180f Working on the localization and fixing up the breakage in song information
Matti Hamalainen <ccr@tnsp.org>
parents: 412
diff changeset
55
468
6963982fcbb6 New songinfo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 460
diff changeset
56 /* Get currently playing tune information */
445
f277dad3180f Working on the localization and fixing up the breakage in song information
Matti Hamalainen <ccr@tnsp.org>
parents: 412
diff changeset
57 #ifdef _XS_SIDPLAY1_H
468
6963982fcbb6 New songinfo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 460
diff changeset
58 myTune->getInfo(myInfo);
445
f277dad3180f Working on the localization and fixing up the breakage in song information
Matti Hamalainen <ccr@tnsp.org>
parents: 412
diff changeset
59 #endif
f277dad3180f Working on the localization and fixing up the breakage in song information
Matti Hamalainen <ccr@tnsp.org>
parents: 412
diff changeset
60 #ifdef _XS_SIDPLAY2_H
468
6963982fcbb6 New songinfo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 460
diff changeset
61 myInfo = myTune->getInfo();
445
f277dad3180f Working on the localization and fixing up the breakage in song information
Matti Hamalainen <ccr@tnsp.org>
parents: 412
diff changeset
62 #endif
f277dad3180f Working on the localization and fixing up the breakage in song information
Matti Hamalainen <ccr@tnsp.org>
parents: 412
diff changeset
63
468
6963982fcbb6 New songinfo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 460
diff changeset
64 /* Here we assume that libSIDPlay[12] headers define SIDTUNE_SIDMODEL_*
6963982fcbb6 New songinfo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 460
diff changeset
65 * similarly to our enums in xs_config.h ...
6963982fcbb6 New songinfo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 460
diff changeset
66 */
6963982fcbb6 New songinfo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 460
diff changeset
67 i = myStatus->tuneInfo;
6963982fcbb6 New songinfo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 460
diff changeset
68 i->sidModel = myInfo.sidModel;
6963982fcbb6 New songinfo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 460
diff changeset
69
472
3f02945a0c48 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 468
diff changeset
70 XSDEBUG("%s[%d]: %d, %d\n", i->sidFilename, myStatus->currSong, myInfo.songSpeed, myInfo.clockSpeed);
3f02945a0c48 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 468
diff changeset
71
3f02945a0c48 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 468
diff changeset
72 if ((myStatus->currSong > 0) && (myStatus->currSong <= i->nsubTunes)) {
3f02945a0c48 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 468
diff changeset
73 gint tmpSpeed = -1;
468
6963982fcbb6 New songinfo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 460
diff changeset
74
472
3f02945a0c48 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 468
diff changeset
75 switch (myInfo.clockSpeed) {
3f02945a0c48 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 468
diff changeset
76 case SIDTUNE_CLOCK_PAL: tmpSpeed = 50; break;
3f02945a0c48 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 468
diff changeset
77 case SIDTUNE_CLOCK_NTSC: tmpSpeed = 60; break;
468
6963982fcbb6 New songinfo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 460
diff changeset
78 default:
472
3f02945a0c48 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 468
diff changeset
79 if (myInfo.songSpeed != 0)
3f02945a0c48 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 468
diff changeset
80 tmpSpeed = myInfo.songSpeed;
468
6963982fcbb6 New songinfo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 460
diff changeset
81 break;
6963982fcbb6 New songinfo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 460
diff changeset
82 }
472
3f02945a0c48 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 468
diff changeset
83
3f02945a0c48 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 468
diff changeset
84 i->subTunes[myStatus->currSong - 1].tuneSpeed = tmpSpeed;
468
6963982fcbb6 New songinfo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 460
diff changeset
85 }
445
f277dad3180f Working on the localization and fixing up the breakage in song information
Matti Hamalainen <ccr@tnsp.org>
parents: 412
diff changeset
86
460
9e683fb666ba Updates
Matti Hamalainen <ccr@tnsp.org>
parents: 445
diff changeset
87 return TRUE;
445
f277dad3180f Working on the localization and fixing up the breakage in song information
Matti Hamalainen <ccr@tnsp.org>
parents: 412
diff changeset
88 }
f277dad3180f Working on the localization and fixing up the breakage in song information
Matti Hamalainen <ccr@tnsp.org>
parents: 412
diff changeset
89
95
4e929bb71057 Fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 93
diff changeset
90 /* Undefine these */
202
fe684a2ccdc7 Reworking code.
Matti Hamalainen <ccr@tnsp.org>
parents: 130
diff changeset
91 #undef TFUNCTION
460
9e683fb666ba Updates
Matti Hamalainen <ccr@tnsp.org>
parents: 445
diff changeset
92 #undef TFUNCTION2
95
4e929bb71057 Fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 93
diff changeset
93 #undef TTUNEINFO
4e929bb71057 Fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 93
diff changeset
94 #undef TTUNE