Mercurial > audlegacy-plugins
annotate src/psf2/eng_spu.c @ 2882:15754379dbd5
fixed the remove bonding bug and made it thread safe
author | Paula Stanciu <paula.stanciu@gmail.com> |
---|---|
date | Thu, 07 Aug 2008 20:00:52 +0300 |
parents | f0547285577e |
children | f1482af6384c |
rev | line source |
---|---|
2737
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
1 /* |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
2 Audio Overload SDK - SPU file format engine |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
3 |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
4 Copyright (c) 2007 R. Belmont and Richard Bannister. |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
5 |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
6 All rights reserved. |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
7 |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
8 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
9 |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
10 * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
11 * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
12 * Neither the names of R. Belmont and Richard Bannister nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
13 |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
14 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
15 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
16 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
17 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
18 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
19 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
20 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
21 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
22 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
23 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
24 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
25 */ |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
26 |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
27 // |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
28 // eng_spu.c |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
29 // |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
30 // Note: support for old-format files is not tested and may not work. All the rips I could find |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
31 // are in the newer format. Also, CDDA and XA commands do not work - I've not found a rip using them. |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
32 // |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
33 |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
34 #include <stdio.h> |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
35 #include <string.h> |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
36 #include <stdlib.h> |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
37 |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
38 #include "ao.h" |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
39 #include "eng_protos.h" |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
40 #include "cpuintrf.h" |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
41 #include "psx.h" |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
42 |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
43 extern int SPUinit(void); |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
44 extern int SPUopen(void); |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
45 extern int SPUclose(void); |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
46 extern void SPUinjectRAMImage(unsigned short *source); |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
47 |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
48 static uint8 *start_of_file, *song_ptr; |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
49 static uint32 cur_tick, cur_event, num_events, next_tick, end_tick; |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
50 static int old_fmt; |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
51 static char name[128], song[128], company[128]; |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
52 |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
53 int32 spu_start(uint8 *buffer, uint32 length) |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
54 { |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
55 int i; |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
56 uint16 reg; |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
57 |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
58 if (strncmp((char *)buffer, "SPU", 3)) |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
59 { |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
60 return AO_FAIL; |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
61 } |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
62 |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
63 start_of_file = buffer; |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
64 |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
65 SPUinit(); |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
66 SPUopen(); |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
67 setlength(~0, 0); |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
68 |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
69 // upload the SPU RAM image |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
70 SPUinjectRAMImage((unsigned short *)&buffer[0]); |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
71 |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
72 // apply the register image |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
73 for (i = 0; i < 512; i += 2) |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
74 { |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
75 reg = buffer[0x80000+i] | buffer[0x80000+i+1]<<8; |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
76 |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
77 SPUwriteRegister((i/2)+0x1f801c00, reg); |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
78 } |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
79 |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
80 old_fmt = 1; |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
81 |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
82 if ((buffer[0x80200] != 0x44) || (buffer[0x80201] != 0xac) || (buffer[0x80202] != 0x00) || (buffer[0x80203] != 0x00)) |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
83 { |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
84 old_fmt = 0; |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
85 } |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
86 |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
87 if (old_fmt) |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
88 { |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
89 num_events = buffer[0x80204] | buffer[0x80205]<<8 | buffer[0x80206]<<16 | buffer[0x80207]<<24; |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
90 |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
91 if (((num_events * 12) + 0x80208) > length) |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
92 { |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
93 old_fmt = 0; |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
94 } |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
95 else |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
96 { |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
97 cur_tick = 0; |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
98 } |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
99 } |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
100 |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
101 if (!old_fmt) |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
102 { |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
103 end_tick = buffer[0x80200] | buffer[0x80201]<<8 | buffer[0x80202]<<16 | buffer[0x80203]<<24; |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
104 cur_tick = buffer[0x80204] | buffer[0x80205]<<8 | buffer[0x80206]<<16 | buffer[0x80207]<<24; |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
105 next_tick = cur_tick; |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
106 } |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
107 |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
108 song_ptr = &buffer[0x80208]; |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
109 cur_event = 0; |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
110 |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
111 strncpy((char *)&buffer[4], name, 128); |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
112 strncpy((char *)&buffer[0x44], song, 128); |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
113 strncpy((char *)&buffer[0x84], company, 128); |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
114 |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
115 return AO_SUCCESS; |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
116 } |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
117 |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
118 extern int SPUasync(uint32 cycles); |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
119 extern void SPU_flushboot(void); |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
120 |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
121 extern char *spu_pOutput; // this is a bit lame, but we'll deal |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
122 |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
123 static void spu_tick(void) |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
124 { |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
125 uint32 time, reg, size; |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
126 uint16 rdata; |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
127 uint8 opcode; |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
128 |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
129 if (old_fmt) |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
130 { |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
131 time = song_ptr[0] | song_ptr[1]<<8 | song_ptr[2]<<16 | song_ptr[3]<<24; |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
132 |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
133 while ((time == cur_tick) && (cur_event < num_events)) |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
134 { |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
135 reg = song_ptr[4] | song_ptr[5]<<8 | song_ptr[6]<<16 | song_ptr[7]<<24; |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
136 rdata = song_ptr[8] | song_ptr[9]<<8; |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
137 |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
138 SPUwriteRegister(reg, rdata); |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
139 |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
140 cur_event++; |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
141 song_ptr += 12; |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
142 |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
143 time = song_ptr[0] | song_ptr[1]<<8 | song_ptr[2]<<16 | song_ptr[3]<<24; |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
144 } |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
145 } |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
146 else |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
147 { |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
148 if (cur_tick < end_tick) |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
149 { |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
150 while (cur_tick == next_tick) |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
151 { |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
152 opcode = song_ptr[0]; |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
153 song_ptr++; |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
154 |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
155 switch (opcode) |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
156 { |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
157 case 0: // write register |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
158 reg = song_ptr[0] | song_ptr[1]<<8 | song_ptr[2]<<16 | song_ptr[3]<<24; |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
159 rdata = song_ptr[4] | song_ptr[5]<<8; |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
160 |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
161 SPUwriteRegister(reg, rdata); |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
162 |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
163 next_tick = song_ptr[6] | song_ptr[7]<<8 | song_ptr[8]<<16 | song_ptr[9]<<24; |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
164 song_ptr += 10; |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
165 break; |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
166 |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
167 case 1: // read register |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
168 reg = song_ptr[0] | song_ptr[1]<<8 | song_ptr[2]<<16 | song_ptr[3]<<24; |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
169 SPUreadRegister(reg); |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
170 next_tick = song_ptr[4] | song_ptr[5]<<8 | song_ptr[6]<<16 | song_ptr[7]<<24; |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
171 song_ptr += 8; |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
172 break; |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
173 |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
174 case 2: // dma write |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
175 size = song_ptr[0] | song_ptr[1]<<8 | song_ptr[2]<<16 | song_ptr[3]<<24; |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
176 song_ptr += (4 + size); |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
177 next_tick = song_ptr[0] | song_ptr[1]<<8 | song_ptr[2]<<16 | song_ptr[3]<<24; |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
178 song_ptr += 4; |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
179 break; |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
180 |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
181 case 3: // dma read |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
182 next_tick = song_ptr[4] | song_ptr[5]<<8 | song_ptr[6]<<16 | song_ptr[7]<<24; |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
183 song_ptr += 8; |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
184 break; |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
185 |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
186 case 4: // xa play |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
187 song_ptr += (32 + 16384); |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
188 next_tick = song_ptr[0] | song_ptr[1]<<8 | song_ptr[2]<<16 | song_ptr[3]<<24; |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
189 song_ptr += 4; |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
190 break; |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
191 |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
192 case 5: // cdda play |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
193 size = song_ptr[0] | song_ptr[1]<<8 | song_ptr[2]<<16 | song_ptr[3]<<24; |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
194 song_ptr += (4 + size); |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
195 next_tick = song_ptr[0] | song_ptr[1]<<8 | song_ptr[2]<<16 | song_ptr[3]<<24; |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
196 song_ptr += 4; |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
197 break; |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
198 |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
199 default: |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
200 printf("Unknown opcode %d\n", opcode); |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
201 exit(-1); |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
202 break; |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
203 } |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
204 } |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
205 } |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
206 else |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
207 { |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
208 // ao_song_done = 1; |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
209 } |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
210 } |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
211 |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
212 cur_tick++; |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
213 } |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
214 |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
215 int32 spu_gen(int16 *buffer, uint32 samples) |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
216 { |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
217 int i, run = 1; |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
218 |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
219 if (old_fmt) |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
220 { |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
221 if (cur_event >= num_events) |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
222 { |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
223 run = 0; |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
224 } |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
225 } |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
226 else |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
227 { |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
228 if (cur_tick >= end_tick) |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
229 { |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
230 run = 0; |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
231 } |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
232 } |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
233 |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
234 if (run) |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
235 { |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
236 for (i = 0; i < samples; i++) |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
237 { |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
238 spu_tick(); |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
239 SPUasync(384); |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
240 } |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
241 |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
242 spu_pOutput = (char *)buffer; |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
243 SPU_flushboot(); |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
244 } |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
245 else |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
246 { |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
247 memset(buffer, 0, samples*2*sizeof(int16)); |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
248 } |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
249 |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
250 return AO_SUCCESS; |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
251 } |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
252 |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
253 int32 spu_stop(void) |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
254 { |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
255 return AO_SUCCESS; |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
256 } |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
257 |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
258 int32 spu_command(int32 command, int32 parameter) |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
259 { |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
260 switch (command) |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
261 { |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
262 case COMMAND_GET_MIN: |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
263 case COMMAND_GET_MAX: |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
264 { |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
265 return 0; |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
266 } |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
267 break; |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
268 |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
269 case COMMAND_HAS_PREV: |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
270 case COMMAND_HAS_NEXT: |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
271 case COMMAND_PREV: |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
272 case COMMAND_NEXT: |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
273 case COMMAND_JUMP: |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
274 { |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
275 return AO_FAIL; |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
276 } |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
277 break; |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
278 |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
279 case COMMAND_RESTART: |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
280 { |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
281 song_ptr = &start_of_file[0x80200]; |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
282 |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
283 if (old_fmt) |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
284 { |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
285 num_events = song_ptr[4] | song_ptr[5]<<8 | song_ptr[6]<<16 | song_ptr[7]<<24; |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
286 } |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
287 else |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
288 { |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
289 end_tick = song_ptr[0] | song_ptr[1]<<8 | song_ptr[2]<<16 | song_ptr[3]<<24; |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
290 cur_tick = song_ptr[4] | song_ptr[5]<<8 | song_ptr[6]<<16 | song_ptr[7]<<24; |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
291 } |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
292 |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
293 song_ptr += 8; |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
294 cur_event = 0; |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
295 return AO_SUCCESS; |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
296 } |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
297 break; |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
298 |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
299 #if VERBOSE |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
300 default: |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
301 printf("Unknown command executed!\n"); |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
302 break; |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
303 #endif |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
304 } |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
305 |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
306 return AO_FAIL; |
62cc6d667119
Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
307 } |