diff options
author | Alexey Yakovenko <wakeroid@gmail.com> | 2010-07-06 21:55:48 +0200 |
---|---|---|
committer | Alexey Yakovenko <wakeroid@gmail.com> | 2010-07-06 21:55:48 +0200 |
commit | aa296438c65a0c0bd2fccea279d3df60821eb388 (patch) | |
tree | a7b995c8f5891b7dba9233ebc0b9df4bd67177cd /plugins | |
parent | a1bc3f3c2e60af892c12ed53cb6c2cd1f93a5bec (diff) |
ao plugin: added minissf, minispu, minipsf, minipsf2 extensions; minipsf library loading fix; psf open/close crash fix
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/ao/eng_psf/eng_psf.c | 21 | ||||
-rw-r--r-- | plugins/ao/eng_psf/peops/spu.c | 5 | ||||
-rw-r--r-- | plugins/ao/plugin.c | 10 |
3 files changed, 29 insertions, 7 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; } diff --git a/plugins/ao/plugin.c b/plugins/ao/plugin.c index 5f6a12bf..badc73ef 100644 --- a/plugins/ao/plugin.c +++ b/plugins/ao/plugin.c @@ -31,7 +31,7 @@ DB_functions_t *deadbeef; static DB_decoder_t plugin; -static const char * exts[] = { "psf", "psf2", "spu", "ssf", "minidsf", "qsf", "dsf", "miniqsf", NULL }; +static const char * exts[] = { "psf", "psf2", "spu", "ssf", "qsf", "dsf", "minipsf", "minipsf2", "minispu", "minissf", "miniqsf", "minidsf", NULL }; static const char *filetypes[] = { "PSF", "PSF2", "SPU", "SSF", "QSF", "DSF", NULL }; typedef struct { @@ -232,16 +232,16 @@ aoplug_insert (DB_playItem_t *after, const char *fname) { } if (*ext == '.') { ext++; - if (!strcasecmp (ext, "psf")) { + if (!strcasecmp (ext, "psf") || !strcasecmp (ext, "minipsf")) { it->filetype = filetypes[0]; } - else if (!strcasecmp (ext, "psf2")) { + else if (!strcasecmp (ext, "psf2") || !strcasecmp (ext, "minipsf2")) { it->filetype = filetypes[1]; } - else if (!strcasecmp (ext, "spu")) { + else if (!strcasecmp (ext, "spu") || !strcasecmp (ext, "minispu")) { it->filetype = filetypes[2]; } - else if (!strcasecmp (ext, "ssf")) { + else if (!strcasecmp (ext, "ssf") || !strcasecmp (ext, "minissf")) { it->filetype = filetypes[3]; } else if (!strcasecmp (ext, "dsf") || !strcasecmp (ext, "minidsf")) { |