Mercurial > audlegacy-plugins
annotate src/sid/xs_sidplay.h @ 462:c488d191b528 trunk
[svn] - modified the sid plugin to use vfs, for both libsidplay v1 and v2; still requires testing and some work in the is_our_file part
author | giacomo |
---|---|
date | Fri, 19 Jan 2007 09:56:06 -0800 |
parents | 3da1b8942b8b |
children | 6c3c7b841382 |
rev | line source |
---|---|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1 /* |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
2 * Here comes the really ugly code... |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
3 * Get all SID-tune information (for all sub-tunes) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
4 * including name, length, etc. |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
5 */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
6 t_xs_tuneinfo *TFUNCTION(gchar * pcFilename) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
7 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
8 t_xs_sldb_node *tuneLength = NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
9 t_xs_tuneinfo *pResult; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
10 TTUNEINFO tuneInfo; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
11 TTUNE *testTune; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
12 gboolean haveInfo = TRUE; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
13 gint i; |
462
c488d191b528
[svn] - modified the sid plugin to use vfs, for both libsidplay v1 and v2; still requires testing and some work in the is_our_file part
giacomo
parents:
12
diff
changeset
|
14 gchar *buffer = NULL; |
c488d191b528
[svn] - modified the sid plugin to use vfs, for both libsidplay v1 and v2; still requires testing and some work in the is_our_file part
giacomo
parents:
12
diff
changeset
|
15 glong buffer_size = 0; |
c488d191b528
[svn] - modified the sid plugin to use vfs, for both libsidplay v1 and v2; still requires testing and some work in the is_our_file part
giacomo
parents:
12
diff
changeset
|
16 |
c488d191b528
[svn] - modified the sid plugin to use vfs, for both libsidplay v1 and v2; still requires testing and some work in the is_our_file part
giacomo
parents:
12
diff
changeset
|
17 if ( TBUFFGETFUNC( pcFilename , &buffer , &buffer_size ) != 0 ) |
c488d191b528
[svn] - modified the sid plugin to use vfs, for both libsidplay v1 and v2; still requires testing and some work in the is_our_file part
giacomo
parents:
12
diff
changeset
|
18 return NULL; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
19 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
20 /* Check if the tune exists and is readable */ |
462
c488d191b528
[svn] - modified the sid plugin to use vfs, for both libsidplay v1 and v2; still requires testing and some work in the is_our_file part
giacomo
parents:
12
diff
changeset
|
21 if ((testTune = new TTUNE((TBUFFTYPEMEM)buffer,(TBUFFTYPESIZE)buffer_size)) == NULL) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
22 return NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
23 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
24 if (!testTune->getStatus()) { |
462
c488d191b528
[svn] - modified the sid plugin to use vfs, for both libsidplay v1 and v2; still requires testing and some work in the is_our_file part
giacomo
parents:
12
diff
changeset
|
25 g_free( buffer ); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
26 delete testTune; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
27 return NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
28 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
29 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
30 /* Get general tune information */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
31 #ifdef _XS_SIDPLAY1_H |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
32 haveInfo = testTune->getInfo(tuneInfo); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
33 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
34 #ifdef _XS_SIDPLAY2_H |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
35 testTune->getInfo(tuneInfo); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
36 haveInfo = TRUE; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
37 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
38 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
39 /* Get length information (NOTE: Do not free this!) */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
40 tuneLength = xs_songlen_get(pcFilename); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
41 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
42 /* Allocate tuneinfo structure */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
43 pResult = xs_tuneinfo_new(pcFilename, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
44 tuneInfo.songs, tuneInfo.startSong, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
45 tuneInfo.infoString[0], tuneInfo.infoString[1], tuneInfo.infoString[2], |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
46 tuneInfo.loadAddr, tuneInfo.initAddr, tuneInfo.playAddr, tuneInfo.dataFileLen); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
47 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
48 if (!pResult) { |
462
c488d191b528
[svn] - modified the sid plugin to use vfs, for both libsidplay v1 and v2; still requires testing and some work in the is_our_file part
giacomo
parents:
12
diff
changeset
|
49 g_free( buffer ); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
50 delete testTune; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
51 return NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
52 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
53 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
54 /* Get information for subtunes */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
55 for (i = 0; i < pResult->nsubTunes; i++) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
56 /* Make the title */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
57 if (haveInfo) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
58 pResult->subTunes[i].tuneTitle = |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
59 xs_make_titlestring(pcFilename, i + 1, pResult->nsubTunes, tuneInfo.sidModel, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
60 tuneInfo.formatString, tuneInfo.infoString[0], |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
61 tuneInfo.infoString[1], tuneInfo.infoString[2]); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
62 } else |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
63 pResult->subTunes[i].tuneTitle = g_strdup(pcFilename); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
64 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
65 /* Get song length */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
66 if (tuneLength && (i < tuneLength->nLengths)) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
67 pResult->subTunes[i].tuneLength = tuneLength->sLengths[i]; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
68 else |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
69 pResult->subTunes[i].tuneLength = -1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
70 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
71 |
462
c488d191b528
[svn] - modified the sid plugin to use vfs, for both libsidplay v1 and v2; still requires testing and some work in the is_our_file part
giacomo
parents:
12
diff
changeset
|
72 g_free( buffer ); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
73 delete testTune; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
74 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
75 return pResult; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
76 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
77 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
78 /* Undefine these */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
79 #undef TFUNCTION |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
80 #undef TTUNEINFO |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
81 #undef TTUNE |
462
c488d191b528
[svn] - modified the sid plugin to use vfs, for both libsidplay v1 and v2; still requires testing and some work in the is_our_file part
giacomo
parents:
12
diff
changeset
|
82 #undef TBUFFGETFUNC |
c488d191b528
[svn] - modified the sid plugin to use vfs, for both libsidplay v1 and v2; still requires testing and some work in the is_our_file part
giacomo
parents:
12
diff
changeset
|
83 #undef TBUFFTYPEMEM |
c488d191b528
[svn] - modified the sid plugin to use vfs, for both libsidplay v1 and v2; still requires testing and some work in the is_our_file part
giacomo
parents:
12
diff
changeset
|
84 #undef TBUFFTYPESIZE |