summaryrefslogtreecommitdiff
path: root/plugins/ao/eng_psf
diff options
context:
space:
mode:
authorGravatar Alexey Yakovenko <wakeroid@gmail.com>2010-07-06 21:55:48 +0200
committerGravatar Alexey Yakovenko <wakeroid@gmail.com>2010-07-06 21:55:48 +0200
commitaa296438c65a0c0bd2fccea279d3df60821eb388 (patch)
treea7b995c8f5891b7dba9233ebc0b9df4bd67177cd /plugins/ao/eng_psf
parenta1bc3f3c2e60af892c12ed53cb6c2cd1f93a5bec (diff)
ao plugin: added minissf, minispu, minipsf, minipsf2 extensions; minipsf library loading fix; psf open/close crash fix
Diffstat (limited to 'plugins/ao/eng_psf')
-rw-r--r--plugins/ao/eng_psf/eng_psf.c21
-rw-r--r--plugins/ao/eng_psf/peops/spu.c5
2 files changed, 24 insertions, 2 deletions
diff --git a/plugins/ao/eng_psf/eng_psf.c b/plugins/ao/eng_psf/eng_psf.c
index 86c1ac92..4cc284e1 100644
--- a/plugins/ao/eng_psf/eng_psf.c
+++ b/plugins/ao/eng_psf/eng_psf.c
@@ -122,11 +122,25 @@ void *psf_start(const char *path, uint8 *buffer, uint32 length)
if (s->c->lib[0] != 0)
{
uint64 tmp_length;
+ char libpath[PATH_MAX];
+ const char *e = path + strlen(path);
+ while (e > path && *e != '/') {
+ e--;
+ }
+ if (*e == '/') {
+ e++;
+ memcpy (libpath, path, e-path);
+ libpath[e-path] = 0;
+ strcat (libpath, s->c->lib);
+ }
+ else {
+ strcpy (libpath, s->c->lib);
+ }
#if DEBUG_LOADER
printf("Loading library: %s\n", c->lib);
#endif
- if (ao_get_lib(s->c->lib, &lib_raw_file, &tmp_length) != AO_SUCCESS)
+ if (ao_get_lib(libpath, &lib_raw_file, &tmp_length) != AO_SUCCESS)
{
psf_stop (s);
return NULL;
@@ -383,7 +397,10 @@ int32 psf_gen(void *handle, int16 *buffer, uint32 samples)
int32 psf_stop(void *handle)
{
psf_synth_t *s = handle;
- SPUclose(s->mips_cpu);
+ if (s->mips_cpu) {
+ SPUclose(s->mips_cpu);
+ mips_exit (s->mips_cpu);
+ }
free(s->c);
free (s);
diff --git a/plugins/ao/eng_psf/peops/spu.c b/plugins/ao/eng_psf/peops/spu.c
index 75f3c845..bf2845f2 100644
--- a/plugins/ao/eng_psf/peops/spu.c
+++ b/plugins/ao/eng_psf/peops/spu.c
@@ -593,11 +593,16 @@ int SPUopen(mips_cpu_context *cpu)
int SPUclose(mips_cpu_context *cpu)
{
spu_state_t *spu = cpu->spu;
+ if (!spu) {
+ return 0;
+ }
if(!spu->bSPUIsOpen) return 0; // some security
spu->bSPUIsOpen=0; // no more open
RemoveStreams(spu); // no more streaming
+ free (spu);
+ cpu->spu = NULL;
return 0;
}