Mercurial > audlegacy-plugins
annotate src/adplug/core/cff.cxx @ 956:88ba14f18587 trunk
[svn] I said to indent it, not to break it, hmmkay?
author | chainsaw |
---|---|
date | Sat, 14 Apr 2007 16:09:21 -0700 |
parents | 4709ce4e209e |
children |
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 AdPlug - Replayer for many OPL2/OPL3 audio file formats. |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
3 Copyright (C) 1999 - 2006 Simon Peter <dn.tlp@gmx.net>, et al. |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
4 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
5 This library is free software; you can redistribute it and/or |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
6 modify it under the terms of the GNU Lesser General Public |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
7 License as published by the Free Software Foundation; either |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
8 version 2.1 of the License, or (at your option) any later version. |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
9 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
10 This library is distributed in the hope that it will be useful, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
11 but WITHOUT ANY WARRANTY; without even the implied warranty of |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
13 Lesser General Public License for more details. |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
14 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
15 You should have received a copy of the GNU Lesser General Public |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
16 License along with this library; if not, write to the Free Software |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
18 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
19 cff.cpp - BoomTracker loader by Riven the Mage <riven@ok.ru> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
20 */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
21 /* |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
22 NOTE: Conversion of slides is not 100% accurate. Original volume slides |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
23 have effect on carrier volume only. Also, original arpeggio, frequency & volume |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
24 slides use previous effect data instead of current. |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
25 */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
26 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
27 #include <stdlib.h> |
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 #include "cff.h" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
30 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
31 /* -------- Public Methods -------------------------------- */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
32 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
33 CPlayer * |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
34 CcffLoader::factory (Copl * newopl) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
35 { |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
36 return new CcffLoader (newopl); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
37 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
38 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
39 bool |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
40 CcffLoader::load (VFSFile * fd, const CFileProvider & fp) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
41 { |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
42 binistream *f = fp.open (fd); |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
43 if (!f) |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
44 return false; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
45 const unsigned char conv_inst[11] = { 2, 1, 10, 9, 4, 3, 6, 5, 0, 8, 7 }; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
46 const unsigned short conv_note[12] = |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
47 { 0x16B, 0x181, 0x198, 0x1B0, 0x1CA, 0x1E5, 0x202, 0x220, 0x241, 0x263, |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
48 0x287, 0x2AE }; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
49 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
50 int i, j, k, t = 0; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
51 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
52 // '<CUD-FM-File>' - signed ? |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
53 f->readString (header.id, 16); |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
54 header.version = f->readInt (1); |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
55 header.size = f->readInt (2); |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
56 header.packed = f->readInt (1); |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
57 f->readString ((char *) header.reserved, 12); |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
58 if (memcmp (header.id, "<CUD-FM-File>" "\x1A\xDE\xE0", 16)) |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
59 { |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
60 fp.close (f); |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
61 return false; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
62 } |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
63 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
64 unsigned char *module = new unsigned char[0x10000]; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
65 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
66 // packed ? |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
67 if (header.packed) |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
68 { |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
69 cff_unpacker *unpacker = new cff_unpacker; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
70 |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
71 unsigned char *packed_module = new unsigned char[header.size + 4]; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
72 |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
73 memset (packed_module, 0, header.size + 4); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
74 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
75 f->readString ((char *) packed_module, header.size); |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
76 fp.close (f); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
77 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
78 if (!unpacker->unpack (packed_module, module)) |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
79 { |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
80 delete unpacker; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
81 delete packed_module; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
82 delete module; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
83 return false; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
84 } |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
85 |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
86 delete unpacker; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
87 delete packed_module; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
88 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
89 if (memcmp (&module[0x5E1], "CUD-FM-File - SEND A POSTCARD -", 31)) |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
90 { |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
91 delete module; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
92 return false; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
93 } |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
94 } |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
95 else |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
96 { |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
97 f->readString ((char *) module, header.size); |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
98 fp.close (f); |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
99 } |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
100 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
101 // init CmodPlayer |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
102 realloc_instruments (47); |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
103 realloc_order (64); |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
104 realloc_patterns (36, 64, 9); |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
105 init_notetable (conv_note); |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
106 init_trackord (); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
107 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
108 // load instruments |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
109 for (i = 0; i < 47; i++) |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
110 { |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
111 memcpy (&instruments[i], &module[i * 32], sizeof (cff_instrument)); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
112 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
113 for (j = 0; j < 11; j++) |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
114 inst[i].data[conv_inst[j]] = instruments[i].data[j]; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
115 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
116 instruments[i].name[20] = 0; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
117 } |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
118 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
119 // number of patterns |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
120 nop = module[0x5E0]; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
121 |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
122 // load title & author |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
123 memcpy (song_title, &module[0x614], 20); |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
124 memcpy (song_author, &module[0x600], 20); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
125 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
126 // load order |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
127 memcpy (order, &module[0x628], 64); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
128 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
129 // load tracks |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
130 for (i = 0; i < nop; i++) |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
131 { |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
132 unsigned char old_event_byte2[9]; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
133 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
134 memset (old_event_byte2, 0, 9); |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
135 |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
136 for (j = 0; j < 9; j++) |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
137 { |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
138 for (k = 0; k < 64; k++) |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
139 { |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
140 cff_event *event = |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
141 (cff_event *) & module[0x669 + ((i * 64 + k) * 9 + j) * 3]; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
142 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
143 // convert note |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
144 if (event->byte0 == 0x6D) |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
145 tracks[t][k].note = 127; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
146 else if (event->byte0) |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
147 tracks[t][k].note = event->byte0; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
148 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
149 if (event->byte2) |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
150 old_event_byte2[j] = event->byte2; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
151 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
152 // convert effect |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
153 switch (event->byte1) |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
154 { |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
155 case 'I': // set instrument |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
156 tracks[t][k].inst = event->byte2 + 1; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
157 tracks[t][k].param1 = tracks[t][k].param2 = 0; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
158 break; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
159 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
160 case 'H': // set tempo |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
161 tracks[t][k].command = 7; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
162 if (event->byte2 < 16) |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
163 { |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
164 tracks[t][k].param1 = 0x07; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
165 tracks[t][k].param2 = 0x0D; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
166 } |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
167 break; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
168 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
169 case 'A': // set speed |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
170 tracks[t][k].command = 19; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
171 tracks[t][k].param1 = event->byte2 >> 4; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
172 tracks[t][k].param2 = event->byte2 & 15; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
173 break; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
174 |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
175 case 'L': // pattern break |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
176 tracks[t][k].command = 13; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
177 tracks[t][k].param1 = event->byte2 >> 4; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
178 tracks[t][k].param2 = event->byte2 & 15; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
179 break; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
180 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
181 case 'K': // order jump |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
182 tracks[t][k].command = 11; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
183 tracks[t][k].param1 = event->byte2 >> 4; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
184 tracks[t][k].param2 = event->byte2 & 15; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
185 break; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
186 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
187 case 'M': // set vibrato/tremolo |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
188 tracks[t][k].command = 27; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
189 tracks[t][k].param1 = event->byte2 >> 4; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
190 tracks[t][k].param2 = event->byte2 & 15; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
191 break; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
192 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
193 case 'C': // set modulator volume |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
194 tracks[t][k].command = 21; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
195 tracks[t][k].param1 = (0x3F - event->byte2) >> 4; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
196 tracks[t][k].param2 = (0x3F - event->byte2) & 15; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
197 break; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
198 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
199 case 'G': // set carrier volume |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
200 tracks[t][k].command = 22; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
201 tracks[t][k].param1 = (0x3F - event->byte2) >> 4; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
202 tracks[t][k].param2 = (0x3F - event->byte2) & 15; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
203 break; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
204 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
205 case 'B': // set carrier waveform |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
206 tracks[t][k].command = 25; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
207 tracks[t][k].param1 = event->byte2; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
208 tracks[t][k].param2 = 0x0F; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
209 break; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
210 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
211 case 'E': // fine frequency slide down |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
212 tracks[t][k].command = 24; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
213 tracks[t][k].param1 = old_event_byte2[j] >> 4; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
214 tracks[t][k].param2 = old_event_byte2[j] & 15; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
215 break; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
216 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
217 case 'F': // fine frequency slide up |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
218 tracks[t][k].command = 23; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
219 tracks[t][k].param1 = old_event_byte2[j] >> 4; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
220 tracks[t][k].param2 = old_event_byte2[j] & 15; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
221 break; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
222 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
223 case 'D': // fine volume slide |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
224 tracks[t][k].command = 14; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
225 if (old_event_byte2[j] & 15) |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
226 { |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
227 // slide down |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
228 tracks[t][k].param1 = 5; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
229 tracks[t][k].param2 = old_event_byte2[j] & 15; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
230 } |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
231 else |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
232 { |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
233 // slide up |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
234 tracks[t][k].param1 = 4; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
235 tracks[t][k].param2 = old_event_byte2[j] >> 4; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
236 } |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
237 break; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
238 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
239 case 'J': // arpeggio |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
240 tracks[t][k].param1 = old_event_byte2[j] >> 4; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
241 tracks[t][k].param2 = old_event_byte2[j] & 15; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
242 break; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
243 } |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
244 } |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
245 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
246 t++; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
247 } |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
248 } |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
249 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
250 delete[]module; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
251 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
252 // order loop |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
253 restartpos = 0; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
254 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
255 // order length |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
256 for (i = 0; i < 64; i++) |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
257 { |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
258 if (order[i] >= 0x80) |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
259 { |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
260 length = i; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
261 break; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
262 } |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
263 } |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
264 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
265 // default tempo |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
266 bpm = 0x7D; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
267 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
268 rewind (0); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
269 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
270 return true; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
271 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
272 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
273 void |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
274 CcffLoader::rewind (int subsong) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
275 { |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
276 CmodPlayer::rewind (subsong); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
277 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
278 // default instruments |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
279 for (int i = 0; i < 9; i++) |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
280 { |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
281 channel[i].inst = i; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
282 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
283 channel[i].vol1 = 63 - (inst[i].data[10] & 63); |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
284 channel[i].vol2 = 63 - (inst[i].data[9] & 63); |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
285 } |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
286 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
287 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
288 std::string CcffLoader::gettype () |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
289 { |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
290 if (header.packed) |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
291 return std::string ("BoomTracker 4, packed"); |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
292 else |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
293 return std::string ("BoomTracker 4"); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
294 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
295 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
296 std::string CcffLoader::gettitle () |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
297 { |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
298 return std::string (song_title, 20); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
299 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
300 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
301 std::string CcffLoader::getauthor () |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
302 { |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
303 return std::string (song_author, 20); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
304 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
305 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
306 std::string CcffLoader::getinstrument (unsigned int n) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
307 { |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
308 return std::string (instruments[n].name); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
309 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
310 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
311 unsigned int |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
312 CcffLoader::getinstruments () |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
313 { |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
314 return 47; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
315 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
316 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
317 /* -------- Private Methods ------------------------------- */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
318 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
319 #ifdef _WIN32 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
320 #pragma warning(disable:4244) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
321 #pragma warning(disable:4018) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
322 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
323 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
324 /* |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
325 Lempel-Ziv-Tyr ;-) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
326 */ |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
327 long |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
328 CcffLoader::cff_unpacker::unpack (unsigned char *ibuf, unsigned char *obuf) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
329 { |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
330 if (memcmp (ibuf, "YsComp" "\x07" "CUD1997" "\x1A\x04", 16)) |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
331 return 0; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
332 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
333 input = ibuf + 16; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
334 output = obuf; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
335 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
336 output_length = 0; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
337 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
338 heap = (unsigned char *) malloc (0x10000); |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
339 dictionary = (unsigned char **) malloc (sizeof (unsigned char *) * 0x8000); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
340 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
341 memset (heap, 0, 0x10000); |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
342 memset (dictionary, 0, 0x8000); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
343 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
344 cleanup (); |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
345 if (!startup ()) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
346 goto out; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
347 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
348 // LZW |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
349 while (1) |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
350 { |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
351 new_code = get_code (); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
352 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
353 // 0x00: end of data |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
354 if (new_code == 0) |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
355 break; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
356 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
357 // 0x01: end of block |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
358 if (new_code == 1) |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
359 { |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
360 cleanup (); |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
361 if (!startup ()) |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
362 goto out; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
363 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
364 continue; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
365 } |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
366 |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
367 // 0x02: expand code length |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
368 if (new_code == 2) |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
369 { |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
370 code_length++; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
371 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
372 continue; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
373 } |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
374 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
375 // 0x03: RLE |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
376 if (new_code == 3) |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
377 { |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
378 unsigned char |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
379 old_code_length = code_length; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
380 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
381 code_length = 2; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
382 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
383 unsigned char |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
384 repeat_length = get_code () + 1; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
385 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
386 code_length = 4 << get_code (); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
387 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
388 unsigned long |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
389 repeat_counter = get_code (); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
390 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
391 if (output_length + repeat_counter * repeat_length > 0x10000) |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
392 { |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
393 output_length = 0; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
394 goto out; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
395 } |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
396 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
397 for (unsigned int i = 0; i < repeat_counter * repeat_length; i++) |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
398 output[output_length++] = output[output_length - repeat_length]; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
399 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
400 code_length = old_code_length; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
401 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
402 if (!startup ()) |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
403 goto out; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
404 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
405 continue; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
406 } |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
407 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
408 if (new_code >= (0x104 + dictionary_length)) |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
409 { |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
410 // dictionary <- old.code.string + old.code.char |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
411 the_string[++the_string[0]] = the_string[1]; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
412 } |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
413 else |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
414 { |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
415 // dictionary <- old.code.string + new.code.char |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
416 unsigned char |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
417 temp_string[256]; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
418 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
419 translate_code (new_code, temp_string); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
420 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
421 the_string[++the_string[0]] = temp_string[1]; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
422 } |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
423 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
424 expand_dictionary (the_string); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
425 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
426 // output <- new.code.string |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
427 translate_code (new_code, the_string); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
428 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
429 if (output_length + the_string[0] > 0x10000) |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
430 { |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
431 output_length = 0; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
432 goto out; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
433 } |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
434 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
435 for (int i = 0; i < the_string[0]; i++) |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
436 output[output_length++] = the_string[i + 1]; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
437 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
438 old_code = new_code; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
439 } |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
440 |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
441 out: |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
442 free (heap); |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
443 free (dictionary); |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
444 return output_length; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
445 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
446 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
447 unsigned long |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
448 CcffLoader::cff_unpacker::get_code () |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
449 { |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
450 unsigned long |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
451 code; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
452 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
453 while (bits_left < code_length) |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
454 { |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
455 bits_buffer |= ((*input++) << bits_left); |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
456 bits_left += 8; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
457 } |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
458 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
459 code = bits_buffer & ((1 << code_length) - 1); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
460 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
461 bits_buffer >>= code_length; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
462 bits_left -= code_length; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
463 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
464 return code; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
465 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
466 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
467 void |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
468 CcffLoader::cff_unpacker::translate_code (unsigned long code, |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
469 unsigned char *string) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
470 { |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
471 unsigned char |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
472 translated_string[256]; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
473 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
474 if (code >= 0x104) |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
475 { |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
476 memcpy (translated_string, dictionary[code - 0x104], |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
477 (*(dictionary[code - 0x104])) + 1); |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
478 } |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
479 else |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
480 { |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
481 translated_string[0] = 1; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
482 translated_string[1] = (code - 4) & 0xFF; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
483 } |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
484 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
485 memcpy (string, translated_string, 256); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
486 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
487 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
488 void |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
489 CcffLoader::cff_unpacker::cleanup () |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
490 { |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
491 code_length = 9; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
492 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
493 bits_buffer = 0; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
494 bits_left = 0; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
495 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
496 heap_length = 0; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
497 dictionary_length = 0; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
498 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
499 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
500 int |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
501 CcffLoader::cff_unpacker::startup () |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
502 { |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
503 old_code = get_code (); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
504 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
505 translate_code (old_code, the_string); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
506 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
507 if (output_length + the_string[0] > 0x10000) |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
508 { |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
509 output_length = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
510 return 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
511 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
512 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
513 for (int i = 0; i < the_string[0]; i++) |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
514 output[output_length++] = the_string[i + 1]; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
515 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
516 return 1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
517 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
518 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
519 void |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
520 CcffLoader::cff_unpacker::expand_dictionary (unsigned char *string) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
521 { |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
522 if (string[0] >= 0xF0) |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
523 return; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
524 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
525 memcpy (&heap[heap_length], string, string[0] + 1); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
526 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
527 dictionary[dictionary_length] = &heap[heap_length]; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
528 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
529 dictionary_length++; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
530 |
955
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
703
diff
changeset
|
531 heap_length += (string[0] + 1); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
532 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
533 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
534 #ifdef _WIN32 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
535 #pragma warning(default:4244) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
536 #pragma warning(default:4018) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
537 #endif |