summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore11
-rw-r--r--junklib.c13
-rw-r--r--playlist.c8
-rw-r--r--plugins.c84
-rw-r--r--plugins.h2
-rw-r--r--plugins/adplug/Makefile.am5
-rw-r--r--plugins/adplug/adplug-db.cpp33
-rw-r--r--plugins/adplug/adplug/a2m.cpp4
-rw-r--r--plugins/adplug/adplug/a2m.h18
-rw-r--r--plugins/adplug/adplug/adl.cpp4
-rw-r--r--plugins/adplug/adplug/adl.h4
-rw-r--r--plugins/adplug/adplug/adplug.cpp43
-rw-r--r--plugins/adplug/adplug/adplug.h16
-rw-r--r--plugins/adplug/adplug/adtrack.cpp23
-rw-r--r--plugins/adplug/adplug/adtrack.h6
-rw-r--r--plugins/adplug/adplug/amd.cpp2
-rw-r--r--plugins/adplug/adplug/amd.h18
-rw-r--r--plugins/adplug/adplug/bam.cpp2
-rw-r--r--plugins/adplug/adplug/bam.h6
-rw-r--r--plugins/adplug/adplug/bmf.cpp18
-rw-r--r--plugins/adplug/adplug/bmf.h8
-rw-r--r--plugins/adplug/adplug/cff.cpp21
-rw-r--r--plugins/adplug/adplug/cff.h10
-rw-r--r--plugins/adplug/adplug/d00.cpp10
-rw-r--r--plugins/adplug/adplug/d00.h17
-rw-r--r--plugins/adplug/adplug/database.cpp42
-rw-r--r--plugins/adplug/adplug/database.h11
-rw-r--r--plugins/adplug/adplug/dfm.cpp8
-rw-r--r--plugins/adplug/adplug/dfm.h13
-rw-r--r--plugins/adplug/adplug/diskopl.cpp4
-rw-r--r--plugins/adplug/adplug/diskopl.h4
-rw-r--r--plugins/adplug/adplug/dmo.cpp10
-rw-r--r--plugins/adplug/adplug/dmo.h6
-rw-r--r--plugins/adplug/adplug/dro.cpp4
-rw-r--r--plugins/adplug/adplug/dro.h6
-rw-r--r--plugins/adplug/adplug/dro2.cpp4
-rw-r--r--plugins/adplug/adplug/dro2.h6
-rw-r--r--plugins/adplug/adplug/dtm.cpp24
-rw-r--r--plugins/adplug/adplug/dtm.h12
-rw-r--r--plugins/adplug/adplug/flash.cpp4
-rw-r--r--plugins/adplug/adplug/flash.h2
-rw-r--r--plugins/adplug/adplug/fmc.cpp16
-rw-r--r--plugins/adplug/adplug/fmc.h8
-rw-r--r--plugins/adplug/adplug/fprovide.cpp8
-rw-r--r--plugins/adplug/adplug/fprovide.h9
-rw-r--r--plugins/adplug/adplug/hsc.cpp4
-rw-r--r--plugins/adplug/adplug/hsc.h4
-rw-r--r--plugins/adplug/adplug/hsp.cpp2
-rw-r--r--plugins/adplug/adplug/hsp.h2
-rw-r--r--plugins/adplug/adplug/hybrid.cpp8
-rw-r--r--plugins/adplug/adplug/hybrid.h4
-rw-r--r--plugins/adplug/adplug/hyp.cpp4
-rw-r--r--plugins/adplug/adplug/hyp.h2
-rw-r--r--plugins/adplug/adplug/imf.cpp54
-rw-r--r--plugins/adplug/adplug/imf.h18
-rw-r--r--plugins/adplug/adplug/jbm.cpp2
-rw-r--r--plugins/adplug/adplug/jbm.h14
-rw-r--r--plugins/adplug/adplug/ksm.cpp16
-rw-r--r--plugins/adplug/adplug/ksm.h8
-rw-r--r--plugins/adplug/adplug/lds.cpp4
-rw-r--r--plugins/adplug/adplug/lds.h4
-rw-r--r--plugins/adplug/adplug/mad.cpp12
-rw-r--r--plugins/adplug/adplug/mad.h6
-rw-r--r--plugins/adplug/adplug/mid.cpp24
-rw-r--r--plugins/adplug/adplug/mid.h18
-rw-r--r--plugins/adplug/adplug/mkj.cpp6
-rw-r--r--plugins/adplug/adplug/mkj.h6
-rw-r--r--plugins/adplug/adplug/msc.cpp10
-rw-r--r--plugins/adplug/adplug/msc.h6
-rw-r--r--plugins/adplug/adplug/mtk.cpp4
-rw-r--r--plugins/adplug/adplug/mtk.h18
-rw-r--r--plugins/adplug/adplug/player.cpp4
-rw-r--r--plugins/adplug/adplug/player.h24
-rw-r--r--plugins/adplug/adplug/players.cpp35
-rw-r--r--plugins/adplug/adplug/players.h33
-rw-r--r--plugins/adplug/adplug/protrack.cpp2
-rw-r--r--plugins/adplug/adplug/psi.cpp4
-rw-r--r--plugins/adplug/adplug/psi.h2
-rw-r--r--plugins/adplug/adplug/rad.cpp4
-rw-r--r--plugins/adplug/adplug/rad.h10
-rw-r--r--plugins/adplug/adplug/rat.cpp10
-rw-r--r--plugins/adplug/adplug/rat.h4
-rw-r--r--plugins/adplug/adplug/raw.cpp4
-rw-r--r--plugins/adplug/adplug/raw.h6
-rw-r--r--plugins/adplug/adplug/rix.cpp11
-rw-r--r--plugins/adplug/adplug/rix.h6
-rw-r--r--plugins/adplug/adplug/rol.cpp208
-rw-r--r--plugins/adplug/adplug/rol.h89
-rw-r--r--plugins/adplug/adplug/s3m.cpp192
-rw-r--r--plugins/adplug/adplug/s3m.h14
-rw-r--r--plugins/adplug/adplug/sa2.cpp27
-rw-r--r--plugins/adplug/adplug/sa2.h14
-rw-r--r--plugins/adplug/adplug/sng.cpp4
-rw-r--r--plugins/adplug/adplug/sng.h6
-rw-r--r--plugins/adplug/adplug/u6m.cpp50
-rw-r--r--plugins/adplug/adplug/u6m.h18
-rw-r--r--plugins/adplug/adplug/xad.cpp10
-rw-r--r--plugins/adplug/adplug/xad.h24
-rw-r--r--plugins/adplug/adplug/xsm.cpp2
-rw-r--r--plugins/adplug/adplug/xsm.h4
-rw-r--r--plugins/adplug/libbinio/binio.h4
-rw-r--r--plugins/ao/eng_ssf/m68kcpu.h2
-rw-r--r--plugins/dumb/cdumb.c2
-rw-r--r--plugins/dumb/dumb-kode54/src/it/itrender.c1
-rw-r--r--plugins/ffap/ffap.c7
-rw-r--r--plugins/gme/cgme.c2
-rw-r--r--plugins/gtkui/ddbcellrenderertextmultiline.c8
-rw-r--r--plugins/gtkui/ddbcellrenderertextmultiline.h2
-rw-r--r--plugins/musepack/musepack.c5
-rw-r--r--plugins/sid/Makefile.am32
-rw-r--r--plugins/sid/csid.cpp29
-rw-r--r--plugins/sid/plugin.c5
-rw-r--r--plugins/sid/sidplay-libs/Makefile.am107
-rw-r--r--plugins/sid/sidplay-libs/builders/resid-builder/include/sidplay/builders/resid.h7
-rw-r--r--plugins/sid/sidplay-libs/builders/resid-builder/src/resid-builder.cpp23
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/include/sidplay/SidTune.h8
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/src/mos6510/cycle_based/mos6510c.h20
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/src/mos6510/cycle_based/mos6510c.i9
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/src/sidtune/IconInfo.cpp34
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/src/sidtune/InfoFile.cpp49
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/src/sidtune/PSID.cpp2
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/src/sidtune/SidTune.cpp56
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/src/sidtune/SidTuneTools.cpp35
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/src/sidtune/SidTuneTools.h9
-rw-r--r--plugins/sid/sidplay-libs/resid/envelope.cpp (renamed from plugins/sid/sidplay-libs/resid/envelope.cc)0
-rw-r--r--plugins/sid/sidplay-libs/resid/extfilt.cpp (renamed from plugins/sid/sidplay-libs/resid/extfilt.cc)0
-rw-r--r--plugins/sid/sidplay-libs/resid/filter.cpp (renamed from plugins/sid/sidplay-libs/resid/filter.cc)0
-rw-r--r--plugins/sid/sidplay-libs/resid/pot.cpp (renamed from plugins/sid/sidplay-libs/resid/pot.cc)0
-rw-r--r--plugins/sid/sidplay-libs/resid/sid.cpp (renamed from plugins/sid/sidplay-libs/resid/sid.cc)0
-rw-r--r--plugins/sid/sidplay-libs/resid/version.cpp (renamed from plugins/sid/sidplay-libs/resid/version.cc)0
-rw-r--r--plugins/sid/sidplay-libs/resid/voice.cpp (renamed from plugins/sid/sidplay-libs/resid/voice.cc)0
-rw-r--r--plugins/sid/sidplay-libs/resid/wave.cpp (renamed from plugins/sid/sidplay-libs/resid/wave.cc)0
-rw-r--r--plugins/sid/sidplay-libs/resid/wave6581_PST.cpp (renamed from plugins/sid/sidplay-libs/resid/wave6581_PST.cc)0
-rw-r--r--plugins/sid/sidplay-libs/resid/wave6581_PS_.cpp (renamed from plugins/sid/sidplay-libs/resid/wave6581_PS_.cc)0
-rw-r--r--plugins/sid/sidplay-libs/resid/wave6581_P_T.cpp (renamed from plugins/sid/sidplay-libs/resid/wave6581_P_T.cc)0
-rw-r--r--plugins/sid/sidplay-libs/resid/wave6581__ST.cpp (renamed from plugins/sid/sidplay-libs/resid/wave6581__ST.cc)0
-rw-r--r--plugins/sid/sidplay-libs/resid/wave8580_PST.cpp (renamed from plugins/sid/sidplay-libs/resid/wave8580_PST.cc)0
-rw-r--r--plugins/sid/sidplay-libs/resid/wave8580_PS_.cpp (renamed from plugins/sid/sidplay-libs/resid/wave8580_PS_.cc)0
-rw-r--r--plugins/sid/sidplay-libs/resid/wave8580_P_T.cpp (renamed from plugins/sid/sidplay-libs/resid/wave8580_P_T.cc)0
-rw-r--r--plugins/sid/sidplay-libs/resid/wave8580__ST.cpp (renamed from plugins/sid/sidplay-libs/resid/wave8580__ST.cc)0
-rw-r--r--plugins/vtx/vtx.c2
-rw-r--r--plugins/wavpack/wavpack.c33
-rw-r--r--threading_pthread.c2
143 files changed, 1094 insertions, 1069 deletions
diff --git a/.gitignore b/.gitignore
index bf040115..b4b4ded3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -20,7 +20,6 @@ stamp-h*
*.guess
autom4te.cache
tags
-deadbeef
todo.txt
test
shots
@@ -36,3 +35,13 @@ m4
*.lo
deadbeef.desktop
.vimrc
+ddbcellrenderertextmultiline.vapi
+ddbequalizer.vapi
+ddbseekbar.vapi
+vala.stamp
+*.tar.bz2
+*.tar.gz
+*.gmo
+POTFILES
+stamp-it
+
diff --git a/junklib.c b/junklib.c
index a679c5bc..a7ae5983 100644
--- a/junklib.c
+++ b/junklib.c
@@ -15,12 +15,17 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
#include "junklib.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#if HAVE_ICONV
#define LIBICONV_PLUG
#include <iconv.h>
+#endif
#include <limits.h>
#include <errno.h>
#include <ctype.h>
@@ -29,9 +34,6 @@
#include "playlist.h"
#include "utf8.h"
#include "plugins.h"
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
#define MAX_TEXT_FRAME_SIZE 1024
#define MAX_CUESHEET_FRAME_SIZE 10000
@@ -153,6 +155,7 @@ extract_f32 (unsigned char *buf) {
int
junk_iconv (const char *in, int inlen, char *out, int outlen, const char *cs_in, const char *cs_out) {
+#if HAVE_ICONV
iconv_t cd = iconv_open (cs_out, cs_in);
if (cd == (iconv_t)-1) {
return -1;
@@ -179,6 +182,10 @@ junk_iconv (const char *in, int inlen, char *out, int outlen, const char *cs_in,
}
//trace ("iconv out: %s (len=%d)\n", out, pout - out);
return pout - out;
+#elif TARGET_ANDROID
+ // TODO: android charset conversion
+ return 0;
+#endif
}
diff --git a/playlist.c b/playlist.c
index d156d8d3..40d1a671 100644
--- a/playlist.c
+++ b/playlist.c
@@ -16,7 +16,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAVE_CONFIG_H
-# include <config.h>
+# include "config.h"
#endif
#include <stdlib.h>
#include <string.h>
@@ -1352,6 +1352,10 @@ pl_insert_file (playItem_t *after, const char *fname, int *pabort, int (*cb)(pla
return NULL;
}
+static int dirent_alphasort (const struct dirent **a, const struct dirent **b) {
+ return strcmp ((*a)->d_name, (*b)->d_name);
+}
+
playItem_t *
pl_insert_dir (playItem_t *after, const char *dirname, int *pabort, int (*cb)(playItem_t *it, void *data), void *user_data) {
if (!memcmp (dirname, "file://", 7)) {
@@ -1365,7 +1369,7 @@ pl_insert_dir (playItem_t *after, const char *dirname, int *pabort, int (*cb)(pl
struct dirent **namelist = NULL;
int n;
- n = scandir (dirname, &namelist, NULL, alphasort);
+ n = scandir (dirname, &namelist, NULL, dirent_alphasort);
if (n < 0)
{
if (namelist)
diff --git a/plugins.c b/plugins.c
index ffa381c1..07c38a7e 100644
--- a/plugins.c
+++ b/plugins.c
@@ -28,7 +28,7 @@
#endif
#include <limits.h>
#ifdef HAVE_CONFIG_H
-# include <config.h>
+# include "config.h"
#endif
#include "gettext.h"
#include "plugins.h"
@@ -340,7 +340,7 @@ plug_ev_subscribe (DB_plugin_t *plugin, int ev, DB_callback_t callback, uintptr_
}
mutex_unlock (mutex);
if (i == MAX_HANDLERS) {
- fprintf (stderr, "failed to subscribe plugin %s to event %d (too many event handlers)\n", plugin->name, ev);
+ trace ("failed to subscribe plugin %s to event %d (too many event handlers)\n", plugin->name, ev);
}
}
@@ -523,12 +523,12 @@ plug_init_plugin (DB_plugin_t* (*loadfunc)(DB_functions_t *), void *handle) {
if (plugin_api->api_vmajor != 0 || plugin_api->api_vminor != 0) {
// version check enabled
if (plugin_api->api_vmajor != DB_API_VERSION_MAJOR || plugin_api->api_vminor != DB_API_VERSION_MINOR) {
- fprintf (stderr, "\033[0;31mWARNING: plugin \"%s\" wants API v%d.%d (got %d.%d), will not be loaded\033[0;m\n", plugin_api->name, plugin_api->api_vmajor, plugin_api->api_vminor, DB_API_VERSION_MAJOR, DB_API_VERSION_MINOR);
+ trace ("\033[0;31mWARNING: plugin \"%s\" wants API v%d.%d (got %d.%d), will not be loaded\033[0;m\n", plugin_api->name, plugin_api->api_vmajor, plugin_api->api_vminor, DB_API_VERSION_MAJOR, DB_API_VERSION_MINOR);
return -1;
}
}
else {
- fprintf (stderr, "\033[0;31mWARNING: plugin \"%s\" has disabled version check. do not distribute!\033[0;m\n", plugin_api->name);
+ trace ("\033[0;31mWARNING: plugin \"%s\" has disabled version check. do not distribute!\033[0;m\n", plugin_api->name);
}
#endif
plugin_t *plug = malloc (sizeof (plugin_t));
@@ -545,11 +545,17 @@ plug_init_plugin (DB_plugin_t* (*loadfunc)(DB_functions_t *), void *handle) {
return 0;
}
-void
+static int dirent_alphasort (const struct dirent **a, const struct dirent **b) {
+ return strcmp ((*a)->d_name, (*b)->d_name);
+}
+
+int
plug_load_all (void) {
#if DISABLE_VERSIONCHECK
- fprintf (stderr, "\033[0;31mDISABLE_VERSIONCHECK=1! do not distribute!\033[0;m\n");
+ trace ("\033[0;31mDISABLE_VERSIONCHECK=1! do not distribute!\033[0;m\n");
#endif
+
+#if !TARGET_ANDROID
const char *conf_blacklist_plugins = conf_get_str ("blacklist_plugins", "");
trace ("plug: mutex_create\n");
mutex = mutex_create ();
@@ -565,13 +571,13 @@ plug_load_all (void) {
char *homedir = getenv ("HOME");
if (!homedir) {
- fprintf (stderr, "plug_load_all: warning: unable to find home directory\n");
+ trace ("plug_load_all: warning: unable to find home directory\n");
xdg_plugin_dir[0] = 0;
}
else {
int written = snprintf (xdg_plugin_dir, sizeof (xdg_plugin_dir), "%s/.local/lib/deadbeef", homedir);
if (written > sizeof (xdg_plugin_dir)) {
- fprintf (stderr, "warning: XDG_LOCAL_HOME value is too long: %s. Ignoring.", xdg_local_home);
+ trace ("warning: XDG_LOCAL_HOME value is too long: %s. Ignoring.", xdg_local_home);
xdg_plugin_dir[0] = 0;
}
}
@@ -586,9 +592,9 @@ plug_load_all (void) {
if (!(*plugdir)) {
continue;
}
- fprintf (stderr, "loading plugins from %s\n", plugdir);
+ trace ("loading plugins from %s\n", plugdir);
namelist = NULL;
- n = scandir (plugdir, &namelist, NULL, alphasort);
+ n = scandir (plugdir, &namelist, NULL, dirent_alphasort);
if (n < 0)
{
if (namelist) {
@@ -632,29 +638,29 @@ plug_load_all (void) {
}
}
if (!p) {
- fprintf (stderr, "plugin %s is blacklisted in config file\n", d_name);
+ trace ("plugin %s is blacklisted in config file\n", d_name);
break;
}
char fullname[PATH_MAX];
snprintf (fullname, PATH_MAX, "%s/%s", plugdir, d_name);
- fprintf (stderr, "loading plugin %s\n", d_name);
+ trace ("loading plugin %s\n", d_name);
void *handle = dlopen (fullname, RTLD_NOW);
if (!handle) {
- fprintf (stderr, "dlopen error: %s\n", dlerror ());
+ trace ("dlopen error: %s\n", dlerror ());
break;
}
d_name[l-3] = 0;
- fprintf (stderr, "module name is %s\n", d_name);
+ trace ("module name is %s\n", d_name);
strcat (d_name, "_load");
DB_plugin_t *(*plug_load)(DB_functions_t *api) = dlsym (handle, d_name);
if (!plug_load) {
- fprintf (stderr, "dlsym error: %s\n", dlerror ());
+ trace ("dlsym error: %s\n", dlerror ());
dlclose (handle);
break;
}
if (plug_init_plugin (plug_load, handle) < 0) {
d_name[l-3] = 0;
- fprintf (stderr, "plugin %s is incompatible with current version of deadbeef, please upgrade the plugin\n", d_name);
+ trace ("plugin %s is incompatible with current version of deadbeef, please upgrade the plugin\n", d_name);
dlclose (handle);
break;
}
@@ -665,6 +671,7 @@ plug_load_all (void) {
free (namelist);
}
}
+#endif
// load all compiled-in modules
#define PLUG(n) extern DB_plugin_t * n##_load (DB_functions_t *api);
#include "moduleconf.h"
@@ -672,6 +679,14 @@ plug_load_all (void) {
#define PLUG(n) plug_init_plugin (n##_load, NULL);
#include "moduleconf.h"
#undef PLUG
+#if TARGET_ANDROID
+#define PLUG(n) extern DB_plugin_t * n##_load (DB_functions_t *api);
+#include "moduleconf-android.h"
+#undef PLUG
+#define PLUG(n) plug_init_plugin (n##_load, NULL);
+#include "moduleconf-android.h"
+#undef PLUG
+#endif
plugin_t *plug;
// categorize plugins
@@ -683,28 +698,28 @@ plug_load_all (void) {
for (plug = plugins; plug; plug = plug->next) {
g_plugins[numplugins++] = plug->plugin;
if (plug->plugin->type == DB_PLUGIN_DECODER) {
- fprintf (stderr, "found decoder plugin %s\n", plug->plugin->name);
+ trace ("found decoder plugin %s\n", plug->plugin->name);
if (numdecoders >= MAX_DECODER_PLUGINS) {
break;
}
g_decoder_plugins[numdecoders++] = (DB_decoder_t *)plug->plugin;
}
else if (plug->plugin->type == DB_PLUGIN_VFS) {
- fprintf (stderr, "found vfs plugin %s\n", plug->plugin->name);
+ trace ("found vfs plugin %s\n", plug->plugin->name);
if (numvfs >= MAX_VFS_PLUGINS) {
break;
}
g_vfs_plugins[numvfs++] = (DB_vfs_t *)plug->plugin;
}
else if (plug->plugin->type == DB_PLUGIN_OUTPUT) {
- fprintf (stderr, "found output plugin %s\n", plug->plugin->name);
+ trace ("found output plugin %s\n", plug->plugin->name);
if (numoutput >= MAX_OUTPUT_PLUGINS) {
break;
}
g_output_plugins[numoutput++] = (DB_output_t *)plug->plugin;
}
else if (plug->plugin->type == DB_PLUGIN_DSP) {
- fprintf (stderr, "found dsp plugin %s\n", plug->plugin->name);
+ trace ("found dsp plugin %s\n", plug->plugin->name);
if (numdsp >= MAX_DSP_PLUGINS) {
break;
}
@@ -720,7 +735,7 @@ plug_load_all (void) {
}
}
-// fprintf (stderr, "numplugins: %d, numdecoders: %d, numvfs: %d\n", numplugins, numdecoders, numvfs);
+// trace ("numplugins: %d, numdecoders: %d, numvfs: %d\n", numplugins, numdecoders, numvfs);
g_plugins[numplugins] = NULL;
g_decoder_plugins[numdecoders] = NULL;
g_vfs_plugins[numvfs] = NULL;
@@ -728,33 +743,36 @@ plug_load_all (void) {
// select output plugin
if (plug_select_output () < 0) {
- fprintf (stderr, "failed to find output plugin!\n");
- exit (-1);
+ trace ("failed to find output plugin!\n");
+ return -1;
}
+ return 0;
}
void
plug_unload_all (void) {
- fprintf (stderr, "plug_unload_all\n");
+ trace ("plug_unload_all\n");
plugin_t *p;
for (p = plugins; p; p = p->next) {
if (p->plugin->stop) {
- fprintf (stderr, "stopping %s...\n", p->plugin->name);
+ trace ("stopping %s...\n", p->plugin->name);
fflush (stderr);
p->plugin->stop ();
}
}
- fprintf (stderr, "stopped all plugins\n");
+ trace ("stopped all plugins\n");
while (plugins) {
plugin_t *next = plugins->next;
+#if !TARGET_ANDROID
if (plugins->handle) {
dlclose (plugins->handle);
}
+#endif
free (plugins);
plugins = next;
}
plugins_tail = NULL;
- fprintf (stderr, "all plugins had been unloaded\n");
+ trace ("all plugins had been unloaded\n");
}
void
@@ -805,7 +823,7 @@ plug_activate (DB_plugin_t *plug, int activate) {
plug->inactive = 0;
}
else {
- fprintf (stderr, "failed to start plugin %s\n", plug->name);
+ trace ("failed to start plugin %s\n", plug->name);
return -1;
}
return 0;
@@ -820,7 +838,7 @@ plug_activate (DB_plugin_t *plug, int activate) {
plug->inactive = 1;
}
else {
- fprintf (stderr, "failed to stop plugin %s\n", plug->name);
+ trace ("failed to stop plugin %s\n", plug->name);
return -1;
}
return 0;
@@ -842,7 +860,7 @@ plug_select_output (void) {
for (int i = 0; g_output_plugins[i]; i++) {
DB_output_t *p = g_output_plugins[i];
if (!strcmp (p->plugin.name, outplugname)) {
- fprintf (stderr, "selected output plugin: %s\n", outplugname);
+ trace ("selected output plugin: %s\n", outplugname);
output_plugin = p;
break;
}
@@ -850,7 +868,7 @@ plug_select_output (void) {
if (!output_plugin) {
output_plugin = g_output_plugins[0];
if (output_plugin) {
- fprintf (stderr, "selected output plugin: %s\n", output_plugin->plugin.name);
+ trace ("selected output plugin: %s\n", output_plugin->plugin.name);
conf_set_str ("output_plugin", output_plugin->plugin.name);
}
}
@@ -870,7 +888,7 @@ plug_reinit_sound (void) {
DB_output_t *prev = plug_get_output ();
if (plug_select_output () < 0) {
const char *outplugname = conf_get_str ("output_plugin", "ALSA output plugin");
- fprintf (stderr, "failed to select output plugin %s\nreverted to %s\n", outplugname, prev->plugin.name);
+ trace ("failed to select output plugin %s\nreverted to %s\n", outplugname, prev->plugin.name);
output_plugin = prev;
}
streamer_reset (1);
@@ -881,7 +899,7 @@ plug_reinit_sound (void) {
if (state != OUTPUT_STATE_PAUSED && state != OUTPUT_STATE_STOPPED) {
if (p_play () < 0) {
- fprintf (stderr, "failed to reinit sound output\n");
+ trace ("failed to reinit sound output\n");
streamer_set_nextsong (-2, 0);
}
}
diff --git a/plugins.h b/plugins.h
index 3b275316..231eaf1f 100644
--- a/plugins.h
+++ b/plugins.h
@@ -24,7 +24,7 @@ extern DB_functions_t *deadbeef;
struct playItem_s;
-void
+int
plug_load_all (void);
void
diff --git a/plugins/adplug/Makefile.am b/plugins/adplug/Makefile.am
index 0d4e2a5d..a75f38b5 100644
--- a/plugins/adplug/Makefile.am
+++ b/plugins/adplug/Makefile.am
@@ -40,8 +40,6 @@ adplug_la_SOURCES = adplug-db.cpp\
adplug/cff.h\
adplug/d00.cpp\
adplug/d00.h\
- adplug/database.cpp\
- adplug/database.h\
adplug/debug.c\
adplug/debug.h\
adplug/dfm.cpp\
@@ -133,5 +131,8 @@ adplug_la_SOURCES = adplug-db.cpp\
adplug/xsm.cpp\
adplug/xsm.h
+# adplug/database.cpp
+# adplug/database.h
+
adplug_la_LDFLAGS = -module
endif
diff --git a/plugins/adplug/adplug-db.cpp b/plugins/adplug/adplug-db.cpp
index 3a3a683f..1ecb9c74 100644
--- a/plugins/adplug/adplug-db.cpp
+++ b/plugins/adplug/adplug-db.cpp
@@ -66,7 +66,7 @@ adplug_init (DB_fileinfo_t *_info, DB_playItem_t *it) {
// return -1 on failure
adplug_info_t *info = (adplug_info_t *)_info;
- int samplerate = deadbeef->conf_get_int ("synth.samplerate", 48000);
+ int samplerate = deadbeef->conf_get_int ("synth.samplerate", 44100);
int bps = deadbeef->get_output ()->bitspersample ();
int channels = 2;
info->opl = new CEmuopl (samplerate, true, channels == 2);
@@ -79,7 +79,7 @@ adplug_init (DB_fileinfo_t *_info, DB_playItem_t *it) {
info->subsong = it->tracknum;
info->decoder->rewind (info->subsong);
- info->totalsamples = info->decoder->songlength (info->subsong) * samplerate / 1000;
+ info->totalsamples = info->decoder->songlength (info->subsong) / 1000.f * samplerate;
info->currentsample = 0;
info->toadd = 0;
@@ -90,7 +90,7 @@ adplug_init (DB_fileinfo_t *_info, DB_playItem_t *it) {
_info->samplerate = samplerate;
_info->readpos = 0;
- trace ("adplug_init ok (duration=%f, totalsamples=%d)\n", deadbeef->pl_get_item_duration (it), totalsamples);
+ trace ("adplug_init ok (songlength=%d, duration=%f, totalsamples=%d)\n", info->decoder->songlength (info->subsong), deadbeef->pl_get_item_duration (it), info->totalsamples);
return 0;
}
@@ -235,6 +235,8 @@ adplug_insert (DB_playItem_t *after, const char *fname) {
// return track pointer on success
// return NULL on failure
+ trace ("adplug: trying to insert %s\n", fname);
+
CSilentopl opl;
CPlayer *p = CAdPlug::factory (fname, &opl, CAdPlug::players);
if (!p) {
@@ -252,18 +254,19 @@ adplug_insert (DB_playItem_t *after, const char *fname) {
it->tracknum = i;
deadbeef->pl_set_item_duration (it, p->songlength (i)/1000.f);
// add metainfo
- if (!p->gettitle().empty()) {
- adplug_add_meta (it, "title", p->gettitle().c_str());
- }
- else {
- deadbeef->pl_add_meta (it, "title", NULL);
- }
- if (!p->getdesc().empty()) {
- adplug_add_meta (it, "comment", p->getdesc().c_str());
- }
- if (!p->getauthor().empty()) {
- adplug_add_meta (it, "artist", p->getauthor().c_str());
- }
+// if (p->gettitle()[0]) {
+// adplug_add_meta (it, "title", p->gettitle());
+// }
+// else {
+// deadbeef->pl_add_meta (it, "title", NULL);
+// }
+// if (p->getdesc()[0]) {
+// adplug_add_meta (it, "comment", p->getdesc());
+// }
+// if (!p->getauthor()[0]) {
+// adplug_add_meta (it, "artist", p->getauthor());
+// }
+ deadbeef->pl_add_meta (it, "title", NULL);
// insert
after = deadbeef->pl_insert_item (after, it);
deadbeef->pl_item_unref (it);
diff --git a/plugins/adplug/adplug/a2m.cpp b/plugins/adplug/adplug/a2m.cpp
index d9d775e2..83940b68 100644
--- a/plugins/adplug/adplug/a2m.cpp
+++ b/plugins/adplug/adplug/a2m.cpp
@@ -29,7 +29,7 @@
* Following commands are ignored: Gxy, Hxy, Kxy - &xy
*/
-#include <cstring>
+#include <string.h>
#include "a2m.h"
const unsigned int Ca2mLoader::MAXFREQ = 2000,
@@ -59,7 +59,7 @@ CPlayer *Ca2mLoader::factory(Copl *newopl)
return new Ca2mLoader(newopl);
}
-bool Ca2mLoader::load(const std::string &filename, const CFileProvider &fp)
+bool Ca2mLoader::load(const char *filename, const CFileProvider &fp)
{
binistream *f = fp.open(filename); if(!f) return false;
char id[10];
diff --git a/plugins/adplug/adplug/a2m.h b/plugins/adplug/adplug/a2m.h
index 9e032f61..e21d1dff 100644
--- a/plugins/adplug/adplug/a2m.h
+++ b/plugins/adplug/adplug/a2m.h
@@ -32,19 +32,19 @@ public:
Ca2mLoader(Copl *newopl): CmodPlayer(newopl)
{ }
- bool load(const std::string &filename, const CFileProvider &fp);
+ bool load(const char *filename, const CFileProvider &fp);
float getrefresh();
- std::string gettype()
- { return std::string("AdLib Tracker 2"); }
- std::string gettitle()
- { if(*songname) return std::string(songname,1,*songname); else return std::string(); }
- std::string getauthor()
- { if(*author) return std::string(author,1,*author); else return std::string(); }
+ const char *gettype()
+ { return "AdLib Tracker 2"; }
+ const char *gettitle()
+ { if(*songname) return songname; else return ""; }
+ const char *getauthor()
+ { if(*author) return author; else return ""; }
unsigned int getinstruments()
{ return 250; }
- std::string getinstrument(unsigned int n)
- { return std::string(instname[n],1,*instname[n]); }
+ const char *getinstrument(unsigned int n)
+ { return instname[n]; }
private:
diff --git a/plugins/adplug/adplug/adl.cpp b/plugins/adplug/adplug/adl.cpp
index ae8c4e99..0ad196e9 100644
--- a/plugins/adplug/adplug/adl.cpp
+++ b/plugins/adplug/adplug/adl.cpp
@@ -48,10 +48,10 @@
*
*/
-#include <cstring>
#include <inttypes.h>
#include <stdarg.h>
#include <assert.h>
+#include <string.h>
#include "adl.h"
#include "debug.h"
@@ -2321,7 +2321,7 @@ void CadlPlayer::play(uint8_t track) {
// playSoundEffect(1);
// }
-bool CadlPlayer::load(const std::string &filename, const CFileProvider &fp)
+bool CadlPlayer::load(const char *filename, const CFileProvider &fp)
{
binistream *f = fp.open(filename);
diff --git a/plugins/adplug/adplug/adl.h b/plugins/adplug/adplug/adl.h
index 203692b0..6a47a1a9 100644
--- a/plugins/adplug/adplug/adl.h
+++ b/plugins/adplug/adplug/adl.h
@@ -36,7 +36,7 @@ class CadlPlayer: public CPlayer
CadlPlayer(Copl *newopl);
~CadlPlayer();
- bool load(const std::string &filename, const CFileProvider &fp);
+ bool load(const char *filename, const CFileProvider &fp);
bool update();
void rewind(int subsong = -1);
@@ -48,7 +48,7 @@ class CadlPlayer: public CPlayer
unsigned int getsubsongs();
unsigned int getsubsong() { return cursubsong; }
- std::string gettype() { return std::string("Westwood ADL"); }
+ const char *gettype() { return "Westwood ADL"; }
private:
int numsubsongs, cursubsong;
diff --git a/plugins/adplug/adplug/adplug.cpp b/plugins/adplug/adplug/adplug.cpp
index f4b8e729..ab5f7513 100644
--- a/plugins/adplug/adplug/adplug.cpp
+++ b/plugins/adplug/adplug/adplug.cpp
@@ -19,8 +19,7 @@
* adplug.cpp - CAdPlug utility class, by Simon Peter <dn.tlp@gmx.net>
*/
-#include <cstring>
-#include <string>
+#include <string.h>
#include <binfile.h>
#include "adplug.h"
@@ -72,7 +71,7 @@
/***** CAdPlug *****/
// List of all players that come with the standard AdPlug distribution
-const CPlayerDesc CAdPlug::allplayers[] = {
+CPlayerDesc CAdPlug::allplayers[] = {
CPlayerDesc(ChscPlayer::factory, "HSC-Tracker", ".hsc\0"),
CPlayerDesc(CsngPlayer::factory, "SNGPlay", ".sng\0"),
CPlayerDesc(CimfPlayer::factory, "Apogee IMF", ".imf\0.wlf\0.adlib\0"),
@@ -116,7 +115,7 @@ const CPlayerDesc CAdPlug::allplayers[] = {
CPlayerDesc()
};
-const CPlayers &CAdPlug::init_players(const CPlayerDesc pd[])
+const CPlayers &CAdPlug::init_players(CPlayerDesc pd[])
{
static CPlayers initplayers;
unsigned int i;
@@ -128,23 +127,23 @@ const CPlayers &CAdPlug::init_players(const CPlayerDesc pd[])
}
const CPlayers CAdPlug::players = CAdPlug::init_players(CAdPlug::allplayers);
-CAdPlugDatabase *CAdPlug::database = 0;
+//CAdPlugDatabase *CAdPlug::database = 0;
-CPlayer *CAdPlug::factory(const std::string &fn, Copl *opl, const CPlayers &pl,
+CPlayer *CAdPlug::factory(const char *fn, Copl *opl, const CPlayers &pl,
const CFileProvider &fp)
{
CPlayer *p;
- CPlayers::const_iterator i;
+ CPlayerDesc *i;
unsigned int j;
- AdPlug_LogWrite("*** CAdPlug::factory(\"%s\",opl,fp) ***\n", fn.c_str());
+ AdPlug_LogWrite("*** CAdPlug::factory(\"%s\",opl,fp) ***\n", fn);
// Try a direct hit by file extension
- for(i = pl.begin(); i != pl.end(); i++)
- for(j = 0; (*i)->get_extension(j); j++)
- if(fp.extension(fn, (*i)->get_extension(j))) {
- AdPlug_LogWrite("Trying direct hit: %s\n", (*i)->filetype.c_str());
- if((p = (*i)->factory(opl))) {
+ for(i = pl.head; i; i = i->next)
+ for(j = 0; i->get_extension(j); j++)
+ if(fp.extension(fn, i->get_extension(j))) {
+ AdPlug_LogWrite("Trying direct hit: %s\n", i->filetype);
+ if((p = i->factory(opl))) {
if(p->load(fn, fp)) {
AdPlug_LogWrite("got it!\n");
AdPlug_LogWrite("--- CAdPlug::factory ---\n");
@@ -155,9 +154,9 @@ CPlayer *CAdPlug::factory(const std::string &fn, Copl *opl, const CPlayers &pl,
}
// Try all players, one by one
- for(i = pl.begin(); i != pl.end(); i++) {
- AdPlug_LogWrite("Trying: %s\n", (*i)->filetype.c_str());
- if((p = (*i)->factory(opl))) {
+ for(i = pl.head; i; i = i->next) {
+ AdPlug_LogWrite("Trying: %s\n", i->filetype);
+ if((p = i->factory(opl))) {
if(p->load(fn, fp)) {
AdPlug_LogWrite("got it!\n");
AdPlug_LogWrite("--- CAdPlug::factory ---\n");
@@ -173,18 +172,20 @@ CPlayer *CAdPlug::factory(const std::string &fn, Copl *opl, const CPlayers &pl,
return 0;
}
+#if 0
void CAdPlug::set_database(CAdPlugDatabase *db)
{
database = db;
}
+#endif
-std::string CAdPlug::get_version()
+const char * CAdPlug::get_version()
{
- return std::string(VERSION);
+ return VERSION;
}
-void CAdPlug::debug_output(const std::string &filename)
+void CAdPlug::debug_output(const char *filename)
{
- AdPlug_LogFile(filename.c_str());
- AdPlug_LogWrite("CAdPlug::debug_output(\"%s\"): Redirected.\n",filename.c_str());
+ AdPlug_LogFile(filename);
+ AdPlug_LogWrite("CAdPlug::debug_output(\"%s\"): Redirected.\n",filename);
}
diff --git a/plugins/adplug/adplug/adplug.h b/plugins/adplug/adplug/adplug.h
index e5aec896..f9d2117a 100644
--- a/plugins/adplug/adplug/adplug.h
+++ b/plugins/adplug/adplug/adplug.h
@@ -22,8 +22,6 @@
#ifndef H_ADPLUG_ADPLUG
#define H_ADPLUG_ADPLUG
-#include <string>
-
#include "player.h"
#include "opl.h"
#include "fprovide.h"
@@ -37,19 +35,19 @@ class CAdPlug
public:
static const CPlayers players;
- static CPlayer *factory(const std::string &fn, Copl *opl,
+ static CPlayer *factory(const char *fn, Copl *opl,
const CPlayers &pl = players,
const CFileProvider &fp = CProvider_Filesystem());
- static void set_database(CAdPlugDatabase *db);
- static std::string get_version();
- static void debug_output(const std::string &filename);
+// static void set_database(CAdPlugDatabase *db);
+ static const char *get_version();
+ static void debug_output(const char *filename);
private:
- static CAdPlugDatabase *database;
- static const CPlayerDesc allplayers[];
+// static CAdPlugDatabase *database;
+ static CPlayerDesc allplayers[];
- static const CPlayers &init_players(const CPlayerDesc pd[]);
+ static const CPlayers &init_players(CPlayerDesc pd[]);
};
#endif
diff --git a/plugins/adplug/adplug/adtrack.cpp b/plugins/adplug/adplug/adtrack.cpp
index d3f3490a..54866a32 100644
--- a/plugins/adplug/adplug/adtrack.cpp
+++ b/plugins/adplug/adplug/adtrack.cpp
@@ -35,6 +35,10 @@
#include "adtrack.h"
#include "debug.h"
+#include <limits.h>
+#ifndef PATH_MAX
+#define PATH_MAX 1024 /* max # of characters in a path name */
+#endif
/*** Public methods ***/
CPlayer *CadtrackLoader::factory(Copl *newopl)
@@ -42,7 +46,7 @@ CPlayer *CadtrackLoader::factory(Copl *newopl)
return new CadtrackLoader(newopl);
}
-bool CadtrackLoader::load(const std::string &filename, const CFileProvider &fp)
+bool CadtrackLoader::load(const char * filename, const CFileProvider &fp)
{
binistream *f = fp.open(filename); if(!f) return false;
binistream *instf;
@@ -57,10 +61,21 @@ bool CadtrackLoader::load(const std::string &filename, const CFileProvider &fp)
{ fp.close(f); return false; }
// check for instruments file
- std::string instfilename(filename, 0, filename.find_last_of('.'));
- instfilename += ".ins";
+ char instfilename[PATH_MAX];
+ strncpy (instfilename, filename, sizeof (instfilename)-5);
+ instfilename[PATH_MAX-5] = 0;
+ char *pext = instfilename + strlen (instfilename);
+ while (pext > instfilename && *pext != '.') {
+ pext--;
+ }
+ if (*pext == '.') {
+ strcpy (pext, ".ins");
+ }
+ else {
+ strcat (instfilename, ".ins");
+ }
AdPlug_LogWrite("CadtrackLoader::load(,\"%s\"): Checking for \"%s\"...\n",
- filename.c_str(), instfilename.c_str());
+ filename, instfilename);
instf = fp.open(instfilename);
if(!instf || fp.filesize(instf) != 468) { fp.close(f); return false; }
diff --git a/plugins/adplug/adplug/adtrack.h b/plugins/adplug/adplug/adtrack.h
index 289491ff..9515976c 100644
--- a/plugins/adplug/adplug/adtrack.h
+++ b/plugins/adplug/adplug/adtrack.h
@@ -30,11 +30,11 @@ public:
: CmodPlayer(newopl)
{ };
- bool load(const std::string &filename, const CFileProvider &fp);
+ bool load(const char *filename, const CFileProvider &fp);
float getrefresh();
- std::string gettype()
- { return std::string("Adlib Tracker 1.0"); };
+ const char * gettype()
+ { return "Adlib Tracker 1.0"; };
unsigned int getinstruments()
{ return 9; };
diff --git a/plugins/adplug/adplug/amd.cpp b/plugins/adplug/adplug/amd.cpp
index 4f844227..4f05bb51 100644
--- a/plugins/adplug/adplug/amd.cpp
+++ b/plugins/adplug/adplug/amd.cpp
@@ -29,7 +29,7 @@ CPlayer *CamdLoader::factory(Copl *newopl)
return new CamdLoader(newopl);
}
-bool CamdLoader::load(const std::string &filename, const CFileProvider &fp)
+bool CamdLoader::load(const char *filename, const CFileProvider &fp)
{
binistream *f = fp.open(filename); if(!f) return false;
struct {
diff --git a/plugins/adplug/adplug/amd.h b/plugins/adplug/adplug/amd.h
index daa630b6..847ac037 100644
--- a/plugins/adplug/adplug/amd.h
+++ b/plugins/adplug/adplug/amd.h
@@ -30,19 +30,19 @@ public:
: CmodPlayer(newopl)
{ };
- bool load(const std::string &filename, const CFileProvider &fp);
+ bool load(const char *filename, const CFileProvider &fp);
float getrefresh();
- std::string gettype()
- { return std::string("AMUSIC Adlib Tracker"); };
- std::string gettitle()
- { return std::string(songname,0,24); };
- std::string getauthor()
- { return std::string(author,0,24); };
+ const char *gettype()
+ { return "AMUSIC Adlib Tracker"; };
+ const char *gettitle()
+ { return songname; };
+ const char *getauthor()
+ { return author; };
unsigned int getinstruments()
{ return 26; };
- std::string getinstrument(unsigned int n)
- { return std::string(instname[n],0,23); };
+ const char *getinstrument(unsigned int n)
+ { return instname[n]; };
private:
char songname[24],author[24],instname[26][23];
diff --git a/plugins/adplug/adplug/bam.cpp b/plugins/adplug/adplug/bam.cpp
index ea1aca01..20ee4d8d 100644
--- a/plugins/adplug/adplug/bam.cpp
+++ b/plugins/adplug/adplug/bam.cpp
@@ -65,7 +65,7 @@ CPlayer *CbamPlayer::factory(Copl *newopl)
return new CbamPlayer(newopl);
}
-bool CbamPlayer::load(const std::string &filename, const CFileProvider &fp)
+bool CbamPlayer::load(const char *filename, const CFileProvider &fp)
{
binistream *f = fp.open(filename); if(!f) return false;
char id[4];
diff --git a/plugins/adplug/adplug/bam.h b/plugins/adplug/adplug/bam.h
index 53f321b2..329b9369 100644
--- a/plugins/adplug/adplug/bam.h
+++ b/plugins/adplug/adplug/bam.h
@@ -32,14 +32,14 @@ public:
~CbamPlayer()
{ if(song) delete [] song; };
- bool load(const std::string &filename, const CFileProvider &fp);
+ bool load(const char *filename, const CFileProvider &fp);
bool update();
void rewind(int subsong);
float getrefresh()
{ return 25.0f; };
- std::string gettype()
- { return std::string("Bob's Adlib Music"); };
+ const char *gettype()
+ { return "Bob's Adlib Music"; };
private:
static const unsigned short freq[];
diff --git a/plugins/adplug/adplug/bmf.cpp b/plugins/adplug/adplug/bmf.cpp
index 469fde43..b0ab9ef6 100644
--- a/plugins/adplug/adplug/bmf.cpp
+++ b/plugins/adplug/adplug/bmf.cpp
@@ -40,7 +40,7 @@
comment : inaccurate replaying, because constant outport; in original player it can be 380 or 382.
*/
-#include <cstring>
+#include <string.h>
#include "bmf.h"
#include "debug.h"
@@ -381,19 +381,19 @@ float CxadbmfPlayer::xadplayer_getrefresh()
return bmf.timer;
}
-std::string CxadbmfPlayer::xadplayer_gettype()
+const char * CxadbmfPlayer::xadplayer_gettype()
{
- return std::string("xad: BMF Adlib Tracker");
+ return "xad: BMF Adlib Tracker";
}
-std::string CxadbmfPlayer::xadplayer_gettitle()
+const char * CxadbmfPlayer::xadplayer_gettitle()
{
- return std::string(bmf.title);
+ return bmf.title;
}
-std::string CxadbmfPlayer::xadplayer_getauthor()
+const char * CxadbmfPlayer::xadplayer_getauthor()
{
- return std::string(bmf.author);
+ return bmf.author;
}
unsigned int CxadbmfPlayer::xadplayer_getinstruments()
@@ -401,9 +401,9 @@ unsigned int CxadbmfPlayer::xadplayer_getinstruments()
return 32;
}
-std::string CxadbmfPlayer::xadplayer_getinstrument(unsigned int i)
+const char * CxadbmfPlayer::xadplayer_getinstrument(unsigned int i)
{
- return std::string(bmf.instruments[i].name);
+ return bmf.instruments[i].name;
}
/* -------- Internal Functions ---------------------------- */
diff --git a/plugins/adplug/adplug/bmf.h b/plugins/adplug/adplug/bmf.h
index 12cbdfd3..6db543d6 100644
--- a/plugins/adplug/adplug/bmf.h
+++ b/plugins/adplug/adplug/bmf.h
@@ -75,10 +75,10 @@ protected:
void xadplayer_rewind(int subsong);
void xadplayer_update();
float xadplayer_getrefresh();
- std::string xadplayer_gettype();
- std::string xadplayer_gettitle();
- std::string xadplayer_getauthor();
- std::string xadplayer_getinstrument(unsigned int i);
+ const char * xadplayer_gettype();
+ const char * xadplayer_gettitle();
+ const char * xadplayer_getauthor();
+ const char * xadplayer_getinstrument(unsigned int i);
unsigned int xadplayer_getinstruments();
//
private:
diff --git a/plugins/adplug/adplug/cff.cpp b/plugins/adplug/adplug/cff.cpp
index 68a11692..0966a8d7 100644
--- a/plugins/adplug/adplug/cff.cpp
+++ b/plugins/adplug/adplug/cff.cpp
@@ -24,7 +24,6 @@
slides use previous effect data instead of current.
*/
-#include <cstring>
#include <stdlib.h>
#include <string.h>
@@ -37,7 +36,7 @@ CPlayer *CcffLoader::factory(Copl *newopl)
return new CcffLoader(newopl);
}
-bool CcffLoader::load(const std::string &filename, const CFileProvider &fp)
+bool CcffLoader::load(const char *filename, const CFileProvider &fp)
{
binistream *f = fp.open(filename); if(!f) return false;
const unsigned char conv_inst[11] = { 2,1,10,9,4,3,6,5,0,8,7 };
@@ -275,27 +274,27 @@ void CcffLoader::rewind(int subsong)
}
}
-std::string CcffLoader::gettype()
+const char * CcffLoader::gettype()
{
if (header.packed)
- return std::string("BoomTracker 4, packed");
+ return "BoomTracker 4, packed";
else
- return std::string("BoomTracker 4");
+ return "BoomTracker 4";
}
-std::string CcffLoader::gettitle()
+const char * CcffLoader::gettitle()
{
- return std::string(song_title,20);
+ return song_title;
}
-std::string CcffLoader::getauthor()
+const char * CcffLoader::getauthor()
{
- return std::string(song_author,20);
+ return song_author;
}
-std::string CcffLoader::getinstrument(unsigned int n)
+const char * CcffLoader::getinstrument(unsigned int n)
{
- return std::string(instruments[n].name);
+ return instruments[n].name;
}
unsigned int CcffLoader::getinstruments()
diff --git a/plugins/adplug/adplug/cff.h b/plugins/adplug/adplug/cff.h
index 04ead8bb..08f11315 100644
--- a/plugins/adplug/adplug/cff.h
+++ b/plugins/adplug/adplug/cff.h
@@ -28,13 +28,13 @@ class CcffLoader: public CmodPlayer
CcffLoader(Copl *newopl) : CmodPlayer(newopl) { };
- bool load(const std::string &filename, const CFileProvider &fp);
+ bool load(const char * filename, const CFileProvider &fp);
void rewind(int subsong);
- std::string gettype();
- std::string gettitle();
- std::string getauthor();
- std::string getinstrument(unsigned int n);
+ const char * gettype();
+ const char * gettitle();
+ const char * getauthor();
+ const char * getinstrument(unsigned int n);
unsigned int getinstruments();
private:
diff --git a/plugins/adplug/adplug/d00.cpp b/plugins/adplug/adplug/d00.cpp
index 0644b84b..2f5aca1a 100644
--- a/plugins/adplug/adplug/d00.cpp
+++ b/plugins/adplug/adplug/d00.cpp
@@ -53,7 +53,7 @@ CPlayer *Cd00Player::factory(Copl *newopl)
return new Cd00Player(newopl);
}
-bool Cd00Player::load(const std::string &filename, const CFileProvider &fp)
+bool Cd00Player::load(const char * filename, const CFileProvider &fp)
{
binistream *f = fp.open(filename); if(!f) return false;
d00header *checkhead;
@@ -82,7 +82,7 @@ bool Cd00Player::load(const std::string &filename, const CFileProvider &fp)
delete checkhead;
AdPlug_LogWrite("Cd00Player::load(f,\"%s\"): %s format D00 file detected!\n",
- filename.c_str(), ver1 ? "Old" : "New");
+ filename, ver1 ? "Old" : "New");
// load section
filesize = fp.filesize(f); f->seek(0);
@@ -448,12 +448,10 @@ void Cd00Player::rewind(int subsong)
cursubsong = subsong;
}
-std::string Cd00Player::gettype()
+const char * Cd00Player::gettype()
{
- char tmpstr[40];
-
sprintf(tmpstr,"EdLib packed (version %d)",version > 1 ? header->version : header1->version);
- return std::string(tmpstr);
+ return tmpstr;
}
float Cd00Player::getrefresh()
diff --git a/plugins/adplug/adplug/d00.h b/plugins/adplug/adplug/d00.h
index d0bf4b24..8c6339e1 100644
--- a/plugins/adplug/adplug/d00.h
+++ b/plugins/adplug/adplug/d00.h
@@ -35,18 +35,18 @@ class Cd00Player: public CPlayer
~Cd00Player()
{ if(filedata) delete [] filedata; };
- bool load(const std::string &filename, const CFileProvider &fp);
+ bool load(const char *filename, const CFileProvider &fp);
bool update();
void rewind(int subsong);
float getrefresh();
- std::string gettype();
- std::string gettitle()
- { if(version > 1) return std::string(header->songname); else return std::string(); };
- std::string getauthor()
- { if(version > 1) return std::string(header->author); else return std::string(); };
- std::string getdesc()
- { if(*datainfo) return std::string(datainfo); else return std::string(); };
+ const char * gettype();
+ const char * gettitle()
+ { if(version > 1) return header->songname; else return ""; };
+ const char * getauthor()
+ { if(version > 1) return header->author; else return ""; };
+ const char * getdesc()
+ { if(*datainfo) return datainfo; else return ""; };
unsigned int getsubsongs();
protected:
@@ -97,6 +97,7 @@ class Cd00Player: public CPlayer
d00header *header;
d00header1 *header1;
char *filedata;
+ char tmpstr[40];
private:
void setvolume(unsigned char chan);
diff --git a/plugins/adplug/adplug/database.cpp b/plugins/adplug/adplug/database.cpp
index 0a2abdad..de5cad3c 100644
--- a/plugins/adplug/adplug/database.cpp
+++ b/plugins/adplug/adplug/database.cpp
@@ -286,27 +286,27 @@ void CAdPlugDatabase::CRecord::write(binostream &out)
write_own(out);
}
-bool CAdPlugDatabase::CRecord::user_read(std::istream &in, std::ostream &out)
-{
- return user_read_own(in, out);
-}
-
-bool CAdPlugDatabase::CRecord::user_write(std::ostream &out)
-{
- out << "Record type: ";
- switch(type) {
- case Plain: out << "Plain"; break;
- case SongInfo: out << "SongInfo"; break;
- case ClockSpeed: out << "ClockSpeed"; break;
- default: out << "*** Unknown ***"; break;
- }
- out << std::endl;
- out << "Key: " << std::hex << key.crc16 << ":" << key.crc32 << std::dec << std::endl;
- out << "File type: " << filetype << std::endl;
- out << "Comment: " << comment << std::endl;
-
- return user_write_own(out);
-}
+//bool CAdPlugDatabase::CRecord::user_read(std::istream &in, std::ostream &out)
+//{
+// return user_read_own(in, out);
+//}
+
+//bool CAdPlugDatabase::CRecord::user_write(std::ostream &out)
+//{
+// out << "Record type: ";
+// switch(type) {
+// case Plain: out << "Plain"; break;
+// case SongInfo: out << "SongInfo"; break;
+// case ClockSpeed: out << "ClockSpeed"; break;
+// default: out << "*** Unknown ***"; break;
+// }
+// out << std::endl;
+// out << "Key: " << std::hex << key.crc16 << ":" << key.crc32 << std::dec << std::endl;
+// out << "File type: " << filetype << std::endl;
+// out << "Comment: " << comment << std::endl;
+//
+// return user_write_own(out);
+//}
/***** CAdPlugDatabase::CRecord::CKey *****/
diff --git a/plugins/adplug/adplug/database.h b/plugins/adplug/adplug/database.h
index 050e8959..aba5b776 100644
--- a/plugins/adplug/adplug/database.h
+++ b/plugins/adplug/adplug/database.h
@@ -24,8 +24,7 @@
#ifndef H_ADPLUG_DATABASE
#define H_ADPLUG_DATABASE
-#include <iostream>
-#include <string>
+#if 0
#include <binio.h>
class CAdPlugDatabase
@@ -53,7 +52,7 @@ public:
RecordType type;
CKey key;
- std::string filetype, comment;
+ char *filetype, comment;
static CRecord *factory(RecordType type);
static CRecord *factory(binistream &in);
@@ -63,8 +62,8 @@ public:
void write(binostream &out);
- bool user_read(std::istream &in, std::ostream &out);
- bool user_write(std::ostream &out);
+ //bool user_read(std::istream &in, std::ostream &out);
+ //bool user_write(std::ostream &out);
protected:
virtual void read_own(binistream &in) = 0;
@@ -167,3 +166,5 @@ protected:
};
#endif
+
+#endif
diff --git a/plugins/adplug/adplug/dfm.cpp b/plugins/adplug/adplug/dfm.cpp
index 4a70a032..66a47bed 100644
--- a/plugins/adplug/adplug/dfm.cpp
+++ b/plugins/adplug/adplug/dfm.cpp
@@ -30,7 +30,7 @@ CPlayer *CdfmLoader::factory(Copl *newopl)
return new CdfmLoader(newopl);
}
-bool CdfmLoader::load(const std::string &filename, const CFileProvider &fp)
+bool CdfmLoader::load(const char *filename, const CFileProvider &fp)
{
binistream *f = fp.open(filename); if(!f) return false;
unsigned char npats,n,note,fx,c,r,param;
@@ -101,12 +101,10 @@ bool CdfmLoader::load(const std::string &filename, const CFileProvider &fp)
return true;
}
-std::string CdfmLoader::gettype()
+const char * CdfmLoader::gettype()
{
- char tmpstr[20];
-
sprintf(tmpstr,"Digital-FM %d.%d",header.hiver,header.lover);
- return std::string(tmpstr);
+ return tmpstr;
}
float CdfmLoader::getrefresh()
diff --git a/plugins/adplug/adplug/dfm.h b/plugins/adplug/adplug/dfm.h
index 4212b2fe..3877d9d8 100644
--- a/plugins/adplug/adplug/dfm.h
+++ b/plugins/adplug/adplug/dfm.h
@@ -30,16 +30,16 @@ public:
: CmodPlayer(newopl)
{ };
- bool load(const std::string &filename, const CFileProvider &fp);
+ bool load(const char *filename, const CFileProvider &fp);
float getrefresh();
- std::string gettype();
+ const char * gettype();
unsigned int getinstruments()
{ return 32; };
- std::string getinstrument(unsigned int n)
- { if(*instname[n]) return std::string(instname[n],1,*instname[n]); else return std::string(); };
- std::string getdesc()
- { return std::string(songinfo,1,*songinfo); };
+ const char * getinstrument(unsigned int n)
+ { return instname[n]; };
+ const char * getdesc()
+ { return songinfo; };
private:
struct {
@@ -49,4 +49,5 @@ private:
char songinfo[33];
char instname[32][12];
+ char tmpstr[20];
};
diff --git a/plugins/adplug/adplug/diskopl.cpp b/plugins/adplug/adplug/diskopl.cpp
index 3296c0a1..94dd1bf3 100644
--- a/plugins/adplug/adplug/diskopl.cpp
+++ b/plugins/adplug/adplug/diskopl.cpp
@@ -24,13 +24,13 @@
//static const unsigned short note_table[12] = {363,385,408,432,458,485,514,544,577,611,647,686};
const unsigned char CDiskopl::op_table[9] = {0x00, 0x01, 0x02, 0x08, 0x09, 0x0a, 0x10, 0x11, 0x12};
-CDiskopl::CDiskopl(std::string filename)
+CDiskopl::CDiskopl(const char * filename)
: old_freq(0.0f), del(1), nowrite(false)
{
unsigned short clock = 0xffff;
currType = TYPE_OPL3;
- f = fopen(filename.c_str(),"wb");
+ f = fopen(filename,"wb");
fwrite("RAWADATA",8,1,f);
fwrite(&clock,sizeof(clock),1,f);
}
diff --git a/plugins/adplug/adplug/diskopl.h b/plugins/adplug/adplug/diskopl.h
index 929f2906..14d3c13e 100644
--- a/plugins/adplug/adplug/diskopl.h
+++ b/plugins/adplug/adplug/diskopl.h
@@ -19,7 +19,7 @@
* diskopl.h - Disk Writer OPL, by Simon Peter <dn.tlp@gmx.net>
*/
-#include <string>
+#include <string.h>
#include <stdio.h>
#include "opl.h"
#include "player.h"
@@ -27,7 +27,7 @@
class CDiskopl: public Copl
{
public:
- CDiskopl(std::string filename);
+ CDiskopl(const char * filename);
virtual ~CDiskopl();
void update(CPlayer *p); // write to file
diff --git a/plugins/adplug/adplug/dmo.cpp b/plugins/adplug/adplug/dmo.cpp
index c25293c4..8a3d8e24 100644
--- a/plugins/adplug/adplug/dmo.cpp
+++ b/plugins/adplug/adplug/dmo.cpp
@@ -49,7 +49,7 @@ CPlayer *CdmoLoader::factory(Copl *newopl)
return new CdmoLoader(newopl);
}
-bool CdmoLoader::load(const std::string &filename, const CFileProvider &fp)
+bool CdmoLoader::load(const char *filename, const CFileProvider &fp)
{
int i,j;
binistream *f;
@@ -209,19 +209,19 @@ bool CdmoLoader::load(const std::string &filename, const CFileProvider &fp)
return true;
}
-std::string CdmoLoader::gettype()
+const char * CdmoLoader::gettype()
{
- return std::string("TwinTeam (packed S3M)");
+ return "TwinTeam (packed S3M)";
}
-std::string CdmoLoader::getauthor()
+const char * CdmoLoader::getauthor()
{
/*
All available .DMO modules written by one composer. And because all .DMO
stuff was lost due to hd crash (TwinTeam guys said this), there are
never(?) be another.
*/
- return std::string("Benjamin GERARDIN");
+ return "Benjamin GERARDIN";
}
/* -------- Private Methods ------------------------------- */
diff --git a/plugins/adplug/adplug/dmo.h b/plugins/adplug/adplug/dmo.h
index 8591cfcc..5996c112 100644
--- a/plugins/adplug/adplug/dmo.h
+++ b/plugins/adplug/adplug/dmo.h
@@ -28,10 +28,10 @@ class CdmoLoader: public Cs3mPlayer
CdmoLoader(Copl *newopl) : Cs3mPlayer(newopl) { };
- bool load(const std::string &filename, const CFileProvider &fp);
+ bool load(const char *filename, const CFileProvider &fp);
- std::string gettype();
- std::string getauthor();
+ const char * gettype();
+ const char * getauthor();
private:
diff --git a/plugins/adplug/adplug/dro.cpp b/plugins/adplug/adplug/dro.cpp
index 8342fe89..1d7d5f8e 100644
--- a/plugins/adplug/adplug/dro.cpp
+++ b/plugins/adplug/adplug/dro.cpp
@@ -23,7 +23,7 @@
* NOTES: 3-oct-04: the DRO format is not yet finalized. beware.
*/
-#include <cstring>
+#include <string.h>
#include <stdio.h>
#include "dro.h"
@@ -44,7 +44,7 @@ CdroPlayer::CdroPlayer(Copl *newopl)
opl3_mode = 1;
}
-bool CdroPlayer::load(const std::string &filename, const CFileProvider &fp)
+bool CdroPlayer::load(const char *filename, const CFileProvider &fp)
{
binistream *f = fp.open(filename); if(!f) return false;
char id[8];
diff --git a/plugins/adplug/adplug/dro.h b/plugins/adplug/adplug/dro.h
index 995da6cc..9ecca105 100644
--- a/plugins/adplug/adplug/dro.h
+++ b/plugins/adplug/adplug/dro.h
@@ -33,14 +33,14 @@ class CdroPlayer: public CPlayer
delete [] data;
}
- bool load(const std::string &filename, const CFileProvider &fp);
+ bool load(const char *filename, const CFileProvider &fp);
bool update();
void rewind(int subsong);
float getrefresh();
- std::string gettype()
+ const char * gettype()
{
- return std::string("DOSBox Raw OPL v0.1");
+ return "DOSBox Raw OPL v0.1";
}
protected:
diff --git a/plugins/adplug/adplug/dro2.cpp b/plugins/adplug/adplug/dro2.cpp
index e11196e7..7fd31548 100644
--- a/plugins/adplug/adplug/dro2.cpp
+++ b/plugins/adplug/adplug/dro2.cpp
@@ -19,7 +19,7 @@
* dro2.cpp - DOSBox Raw OPL v2.0 player by Adam Nielsen <malvineous@shikadi.net>
*/
-#include <cstring>
+#include <string.h>
#include <stdio.h>
#include "dro2.h"
@@ -42,7 +42,7 @@ Cdro2Player::~Cdro2Player()
if (this->piConvTable) delete[] this->piConvTable;
}
-bool Cdro2Player::load(const std::string &filename, const CFileProvider &fp)
+bool Cdro2Player::load(const char * filename, const CFileProvider &fp)
{
binistream *f = fp.open(filename);
if (!f) return false;
diff --git a/plugins/adplug/adplug/dro2.h b/plugins/adplug/adplug/dro2.h
index fdd2f06d..82dc1fb1 100644
--- a/plugins/adplug/adplug/dro2.h
+++ b/plugins/adplug/adplug/dro2.h
@@ -41,14 +41,14 @@ class Cdro2Player: public CPlayer
Cdro2Player(Copl *newopl);
~Cdro2Player();
- bool load(const std::string &filename, const CFileProvider &fp);
+ bool load(const char * filename, const CFileProvider &fp);
bool update();
void rewind(int subsong);
float getrefresh();
- std::string gettype()
+ const char * gettype()
{
- return std::string("DOSBox Raw OPL v2.0");
+ return "DOSBox Raw OPL v2.0";
}
protected:
diff --git a/plugins/adplug/adplug/dtm.cpp b/plugins/adplug/adplug/dtm.cpp
index 91ea837c..5869a8e3 100644
--- a/plugins/adplug/adplug/dtm.cpp
+++ b/plugins/adplug/adplug/dtm.cpp
@@ -22,7 +22,7 @@
NOTE: Panning (Ex) effect is ignored.
*/
-#include <cstring>
+#include <string.h>
#include "dtm.h"
/* -------- Public Methods -------------------------------- */
@@ -32,7 +32,7 @@ CPlayer *CdtmLoader::factory(Copl *newopl)
return new CdtmLoader(newopl);
}
-bool CdtmLoader::load(const std::string &filename, const CFileProvider &fp)
+bool CdtmLoader::load(const char *filename, const CFileProvider &fp)
{
binistream *f = fp.open(filename); if(!f) return false;
const unsigned char conv_inst[11] = { 2,1,10,9,4,3,6,5,0,8,7 };
@@ -251,29 +251,29 @@ float CdtmLoader::getrefresh()
return 18.2f;
}
-std::string CdtmLoader::gettype()
+const char * CdtmLoader::gettype()
{
- return std::string("DeFy Adlib Tracker");
+ return "DeFy Adlib Tracker";
}
-std::string CdtmLoader::gettitle()
+const char * CdtmLoader::gettitle()
{
- return std::string(header.title);
+ return header.title;
}
-std::string CdtmLoader::getauthor()
+const char * CdtmLoader::getauthor()
{
- return std::string(header.author);
+ return header.author;
}
-std::string CdtmLoader::getdesc()
+const char * CdtmLoader::getdesc()
{
- return std::string(desc);
+ return desc;
}
-std::string CdtmLoader::getinstrument(unsigned int n)
+const char * CdtmLoader::getinstrument(unsigned int n)
{
- return std::string(instruments[n].name);
+ return instruments[n].name;
}
unsigned int CdtmLoader::getinstruments()
diff --git a/plugins/adplug/adplug/dtm.h b/plugins/adplug/adplug/dtm.h
index 8429bc4f..d5b10f2d 100644
--- a/plugins/adplug/adplug/dtm.h
+++ b/plugins/adplug/adplug/dtm.h
@@ -28,15 +28,15 @@ class CdtmLoader: public CmodPlayer
CdtmLoader(Copl *newopl) : CmodPlayer(newopl) { };
- bool load(const std::string &filename, const CFileProvider &fp);
+ bool load(const char *filename, const CFileProvider &fp);
void rewind(int subsong);
float getrefresh();
- std::string gettype();
- std::string gettitle();
- std::string getauthor();
- std::string getdesc();
- std::string getinstrument(unsigned int n);
+ const char * gettype();
+ const char * gettitle();
+ const char * getauthor();
+ const char * getdesc();
+ const char * getinstrument(unsigned int n);
unsigned int getinstruments();
private:
diff --git a/plugins/adplug/adplug/flash.cpp b/plugins/adplug/adplug/flash.cpp
index a6bf511c..8fc8f333 100644
--- a/plugins/adplug/adplug/flash.cpp
+++ b/plugins/adplug/adplug/flash.cpp
@@ -219,9 +219,9 @@ float CxadflashPlayer::xadplayer_getrefresh()
return 17.5f;
}
-std::string CxadflashPlayer::xadplayer_gettype()
+const char * CxadflashPlayer::xadplayer_gettype()
{
- return std::string("xad: flash player");
+ return "xad: flash player";
}
unsigned int CxadflashPlayer::xadplayer_getinstruments()
diff --git a/plugins/adplug/adplug/flash.h b/plugins/adplug/adplug/flash.h
index a3471df4..d448e042 100644
--- a/plugins/adplug/adplug/flash.h
+++ b/plugins/adplug/adplug/flash.h
@@ -46,7 +46,7 @@ protected:
void xadplayer_rewind(int subsong);
void xadplayer_update();
float xadplayer_getrefresh();
- std::string xadplayer_gettype();
+ const char * xadplayer_gettype();
unsigned int xadplayer_getinstruments();
private:
diff --git a/plugins/adplug/adplug/fmc.cpp b/plugins/adplug/adplug/fmc.cpp
index 75cd99a7..bf9911e3 100644
--- a/plugins/adplug/adplug/fmc.cpp
+++ b/plugins/adplug/adplug/fmc.cpp
@@ -19,7 +19,7 @@
fmc.cpp - FMC Loader by Riven the Mage <riven@ok.ru>
*/
-#include <cstring>
+#include <string.h>
#include "fmc.h"
/* -------- Public Methods -------------------------------- */
@@ -29,7 +29,7 @@ CPlayer *CfmcLoader::factory(Copl *newopl)
return new CfmcLoader(newopl);
}
-bool CfmcLoader::load(const std::string &filename, const CFileProvider &fp)
+bool CfmcLoader::load(const char *filename, const CFileProvider &fp)
{
binistream *f = fp.open(filename); if(!f) return false;
const unsigned char conv_fx[16] = {0,1,2,3,4,8,255,255,255,255,26,11,12,13,14,15};
@@ -168,19 +168,19 @@ float CfmcLoader::getrefresh()
return 50.0f;
}
-std::string CfmcLoader::gettype()
+const char * CfmcLoader::gettype()
{
- return std::string("Faust Music Creator");
+ return "Faust Music Creator";
}
-std::string CfmcLoader::gettitle()
+const char * CfmcLoader::gettitle()
{
- return std::string(header.title);
+ return header.title;
}
-std::string CfmcLoader::getinstrument(unsigned int n)
+const char * CfmcLoader::getinstrument(unsigned int n)
{
- return std::string(instruments[n].name);
+ return instruments[n].name;
}
unsigned int CfmcLoader::getinstruments()
diff --git a/plugins/adplug/adplug/fmc.h b/plugins/adplug/adplug/fmc.h
index ae7d5c5b..0be93a4e 100644
--- a/plugins/adplug/adplug/fmc.h
+++ b/plugins/adplug/adplug/fmc.h
@@ -28,12 +28,12 @@ class CfmcLoader: public CmodPlayer
CfmcLoader(Copl *newopl) : CmodPlayer(newopl) { };
- bool load(const std::string &filename, const CFileProvider &fp);
+ bool load(const char *filename, const CFileProvider &fp);
float getrefresh();
- std::string gettype();
- std::string gettitle();
- std::string getinstrument(unsigned int n);
+ const char * gettype();
+ const char * gettitle();
+ const char * getinstrument(unsigned int n);
unsigned int getinstruments();
private:
diff --git a/plugins/adplug/adplug/fprovide.cpp b/plugins/adplug/adplug/fprovide.cpp
index cbe94e2f..12424431 100644
--- a/plugins/adplug/adplug/fprovide.cpp
+++ b/plugins/adplug/adplug/fprovide.cpp
@@ -27,10 +27,10 @@
/***** CFileProvider *****/
-bool CFileProvider::extension(const std::string &filename,
- const std::string &extension)
+bool CFileProvider::extension(const char *filename,
+ const char *extension)
{
- const char *fname = filename.c_str(), *ext = extension.c_str();
+ const char *fname = filename, *ext = extension;
if(strlen(fname) < strlen(ext) ||
stricmp(fname + strlen(fname) - strlen(ext), ext))
@@ -52,7 +52,7 @@ unsigned long CFileProvider::filesize(binistream *f)
/***** CProvider_Filesystem *****/
-binistream *CProvider_Filesystem::open(std::string filename) const
+binistream *CProvider_Filesystem::open(const char * filename) const
{
binifstream *f = new binifstream(filename);
diff --git a/plugins/adplug/adplug/fprovide.h b/plugins/adplug/adplug/fprovide.h
index 572f28ac..0029bd3e 100644
--- a/plugins/adplug/adplug/fprovide.h
+++ b/plugins/adplug/adplug/fprovide.h
@@ -22,7 +22,6 @@
#ifndef H_ADPLUG_FILEPROVIDER
#define H_ADPLUG_FILEPROVIDER
-#include <string>
#include <binio.h>
class CFileProvider
@@ -32,18 +31,18 @@ public:
{
}
- virtual binistream *open(std::string) const = 0;
+ virtual binistream *open(const char *) const = 0;
virtual void close(binistream *) const = 0;
- static bool extension(const std::string &filename,
- const std::string &extension);
+ static bool extension(const char *filename,
+ const char *extension);
static unsigned long filesize(binistream *f);
};
class CProvider_Filesystem: public CFileProvider
{
public:
- virtual binistream *open(std::string filename) const;
+ virtual binistream *open(const char *filename) const;
virtual void close(binistream *f) const;
};
diff --git a/plugins/adplug/adplug/hsc.cpp b/plugins/adplug/adplug/hsc.cpp
index 1a912ff1..0fdefc3f 100644
--- a/plugins/adplug/adplug/hsc.cpp
+++ b/plugins/adplug/adplug/hsc.cpp
@@ -31,14 +31,14 @@ CPlayer *ChscPlayer::factory(Copl *newopl)
return new ChscPlayer(newopl);
}
-bool ChscPlayer::load(const std::string &filename, const CFileProvider &fp)
+bool ChscPlayer::load(const char *filename, const CFileProvider &fp)
{
binistream *f = fp.open(filename);
int i;
// file validation section
if(!f || !fp.extension(filename, ".hsc") || fp.filesize(f) > 59187) {
- AdPlug_LogWrite("ChscPlayer::load(\"%s\"): Not a HSC file!\n", filename.c_str());
+ AdPlug_LogWrite("ChscPlayer::load(\"%s\"): Not a HSC file!\n", filename);
fp.close(f);
return false;
}
diff --git a/plugins/adplug/adplug/hsc.h b/plugins/adplug/adplug/hsc.h
index 4a9e2d27..e57cdb47 100644
--- a/plugins/adplug/adplug/hsc.h
+++ b/plugins/adplug/adplug/hsc.h
@@ -31,12 +31,12 @@ class ChscPlayer: public CPlayer
ChscPlayer(Copl *newopl): CPlayer(newopl), mtkmode(0) {}
- bool load(const std::string &filename, const CFileProvider &fp);
+ bool load(const char *filename, const CFileProvider &fp);
bool update();
void rewind(int subsong);
float getrefresh() { return 18.2f; }; // refresh rate is fixed at 18.2Hz
- std::string gettype() { return std::string("HSC Adlib Composer / HSC-Tracker"); }
+ const char * gettype() { return "HSC Adlib Composer / HSC-Tracker"; }
unsigned int getpatterns();
unsigned int getpattern() { return song[songpos]; }
unsigned int getorders();
diff --git a/plugins/adplug/adplug/hsp.cpp b/plugins/adplug/adplug/hsp.cpp
index 0430f6d7..73a697af 100644
--- a/plugins/adplug/adplug/hsp.cpp
+++ b/plugins/adplug/adplug/hsp.cpp
@@ -28,7 +28,7 @@ CPlayer *ChspLoader::factory(Copl *newopl)
return new ChspLoader(newopl);
}
-bool ChspLoader::load(const std::string &filename, const CFileProvider &fp)
+bool ChspLoader::load(const char *filename, const CFileProvider &fp)
{
binistream *f = fp.open(filename); if(!f) return false;
unsigned long i, j, orgsize, filesize;
diff --git a/plugins/adplug/adplug/hsp.h b/plugins/adplug/adplug/hsp.h
index 86fa9d69..e0505fc2 100644
--- a/plugins/adplug/adplug/hsp.h
+++ b/plugins/adplug/adplug/hsp.h
@@ -33,7 +33,7 @@ public:
: ChscPlayer(newopl)
{};
- bool load(const std::string &filename, const CFileProvider &fp);
+ bool load(const char *filename, const CFileProvider &fp);
};
#endif
diff --git a/plugins/adplug/adplug/hybrid.cpp b/plugins/adplug/adplug/hybrid.cpp
index cff08c88..2e545ba1 100644
--- a/plugins/adplug/adplug/hybrid.cpp
+++ b/plugins/adplug/adplug/hybrid.cpp
@@ -232,14 +232,14 @@ float CxadhybridPlayer::xadplayer_getrefresh()
return 50.0f;
}
-std::string CxadhybridPlayer::xadplayer_gettype()
+const char * CxadhybridPlayer::xadplayer_gettype()
{
- return (std::string("xad: hybrid player"));
+ return "xad: hybrid player";
}
-std::string CxadhybridPlayer::xadplayer_getinstrument(unsigned int i)
+const char * CxadhybridPlayer::xadplayer_getinstrument(unsigned int i)
{
- return (std::string(hyb.inst[i].name,7));
+ return hyb.inst[i].name;
}
unsigned int CxadhybridPlayer::xadplayer_getinstruments()
diff --git a/plugins/adplug/adplug/hybrid.h b/plugins/adplug/adplug/hybrid.h
index 65d39d34..d727b84d 100644
--- a/plugins/adplug/adplug/hybrid.h
+++ b/plugins/adplug/adplug/hybrid.h
@@ -69,8 +69,8 @@ protected:
void xadplayer_rewind(int subsong);
void xadplayer_update();
float xadplayer_getrefresh();
- std::string xadplayer_gettype();
- std::string xadplayer_getinstrument(unsigned int i);
+ const char * xadplayer_gettype();
+ const char * xadplayer_getinstrument(unsigned int i);
unsigned int xadplayer_getinstruments();
private:
diff --git a/plugins/adplug/adplug/hyp.cpp b/plugins/adplug/adplug/hyp.cpp
index 7ed3a315..724f07a9 100644
--- a/plugins/adplug/adplug/hyp.cpp
+++ b/plugins/adplug/adplug/hyp.cpp
@@ -119,7 +119,7 @@ float CxadhypPlayer::xadplayer_getrefresh()
return 60.0f;
}
-std::string CxadhypPlayer::xadplayer_gettype()
+const char * CxadhypPlayer::xadplayer_gettype()
{
- return std::string("xad: hypnosis player");
+ return "xad: hypnosis player";
}
diff --git a/plugins/adplug/adplug/hyp.h b/plugins/adplug/adplug/hyp.h
index e2a5bf5a..634cdd3c 100644
--- a/plugins/adplug/adplug/hyp.h
+++ b/plugins/adplug/adplug/hyp.h
@@ -45,7 +45,7 @@ protected:
void xadplayer_rewind(int subsong);
void xadplayer_update();
float xadplayer_getrefresh();
- std::string xadplayer_gettype();
+ const char * xadplayer_gettype();
private:
static const unsigned char hyp_adlib_registers[99];
diff --git a/plugins/adplug/adplug/imf.cpp b/plugins/adplug/adplug/imf.cpp
index c525ac8b..06602b9f 100644
--- a/plugins/adplug/adplug/imf.cpp
+++ b/plugins/adplug/adplug/imf.cpp
@@ -42,6 +42,7 @@
*/
#include <string.h>
+#include <stdio.h>
#include "imf.h"
#include "database.h"
@@ -53,7 +54,7 @@ CPlayer *CimfPlayer::factory(Copl *newopl)
return new CimfPlayer(newopl);
}
-bool CimfPlayer::load(const std::string &filename, const CFileProvider &fp)
+bool CimfPlayer::load(const char *filename, const CFileProvider &fp)
{
binistream *f = fp.open(filename); if(!f) return false;
unsigned long fsize, flsize, mfsize = 0;
@@ -76,8 +77,8 @@ bool CimfPlayer::load(const std::string &filename, const CFileProvider &fp)
f->seek(0); // It's a normal IMF file
} else {
// It's a IMF file with header
- track_name = f->readString('\0');
- game_name = f->readString('\0');
+ f->readString(track_name, sizeof (track_name), '\0');
+ f->readString(game_name, sizeof (game_name), '\0');
f->ignore(1);
mfsize = f->pos() + 2;
}
@@ -108,9 +109,9 @@ bool CimfPlayer::load(const std::string &filename, const CFileProvider &fp)
if(fsize && (fsize < flsize - 2 - mfsize)) {
if(f->readInt(1) == 0x1a) {
// Adam Nielsen's footer format
- track_name = f->readString();
- author_name = f->readString();
- remarks = f->readString();
+ f->readString(track_name, sizeof (track_name));
+ f->readString(author_name, sizeof (author_name));
+ f->readString(remarks, sizeof (remarks));
} else {
// Generic footer
unsigned long footerlen = flsize - fsize - 2 - mfsize;
@@ -150,45 +151,48 @@ void CimfPlayer::rewind(int subsong)
opl->init(); opl->write(1,32); // go to OPL2 mode
}
-std::string CimfPlayer::gettitle()
+const char * CimfPlayer::gettitle()
{
- std::string title;
-
- title = track_name;
-
- if(!track_name.empty() && !game_name.empty())
- title += " - ";
-
- title += game_name;
+ title[0] = 0;
+ if(track_name[0] && game_name[0]) {
+ snprintf (title, sizeof (title), "%s - %s", game_name, track_name);
+ }
+ else if (track_name[0]) {
+ strcpy (title, track_name);
+ }
+ else if (game_name[0]) {
+ strcpy (title, game_name);
+ }
- return title;
+ return title;
}
-std::string CimfPlayer::getdesc()
+const char * CimfPlayer::getdesc()
{
- std::string desc;
-
+ desc[0] = 0;
if(footer)
- desc = std::string(footer);
+ strcpy (desc, footer);
- if(!remarks.empty() && footer)
- desc += "\n\n";
-
- desc += remarks;
+ if(remarks[0] && footer) {
+ strcat (desc, "\n\n");
+ strcat (desc, remarks);
+ }
return desc;
}
/*** private methods *************************************/
-float CimfPlayer::getrate(const std::string &filename, const CFileProvider &fp, binistream *f)
+float CimfPlayer::getrate(const char *filename, const CFileProvider &fp, binistream *f)
{
+#if 0
if(db) { // Database available
f->seek(0, binio::Set);
CClockRecord *record = (CClockRecord *)db->search(CAdPlugDatabase::CKey(*f));
if (record && record->type == CAdPlugDatabase::CRecord::ClockSpeed)
return record->clock;
}
+#endif
// Otherwise the database is either unavailable, or there's no entry for this file
if (fp.extension(filename, ".imf")) return 560.0f;
diff --git a/plugins/adplug/adplug/imf.h b/plugins/adplug/adplug/imf.h
index 4c7d0daf..9969958c 100644
--- a/plugins/adplug/adplug/imf.h
+++ b/plugins/adplug/adplug/imf.h
@@ -35,18 +35,18 @@ public:
~CimfPlayer()
{ if(data) delete [] data; if(footer) delete [] footer; };
- bool load(const std::string &filename, const CFileProvider &fp);
+ bool load(const char *filename, const CFileProvider &fp);
bool update();
void rewind(int subsong);
float getrefresh()
{ return timer; };
- std::string gettype()
- { return std::string("IMF File Format"); }
- std::string gettitle();
- std::string getauthor()
+ const char * gettype()
+ { return "IMF File Format"; }
+ const char * gettitle();
+ const char * getauthor()
{ return author_name; }
- std::string getdesc();
+ const char * getdesc();
protected:
unsigned long pos, size;
@@ -54,7 +54,9 @@ protected:
bool songend;
float rate, timer;
char *footer;
- std::string track_name, game_name, author_name, remarks;
+ char track_name[100], game_name[100], author_name[100], remarks[100];
+ char title[100];
+ char desc[100];
struct Sdata {
unsigned char reg, val;
@@ -62,7 +64,7 @@ protected:
} *data;
private:
- float getrate(const std::string &filename, const CFileProvider &fp, binistream *f);
+ float getrate(const char *filename, const CFileProvider &fp, binistream *f);
};
#endif
diff --git a/plugins/adplug/adplug/jbm.cpp b/plugins/adplug/adplug/jbm.cpp
index 0990001b..1fd33b40 100644
--- a/plugins/adplug/adplug/jbm.cpp
+++ b/plugins/adplug/adplug/jbm.cpp
@@ -63,7 +63,7 @@ CPlayer *CjbmPlayer::factory(Copl *newopl)
return new CjbmPlayer(newopl);
}
-bool CjbmPlayer::load(const std::string &filename, const CFileProvider &fp)
+bool CjbmPlayer::load(const char *filename, const CFileProvider &fp)
{
binistream *f = fp.open(filename); if(!f) return false;
int filelen = fp.filesize(f);
diff --git a/plugins/adplug/adplug/jbm.h b/plugins/adplug/adplug/jbm.h
index 3f95b03f..1d8572c4 100644
--- a/plugins/adplug/adplug/jbm.h
+++ b/plugins/adplug/adplug/jbm.h
@@ -32,22 +32,22 @@ class CjbmPlayer: public CPlayer
CjbmPlayer(Copl *newopl) : CPlayer(newopl), m(0)
{ }
~CjbmPlayer()
- { if(m != NULL) delete [] m; }
+ { delete [] m; }
- bool load(const std::string &filename, const CFileProvider &fp);
+ bool load(const char *filename, const CFileProvider &fp);
bool update();
void rewind(int subsong);
float getrefresh()
{ return timer; }
- std::string gettype()
+ const char * gettype()
{
- return std::string(flags&1 ? "JBM Adlib Music [rhythm mode]" :
- "JBM Adlib Music");
+ return flags&1 ? "JBM Adlib Music [rhythm mode]" :
+ "JBM Adlib Music";
}
- std::string getauthor()
- { return std::string("Johannes Bjerregaard"); }
+ const char * getauthor()
+ { return "Johannes Bjerregaard"; }
protected:
diff --git a/plugins/adplug/adplug/ksm.cpp b/plugins/adplug/adplug/ksm.cpp
index c12f3d8f..b93b52f7 100644
--- a/plugins/adplug/adplug/ksm.cpp
+++ b/plugins/adplug/adplug/ksm.cpp
@@ -40,22 +40,22 @@ CPlayer *CksmPlayer::factory(Copl *newopl)
return new CksmPlayer(newopl);
}
-bool CksmPlayer::load(const std::string &filename, const CFileProvider &fp)
+bool CksmPlayer::load(const char *filename, const CFileProvider &fp)
{
binistream *f;
int i;
- char *fn = new char[filename.length() + 9];
+ char *fn = new char[strlen (filename) + 9];
// file validation section
if(!fp.extension(filename, ".ksm")) {
AdPlug_LogWrite("CksmPlayer::load(,\"%s\"): File doesn't have '.ksm' "
- "extension! Rejected!\n", filename.c_str());
+ "extension! Rejected!\n", filename);
return false;
}
- AdPlug_LogWrite("*** CksmPlayer::load(,\"%s\") ***\n", filename.c_str());
+ AdPlug_LogWrite("*** CksmPlayer::load(,\"%s\") ***\n", filename);
// Load instruments from 'insts.dat'
- strcpy(fn, filename.c_str());
+ strcpy(fn, filename);
for(i = strlen(fn) - 1; i >= 0; i--)
if(fn[i] == '/' || fn[i] == '\\')
break;
@@ -289,12 +289,12 @@ void CksmPlayer::rewind(int subsong)
nownote = 0;
}
-std::string CksmPlayer::getinstrument(unsigned int n)
+const char * CksmPlayer::getinstrument(unsigned int n)
{
if(trchan[n])
- return std::string(instname[trinst[n]]);
+ return instname[trinst[n]];
else
- return std::string();
+ return "";
}
/*** private methods *************************************/
diff --git a/plugins/adplug/adplug/ksm.h b/plugins/adplug/adplug/ksm.h
index 98d643ea..85f19a31 100644
--- a/plugins/adplug/adplug/ksm.h
+++ b/plugins/adplug/adplug/ksm.h
@@ -32,17 +32,17 @@ public:
~CksmPlayer()
{ if(note) delete [] note; };
- bool load(const std::string &filename, const CFileProvider &fp);
+ bool load(const char *filename, const CFileProvider &fp);
bool update();
void rewind(int subsong);
float getrefresh()
{ return 240.0f; };
- std::string gettype()
- { return std::string("Ken Silverman's Music Format"); };
+ const char * gettype()
+ { return "Ken Silverman's Music Format"; };
unsigned int getinstruments()
{ return 16; };
- std::string getinstrument(unsigned int n);
+ const char * getinstrument(unsigned int n);
private:
static const unsigned int adlibfreq[63];
diff --git a/plugins/adplug/adplug/lds.cpp b/plugins/adplug/adplug/lds.cpp
index fb70a067..81bae44c 100644
--- a/plugins/adplug/adplug/lds.cpp
+++ b/plugins/adplug/adplug/lds.cpp
@@ -83,7 +83,7 @@ CldsPlayer::~CldsPlayer()
if(patterns) delete [] patterns;
}
-bool CldsPlayer::load(const std::string &filename, const CFileProvider &fp)
+bool CldsPlayer::load(const char *filename, const CFileProvider &fp)
{
binistream *f;
unsigned int i, j;
@@ -142,7 +142,7 @@ bool CldsPlayer::load(const std::string &filename, const CFileProvider &fp)
AdPlug_LogWrite("CldsPlayer::load(\"%s\",fp): loading LOUDNESS file: mode = "
"%d, pattlen = %d, numpatch = %d, numposi = %d\n",
- filename.c_str(), mode, pattlen, numpatch, numposi);
+ filename, mode, pattlen, numpatch, numposi);
// load patterns
f->ignore(2); // ignore # of digital sounds (not played by this player)
diff --git a/plugins/adplug/adplug/lds.h b/plugins/adplug/adplug/lds.h
index 95f59606..2642a6a9 100644
--- a/plugins/adplug/adplug/lds.h
+++ b/plugins/adplug/adplug/lds.h
@@ -29,12 +29,12 @@ class CldsPlayer: public CPlayer
CldsPlayer(Copl *newopl);
virtual ~CldsPlayer();
- bool load(const std::string &filename, const CFileProvider &fp);
+ bool load(const char *filename, const CFileProvider &fp);
virtual bool update();
virtual void rewind(int subsong = -1);
float getrefresh() { return 70.0f; }
- std::string gettype() { return std::string("LOUDNESS Sound System"); }
+ const char * gettype() { return "LOUDNESS Sound System"; }
unsigned int getorders() { return numposi; }
unsigned int getorder() { return posplay; }
unsigned int getrow() { return pattplay; }
diff --git a/plugins/adplug/adplug/mad.cpp b/plugins/adplug/adplug/mad.cpp
index b8cb527d..76e694c5 100644
--- a/plugins/adplug/adplug/mad.cpp
+++ b/plugins/adplug/adplug/mad.cpp
@@ -19,7 +19,7 @@
mad.cpp - MAD loader by Riven the Mage <riven@ok.ru>
*/
-#include <cstring>
+#include <string.h>
#include "mad.h"
/* -------- Public Methods -------------------------------- */
@@ -29,7 +29,7 @@ CPlayer *CmadLoader::factory(Copl *newopl)
return new CmadLoader(newopl);
}
-bool CmadLoader::load(const std::string &filename, const CFileProvider &fp)
+bool CmadLoader::load(const char *filename, const CFileProvider &fp)
{
binistream *f = fp.open(filename); if(!f) return false;
const unsigned char conv_inst[10] = { 2,1,10,9,4,3,6,5,8,7 };
@@ -111,14 +111,14 @@ float CmadLoader::getrefresh()
return (float)timer;
}
-std::string CmadLoader::gettype()
+const char * CmadLoader::gettype()
{
- return std::string("Mlat Adlib Tracker");
+ return "Mlat Adlib Tracker";
}
-std::string CmadLoader::getinstrument(unsigned int n)
+const char * CmadLoader::getinstrument(unsigned int n)
{
- return std::string(instruments[n].name,8);
+ return instruments[n].name;
}
unsigned int CmadLoader::getinstruments()
diff --git a/plugins/adplug/adplug/mad.h b/plugins/adplug/adplug/mad.h
index 98d2a445..c9272924 100644
--- a/plugins/adplug/adplug/mad.h
+++ b/plugins/adplug/adplug/mad.h
@@ -28,12 +28,12 @@ public:
CmadLoader(Copl *newopl) : CmodPlayer(newopl) { };
- bool load(const std::string &filename, const CFileProvider &fp);
+ bool load(const char *filename, const CFileProvider &fp);
void rewind(int subsong);
float getrefresh();
- std::string gettype();
- std::string getinstrument(unsigned int n);
+ const char * gettype();
+ const char * getinstrument(unsigned int n);
unsigned int getinstruments();
private:
diff --git a/plugins/adplug/adplug/mid.cpp b/plugins/adplug/adplug/mid.cpp
index 03a2d84a..5c13b144 100644
--- a/plugins/adplug/adplug/mid.cpp
+++ b/plugins/adplug/adplug/mid.cpp
@@ -178,15 +178,15 @@ unsigned long CmidPlayer::getval()
return(v);
}
-bool CmidPlayer::load_sierra_ins(const std::string &fname, const CFileProvider &fp)
+bool CmidPlayer::load_sierra_ins(const char *fname, const CFileProvider &fp)
{
long i,j,k,l;
unsigned char ins[28];
char *pfilename;
binistream *f;
- pfilename = (char *)malloc(fname.length()+9);
- strcpy(pfilename,fname.c_str());
+ pfilename = (char *)malloc(strlen (fname)+9);
+ strcpy(pfilename,fname);
j=0;
for(i=strlen(pfilename)-1; i >= 0; i--)
if(pfilename[i] == '/' || pfilename[i] == '\\') {
@@ -281,7 +281,7 @@ void CmidPlayer::sierra_next_section()
doing=1;
}
-bool CmidPlayer::load(const std::string &filename, const CFileProvider &fp)
+bool CmidPlayer::load(const char *filename, const CFileProvider &fp)
{
binistream *f = fp.open(filename); if(!f) return false;
int good;
@@ -1089,22 +1089,22 @@ void CmidPlayer::rewind(int subsong)
midi_fm_reset();
}
-std::string CmidPlayer::gettype()
+const char * CmidPlayer::gettype()
{
switch(type) {
case FILE_LUCAS:
- return std::string("LucasArts AdLib MIDI");
+ return "LucasArts AdLib MIDI";
case FILE_MIDI:
- return std::string("General MIDI");
+ return "General MIDI";
case FILE_CMF:
- return std::string("Creative Music Format (CMF MIDI)");
+ return "Creative Music Format (CMF MIDI)";
case FILE_OLDLUCAS:
- return std::string("Lucasfilm Adlib MIDI");
+ return "Lucasfilm Adlib MIDI";
case FILE_ADVSIERRA:
- return std::string("Sierra On-Line VGA MIDI");
+ return "Sierra On-Line VGA MIDI";
case FILE_SIERRA:
- return std::string("Sierra On-Line EGA MIDI");
+ return "Sierra On-Line EGA MIDI";
default:
- return std::string("MIDI unknown");
+ return "MIDI unknown";
}
}
diff --git a/plugins/adplug/adplug/mid.h b/plugins/adplug/adplug/mid.h
index 5dfe9e76..d5fac624 100644
--- a/plugins/adplug/adplug/mid.h
+++ b/plugins/adplug/adplug/mid.h
@@ -30,18 +30,18 @@ public:
~CmidPlayer()
{ if(data) delete [] data; }
- bool load(const std::string &filename, const CFileProvider &fp);
+ bool load(const char *filename, const CFileProvider &fp);
bool update();
void rewind(int subsong);
float getrefresh();
- std::string gettype();
- std::string gettitle()
- { return std::string(title); }
- std::string getauthor()
- { return std::string(author); }
- std::string getdesc()
- { return std::string(remarks); }
+ const char * gettype();
+ const char * gettitle()
+ { return title; }
+ const char * getauthor()
+ { return author; }
+ const char * getdesc()
+ { return remarks; }
unsigned int getinstruments()
{ return tins; }
unsigned int getsubsongs()
@@ -95,7 +95,7 @@ public:
int type,tins,stins;
private:
- bool load_sierra_ins(const std::string &fname, const CFileProvider &fp);
+ bool load_sierra_ins(const char *fname, const CFileProvider &fp);
void midiprintf(const char *format, ...);
unsigned char datalook(long pos);
unsigned long getnexti(unsigned long num);
diff --git a/plugins/adplug/adplug/mkj.cpp b/plugins/adplug/adplug/mkj.cpp
index 38c1c082..4d18a0f8 100644
--- a/plugins/adplug/adplug/mkj.cpp
+++ b/plugins/adplug/adplug/mkj.cpp
@@ -19,7 +19,7 @@
* mkj.cpp - MKJamz Player, by Simon Peter <dn.tlp@gmx.net>
*/
-#include <cstring>
+#include <string.h>
#include <assert.h>
#include "mkj.h"
@@ -30,7 +30,7 @@ CPlayer *CmkjPlayer::factory(Copl *newopl)
return new CmkjPlayer(newopl);
}
-bool CmkjPlayer::load(const std::string &filename, const CFileProvider &fp)
+bool CmkjPlayer::load(const char *filename, const CFileProvider &fp)
{
binistream *f = fp.open(filename); if(!f) return false;
char id[6];
@@ -65,7 +65,7 @@ bool CmkjPlayer::load(const std::string &filename, const CFileProvider &fp)
songbuf[i] = f->readInt(2);
AdPlug_LogWrite("CmkjPlayer::load(\"%s\"): loaded file ver %.2f, %d channels,"
- " %d notes/channel.\n", filename.c_str(), ver, maxchannel,
+ " %d notes/channel.\n", filename, ver, maxchannel,
maxnotes);
fp.close(f);
rewind(0);
diff --git a/plugins/adplug/adplug/mkj.h b/plugins/adplug/adplug/mkj.h
index a7a2ffad..b82d33fe 100644
--- a/plugins/adplug/adplug/mkj.h
+++ b/plugins/adplug/adplug/mkj.h
@@ -32,13 +32,13 @@ public:
~CmkjPlayer()
{ if(songbuf) delete [] songbuf; }
- bool load(const std::string &filename, const CFileProvider &fp);
+ bool load(const char * filename, const CFileProvider &fp);
bool update();
void rewind(int subsong);
float getrefresh();
- std::string gettype()
- { return std::string("MKJamz Audio File"); }
+ const char * gettype()
+ { return "MKJamz Audio File"; }
private:
short maxchannel,maxnotes,*songbuf;
diff --git a/plugins/adplug/adplug/msc.cpp b/plugins/adplug/adplug/msc.cpp
index c9eade06..ae613e48 100644
--- a/plugins/adplug/adplug/msc.cpp
+++ b/plugins/adplug/adplug/msc.cpp
@@ -19,7 +19,7 @@
* msc.c - MSC Player by Lubomir Bulej (pallas@kadan.cz)
*/
-#include <cstring>
+#include <string.h>
#include <stdio.h>
#include "msc.h"
@@ -63,7 +63,7 @@ CmscPlayer::~CmscPlayer()
delete [] desc;
}
-bool CmscPlayer::load(const std::string & filename, const CFileProvider & fp)
+bool CmscPlayer::load(const char * filename, const CFileProvider & fp)
{
binistream * bf;
msc_header hdr;
@@ -172,12 +172,10 @@ float CmscPlayer::getrefresh()
return 1193180 / (float) (timer_div ? timer_div : 0xffff);
}
-std::string CmscPlayer::gettype()
+const char * CmscPlayer::gettype()
{
- char vstr [40];
-
sprintf(vstr, "AdLib MSCplay (version %d)", version);
- return std::string (vstr);
+ return vstr;
}
/*** private methods *************************************/
diff --git a/plugins/adplug/adplug/msc.h b/plugins/adplug/adplug/msc.h
index a42ec750..0cca2933 100644
--- a/plugins/adplug/adplug/msc.h
+++ b/plugins/adplug/adplug/msc.h
@@ -32,12 +32,12 @@ class CmscPlayer: public CPlayer
CmscPlayer(Copl * newopl);
~CmscPlayer();
- bool load(const std::string &filename, const CFileProvider &fp);
+ bool load(const char *filename, const CFileProvider &fp);
bool update();
void rewind(int subsong);
float getrefresh();
- std::string gettype ();
+ const char * gettype ();
protected:
typedef unsigned char u8;
@@ -81,6 +81,8 @@ class CmscPlayer: public CPlayer
private:
static const u8 msc_signature [MSC_SIGN_LEN];
+ char vstr [40];
+
bool load_header (binistream * bf, msc_header * hdr);
bool decode_octet (u8 * output);
diff --git a/plugins/adplug/adplug/mtk.cpp b/plugins/adplug/adplug/mtk.cpp
index 6bafc853..c9631121 100644
--- a/plugins/adplug/adplug/mtk.cpp
+++ b/plugins/adplug/adplug/mtk.cpp
@@ -19,7 +19,7 @@
* mtk.cpp - MPU-401 Trakker Loader by Simon Peter (dn.tlp@gmx.net)
*/
-#include <cstring>
+#include <string.h>
#include "mtk.h"
/*** public methods **************************************/
@@ -29,7 +29,7 @@ CPlayer *CmtkLoader::factory(Copl *newopl)
return new CmtkLoader(newopl);
}
-bool CmtkLoader::load(const std::string &filename, const CFileProvider &fp)
+bool CmtkLoader::load(const char *filename, const CFileProvider &fp)
{
binistream *f = fp.open(filename); if(!f) return false;
struct {
diff --git a/plugins/adplug/adplug/mtk.h b/plugins/adplug/adplug/mtk.h
index 175576a2..37328e0f 100644
--- a/plugins/adplug/adplug/mtk.h
+++ b/plugins/adplug/adplug/mtk.h
@@ -32,18 +32,18 @@ class CmtkLoader: public ChscPlayer
mtkmode = 1;
};
- bool load(const std::string &filename, const CFileProvider &fp);
+ bool load(const char *filename, const CFileProvider &fp);
- std::string gettype()
- { return std::string("MPU-401 Trakker"); };
- std::string gettitle()
- { return std::string(title); };
- std::string getauthor()
- { return std::string(composer); };
+ const char * gettype()
+ { return "MPU-401 Trakker"; };
+ const char * gettitle()
+ { return title; };
+ const char * getauthor()
+ { return composer; };
unsigned int getinstruments()
{ return 128; };
- std::string getinstrument(unsigned int n)
- { return std::string(instname[n]); };
+ const char * getinstrument(unsigned int n)
+ { return instname[n]; };
private:
char title[34],composer[34],instname[0x80][34];
diff --git a/plugins/adplug/adplug/player.cpp b/plugins/adplug/adplug/player.cpp
index 9a0061af..03d26902 100644
--- a/plugins/adplug/adplug/player.cpp
+++ b/plugins/adplug/adplug/player.cpp
@@ -32,8 +32,10 @@ const unsigned char CPlayer::op_table[9] =
{0x00, 0x01, 0x02, 0x08, 0x09, 0x0a, 0x10, 0x11, 0x12};
CPlayer::CPlayer(Copl *newopl)
- : opl(newopl), db(CAdPlug::database)
+// : opl(newopl)
+ //, db(CAdPlug::database)
{
+ opl = newopl;
}
CPlayer::~CPlayer()
diff --git a/plugins/adplug/adplug/player.h b/plugins/adplug/adplug/player.h
index 8c474daa..c83eda79 100644
--- a/plugins/adplug/adplug/player.h
+++ b/plugins/adplug/adplug/player.h
@@ -22,8 +22,6 @@
#ifndef H_ADPLUG_PLAYER
#define H_ADPLUG_PLAYER
-#include <string>
-
#include "fprovide.h"
#include "opl.h"
#include "database.h"
@@ -37,7 +35,7 @@ public:
/***** Operational methods *****/
void seek(unsigned long ms);
- virtual bool load(const std::string &filename, // loads file
+ virtual bool load(const char *filename, // loads file
const CFileProvider &fp = CProvider_Filesystem()) = 0;
virtual bool update() = 0; // executes replay code for 1 tick
virtual void rewind(int subsong = -1) = 0; // rewinds to specified subsong
@@ -46,13 +44,13 @@ public:
/***** Informational methods *****/
unsigned long songlength(int subsong = -1);
- virtual std::string gettype() = 0; // returns file type
- virtual std::string gettitle() // returns song title
- { return std::string(); }
- virtual std::string getauthor() // returns song author name
- { return std::string(); }
- virtual std::string getdesc() // returns song description
- { return std::string(); }
+ virtual const char *gettype() = 0; // returns file type
+ virtual const char *gettitle() // returns song title
+ { return ""; }
+ virtual const char *getauthor() // returns song author name
+ { return ""; }
+ virtual const char *getdesc() // returns song description
+ { return ""; }
virtual unsigned int getpatterns() // returns number of patterns
{ return 0; }
virtual unsigned int getpattern() // returns currently playing pattern
@@ -71,12 +69,12 @@ public:
{ return 0; }
virtual unsigned int getinstruments() // returns number of instruments
{ return 0; }
- virtual std::string getinstrument(unsigned int n) // returns n-th instrument name
- { return std::string(); }
+ virtual const char *getinstrument(unsigned int n) // returns n-th instrument name
+ { return ""; }
protected:
Copl *opl; // our OPL chip
- CAdPlugDatabase *db; // AdPlug Database
+ //CAdPlugDatabase *db; // AdPlug Database
static const unsigned short note_table[12]; // standard adlib note table
static const unsigned char op_table[9]; // the 9 operators as expected by the OPL
diff --git a/plugins/adplug/adplug/players.cpp b/plugins/adplug/adplug/players.cpp
index 09c32b73..c8884fcd 100644
--- a/plugins/adplug/adplug/players.cpp
+++ b/plugins/adplug/adplug/players.cpp
@@ -32,8 +32,9 @@ CPlayerDesc::CPlayerDesc()
}
CPlayerDesc::CPlayerDesc(const CPlayerDesc &pd)
- : factory(pd.factory), filetype(pd.filetype), extlength(pd.extlength)
+ : factory(pd.factory), extlength(pd.extlength)
{
+ memcpy (filetype, pd.filetype, sizeof (filetype));
if(pd.extensions) {
extensions = (char *)malloc(extlength);
memcpy(extensions, pd.extensions, extlength);
@@ -41,9 +42,10 @@ CPlayerDesc::CPlayerDesc(const CPlayerDesc &pd)
extensions = 0;
}
-CPlayerDesc::CPlayerDesc(Factory f, const std::string &type, const char *ext)
- : factory(f), filetype(type), extensions(0)
+CPlayerDesc::CPlayerDesc(Factory f, const char *type, const char *ext)
+ : factory(f), extensions(0)
{
+ strcpy (filetype, type);
const char *i = ext;
// Determine length of passed extensions list
@@ -80,26 +82,25 @@ const char *CPlayerDesc::get_extension(unsigned int n) const
/***** CPlayers *****/
-const CPlayerDesc *CPlayers::lookup_filetype(const std::string &ftype) const
+const CPlayerDesc *CPlayers::lookup_filetype(const char *ftype) const
{
- const_iterator i;
-
- for(i = begin(); i != end(); i++)
- if((*i)->filetype == ftype)
- return *i;
+ for (const CPlayerDesc *i = head; i; i = i->next) {
+ if(!strcmp (i->filetype, ftype))
+ return i;
+ }
return 0;
}
-const CPlayerDesc *CPlayers::lookup_extension(const std::string &extension) const
+const CPlayerDesc *CPlayers::lookup_extension(const char *extension) const
{
- const_iterator i;
- unsigned int j;
-
- for(i = begin(); i != end(); i++)
- for(j = 0; (*i)->get_extension(j); j++)
- if(!stricmp(extension.c_str(), (*i)->get_extension(j)))
- return *i;
+ for (const CPlayerDesc *i = head; i; i = i->next) {
+ for(int j = 0; i->get_extension(j); j++) {
+ if(!strcmp (i->get_extension (j), extension)) {
+ return i;
+ }
+ }
+ }
return 0;
}
diff --git a/plugins/adplug/adplug/players.h b/plugins/adplug/adplug/players.h
index 9d686aef..82a8f3e0 100644
--- a/plugins/adplug/adplug/players.h
+++ b/plugins/adplug/adplug/players.h
@@ -22,9 +22,6 @@
#ifndef H_ADPLUG_PLAYERS
#define H_ADPLUG_PLAYERS
-#include <string>
-#include <list>
-
#include "opl.h"
#include "player.h"
@@ -34,27 +31,47 @@ public:
typedef CPlayer *(*Factory)(Copl *);
Factory factory;
- std::string filetype;
+ char filetype[50];
CPlayerDesc();
CPlayerDesc(const CPlayerDesc &pd);
- CPlayerDesc(Factory f, const std::string &type, const char *ext);
+ CPlayerDesc(Factory f, const char *type, const char *ext);
~CPlayerDesc();
void add_extension(const char *ext);
const char *get_extension(unsigned int n) const;
+ CPlayerDesc *next;
+
private:
char *extensions;
unsigned long extlength;
};
-class CPlayers: public std::list<const CPlayerDesc *>
+class CPlayers
{
public:
- const CPlayerDesc *lookup_filetype(const std::string &ftype) const;
- const CPlayerDesc *lookup_extension(const std::string &extension) const;
+ CPlayerDesc *head;
+ CPlayerDesc *tail;
+ CPlayers() {
+ head = 0;
+ tail = 0;
+ }
+ const CPlayerDesc *lookup_filetype(const char *ftype) const;
+ const CPlayerDesc *lookup_extension(const char *extension) const;
+
+ void push_back (CPlayerDesc *ply) {
+ ply->next = 0;
+ if (tail) {
+ tail->next = ply;
+ }
+ tail = ply;
+ if (!head) {
+ head = ply;
+ }
+ }
+
};
#endif
diff --git a/plugins/adplug/adplug/protrack.cpp b/plugins/adplug/adplug/protrack.cpp
index ebb1570b..bd56e6bc 100644
--- a/plugins/adplug/adplug/protrack.cpp
+++ b/plugins/adplug/adplug/protrack.cpp
@@ -25,7 +25,7 @@
* Protracker-like format, this is most certainly the player you want to use.
*/
-#include <cstring>
+#include <string.h>
#include "protrack.h"
#include "debug.h"
diff --git a/plugins/adplug/adplug/psi.cpp b/plugins/adplug/adplug/psi.cpp
index 00184526..64e5e891 100644
--- a/plugins/adplug/adplug/psi.cpp
+++ b/plugins/adplug/adplug/psi.cpp
@@ -166,9 +166,9 @@ float CxadpsiPlayer::xadplayer_getrefresh()
return 70.0f;
}
-std::string CxadpsiPlayer::xadplayer_gettype()
+const char * CxadpsiPlayer::xadplayer_gettype()
{
- return std::string("xad: psi player");
+ return "xad: psi player";
}
unsigned int CxadpsiPlayer::xadplayer_getinstruments()
diff --git a/plugins/adplug/adplug/psi.h b/plugins/adplug/adplug/psi.h
index 9714ed12..10f5dd3a 100644
--- a/plugins/adplug/adplug/psi.h
+++ b/plugins/adplug/adplug/psi.h
@@ -55,7 +55,7 @@ protected:
void xadplayer_rewind(int subsong);
void xadplayer_update();
float xadplayer_getrefresh();
- std::string xadplayer_gettype();
+ const char * xadplayer_gettype();
unsigned int xadplayer_getinstruments();
private:
diff --git a/plugins/adplug/adplug/rad.cpp b/plugins/adplug/adplug/rad.cpp
index 7996d9ae..5985a98c 100644
--- a/plugins/adplug/adplug/rad.cpp
+++ b/plugins/adplug/adplug/rad.cpp
@@ -22,7 +22,7 @@
* some volumes are dropped out
*/
-#include <cstring>
+#include <string.h>
#include "rad.h"
CPlayer *CradLoader::factory(Copl *newopl)
@@ -30,7 +30,7 @@ CPlayer *CradLoader::factory(Copl *newopl)
return new CradLoader(newopl);
}
-bool CradLoader::load(const std::string &filename, const CFileProvider &fp)
+bool CradLoader::load(const char *filename, const CFileProvider &fp)
{
binistream *f = fp.open(filename); if(!f) return false;
char id[16];
diff --git a/plugins/adplug/adplug/rad.h b/plugins/adplug/adplug/rad.h
index 07814b8a..f93d28d7 100644
--- a/plugins/adplug/adplug/rad.h
+++ b/plugins/adplug/adplug/rad.h
@@ -30,13 +30,13 @@ public:
: CmodPlayer(newopl)
{ *desc = '\0'; };
- bool load(const std::string &filename, const CFileProvider &fp);
+ bool load(const char *filename, const CFileProvider &fp);
float getrefresh();
- std::string gettype()
- { return std::string("Reality ADlib Tracker"); };
- std::string getdesc()
- { return std::string(desc); };
+ const char * gettype()
+ { return "Reality ADlib Tracker"; };
+ const char * getdesc()
+ { return desc; };
private:
unsigned char version,radflags;
diff --git a/plugins/adplug/adplug/rat.cpp b/plugins/adplug/adplug/rat.cpp
index 34f97cb6..c20780fd 100644
--- a/plugins/adplug/adplug/rat.cpp
+++ b/plugins/adplug/adplug/rat.cpp
@@ -29,7 +29,7 @@
comment : there are bug in original replayer's adlib_init(): wrong frequency registers.
*/
-#include <cstring>
+#include <string.h>
#include "rat.h"
#include "debug.h"
@@ -254,14 +254,14 @@ float CxadratPlayer::xadplayer_getrefresh()
return 60.0f;
}
-std::string CxadratPlayer::xadplayer_gettype()
+const char * CxadratPlayer::xadplayer_gettype()
{
- return (std::string("xad: rat player"));
+ return "xad: rat player";
}
-std::string CxadratPlayer::xadplayer_gettitle()
+const char * CxadratPlayer::xadplayer_gettitle()
{
- return (std::string(rat.hdr.title,32));
+ return rat.hdr.title;
}
unsigned int CxadratPlayer::xadplayer_getinstruments()
diff --git a/plugins/adplug/adplug/rat.h b/plugins/adplug/adplug/rat.h
index cc9ddf71..b57b7221 100644
--- a/plugins/adplug/adplug/rat.h
+++ b/plugins/adplug/adplug/rat.h
@@ -109,8 +109,8 @@ protected:
void xadplayer_rewind(int subsong);
void xadplayer_update();
float xadplayer_getrefresh();
- std::string xadplayer_gettype();
- std::string xadplayer_gettitle();
+ const char * xadplayer_gettype();
+ const char * xadplayer_gettitle();
unsigned int xadplayer_getinstruments();
//
private:
diff --git a/plugins/adplug/adplug/raw.cpp b/plugins/adplug/adplug/raw.cpp
index 0ca3f36b..3041ea05 100644
--- a/plugins/adplug/adplug/raw.cpp
+++ b/plugins/adplug/adplug/raw.cpp
@@ -19,7 +19,7 @@
* raw.c - RAW Player by Simon Peter <dn.tlp@gmx.net>
*/
-#include <cstring>
+#include <string.h>
#include "raw.h"
/*** public methods *************************************/
@@ -29,7 +29,7 @@ CPlayer *CrawPlayer::factory(Copl *newopl)
return new CrawPlayer(newopl);
}
-bool CrawPlayer::load(const std::string &filename, const CFileProvider &fp)
+bool CrawPlayer::load(const char *filename, const CFileProvider &fp)
{
binistream *f = fp.open(filename); if(!f) return false;
char id[8];
diff --git a/plugins/adplug/adplug/raw.h b/plugins/adplug/adplug/raw.h
index e05f1fe7..f36ea9f7 100644
--- a/plugins/adplug/adplug/raw.h
+++ b/plugins/adplug/adplug/raw.h
@@ -32,13 +32,13 @@ public:
~CrawPlayer()
{ if(data) delete [] data; };
- bool load(const std::string &filename, const CFileProvider &fp);
+ bool load(const char *filename, const CFileProvider &fp);
bool update();
void rewind(int subsong);
float getrefresh();
- std::string gettype()
- { return std::string("RdosPlay RAW"); };
+ const char * gettype()
+ { return "RdosPlay RAW"; };
protected:
struct Tdata {
diff --git a/plugins/adplug/adplug/rix.cpp b/plugins/adplug/adplug/rix.cpp
index 5cd69bd1..8b788ec6 100644
--- a/plugins/adplug/adplug/rix.cpp
+++ b/plugins/adplug/adplug/rix.cpp
@@ -20,7 +20,7 @@
* BSPAL <BSPAL.ys168.com>
*/
-#include <cstring>
+#include <string.h>
#include "rix.h"
#include "debug.h"
@@ -64,13 +64,16 @@ CrixPlayer::~CrixPlayer()
delete [] file_buffer;
}
-bool CrixPlayer::load(const std::string &filename, const CFileProvider &fp)
+bool CrixPlayer::load(const char *filename, const CFileProvider &fp)
{
binistream *f = fp.open(filename); if(!f) return false;
unsigned long i=0;
- if(stricmp(filename.substr(filename.length()-4,4).c_str(),".mkf")==0)
- {
+ const char *pext = filename + strlen (filename);
+ while (pext > filename && *pext != '.') {
+ pext--;
+ }
+ if (*pext == '.' && !stricmp (pext+1, ".mkf")) {
flag_mkf=1;
f->seek(0);
int offset=f->readInt(4);
diff --git a/plugins/adplug/adplug/rix.h b/plugins/adplug/adplug/rix.h
index 68e08c8b..b0748b0f 100644
--- a/plugins/adplug/adplug/rix.h
+++ b/plugins/adplug/adplug/rix.h
@@ -30,14 +30,14 @@ class CrixPlayer: public CPlayer
CrixPlayer(Copl *newopl);
~CrixPlayer();
- bool load(const std::string &filename, const CFileProvider &fp);
+ bool load(const char *filename, const CFileProvider &fp);
bool update();
void rewind(int subsong);
float getrefresh();
unsigned int getsubsongs();
- std::string gettype()
- { return std::string("Softstar RIX OPL Music Format"); };
+ const char * gettype()
+ { return "Softstar RIX OPL Music Format"; };
protected:
typedef struct {
diff --git a/plugins/adplug/adplug/rol.cpp b/plugins/adplug/adplug/rol.cpp
index a2a88fe8..d0d25f7d 100644
--- a/plugins/adplug/adplug/rol.cpp
+++ b/plugins/adplug/adplug/rol.cpp
@@ -20,12 +20,11 @@
*
* Visit: http://tenacity.hispeed.com/aomit/oplx/
*/
-#include <cstring>
-#include <algorithm>
-
+#include <string.h>
#include "rol.h"
#include "debug.h"
+
int const CrolPlayer::kSizeofDataRecord = 30;
int const CrolPlayer::kMaxTickBeat = 60;
int const CrolPlayer::kSilenceNote = -12;
@@ -65,16 +64,23 @@ CPlayer *CrolPlayer::factory(Copl *newopl)
}
//---------------------------------------------------------
CrolPlayer::CrolPlayer(Copl *newopl)
-: CPlayer ( newopl )
+: CPlayer ( newopl )
,rol_header ( NULL )
,mNextTempoEvent ( 0 )
,mCurrTick ( 0 )
,mTimeOfLastNote ( 0 )
,mRefresh ( kDefaultUpdateTme )
,bdRegister ( 0 )
+ ,n_voice_data(0)
+ ,n_tempo_events(0)
+ ,n_used_ins(0)
{
int n;
+ mTempoEvents = 0;
+ voice_data = 0;
+ ins_list = 0;
+
memset(bxRegister, 0, sizeof(bxRegister) );
memset(volumeCache, 0, sizeof(volumeCache) );
memset(freqCache, 0, sizeof(freqCache) );
@@ -90,25 +96,31 @@ CrolPlayer::~CrolPlayer()
delete rol_header;
rol_header=NULL;
}
+
+ delete[] mTempoEvents;
+ delete[] voice_data;
+ delete[] ins_list;
}
//---------------------------------------------------------
-bool CrolPlayer::load(const std::string &filename, const CFileProvider &fp)
+bool CrolPlayer::load(const char *filename, const CFileProvider &fp)
{
binistream *f = fp.open(filename); if(!f) return false;
- char *fn = new char[filename.length()+12];
+ char fn[strlen(filename)+12];
int i;
- std::string bnk_filename;
-
- AdPlug_LogWrite("*** CrolPlayer::load(f, \"%s\") ***\n", filename.c_str());
- strcpy(fn,filename.data());
- for (i=strlen(fn)-1; i>=0; i--)
- if (fn[i] == '/' || fn[i] == '\\')
- break;
+ const char * bnk_filename;
+
+ AdPlug_LogWrite("*** CrolPlayer::load(f, \"%s\") ***\n", filename);
+ strcpy(fn,filename);
+ int len = strlen(fn)-1;
+ for (i=len; i>=0; i--) {
+ if (fn[i] == '/' || fn[i] == '\\') {
+ break;
+ }
+ }
strcpy(fn+i+1,"standard.bnk");
bnk_filename = fn;
- delete [] fn;
- AdPlug_LogWrite("bnk_filename = \"%s\"\n",bnk_filename.c_str());
+ AdPlug_LogWrite("bnk_filename = \"%s\"\n",bnk_filename);
rol_header = new SRolHeader;
memset( rol_header, 0, sizeof(SRolHeader) );
@@ -157,27 +169,27 @@ bool CrolPlayer::load(const std::string &filename, const CFileProvider &fp)
rewind( 0 );
AdPlug_LogWrite("--- CrolPlayer::load ---\n");
+
return true;
}
//---------------------------------------------------------
bool CrolPlayer::update()
{
- if( mNextTempoEvent < mTempoEvents.size() &&
+ if( mNextTempoEvent < n_tempo_events &&
mTempoEvents[mNextTempoEvent].time == mCurrTick )
{
SetRefresh( mTempoEvents[mNextTempoEvent].multiplier );
++mNextTempoEvent;
}
- TVoiceData::iterator curr = voice_data.begin();
- TVoiceData::iterator end = voice_data.end();
- int voice = 0;
- while( curr != end )
+ int curr = 0;
+ int end = n_voice_data;
+
+ while( curr < end )
{
- UpdateVoice( voice, *curr );
+ UpdateVoice( curr, voice_data[curr] );
++curr;
- ++voice;
}
++mCurrTick;
@@ -193,12 +205,10 @@ bool CrolPlayer::update()
//---------------------------------------------------------
void CrolPlayer::rewind( int subsong )
{
- TVoiceData::iterator curr = voice_data.begin();
- TVoiceData::iterator end = voice_data.end();
-
- while( curr != end )
+ int curr = 0;
+ while( curr < n_voice_data )
{
- CVoiceData &voice = *curr;
+ CVoiceData &voice = voice_data[curr];
voice.Reset();
++curr;
@@ -246,23 +256,17 @@ float CrolPlayer::getrefresh()
//---------------------------------------------------------
void CrolPlayer::UpdateVoice( int const voice, CVoiceData &voiceData )
{
- TNoteEvents const &nEvents = voiceData.note_events;
-
- if( nEvents.empty() || voiceData.mEventStatus & CVoiceData::kES_NoteEnd )
+ if( !voiceData.n_note_events || (voiceData.mEventStatus & CVoiceData::kES_NoteEnd) )
{
return; // no note data to process, don't bother doing anything.
}
- TInstrumentEvents &iEvents = voiceData.instrument_events;
- TVolumeEvents &vEvents = voiceData.volume_events;
- TPitchEvents &pEvents = voiceData.pitch_events;
-
if( !(voiceData.mEventStatus & CVoiceData::kES_InstrEnd ) &&
- iEvents[voiceData.next_instrument_event].time == mCurrTick )
+ voiceData.instrument_events[voiceData.next_instrument_event].time == mCurrTick )
{
- if( voiceData.next_instrument_event < iEvents.size() )
+ if( voiceData.next_instrument_event < voiceData.n_instrument_events )
{
- send_ins_data_to_chip( voice, iEvents[voiceData.next_instrument_event].ins_index );
+ send_ins_data_to_chip( voice, voiceData.instrument_events[voiceData.next_instrument_event].ins_index );
++voiceData.next_instrument_event;
}
else
@@ -272,11 +276,11 @@ void CrolPlayer::UpdateVoice( int const voice, CVoiceData &voiceData )
}
if( !(voiceData.mEventStatus & CVoiceData::kES_VolumeEnd ) &&
- vEvents[voiceData.next_volume_event].time == mCurrTick )
+ voiceData.volume_events[voiceData.next_volume_event].time == mCurrTick )
{
- SVolumeEvent const &volumeEvent = vEvents[voiceData.next_volume_event];
+ SVolumeEvent const &volumeEvent = voiceData.volume_events[voiceData.next_volume_event];
- if( voiceData.next_volume_event < vEvents.size() )
+ if( voiceData.next_volume_event < voiceData.n_volume_events )
{
int const volume = (int)(63.0f*(1.0f - volumeEvent.multiplier));
@@ -297,9 +301,9 @@ void CrolPlayer::UpdateVoice( int const voice, CVoiceData &voiceData )
++voiceData.current_note;
}
- if( voiceData.current_note < nEvents.size() )
+ if( voiceData.current_note < voiceData.n_note_events )
{
- SNoteEvent const &noteEvent = nEvents[voiceData.current_note];
+ SNoteEvent const &noteEvent = voiceData.note_events[voiceData.current_note];
SetNote( voice, noteEvent.number );
voiceData.current_note_duration = 0;
@@ -315,11 +319,11 @@ void CrolPlayer::UpdateVoice( int const voice, CVoiceData &voiceData )
}
if( !(voiceData.mEventStatus & CVoiceData::kES_PitchEnd ) &&
- pEvents[voiceData.next_pitch_event].time == mCurrTick )
+ voiceData.pitch_events[voiceData.next_pitch_event].time == mCurrTick )
{
- if( voiceData.next_pitch_event < pEvents.size() )
+ if( voiceData.next_pitch_event < voiceData.n_pitch_events )
{
- SetPitch(voice,pEvents[voiceData.next_pitch_event].variation);
+ SetPitch(voice,voiceData.pitch_events[voiceData.next_pitch_event].variation);
++voiceData.next_pitch_event;
}
else
@@ -454,7 +458,8 @@ void CrolPlayer::load_tempo_events( binistream *f )
{
int16 const num_tempo_events = f->readInt( 2 );
- mTempoEvents.reserve( num_tempo_events );
+ mTempoEvents = new STempoEvent[num_tempo_events];
+ memset (mTempoEvents, 0, sizeof (STempoEvent) * num_tempo_events);
for(int i=0; i<num_tempo_events; ++i)
{
@@ -462,35 +467,36 @@ void CrolPlayer::load_tempo_events( binistream *f )
event.time = f->readInt( 2 );
event.multiplier = f->readFloat( binio::Single );
- mTempoEvents.push_back( event );
+ mTempoEvents[n_tempo_events++] = event;
}
}
//---------------------------------------------------------
-bool CrolPlayer::load_voice_data( binistream *f, std::string const &bnk_filename, const CFileProvider &fp )
+bool CrolPlayer::load_voice_data( binistream *f, const char *bnk_filename, const CFileProvider &fp )
{
SBnkHeader bnk_header;
- binistream *bnk_file = fp.open( bnk_filename.c_str() );
+ memset (&bnk_header, 0, sizeof (bnk_header));
+ binistream *bnk_file = fp.open( bnk_filename);
if( bnk_file )
{
load_bnk_info( bnk_file, bnk_header );
int const numVoices = rol_header->mode ? kNumMelodicVoices : kNumPercussiveVoices;
+ voice_data = new CVoiceData[numVoices];
- voice_data.reserve( numVoices );
for(int i=0; i<numVoices; ++i)
{
- CVoiceData voice;
+ CVoiceData &voice = voice_data[n_voice_data++];
load_note_events( f, voice );
load_instrument_events( f, voice, bnk_file, bnk_header );
load_volume_events( f, voice );
load_pitch_events( f, voice );
- voice_data.push_back( voice );
}
fp.close(bnk_file);
+ delete[] bnk_header.ins_name_list;
return true;
}
@@ -506,20 +512,17 @@ void CrolPlayer::load_note_events( binistream *f, CVoiceData &voice )
if( time_of_last_note != 0 )
{
- TNoteEvents &note_events = voice.note_events;
int16 total_duration = 0;
do
{
- SNoteEvent event;
+ SNoteEvent &event = voice.note_events[voice.n_note_events++];
event.number = f->readInt( 2 );
event.duration = f->readInt( 2 );
event.number += kSilenceNote; // adding -12
- note_events.push_back( event );
-
total_duration += event.duration;
} while( total_duration < time_of_last_note );
@@ -536,22 +539,18 @@ void CrolPlayer::load_instrument_events( binistream *f, CVoiceData &voice,
binistream *bnk_file, SBnkHeader const &bnk_header )
{
int16 const number_of_instrument_events = f->readInt( 2 );
-
- TInstrumentEvents &instrument_events = voice.instrument_events;
-
- instrument_events.reserve( number_of_instrument_events );
+ voice.instrument_events = new SInstrumentEvent[number_of_instrument_events];
+ memset (voice.instrument_events, 0, sizeof (SInstrumentEvent) * number_of_instrument_events);
for(int i=0; i<number_of_instrument_events; ++i)
{
- SInstrumentEvent event;
+ SInstrumentEvent &event = voice.instrument_events[voice.n_instrument_events++];
event.time = f->readInt( 2 );
f->readString( event.name, 9 );
- std::string event_name = event.name;
+ const char * event_name = event.name;
event.ins_index = load_rol_instrument( bnk_file, bnk_header, event_name );
- instrument_events.push_back( event );
-
f->seek( 1+2, binio::Add );
}
@@ -561,18 +560,14 @@ void CrolPlayer::load_instrument_events( binistream *f, CVoiceData &voice,
void CrolPlayer::load_volume_events( binistream *f, CVoiceData &voice )
{
int16 const number_of_volume_events = f->readInt( 2 );
-
- TVolumeEvents &volume_events = voice.volume_events;
-
- volume_events.reserve( number_of_volume_events );
+ voice.volume_events = new SVolumeEvent[number_of_volume_events];
+ memset (voice.volume_events, 0, sizeof (SVolumeEvent) * number_of_volume_events);
for(int i=0; i<number_of_volume_events; ++i)
{
- SVolumeEvent event;
+ SVolumeEvent &event = voice.volume_events[voice.n_volume_events++];
event.time = f->readInt( 2 );
event.multiplier = f->readFloat( binio::Single );
-
- volume_events.push_back( event );
}
f->seek( 15, binio::Add );
@@ -581,18 +576,14 @@ void CrolPlayer::load_volume_events( binistream *f, CVoiceData &voice )
void CrolPlayer::load_pitch_events( binistream *f, CVoiceData &voice )
{
int16 const number_of_pitch_events = f->readInt( 2 );
-
- TPitchEvents &pitch_events = voice.pitch_events;
-
- pitch_events.reserve( number_of_pitch_events );
+ voice.pitch_events = new SPitchEvent[number_of_pitch_events];
+ memset (voice.pitch_events, 0, sizeof (SPitchEvent) * number_of_pitch_events);
for(int i=0; i<number_of_pitch_events; ++i)
{
- SPitchEvent event;
+ SPitchEvent &event = voice.pitch_events[voice.n_pitch_events++];
event.time = f->readInt( 2 );
event.variation = f->readFloat( binio::Single );
-
- pitch_events.push_back( event );
}
}
//---------------------------------------------------------
@@ -610,31 +601,27 @@ bool CrolPlayer::load_bnk_info( binistream *f, SBnkHeader &header )
f->seek( header.abs_offset_of_name_list, binio::Set );
- TInstrumentNames &ins_name_list = header.ins_name_list;
- ins_name_list.reserve( header.number_of_list_entries_used );
+ header.ins_name_list = new SInstrumentName[header.number_of_list_entries_used];
+ memset (header.ins_name_list, 0, sizeof (SInstrumentName) * header.number_of_list_entries_used);
for(int i=0; i<header.number_of_list_entries_used; ++i)
{
- SInstrumentName instrument;
+ SInstrumentName &instrument = header.ins_name_list[header.n_ins_names++];
instrument.index = f->readInt( 2 );
instrument.record_used = f->readInt(1);
f->readString( instrument.name, 9 );
-
- // printf("%s = #%d\n", instrument.name, i );
-
- ins_name_list.push_back( instrument );
}
- //std::sort( ins_name_list.begin(), ins_name_list.end(), StringCompare() );
+ // preallocate space for instruments
+ ins_list = new SUsedList[header.number_of_list_entries_used * 2];
+ memset (ins_list, 0, sizeof (SUsedList) * header.number_of_list_entries_used * 2);
return true;
}
//---------------------------------------------------------
-int CrolPlayer::load_rol_instrument( binistream *f, SBnkHeader const &header, std::string &name )
+int CrolPlayer::load_rol_instrument( binistream *f, SBnkHeader const &header, const char * name )
{
- TInstrumentNames const &ins_name_list = header.ins_name_list;
-
int const ins_index = get_ins_index( name );
if( ins_index != -1 )
@@ -642,42 +629,41 @@ int CrolPlayer::load_rol_instrument( binistream *f, SBnkHeader const &header, st
return ins_index;
}
- typedef TInstrumentNames::const_iterator TInsIter;
- typedef std::pair<TInsIter, TInsIter> TInsIterPair;
-
- TInsIterPair range = std::equal_range( ins_name_list.begin(),
- ins_name_list.end(),
- name,
- StringCompare() );
+ if (n_used_ins >= header.n_ins_names * 2) {
+ AdPlug_LogWrite("*** CrolPlayer::load_rol_instrument out of memory***\n");
+ return -1;
+ }
- if( range.first != range.second )
- {
- int const seekOffs = header.abs_offset_of_data + (range.first->index*kSizeofDataRecord);
+ // find instrument struct by name to get file pos
+ int ipos;
+ for (ipos = 0; ipos < header.n_ins_names; ipos++) {
+ if (!stricmp (name, header.ins_name_list[ipos].name)) {
+ break;
+ }
+ }
+ if (ipos < header.n_ins_names && ipos >= 0) {
+ int const seekOffs = header.abs_offset_of_data + (header.ins_name_list[ipos].index*kSizeofDataRecord);
f->seek( seekOffs, binio::Set );
}
- SUsedList usedIns;
- usedIns.name = name;
+ SUsedList &usedIns = ins_list[n_used_ins++];
+ usedIns.name = name; // no strdup, pointing to SInstrumentEvent name
- if( range.first != range.second )
- {
+ if (ipos < header.n_ins_names && ipos >= 0) {
read_rol_instrument( f, usedIns.instrument );
}
- else
- {
+ else {
// set up default instrument data here
memset( &usedIns.instrument, 0, sizeof(SRolInstrument) );
}
- ins_list.push_back( usedIns );
-
- return ins_list.size()-1;
+ return n_used_ins-1;
}
//---------------------------------------------------------
-int CrolPlayer::get_ins_index( std::string const &name ) const
+int CrolPlayer::get_ins_index( const char * const &name ) const
{
- for(unsigned int i=0; i<ins_list.size(); ++i)
+ for(unsigned int i=0; i<n_used_ins; ++i)
{
- if( stricmp(ins_list[i].name.c_str(), name.c_str()) == 0 )
+ if( stricmp(ins_list[i].name, name) == 0 )
{
return i;
}
diff --git a/plugins/adplug/adplug/rol.h b/plugins/adplug/adplug/rol.h
index 82337adf..a7f936b7 100644
--- a/plugins/adplug/adplug/rol.h
+++ b/plugins/adplug/adplug/rol.h
@@ -23,10 +23,6 @@
#ifndef H_ROLPLAYER
#define H_ROLPLAYER
-#include <vector>
-#include <string>
-#include <strings.h>
-
#include "player.h"
class CrolPlayer: public CPlayer
@@ -38,12 +34,12 @@ public:
~CrolPlayer();
- bool load (const std::string &filename, const CFileProvider &fp);
+ bool load (const char *filename, const CFileProvider &fp);
bool update ();
void rewind (int subsong); // rewinds to specified subsong
float getrefresh(); // returns needed timer refresh rate
- std::string gettype() { return std::string("Adlib Visual Composer"); }
+ const char * gettype() { return "Adlib Visual Composer"; }
private:
typedef unsigned short uint16;
@@ -103,10 +99,9 @@ private:
real32 variation;
} SPitchEvent;
- typedef std::vector<SNoteEvent> TNoteEvents;
- typedef std::vector<SInstrumentEvent> TInstrumentEvents;
- typedef std::vector<SVolumeEvent> TVolumeEvents;
- typedef std::vector<SPitchEvent> TPitchEvents;
+ enum {
+ MAX_NOTE_EVENTS = 2000,
+ };
#define bit_pos( pos ) (1<<pos)
@@ -132,7 +127,21 @@ private:
,next_instrument_event( 0 )
,next_volume_event ( 0 )
,next_pitch_event ( 0 )
+ ,n_note_events (0)
+ ,n_instrument_events(0)
+ ,n_volume_events(0)
+ ,n_pitch_events(0)
{
+ memset (note_events, 0, sizeof (note_events));
+ instrument_events = 0;
+ volume_events = 0;
+ pitch_events = 0;
+ }
+
+ ~CVoiceData () {
+ delete[] instrument_events;
+ delete[] volume_events;
+ delete[] pitch_events;
}
void Reset()
@@ -147,10 +156,14 @@ private:
next_pitch_event = 0;
}
- TNoteEvents note_events;
- TInstrumentEvents instrument_events;
- TVolumeEvents volume_events;
- TPitchEvents pitch_events;
+ SNoteEvent note_events[MAX_NOTE_EVENTS];
+ int n_note_events;
+ SInstrumentEvent *instrument_events;
+ int n_instrument_events;
+ SVolumeEvent *volume_events;
+ int n_volume_events;
+ SPitchEvent *pitch_events;
+ int n_pitch_events;
bool mForceNote : 1;
int mEventStatus;
@@ -169,8 +182,6 @@ private:
char name[9];
} SInstrumentName;
- typedef std::vector<SInstrumentName> TInstrumentNames;
-
typedef struct
{
char version_major;
@@ -181,7 +192,8 @@ private:
int32 abs_offset_of_name_list;
int32 abs_offset_of_data;
- TInstrumentNames ins_name_list;
+ SInstrumentName *ins_name_list;
+ int n_ins_names;
} SBnkHeader;
typedef struct
@@ -221,12 +233,12 @@ private:
typedef struct
{
- std::string name;
+ const char * name;
SRolInstrument instrument;
} SUsedList;
void load_tempo_events ( binistream *f );
- bool load_voice_data ( binistream *f, std::string const &bnk_filename, const CFileProvider &fp );
+ bool load_voice_data ( binistream *f, const char *bnk_filename, const CFileProvider &fp );
void load_note_events ( binistream *f, CVoiceData &voice );
void load_instrument_events( binistream *f, CVoiceData &voice,
binistream *bnk_file, SBnkHeader const &bnk_header );
@@ -234,10 +246,10 @@ private:
void load_pitch_events ( binistream *f, CVoiceData &voice );
bool load_bnk_info ( binistream *f, SBnkHeader &header );
- int load_rol_instrument ( binistream *f, SBnkHeader const &header, std::string &name );
+ int load_rol_instrument ( binistream *f, SBnkHeader const &header, const char *name );
void read_rol_instrument ( binistream *f, SRolInstrument &ins );
void read_fm_operator ( binistream *f, SOPL2Op &opl2_op );
- int get_ins_index( std::string const &name ) const;
+ int get_ins_index( const char * const &name ) const;
void UpdateVoice( int const voice, CVoiceData &voiceData );
void SetNote( int const voice, int const note );
@@ -250,36 +262,13 @@ private:
void send_ins_data_to_chip( int const voice, int const ins_index );
void send_operator( int const voice, SOPL2Op const &modulator, SOPL2Op const &carrier );
- class StringCompare
- {
- public:
- bool operator()( SInstrumentName const &lhs, SInstrumentName const &rhs ) const
- {
- return keyLess(lhs.name, rhs.name);
- }
-
- bool operator()( SInstrumentName const &lhs, std::string const &rhs ) const
- {
- return keyLess(lhs.name, rhs.c_str());
- }
-
- bool operator()( std::string const &lhs, SInstrumentName const &rhs ) const
- {
- return keyLess(lhs.c_str(), rhs.name);
- }
- private:
- bool keyLess( const char *const lhs, const char *const rhs ) const
- {
- return stricmp(lhs, rhs) < 0;
- }
- };
-
- typedef std::vector<CVoiceData> TVoiceData;
-
SRolHeader *rol_header;
- std::vector<STempoEvent> mTempoEvents;
- TVoiceData voice_data;
- std::vector<SUsedList> ins_list;
+ STempoEvent *mTempoEvents;
+ int n_tempo_events;
+ CVoiceData *voice_data;
+ int n_voice_data;
+ SUsedList *ins_list;
+ int n_used_ins;
unsigned int mNextTempoEvent;
int mCurrTick;
diff --git a/plugins/adplug/adplug/s3m.cpp b/plugins/adplug/adplug/s3m.cpp
index ff0baa35..173a7563 100644
--- a/plugins/adplug/adplug/s3m.cpp
+++ b/plugins/adplug/adplug/s3m.cpp
@@ -22,7 +22,8 @@
* Extra Fine Slides (EEx, FEx) & Fine Vibrato (Uxy) are inaccurate
*/
-#include <cstring>
+#include <stdio.h>
+#include <string.h>
#include "s3m.h"
const char Cs3mPlayer::chnresolv[] = // S3M -> adlib channel conversion
@@ -56,97 +57,109 @@ Cs3mPlayer::Cs3mPlayer(Copl *newopl): CPlayer(newopl)
}
}
-bool Cs3mPlayer::load(const std::string &filename, const CFileProvider &fp)
+bool Cs3mPlayer::load(const char *filename, const CFileProvider &fp)
{
- binistream *f = fp.open(filename); if(!f) return false;
- unsigned short insptr[99],pattptr[99];
- int i,row;
- unsigned char bufval,bufval2;
- unsigned short ppatlen;
- s3mheader *checkhead;
- bool adlibins=false;
-
- // file validation section
- checkhead = new s3mheader;
- load_header(f, checkhead);
- if(checkhead->kennung != 0x1a || checkhead->typ != 16
- || checkhead->insnum > 99) {
- delete checkhead; fp.close(f); return false;
- } else
- if(strncmp(checkhead->scrm,"SCRM",4)) {
- delete checkhead; fp.close(f); return false;
- } else { // is an adlib module?
- f->seek(checkhead->ordnum, binio::Add);
- for(i = 0; i < checkhead->insnum; i++)
- insptr[i] = f->readInt(2);
- for(i=0;i<checkhead->insnum;i++) {
- f->seek(insptr[i]*16);
- if(f->readInt(1) >= 2) {
- adlibins = true;
- break;
- }
- }
- delete checkhead;
- if(!adlibins) { fp.close(f); return false; }
+ binistream *f = fp.open(filename);
+ if(!f) {
+ return false;
+ }
+ unsigned short insptr[99],pattptr[99];
+ int i,row;
+ unsigned char bufval,bufval2;
+ unsigned short ppatlen;
+ s3mheader *checkhead;
+ bool adlibins=false;
+
+ // file validation section
+ checkhead = new s3mheader;
+ load_header(f, checkhead);
+ if(checkhead->kennung != 0x1a || checkhead->typ != 16
+ || checkhead->insnum > 99) {
+ delete checkhead;
+ fp.close(f);
+ return false;
+ } else
+ if(strncmp(checkhead->scrm,"SCRM",4)) {
+ delete checkhead;
+ fp.close(f);
+ return false;
+ } else { // is an adlib module?
+ f->seek(checkhead->ordnum, binio::Add);
+ for(i = 0; i < checkhead->insnum; i++) {
+ insptr[i] = f->readInt(2);
+ }
+ for(i=0;i<checkhead->insnum;i++) {
+ f->seek(insptr[i]*16);
+ int n = f->readInt(1);
+ if(n >= 2) {
+ adlibins = true;
+ break;
+ }
+ }
+ delete checkhead;
+ if(!adlibins) {
+ fp.close(f);
+ return false;
+ }
+ }
+
+ // load section
+ f->seek(0); // rewind for load
+ load_header(f, &header); // read header
+
+ // security check
+ if(header.ordnum > 256 || header.insnum > 99 || header.patnum > 99) {
+ fp.close(f);
+ return false;
}
- // load section
- f->seek(0); // rewind for load
- load_header(f, &header); // read header
-
- // security check
- if(header.ordnum > 256 || header.insnum > 99 || header.patnum > 99) {
- fp.close(f);
- return false;
- }
-
- for(i = 0; i < header.ordnum; i++) orders[i] = f->readInt(1); // read orders
- for(i = 0; i < header.insnum; i++) insptr[i] = f->readInt(2); // instrument parapointers
- for(i = 0; i < header.patnum; i++) pattptr[i] = f->readInt(2); // pattern parapointers
-
- for(i=0;i<header.insnum;i++) { // load instruments
- f->seek(insptr[i]*16);
- inst[i].type = f->readInt(1);
- f->readString(inst[i].filename, 15);
- inst[i].d00 = f->readInt(1); inst[i].d01 = f->readInt(1);
- inst[i].d02 = f->readInt(1); inst[i].d03 = f->readInt(1);
- inst[i].d04 = f->readInt(1); inst[i].d05 = f->readInt(1);
- inst[i].d06 = f->readInt(1); inst[i].d07 = f->readInt(1);
- inst[i].d08 = f->readInt(1); inst[i].d09 = f->readInt(1);
- inst[i].d0a = f->readInt(1); inst[i].d0b = f->readInt(1);
- inst[i].volume = f->readInt(1); inst[i].dsk = f->readInt(1);
- f->ignore(2);
- inst[i].c2spd = f->readInt(4);
- f->ignore(12);
- f->readString(inst[i].name, 28);
- f->readString(inst[i].scri, 4);
- }
+ for(i = 0; i < header.ordnum; i++) orders[i] = f->readInt(1); // read orders
+ for(i = 0; i < header.insnum; i++) insptr[i] = f->readInt(2); // instrument parapointers
+ for(i = 0; i < header.patnum; i++) pattptr[i] = f->readInt(2); // pattern parapointers
+
+ for(i=0;i<header.insnum;i++) { // load instruments
+ f->seek(insptr[i]*16);
+ inst[i].type = f->readInt(1);
+ f->readString(inst[i].filename, 15);
+ inst[i].d00 = f->readInt(1); inst[i].d01 = f->readInt(1);
+ inst[i].d02 = f->readInt(1); inst[i].d03 = f->readInt(1);
+ inst[i].d04 = f->readInt(1); inst[i].d05 = f->readInt(1);
+ inst[i].d06 = f->readInt(1); inst[i].d07 = f->readInt(1);
+ inst[i].d08 = f->readInt(1); inst[i].d09 = f->readInt(1);
+ inst[i].d0a = f->readInt(1); inst[i].d0b = f->readInt(1);
+ inst[i].volume = f->readInt(1); inst[i].dsk = f->readInt(1);
+ f->ignore(2);
+ inst[i].c2spd = f->readInt(4);
+ f->ignore(12);
+ f->readString(inst[i].name, 28);
+ f->readString(inst[i].scri, 4);
+ }
- for(i=0;i<header.patnum;i++) { // depack patterns
- f->seek(pattptr[i]*16);
- ppatlen = f->readInt(2);
- unsigned long pattpos = f->pos();
- for(row=0;(row<64) && (pattpos-pattptr[i]*16<=ppatlen);row++)
- do {
- bufval = f->readInt(1);
- if(bufval & 32) {
- bufval2 = f->readInt(1);
- pattern[i][row][bufval & 31].note = bufval2 & 15;
- pattern[i][row][bufval & 31].oct = (bufval2 & 240) >> 4;
- pattern[i][row][bufval & 31].instrument = f->readInt(1);
- }
- if(bufval & 64)
- pattern[i][row][bufval & 31].volume = f->readInt(1);
- if(bufval & 128) {
- pattern[i][row][bufval & 31].command = f->readInt(1);
- pattern[i][row][bufval & 31].info = f->readInt(1);
- }
- } while(bufval);
- }
+ for(i=0;i<header.patnum;i++) { // depack patterns
+ f->seek(pattptr[i]*16);
+ ppatlen = f->readInt(2);
+ unsigned long pattpos = f->pos();
+ for(row=0;(row<64) && (pattpos-pattptr[i]*16<=ppatlen);row++)
+ do {
+ bufval = f->readInt(1);
+ if(bufval & 32) {
+ bufval2 = f->readInt(1);
+ pattern[i][row][bufval & 31].note = bufval2 & 15;
+ pattern[i][row][bufval & 31].oct = (bufval2 & 240) >> 4;
+ pattern[i][row][bufval & 31].instrument = f->readInt(1);
+ }
+ if(bufval & 64)
+ pattern[i][row][bufval & 31].volume = f->readInt(1);
+ if(bufval & 128) {
+ pattern[i][row][bufval & 31].command = f->readInt(1);
+ pattern[i][row][bufval & 31].info = f->readInt(1);
+ }
+ } while(bufval);
+ }
- fp.close(f);
- rewind(0);
- return true; // done
+ fp.close(f);
+ rewind(0);
+ return true; // done
}
bool Cs3mPlayer::update()
@@ -404,7 +417,7 @@ void Cs3mPlayer::rewind(int subsong)
opl->write(1,32); // Go to ym3812 mode
}
-std::string Cs3mPlayer::gettype()
+const char * Cs3mPlayer::gettype()
{
char filever[5];
@@ -416,7 +429,8 @@ std::string Cs3mPlayer::gettype()
default: strcpy(filever,"3.??");
}
- return (std::string("Scream Tracker ") + filever);
+ snprintf (filetype, sizeof (filetype), "Scream Tracker %s", filever);
+ return filetype;
}
float Cs3mPlayer::getrefresh()
diff --git a/plugins/adplug/adplug/s3m.h b/plugins/adplug/adplug/s3m.h
index aefc492e..cf58c44b 100644
--- a/plugins/adplug/adplug/s3m.h
+++ b/plugins/adplug/adplug/s3m.h
@@ -31,14 +31,14 @@ class Cs3mPlayer: public CPlayer
Cs3mPlayer(Copl *newopl);
- bool load(const std::string &filename, const CFileProvider &fp);
+ bool load(const char *filename, const CFileProvider &fp);
bool update();
void rewind(int subsong);
float getrefresh();
- std::string gettype();
- std::string gettitle()
- { return std::string(header.name); };
+ const char * gettype();
+ const char * gettitle()
+ { return header.name; };
unsigned int getpatterns()
{ return header.patnum; };
@@ -54,8 +54,8 @@ class Cs3mPlayer: public CPlayer
{ return speed; };
unsigned int getinstruments()
{ return header.insnum; };
- std::string getinstrument(unsigned int n)
- { return std::string(inst[n].name); };
+ const char * getinstrument(unsigned int n)
+ { return inst[n].name; };
protected:
struct s3mheader {
@@ -89,6 +89,8 @@ class Cs3mPlayer: public CPlayer
unsigned char orders[256];
unsigned char crow,ord,speed,tempo,del,songend,loopstart,loopcnt;
+ char filetype[30];
+
private:
static const char chnresolv[];
static const unsigned short notetable[12];
diff --git a/plugins/adplug/adplug/sa2.cpp b/plugins/adplug/adplug/sa2.cpp
index 8d81e9c1..bdf1b22c 100644
--- a/plugins/adplug/adplug/sa2.cpp
+++ b/plugins/adplug/adplug/sa2.cpp
@@ -20,7 +20,6 @@
* SAdT Loader by Mamiya <mamiya@users.sourceforge.net>
*/
-#include <cstring>
#include <stdio.h>
#include <string.h>
@@ -32,7 +31,7 @@ CPlayer *Csa2Loader::factory(Copl *newopl)
return new Csa2Loader(newopl);
}
-bool Csa2Loader::load(const std::string &filename, const CFileProvider &fp)
+bool Csa2Loader::load(const char *filename, const CFileProvider &fp)
{
binistream *f = fp.open(filename); if(!f) return false;
struct {
@@ -161,7 +160,7 @@ bool Csa2Loader::load(const std::string &filename, const CFileProvider &fp)
AdPlug_LogWrite("Csa2Loader::load(\"%s\"): sat_type = %x, nop = %d, "
"length = %d, restartpos = %d, activechan = %x, bpm = %d\n",
- filename.c_str(), sat_type, nop, length, restartpos, activechan, bpm);
+ filename, sat_type, nop, length, restartpos, activechan, bpm);
// track data
if(sat_type & HAS_OLDPATTERNS) {
@@ -227,15 +226,13 @@ bool Csa2Loader::load(const std::string &filename, const CFileProvider &fp)
return true;
}
-std::string Csa2Loader::gettype()
+const char * Csa2Loader::gettype()
{
- char tmpstr[40];
-
- sprintf(tmpstr,"Surprise! Adlib Tracker 2 (version %d)",header.version);
- return std::string(tmpstr);
+ snprintf(filetype,sizeof(filetype),"Surprise! Adlib Tracker 2 (version %d)",header.version);
+ return filetype;
}
-std::string Csa2Loader::gettitle()
+const char * Csa2Loader::gettitle()
{
char bufinst[29*17],buf[18];
int i,ptr;
@@ -256,8 +253,12 @@ std::string Csa2Loader::gettitle()
strcat(bufinst,buf);
}
- if(strchr(bufinst,'"'))
- return std::string(bufinst,strchr(bufinst,'"')-bufinst+1,strrchr(bufinst,'"')-strchr(bufinst,'"')-1);
- else
- return std::string();
+ if(strchr(bufinst,'"')) {
+ const char *pos = strchr(bufinst,'"')+1;
+ int len = strrchr(bufinst,'"')-pos;
+ memcpy (title,pos,len);
+ title[len] = 0;
+ return title;
+ }
+ return "";
}
diff --git a/plugins/adplug/adplug/sa2.h b/plugins/adplug/adplug/sa2.h
index ed904f0d..369d7730 100644
--- a/plugins/adplug/adplug/sa2.h
+++ b/plugins/adplug/adplug/sa2.h
@@ -31,18 +31,18 @@ public:
: CmodPlayer(newopl)
{ }
- bool load(const std::string &filename, const CFileProvider &fp);
+ bool load(const char *filename, const CFileProvider &fp);
- std::string gettype();
- std::string gettitle();
+ const char * gettype();
+ const char * gettitle();
unsigned int getinstruments()
{ return 31; }
- std::string getinstrument(unsigned int n)
+ const char * getinstrument(unsigned int n)
{
if(n < 29)
- return std::string(instname[n],1,16);
+ return instname[n];
else
- return std::string("-broken-");
+ return "-broken-";
}
private:
@@ -52,4 +52,6 @@ private:
} header;
char instname[29][17];
+ char filetype[40];
+ char title[200];
};
diff --git a/plugins/adplug/adplug/sng.cpp b/plugins/adplug/adplug/sng.cpp
index 5e8b6af4..02afb60b 100644
--- a/plugins/adplug/adplug/sng.cpp
+++ b/plugins/adplug/adplug/sng.cpp
@@ -19,7 +19,7 @@
* sng.cpp - SNG Player by Simon Peter <dn.tlp@gmx.net>
*/
-#include <cstring>
+#include <string.h>
#include "sng.h"
CPlayer *CsngPlayer::factory(Copl *newopl)
@@ -27,7 +27,7 @@ CPlayer *CsngPlayer::factory(Copl *newopl)
return new CsngPlayer(newopl);
}
-bool CsngPlayer::load(const std::string &filename, const CFileProvider &fp)
+bool CsngPlayer::load(const char *filename, const CFileProvider &fp)
{
binistream *f = fp.open(filename); if(!f) return false;
int i;
diff --git a/plugins/adplug/adplug/sng.h b/plugins/adplug/adplug/sng.h
index 6eef98de..e144e60b 100644
--- a/plugins/adplug/adplug/sng.h
+++ b/plugins/adplug/adplug/sng.h
@@ -35,14 +35,14 @@ public:
~CsngPlayer()
{ if(data) delete [] data; };
- bool load(const std::string &filename, const CFileProvider &fp);
+ bool load(const char *filename, const CFileProvider &fp);
bool update();
void rewind(int subsong);
float getrefresh()
{ return 70.0f; };
- std::string gettype()
- { return std::string("SNG File Format"); };
+ const char * gettype()
+ { return "SNG File Format"; };
protected:
struct {
diff --git a/plugins/adplug/adplug/u6m.cpp b/plugins/adplug/adplug/u6m.cpp
index d34f6fc2..565d0820 100644
--- a/plugins/adplug/adplug/u6m.cpp
+++ b/plugins/adplug/adplug/u6m.cpp
@@ -34,7 +34,7 @@ CPlayer *Cu6mPlayer::factory(Copl *newopl)
return new Cu6mPlayer(newopl);
}
-bool Cu6mPlayer::load(const std::string &filename, const CFileProvider &fp)
+bool Cu6mPlayer::load(const char *filename, const CFileProvider &fp)
{
// file validation section
// this section only checks a few *necessary* conditions
@@ -178,8 +178,7 @@ void Cu6mPlayer::rewind(int subsong)
carrier_mf_mod_delay[i] = 0;
}
- while (!subsong_stack.empty()) // empty subsong stack
- subsong_stack.pop();
+ subsong_stack_sz = 0;
opl->init();
out_adlib(1,32); // go to OPL2 mode
@@ -201,6 +200,8 @@ float Cu6mPlayer::getrefresh()
// ============================================================================================
+#define ROOT_STACK_SIZE 200
+
// decompress from memory to memory
bool Cu6mPlayer::lzw_decompress(Cu6mPlayer::data_block source, Cu6mPlayer::data_block dest)
{
@@ -210,7 +211,11 @@ bool Cu6mPlayer::lzw_decompress(Cu6mPlayer::data_block source, Cu6mPlayer::data_
int next_free_codeword = 0x102;
int dictionary_size = 0x200;
MyDict dictionary = MyDict();
- std::stack<unsigned char> root_stack;
+
+ unsigned char root_stack[ROOT_STACK_SIZE];
+ int root_stack_size = 0;
+
+// std::stack<unsigned char> root_stack;
long bytes_written = 0;
@@ -241,13 +246,13 @@ bool Cu6mPlayer::lzw_decompress(Cu6mPlayer::data_block source, Cu6mPlayer::data_
if (cW < next_free_codeword) // codeword is already in the dictionary
{
// create the string associated with cW (on the stack)
- get_string(cW,dictionary,root_stack);
- C = root_stack.top();
+ get_string(cW,dictionary,root_stack,root_stack_size);
+ C = root_stack[root_stack_size-1];
// output the string represented by cW
- while (!root_stack.empty())
+ while (root_stack_size>0)
{
- SAVE_OUTPUT_ROOT(root_stack.top(), dest, bytes_written);
- root_stack.pop();
+ SAVE_OUTPUT_ROOT(root_stack[root_stack_size-1], dest, bytes_written);
+ root_stack_size--;
}
// add pW+C to the dictionary
dictionary.add(C,pW);
@@ -265,13 +270,13 @@ bool Cu6mPlayer::lzw_decompress(Cu6mPlayer::data_block source, Cu6mPlayer::data_
else // codeword is not yet defined
{
// create the string associated with pW (on the stack)
- get_string(pW,dictionary,root_stack);
- C = root_stack.top();
+ get_string(pW,dictionary,root_stack,root_stack_size);
+ C = root_stack[root_stack_size-1];
// output the string represented by pW
- while (!root_stack.empty())
+ while (root_stack_size>0)
{
- SAVE_OUTPUT_ROOT(root_stack.top(), dest, bytes_written);
- root_stack.pop();
+ SAVE_OUTPUT_ROOT(root_stack[root_stack_size-1], dest, bytes_written);
+ root_stack_size--;
}
// output the char C
SAVE_OUTPUT_ROOT(C, dest, bytes_written);
@@ -357,7 +362,8 @@ void Cu6mPlayer::output_root(unsigned char root, unsigned char *destination, lon
// output the string represented by a codeword
-void Cu6mPlayer::get_string(int codeword, Cu6mPlayer::MyDict& dictionary, std::stack<unsigned char>& root_stack)
+//void Cu6mPlayer::get_string(int codeword, Cu6mPlayer::MyDict& dictionary, std::stack<unsigned char>& root_stack)
+void Cu6mPlayer::get_string(int codeword, Cu6mPlayer::MyDict& dictionary, unsigned char *root_stack, int &root_stack_size)
{
unsigned char root;
int current_codeword;
@@ -368,11 +374,11 @@ void Cu6mPlayer::get_string(int codeword, Cu6mPlayer::MyDict& dictionary, std::s
{
root = dictionary.get_root(current_codeword);
current_codeword = dictionary.get_codeword(current_codeword);
- root_stack.push(root);
+ root_stack[root_stack_size++]=root;
}
// push the root at the leaf
- root_stack.push((unsigned char)current_codeword);
+ root_stack[root_stack_size++]= (unsigned char)current_codeword;
}
@@ -583,7 +589,7 @@ void Cu6mPlayer::command_81()
new_ss_info.subsong_start = read_song_byte(); new_ss_info.subsong_start += read_song_byte() << 8;
new_ss_info.continue_pos = song_pos;
- subsong_stack.push(new_ss_info);
+ subsong_stack[subsong_stack_sz++] = new_ss_info;
song_pos = new_ss_info.subsong_start;
}
@@ -662,10 +668,10 @@ void Cu6mPlayer::command_E()
// ---------------------------
void Cu6mPlayer::command_F()
{
- if (!subsong_stack.empty())
+ if (subsong_stack_sz)
{
- subsong_info temp = subsong_stack.top();
- subsong_stack.pop();
+ subsong_info temp = subsong_stack[subsong_stack_sz-1];
+ subsong_stack_sz--;
temp.subsong_repetitions--;
if (temp.subsong_repetitions==0)
{
@@ -674,7 +680,7 @@ void Cu6mPlayer::command_F()
else
{
song_pos = temp.subsong_start;
- subsong_stack.push(temp);
+ subsong_stack[subsong_stack_sz++] = temp;
}
}
else
diff --git a/plugins/adplug/adplug/u6m.h b/plugins/adplug/adplug/u6m.h
index 30e7f3b5..f09d0211 100644
--- a/plugins/adplug/adplug/u6m.h
+++ b/plugins/adplug/adplug/u6m.h
@@ -20,8 +20,7 @@
* This code extends the Adlib Winamp plug-in by Simon Peter <dn.tlp@gmx.net>
*/
-#include <stack>
-
+#include <string.h>
#include "player.h"
#define default_dict_size 4096 // because maximum codeword size == 12 bits
@@ -32,7 +31,7 @@ class Cu6mPlayer: public CPlayer
public:
static CPlayer *factory(Copl *newopl);
- Cu6mPlayer(Copl *newopl) : CPlayer(newopl), song_data(0)
+ Cu6mPlayer(Copl *newopl) : CPlayer(newopl), song_data(0), subsong_stack_sz(0)
{
};
@@ -42,14 +41,14 @@ class Cu6mPlayer: public CPlayer
if(song_data) delete[] song_data;
};
- bool load(const std::string &filename, const CFileProvider &fp);
+ bool load(const char *filename, const CFileProvider &fp);
bool update();
void rewind(int subsong);
float getrefresh();
- std::string gettype()
+ const char * gettype()
{
- return std::string("Ultima 6 Music");
+ return "Ultima 6 Music";
};
protected:
@@ -109,7 +108,9 @@ class Cu6mPlayer: public CPlayer
int song_pos; // current offset within the song
int loop_position; // position of the loop point
int read_delay; // delay (in timer ticks) before further song data is read
- std::stack<subsong_info> subsong_stack;
+ enum {MAX_SUBSONG_STACK = 100};
+ subsong_info subsong_stack[MAX_SUBSONG_STACK];
+ int subsong_stack_sz;
int instrument_offsets[9]; // offsets of the adlib instrument data
// vibrato ("vb")
@@ -163,6 +164,7 @@ class Cu6mPlayer: public CPlayer
bool lzw_decompress(data_block source, data_block dest);
int get_next_codeword (long& bits_read, unsigned char *source, int codeword_size);
void output_root(unsigned char root, unsigned char *destination, long& position);
- void get_string(int codeword, MyDict& dictionary, std::stack<unsigned char>& root_stack);
+ //void get_string(int codeword, MyDict& dictionary, std::stack<unsigned char>& root_stack);
+ void get_string(int codeword, MyDict& dictionary, unsigned char *root_stack, int &root_stack_size);
};
diff --git a/plugins/adplug/adplug/xad.cpp b/plugins/adplug/adplug/xad.cpp
index 81c7c0a7..6b4f2cbf 100644
--- a/plugins/adplug/adplug/xad.cpp
+++ b/plugins/adplug/adplug/xad.cpp
@@ -35,7 +35,7 @@ CxadPlayer::~CxadPlayer()
delete [] tune;
}
-bool CxadPlayer::load(const std::string &filename, const CFileProvider &fp)
+bool CxadPlayer::load(const char *filename, const CFileProvider &fp)
{
binistream *f = fp.open(filename); if(!f) return false;
bool ret = false;
@@ -103,22 +103,22 @@ float CxadPlayer::getrefresh()
return xadplayer_getrefresh();
}
-std::string CxadPlayer::gettype()
+const char * CxadPlayer::gettype()
{
return xadplayer_gettype();
}
-std::string CxadPlayer::gettitle()
+const char * CxadPlayer::gettitle()
{
return xadplayer_gettitle();
}
-std::string CxadPlayer::getauthor()
+const char * CxadPlayer::getauthor()
{
return xadplayer_getauthor();
}
-std::string CxadPlayer::getinstrument(unsigned int i)
+const char * CxadPlayer::getinstrument(unsigned int i)
{
return xadplayer_getinstrument(i);
}
diff --git a/plugins/adplug/adplug/xad.h b/plugins/adplug/adplug/xad.h
index 16872558..8a999b5e 100644
--- a/plugins/adplug/adplug/xad.h
+++ b/plugins/adplug/adplug/xad.h
@@ -32,15 +32,15 @@ public:
CxadPlayer(Copl * newopl);
~CxadPlayer();
- bool load(const std::string &filename, const CFileProvider &fp);
+ bool load(const char *filename, const CFileProvider &fp);
bool update();
void rewind(int subsong);
float getrefresh();
- std::string gettype();
- std::string gettitle();
- std::string getauthor();
- std::string getinstrument(unsigned int i);
+ const char * gettype();
+ const char * gettitle();
+ const char * getauthor();
+ const char * getinstrument(unsigned int i);
unsigned int getinstruments();
protected:
@@ -48,18 +48,18 @@ protected:
virtual bool xadplayer_load() = 0;
virtual void xadplayer_update() = 0;
virtual float xadplayer_getrefresh() = 0;
- virtual std::string xadplayer_gettype() = 0;
- virtual std::string xadplayer_gettitle()
+ virtual const char * xadplayer_gettype() = 0;
+ virtual const char * xadplayer_gettitle()
{
- return std::string(xad.title);
+ return xad.title;
}
- virtual std::string xadplayer_getauthor()
+ virtual const char *xadplayer_getauthor()
{
- return std::string(xad.author);
+ return xad.author;
}
- virtual std::string xadplayer_getinstrument(unsigned int i)
+ virtual const char *xadplayer_getinstrument(unsigned int i)
{
- return std::string("");
+ return "";
}
virtual unsigned int xadplayer_getinstruments()
{
diff --git a/plugins/adplug/adplug/xsm.cpp b/plugins/adplug/adplug/xsm.cpp
index 3c97de04..016add11 100644
--- a/plugins/adplug/adplug/xsm.cpp
+++ b/plugins/adplug/adplug/xsm.cpp
@@ -33,7 +33,7 @@ CxsmPlayer::~CxsmPlayer()
if(music) delete [] music;
}
-bool CxsmPlayer::load(const std::string &filename, const CFileProvider &fp)
+bool CxsmPlayer::load(const char *filename, const CFileProvider &fp)
{
binistream *f = fp.open(filename); if(!f) return false;
char id[6];
diff --git a/plugins/adplug/adplug/xsm.h b/plugins/adplug/adplug/xsm.h
index 0e844afc..2ea118f5 100644
--- a/plugins/adplug/adplug/xsm.h
+++ b/plugins/adplug/adplug/xsm.h
@@ -29,12 +29,12 @@ public:
CxsmPlayer(Copl *newopl);
~CxsmPlayer();
- bool load(const std::string &filename, const CFileProvider &fp);
+ bool load(const char *filename, const CFileProvider &fp);
bool update();
void rewind(int subsong);
float getrefresh();
- std::string gettype() { return std::string("eXtra Simple Music"); }
+ const char * gettype() { return "eXtra Simple Music"; }
private:
unsigned short songlen;
diff --git a/plugins/adplug/libbinio/binio.h b/plugins/adplug/libbinio/binio.h
index 31bcfac6..b527f023 100644
--- a/plugins/adplug/libbinio/binio.h
+++ b/plugins/adplug/libbinio/binio.h
@@ -26,13 +26,13 @@
//
// Set to 1 to build std::string supporting methods. You need the STL to
// do this.
-#define BINIO_ENABLE_STRING 1
+#define BINIO_ENABLE_STRING 0
// BINIO_ENABLE_IOSTREAM - Build iostream wrapper classes
//
// Set to 1 to build the iostream wrapper classes. You need the standard
// C++ library to do this.
-#define BINIO_ENABLE_IOSTREAM 1
+#define BINIO_ENABLE_IOSTREAM 0
// BINIO_ISO_STDLIB - Build with ISO C++ standard library compliance
//
diff --git a/plugins/ao/eng_ssf/m68kcpu.h b/plugins/ao/eng_ssf/m68kcpu.h
index 77e4191b..ab626999 100644
--- a/plugins/ao/eng_ssf/m68kcpu.h
+++ b/plugins/ao/eng_ssf/m68kcpu.h
@@ -67,7 +67,7 @@
#define sint32 signed long
#define uint8 unsigned char
#define uint16 unsigned short
-#define uint32 unsigned long
+#define uint32 unsigned int
/* signed and unsigned int must be at least 32 bits wide */
#define sint signed int
#define uint unsigned int
diff --git a/plugins/dumb/cdumb.c b/plugins/dumb/cdumb.c
index 4410ba83..b8189eeb 100644
--- a/plugins/dumb/cdumb.c
+++ b/plugins/dumb/cdumb.c
@@ -77,7 +77,7 @@ cdumb_init (DB_fileinfo_t *_info, DB_playItem_t *it) {
_info->plugin = &plugin;
_info->bps = 16;
_info->channels = 2;
- _info->samplerate = deadbeef->conf_get_int ("synth.samplerate", 48000);
+ _info->samplerate = deadbeef->conf_get_int ("synth.samplerate", 44100);
_info->readpos = 0;
if (cdumb_startrenderer (_info) < 0) {
diff --git a/plugins/dumb/dumb-kode54/src/it/itrender.c b/plugins/dumb/dumb-kode54/src/it/itrender.c
index d1ffc559..a5986928 100644
--- a/plugins/dumb/dumb-kode54/src/it/itrender.c
+++ b/plugins/dumb/dumb-kode54/src/it/itrender.c
@@ -3558,7 +3558,6 @@ static void process_playing(DUMB_IT_SIGRENDERER *sigrenderer, IT_PLAYING *playin
playing->sample_vibrato_time += playing->sample->vibrato_speed;
}
-//static float log2(float x) {return (float)log(x)/(float)log(2.0f);}
#ifndef __linux__
static inline float log2(float x) {return (float)log(x)/(float)log(2.0f);}
#endif
diff --git a/plugins/ffap/ffap.c b/plugins/ffap/ffap.c
index 27b34332..deaa06dc 100644
--- a/plugins/ffap/ffap.c
+++ b/plugins/ffap/ffap.c
@@ -38,6 +38,13 @@
#include <assert.h>
#include "../../deadbeef.h"
+#ifdef TARGET_ANDROID
+int posix_memalign (void **memptr, size_t alignment, size_t size) {
+ *memptr = malloc (size);
+ return *memptr ? 0 : -1;
+}
+#endif
+
#define ENABLE_DEBUG 0
//#define trace(...) { fprintf(stderr, __VA_ARGS__); }
diff --git a/plugins/gme/cgme.c b/plugins/gme/cgme.c
index 0b95fc22..9c402553 100644
--- a/plugins/gme/cgme.c
+++ b/plugins/gme/cgme.c
@@ -42,7 +42,7 @@ cgme_open (void) {
static int
cgme_init (DB_fileinfo_t *_info, DB_playItem_t *it) {
gme_info_t *info = (gme_info_t*)_info;
- int samplerate = deadbeef->conf_get_int ("synth.samplerate", 48000);
+ int samplerate = deadbeef->conf_get_int ("synth.samplerate", 44100);
if (gme_open_file (it->fname, &info->emu, samplerate)) {
return -1;
}
diff --git a/plugins/gtkui/ddbcellrenderertextmultiline.c b/plugins/gtkui/ddbcellrenderertextmultiline.c
index 4a573705..104d5e9a 100644
--- a/plugins/gtkui/ddbcellrenderertextmultiline.c
+++ b/plugins/gtkui/ddbcellrenderertextmultiline.c
@@ -89,7 +89,7 @@ enum {
DDB_CELL_EDITABLE_TEXT_VIEW_DUMMY_PROPERTY
};
static gboolean ddb_cell_editable_text_view_real_key_press_event (GtkWidget* base, GdkEventKey* event);
-static void ddb_cell_editable_text_view_real_start_editing (GtkCellEditable* base, GdkEvent* event);
+void ddb_cell_editable_text_view_start_editing (DdbCellEditableTextView* self, GdkEvent* event);
DdbCellEditableTextView* ddb_cell_editable_text_view_new (void);
DdbCellEditableTextView* ddb_cell_editable_text_view_construct (GType object_type);
static void ddb_cell_editable_text_view_finalize (GObject* obj);
@@ -138,9 +138,8 @@ static gboolean ddb_cell_editable_text_view_real_key_press_event (GtkWidget* bas
}
-static void ddb_cell_editable_text_view_real_start_editing (GtkCellEditable* base, GdkEvent* event) {
- DdbCellEditableTextView * self;
- self = (DdbCellEditableTextView*) base;
+void ddb_cell_editable_text_view_start_editing (DdbCellEditableTextView* self, GdkEvent* event) {
+ g_return_if_fail (self != NULL);
g_return_if_fail (event != NULL);
}
@@ -166,7 +165,6 @@ static void ddb_cell_editable_text_view_class_init (DdbCellEditableTextViewClass
static void ddb_cell_editable_text_view_gtk_cell_editable_interface_init (GtkCellEditableIface * iface) {
ddb_cell_editable_text_view_gtk_cell_editable_parent_iface = g_type_interface_peek_parent (iface);
- iface->start_editing = ddb_cell_editable_text_view_real_start_editing;
}
diff --git a/plugins/gtkui/ddbcellrenderertextmultiline.h b/plugins/gtkui/ddbcellrenderertextmultiline.h
index 128d5455..55d4a82c 100644
--- a/plugins/gtkui/ddbcellrenderertextmultiline.h
+++ b/plugins/gtkui/ddbcellrenderertextmultiline.h
@@ -8,6 +8,7 @@
#include <gtk/gtk.h>
#include <stdlib.h>
#include <string.h>
+#include <gdk/gdk.h>
G_BEGIN_DECLS
@@ -56,6 +57,7 @@ struct _DdbCellRendererTextMultilineClass {
GType ddb_cell_editable_text_view_get_type (void);
+void ddb_cell_editable_text_view_start_editing (DdbCellEditableTextView* self, GdkEvent* event);
DdbCellEditableTextView* ddb_cell_editable_text_view_new (void);
DdbCellEditableTextView* ddb_cell_editable_text_view_construct (GType object_type);
GType ddb_cell_renderer_text_multiline_get_type (void);
diff --git a/plugins/musepack/musepack.c b/plugins/musepack/musepack.c
index 595eb571..35a81b11 100644
--- a/plugins/musepack/musepack.c
+++ b/plugins/musepack/musepack.c
@@ -306,6 +306,7 @@ musepack_seek (DB_fileinfo_t *_info, float time) {
static DB_playItem_t *
musepack_insert (DB_playItem_t *after, const char *fname) {
+ trace ("mpc: inserting %s\n", fname);
mpc_reader reader = {
.read = musepack_vfs_read,
.seek = musepack_vfs_seek,
@@ -316,14 +317,14 @@ musepack_insert (DB_playItem_t *after, const char *fname) {
DB_FILE *fp = deadbeef->fopen (fname);
if (!fp) {
- fprintf (stderr, "mpc: insert failed to open %s\n", fname);
+ trace ("mpc: insert failed to open %s\n", fname);
return NULL;
}
reader.data = fp;
mpc_demux *demux = mpc_demux_init (&reader);
if (!demux) {
- fprintf (stderr, "mpc: mpc_demux_init failed\n");
+ trace ("mpc: mpc_demux_init failed\n");
deadbeef->fclose (fp);
return NULL;
}
diff --git a/plugins/sid/Makefile.am b/plugins/sid/Makefile.am
index 5034c222..38caa014 100644
--- a/plugins/sid/Makefile.am
+++ b/plugins/sid/Makefile.am
@@ -27,22 +27,22 @@ sidplay-libs/libsidplay/src/xsid/xsid.cpp\
sidplay-libs/libsidplay/src/mos6526/mos6526.cpp\
sidplay-libs/builders/resid-builder/src/resid.cpp\
sidplay-libs/builders/resid-builder/src/resid-builder.cpp\
-sidplay-libs/resid/wave8580_PS_.cc\
-sidplay-libs/resid/filter.cc\
-sidplay-libs/resid/pot.cc\
-sidplay-libs/resid/wave.cc\
-sidplay-libs/resid/version.cc\
-sidplay-libs/resid/wave6581__ST.cc\
-sidplay-libs/resid/extfilt.cc\
-sidplay-libs/resid/wave8580_PST.cc\
-sidplay-libs/resid/wave6581_PST.cc\
-sidplay-libs/resid/wave6581_P_T.cc\
-sidplay-libs/resid/wave6581_PS_.cc\
-sidplay-libs/resid/envelope.cc\
-sidplay-libs/resid/voice.cc\
-sidplay-libs/resid/sid.cc\
-sidplay-libs/resid/wave8580__ST.cc\
-sidplay-libs/resid/wave8580_P_T.cc\
+sidplay-libs/resid/wave8580_PS_.cpp\
+sidplay-libs/resid/filter.cpp\
+sidplay-libs/resid/pot.cpp\
+sidplay-libs/resid/wave.cpp\
+sidplay-libs/resid/version.cpp\
+sidplay-libs/resid/wave6581__ST.cpp\
+sidplay-libs/resid/extfilt.cpp\
+sidplay-libs/resid/wave8580_PST.cpp\
+sidplay-libs/resid/wave6581_PST.cpp\
+sidplay-libs/resid/wave6581_P_T.cpp\
+sidplay-libs/resid/wave6581_PS_.cpp\
+sidplay-libs/resid/envelope.cpp\
+sidplay-libs/resid/voice.cpp\
+sidplay-libs/resid/sid.cpp\
+sidplay-libs/resid/wave8580__ST.cpp\
+sidplay-libs/resid/wave8580_P_T.cpp\
sidplay-libs/libsidplay/src/reloc65.c\
sidplay-libs/unix/config.h\
sidplay-libs/libsidplay/win/VC/sidconfig.h\
diff --git a/plugins/sid/csid.cpp b/plugins/sid/csid.cpp
index c3d8c8b6..ccb2ecb3 100644
--- a/plugins/sid/csid.cpp
+++ b/plugins/sid/csid.cpp
@@ -18,11 +18,14 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#define LIBICONV_PLUG
-#include <iconv.h>
+#include <ctype.h>
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
+#if HAVE_ICONV
+#define LIBICONV_PLUG
+#include <iconv.h>
+#endif
#include "sidplay/sidplay2.h"
#include "sidplay/builders/resid.h"
//#include "md5.h"
@@ -297,7 +300,7 @@ csid_init (DB_fileinfo_t *_info, DB_playItem_t *it) {
// resid->create (1);
info->resid->filter (true);
- int samplerate = deadbeef->conf_get_int ("sid.samplerate", 48000);
+ int samplerate = deadbeef->conf_get_int ("sid.samplerate", 44100);
int bps = deadbeef->get_output ()->bitspersample ();
info->resid->sampling (samplerate);
@@ -354,6 +357,7 @@ csid_read (DB_fileinfo_t *_info, char *bytes, int size) {
int rd = info->sidplay->play (bytes, size/_info->channels);
_info->readpos += size/_info->channels/2 / (float)_info->samplerate;
+#if 0
#if WORDS_BIGENDIAN
// convert samples from le to be
int n = rd * _info->channels/2;
@@ -366,6 +370,7 @@ csid_read (DB_fileinfo_t *_info, char *bytes, int size) {
n--;
}
#endif
+#endif
return rd * _info->channels;
}
@@ -401,8 +406,9 @@ csid_seek (DB_fileinfo_t *_info, float time) {
static const char *
convstr (const char* str) {
+#ifdef HAVE_ICONV
int sz = strlen (str);
- static char out[2048];
+ static char out[2048]; // FIXME: this is not thread-safe
const char *enc = "iso8859-1";
iconv_t cd = iconv_open ("utf-8", enc);
if (cd == (iconv_t)-1) {
@@ -423,17 +429,24 @@ convstr (const char* str) {
iconv_close (cd);
}
return out;
+#else
+ return str;
+#endif
}
extern "C" DB_playItem_t *
csid_insert (DB_playItem_t *after, const char *fname) {
+ trace ("inserting %s\n", fname);
sldb_load ();
SidTune *tune;
+ trace ("new SidTune\n");
tune = new SidTune (fname);
int tunes = tune->getInfo ().songs;
+ trace ("subtunes: %d\n", tunes);
uint8_t sig[16];
unsigned char tmp[2];
#if 1
+ trace ("calculating md5\n");
DB_md5_t md5;
deadbeef->md5_init (&md5);
deadbeef->md5_append (&md5, (const uint8_t *)tune->cache.get () + tune->fileOffset, tune->getInfo ().c64dataLen);
@@ -486,13 +499,15 @@ csid_insert (DB_playItem_t *after, const char *fname) {
memcpy (sig, myMD5.getDigest (), 16);
#endif
- sldb_load ();
+// sldb_load ();
int song = -1;
if (sldb_loaded) {
song = sldb_find (sig);
}
+ trace ("inserting tunes...\n");
for (int s = 0; s < tunes; s++) {
+ trace ("select %d...\n", s);
if (tune->selectSong (s+1)) {
DB_playItem_t *it = deadbeef->pl_item_alloc ();
it->decoder_id = deadbeef->plug_get_decoder_id (sid_plugin.plugin.id);
@@ -502,6 +517,7 @@ csid_insert (DB_playItem_t *after, const char *fname) {
tune->getInfo (sidinfo);
int i = sidinfo.numberOfInfoStrings;
int title_added = 0;
+ trace ("set %d metainfo...\n", s);
if (i >= 1 && sidinfo.infoString[0] && sidinfo.infoString[0][0]) {
const char *meta;
if (sidinfo.songs > 1) {
@@ -553,10 +569,12 @@ csid_insert (DB_playItem_t *after, const char *fname) {
deadbeef->pl_item_unref (it);
}
}
+ trace ("delete sidtune\n");
delete tune;
return after;
}
+#if 0
int
csid_numvoices (DB_fileinfo_t *_info) {
return 3;
@@ -580,6 +598,7 @@ csid_mutevoice (DB_fileinfo_t *_info, int voice, int mute) {
}
}
}
+#endif
static int
csid_on_configchanged (DB_event_t *ev, uintptr_t data) {
diff --git a/plugins/sid/plugin.c b/plugins/sid/plugin.c
index 91c74bb5..9a2e9a27 100644
--- a/plugins/sid/plugin.c
+++ b/plugins/sid/plugin.c
@@ -49,8 +49,9 @@ DB_decoder_t sid_plugin = {
.seek = csid_seek,
.seek_sample = NULL,
.insert = csid_insert,
- .numvoices = csid_numvoices,
- .mutevoice = csid_mutevoice,
+// .numvoices = csid_numvoices,
+// .mutevoice = csid_mutevoice,
.exts = exts,
.filetypes = filetypes,
};
+
diff --git a/plugins/sid/sidplay-libs/Makefile.am b/plugins/sid/sidplay-libs/Makefile.am
deleted file mode 100644
index 9adeb2e9..00000000
--- a/plugins/sid/sidplay-libs/Makefile.am
+++ /dev/null
@@ -1,107 +0,0 @@
-noinst_LIBRARIES = libsidplay2.a
-
-sidpath=@top_srcdir@/plugins/sid/sidplay-libs
-
-EXTRA_DIST = \
- $(sidpath)/libsidutils/README $(sidpath)/libsidplay/README $(sidpath)/resid/README\
- $(sidpath)/libsidutils/COPYING $(sidpath)/libsidplay/COPYING $(sidpath)/resid/COPYING\
- $(sidpath)/libsidutils/AUTHORS $(sidpath)/libsidplay/AUTHORS $(sidpath)/resid/AUTHORS
-
-AM_CPPFLAGS = $(INSANE_CXXFLAGS) -DHAVE_UNIX -I$(sidpath)/unix -I$(sidpath)/libsidplay -I$(sidpath)/libsidplay/include -I$(sidpath)/libsidplay/include/sidplay -I$(sidpath)/libsidutils/include/sidplay/utils -I$(sidpath)/builders/resid-builder/include/sidplay/builders -I$(sidpath)/builders/resid-builder/include -DHAVE_STRCASECMP -DHAVE_STRNCASECMP -fPIC
-
-libsidplay2_a_SOURCES = \
-libsidplay/src/mixer.cpp\
-libsidplay/src/player.cpp\
-libsidplay/src/mos656x/mos656x.cpp\
-libsidplay/src/mos6510/mos6510.cpp\
-libsidplay/src/sid6526/sid6526.cpp\
-libsidplay/src/sidtune/MUS.cpp\
-libsidplay/src/sidtune/SidTuneTools.cpp\
-libsidplay/src/sidtune/InfoFile.cpp\
-libsidplay/src/sidtune/SidTune.cpp\
-libsidplay/src/sidtune/PSID.cpp\
-libsidplay/src/sidtune/PP20.cpp\
-libsidplay/src/sidtune/IconInfo.cpp\
-libsidplay/src/event.cpp\
-libsidplay/src/psiddrv.cpp\
-libsidplay/src/config.cpp\
-libsidplay/src/sidplay2.cpp\
-libsidplay/src/xsid/xsid.cpp\
-libsidplay/src/mos6526/mos6526.cpp\
-builders/resid-builder/src/resid.cpp\
-builders/resid-builder/src/resid-builder.cpp\
-resid/wave8580_PS_.cc\
-resid/filter.cc\
-resid/pot.cc\
-resid/wave.cc\
-resid/version.cc\
-resid/wave6581__ST.cc\
-resid/extfilt.cc\
-resid/wave8580_PST.cc\
-resid/wave6581_PST.cc\
-resid/wave6581_P_T.cc\
-resid/wave6581_PS_.cc\
-resid/envelope.cc\
-resid/voice.cc\
-resid/sid.cc\
-resid/wave8580__ST.cc\
-resid/wave8580_P_T.cc\
-libsidplay/src/reloc65.c\
-unix/config.h\
-libsidplay/win/VC/sidconfig.h\
-libsidplay/win/VC/sidint.h\
-libsidplay/win/VC/config.h\
-libsidplay/unix/sidconfig.h\
-libsidplay/unix/sidint.h\
-libsidplay/src/xsid/xsid.h\
-libsidplay/src/mos6526/mos6526.h\
-libsidplay/src/sid6526/sid6526.h\
-libsidplay/src/mos656x/mos656x.h\
-libsidplay/src/c64/c64xsid.h\
-libsidplay/src/c64/c64cia.h\
-libsidplay/src/c64/c64vic.h\
-libsidplay/src/nullsid.h\
-libsidplay/src/sidtune/PP20_Defs.h\
-libsidplay/src/sidtune/SidTuneTools.h\
-libsidplay/src/sidtune/SidTuneCfg.h\
-libsidplay/src/sidtune/PP20.h\
-libsidplay/src/mos6510/cycle_based/sid6510c.h\
-libsidplay/src/mos6510/cycle_based/mos6510c.h\
-libsidplay/src/mos6510/mos6510.h\
-libsidplay/src/mos6510/conf6510.h\
-libsidplay/src/mos6510/opcodes.h\
-libsidplay/src/player.h\
-libsidplay/include/sidplay/SmartPtr.h\
-libsidplay/include/sidplay/sidusage.h\
-libsidplay/include/sidplay/sidtypes.h\
-libsidplay/include/sidplay/sidplay2.h\
-libsidplay/include/sidplay/sidconfig.h\
-libsidplay/include/sidplay/SidTune.h\
-libsidplay/include/sidplay/sid2types.h\
-libsidplay/include/sidplay/c64env.h\
-libsidplay/include/sidplay/sidbuilder.h\
-libsidplay/include/sidplay/sidint.h\
-libsidplay/include/sidplay/component.h\
-libsidplay/include/sidplay/event.h\
-libsidplay/include/sidplay/sidendian.h\
-libsidplay/include/sidplay/Buffer.h\
-libsidplay/include/sidenv.h\
-libsidplay/include/config.h\
-builders/resid-builder/win/VC/config.h\
-builders/resid-builder/src/resid-emu.h\
-builders/resid-builder/include/sidplay/builders/resid.h\
-builders/resid-builder/include/config.h\
-resid/voice.h\
-resid/siddefs.h\
-resid/wave.h\
-resid/sid.h\
-resid/filter.h\
-resid/envelope.h\
-resid/spline.h\
-resid/pot.h\
-resid/extfilt.h\
-libsidplay/src/mos6510/cycle_based/mos6510c.i\
-libsidplay/src/mos6510/cycle_based/sid6510c.i\
-libsidplay/src/kernal.bin\
-libsidplay/src/psiddrv.bin\
-libsidplay/src/poweron.bin
diff --git a/plugins/sid/sidplay-libs/builders/resid-builder/include/sidplay/builders/resid.h b/plugins/sid/sidplay-libs/builders/resid-builder/include/sidplay/builders/resid.h
index aa6ccffa..8f8f2636 100644
--- a/plugins/sid/sidplay-libs/builders/resid-builder/include/sidplay/builders/resid.h
+++ b/plugins/sid/sidplay-libs/builders/resid-builder/include/sidplay/builders/resid.h
@@ -22,7 +22,6 @@
* creating a wrapper instead of implementing a SID emulation
*/
-#include <vector>
#include <sidplay/sidbuilder.h>
#include <sidplay/event.h>
@@ -37,11 +36,13 @@ private:
static const char *ERR_FILTER_DEFINITION;
char m_errorBuffer[100];
const char *m_error;
- std::vector<sidemu *> sidobjs;
+ enum { MAX_SIDOBJS = 10 };
+ sidemu * sidobjs[MAX_SIDOBJS];
+ int n_sidobjs;
public:
sidemu *getsidemu (int i) {
- if (i >= sidobjs.size ()) {
+ if (i >= n_sidobjs) {
return NULL;
}
return sidobjs[i];
diff --git a/plugins/sid/sidplay-libs/builders/resid-builder/src/resid-builder.cpp b/plugins/sid/sidplay-libs/builders/resid-builder/src/resid-builder.cpp
index 4c7650f6..ebf63b86 100644
--- a/plugins/sid/sidplay-libs/builders/resid-builder/src/resid-builder.cpp
+++ b/plugins/sid/sidplay-libs/builders/resid-builder/src/resid-builder.cpp
@@ -37,7 +37,7 @@
***************************************************************************/
#include <stdio.h>
-#include <cstring>
+#include <string.h>
#include "config.h"
#ifdef HAVE_EXCEPTIONS
@@ -53,6 +53,7 @@ const char *ReSIDBuilder::ERR_FILTER_DEFINITION = "RESID ERROR: Filter definitio
ReSIDBuilder::ReSIDBuilder (const char * const name)
:sidbuilder (name)
{
+ n_sidobjs = 0;
m_error = "N/A";
}
@@ -97,7 +98,7 @@ uint ReSIDBuilder::create (uint sids)
m_error = sid->error ();
goto ReSIDBuilder_create_error;
}
- sidobjs.push_back (sid);
+ sidobjs[n_sidobjs++] = sid;
}
return count;
@@ -113,7 +114,7 @@ const char *ReSIDBuilder::credits ()
m_status = true;
// Available devices
- if (sidobjs.size ())
+ if (n_sidobjs)
{
ReSID *sid = (ReSID *) sidobjs[0];
return sid->credits ();
@@ -136,14 +137,14 @@ uint ReSIDBuilder::devices (bool created)
{
m_status = true;
if (created)
- return sidobjs.size ();
+ return n_sidobjs;
else // Available devices
return 0;
}
void ReSIDBuilder::filter (const sid_filter_t *filter)
{
- int size = sidobjs.size ();
+ int size = n_sidobjs;
m_status = true;
for (int i = 0; i < size; i++)
{
@@ -160,7 +161,7 @@ ReSIDBuilder_sidFilterDef_error:
void ReSIDBuilder::filter (bool enable)
{
- int size = sidobjs.size ();
+ int size = n_sidobjs;
m_status = true;
for (int i = 0; i < size; i++)
{
@@ -172,7 +173,7 @@ void ReSIDBuilder::filter (bool enable)
// Find a free SID of the required specs
sidemu *ReSIDBuilder::lock (c64env *env, sid2_model_t model)
{
- int size = sidobjs.size ();
+ int size = n_sidobjs;
m_status = true;
for (int i = 0; i < size; i++)
@@ -193,7 +194,7 @@ sidemu *ReSIDBuilder::lock (c64env *env, sid2_model_t model)
// Allow something to use this SID
void ReSIDBuilder::unlock (sidemu *device)
{
- int size = sidobjs.size ();
+ int size = n_sidobjs;
// Maek sure this is our SID
for (int i = 0; i < size; i++)
{
@@ -209,15 +210,15 @@ void ReSIDBuilder::unlock (sidemu *device)
// Remove all SID emulations.
void ReSIDBuilder::remove ()
{
- int size = sidobjs.size ();
+ int size = n_sidobjs;
for (int i = 0; i < size; i++)
delete sidobjs[i];
- sidobjs.clear();
+ n_sidobjs = 0;
}
void ReSIDBuilder::sampling (uint_least32_t freq)
{
- int size = sidobjs.size ();
+ int size = n_sidobjs;
m_status = true;
for (int i = 0; i < size; i++)
{
diff --git a/plugins/sid/sidplay-libs/libsidplay/include/sidplay/SidTune.h b/plugins/sid/sidplay-libs/libsidplay/include/sidplay/SidTune.h
index f544afb6..5af215b1 100644
--- a/plugins/sid/sidplay-libs/libsidplay/include/sidplay/SidTune.h
+++ b/plugins/sid/sidplay-libs/libsidplay/include/sidplay/SidTune.h
@@ -24,7 +24,7 @@
#include "Buffer.h"
#include "SmartPtr.h"
-#include <fstream>
+//#include <fstream>
const uint_least16_t SIDTUNE_MAX_SONGS = 256;
@@ -237,7 +237,7 @@ class SID_EXTERN SidTune
// to load files. Error string is put into info.statusString, though.
bool loadFile(const char* fileName, Buffer_sidtt<const uint_least8_t>& bufferRef);
- bool saveToOpenFile( std::ofstream& toFile, const uint_least8_t* buffer, uint_least32_t bufLen );
+// bool saveToOpenFile( std::ofstream& toFile, const uint_least8_t* buffer, uint_least32_t bufLen );
protected: // -------------------------------------------------------------
@@ -288,11 +288,11 @@ class SID_EXTERN SidTune
// Support for various file formats.
virtual bool PSID_fileSupport(const void* buffer, const uint_least32_t bufLen);
- virtual bool PSID_fileSupportSave(std::ofstream& toFile, const uint_least8_t* dataBuffer);
+ //virtual bool PSID_fileSupportSave(std::ofstream& toFile, const uint_least8_t* dataBuffer);
virtual bool SID_fileSupport(const void* dataBuffer, uint_least32_t dataBufLen,
const void* sidBuffer, uint_least32_t sidBufLen);
- virtual bool SID_fileSupportSave(std::ofstream& toFile);
+ //virtual bool SID_fileSupportSave(std::ofstream& toFile);
virtual bool MUS_fileSupport(Buffer_sidtt<const uint_least8_t>& musBufRef,
Buffer_sidtt<const uint_least8_t>& strBufRef);
diff --git a/plugins/sid/sidplay-libs/libsidplay/src/mos6510/cycle_based/mos6510c.h b/plugins/sid/sidplay-libs/libsidplay/src/mos6510/cycle_based/mos6510c.h
index 9a046d2e..93d222a3 100644
--- a/plugins/sid/sidplay-libs/libsidplay/src/mos6510/cycle_based/mos6510c.h
+++ b/plugins/sid/sidplay-libs/libsidplay/src/mos6510/cycle_based/mos6510c.h
@@ -71,11 +71,12 @@
#include "sidtypes.h"
#include "sidendian.h"
-
+#include <setjmp.h>
class MOS6510: public C64Environment, public Event
{
private:
+ jmp_buf jmp_env;
// External signals
bool aec; /* Address Controller, blocks all */
bool rdy; /* Bus Access, blocks reads */
@@ -293,9 +294,22 @@ public:
inline void MOS6510::clock (void)
{
int_least8_t i = cycleCount++;
- try {
+
+// C++ exception version
+// try {
+// (this->*procCycle[i]) ();
+// } catch (int_least8_t delta) {
+// cycleCount += delta;
+// m_blocked = true;
+// eventContext.cancel (this);
+// }
+
+ // longjmp version
+ int_least8_t delta = setjmp (jmp_env);
+ if (delta == 0) {
(this->*procCycle[i]) ();
- } catch (int_least8_t delta) {
+ }
+ else {
cycleCount += delta;
m_blocked = true;
eventContext.cancel (this);
diff --git a/plugins/sid/sidplay-libs/libsidplay/src/mos6510/cycle_based/mos6510c.i b/plugins/sid/sidplay-libs/libsidplay/src/mos6510/cycle_based/mos6510c.i
index 78d57ba6..22794e0f 100644
--- a/plugins/sid/sidplay-libs/libsidplay/src/mos6510/cycle_based/mos6510c.i
+++ b/plugins/sid/sidplay-libs/libsidplay/src/mos6510/cycle_based/mos6510c.i
@@ -168,10 +168,15 @@ const char _sidtune_CHRtab[256] = // CHR$ conversion table (0x01 = no output)
#define getFlagZ() (Register_z_Flag == 0)
#define getFlagC() (Register_c_Flag != 0)
+// c++ exception version
+//#define stealCycle() \
+// interrupts.delay++; \
+// throw((int_least8_t) -1);
+
+// longjmp version
#define stealCycle() \
interrupts.delay++; \
- throw((int_least8_t) -1);
-
+ longjmp (jmp_env, -1);
// Handle bus access signals
void MOS6510::aecSignal (bool state)
diff --git a/plugins/sid/sidplay-libs/libsidplay/src/sidtune/IconInfo.cpp b/plugins/sid/sidplay-libs/libsidplay/src/sidtune/IconInfo.cpp
index 30df20b4..03faf1b4 100644
--- a/plugins/sid/sidplay-libs/libsidplay/src/sidtune/IconInfo.cpp
+++ b/plugins/sid/sidplay-libs/libsidplay/src/sidtune/IconInfo.cpp
@@ -37,7 +37,6 @@
# include <new>
#endif
#include <string.h>
-#include <sstream>
// Amiga Workbench specific structures.
@@ -359,12 +358,13 @@ bool SidTune::INFO_fileSupport(const void* dataBuffer, uint_least32_t dataLength
// Now check all possible keywords.
if ( SidTuneTools::myStrNcaseCmp(cmpBuf,_sidtune_keyword_address) == 0 )
{
- std::string s (cmpBuf + strlen(_sidtune_keyword_address), toolLen - strlen(_sidtune_keyword_address));
- std::istringstream addrIn(s);
- info.loadAddr = (uint_least16_t)SidTuneTools::readHex( addrIn );
- info.initAddr = (uint_least16_t)SidTuneTools::readHex( addrIn );
- info.playAddr = (uint_least16_t)SidTuneTools::readHex( addrIn );
- if ( !addrIn )
+ const char *addrIn= cmpBuf + strlen(_sidtune_keyword_address);
+ int len = toolLen - strlen(_sidtune_keyword_address);
+ int pos = 0;
+ info.loadAddr = (uint_least16_t)SidTuneTools::readHex( addrIn, len, pos );
+ info.initAddr = (uint_least16_t)SidTuneTools::readHex( addrIn, len, pos );
+ info.playAddr = (uint_least16_t)SidTuneTools::readHex( addrIn, len, pos );
+ if ( pos >= len )
{
return false;
}
@@ -372,25 +372,27 @@ bool SidTune::INFO_fileSupport(const void* dataBuffer, uint_least32_t dataLength
}
else if ( SidTuneTools::myStrNcaseCmp(cmpBuf,_sidtune_keyword_songs) == 0 )
{
- std::string s ( cmpBuf + strlen(_sidtune_keyword_songs), toolLen - strlen(_sidtune_keyword_songs));
- std::istringstream numIn(s);
- if ( !numIn )
+ const char *numIn = cmpBuf + strlen(_sidtune_keyword_songs);
+ int len = toolLen - strlen(_sidtune_keyword_songs);
+ int pos = 0;
+ if ( !pos >= len )
{
return false;
}
- info.songs = (uint_least16_t)SidTuneTools::readDec( numIn );
- info.startSong = (uint_least16_t)SidTuneTools::readDec( numIn );
+ info.songs = (uint_least16_t)SidTuneTools::readDec( numIn, len, pos );
+ info.startSong = (uint_least16_t)SidTuneTools::readDec( numIn, len, pos );
hasSongs = true;
}
else if ( SidTuneTools::myStrNcaseCmp(cmpBuf,_sidtune_keyword_speed) == 0 )
{
- std::string s (cmpBuf + strlen(_sidtune_keyword_speed), toolLen - strlen(_sidtune_keyword_speed));
- std::istringstream speedIn (s);
- if ( !speedIn )
+ const char *speedIn = cmpBuf + strlen(_sidtune_keyword_speed);
+ int len = toolLen - strlen(_sidtune_keyword_speed);
+ int pos = 0;
+ if ( pos >= len )
{
return false;
}
- oldStyleSpeed = SidTuneTools::readHex(speedIn);
+ oldStyleSpeed = SidTuneTools::readHex(speedIn, len, pos);
hasSpeed = true;
}
else if ( SidTuneTools::myStrNcaseCmp(cmpBuf,_sidtune_keyword_name) == 0 )
diff --git a/plugins/sid/sidplay-libs/libsidplay/src/sidtune/InfoFile.cpp b/plugins/sid/sidplay-libs/libsidplay/src/sidtune/InfoFile.cpp
index 0c03b23c..6ddb77f5 100644
--- a/plugins/sid/sidplay-libs/libsidplay/src/sidtune/InfoFile.cpp
+++ b/plugins/sid/sidplay-libs/libsidplay/src/sidtune/InfoFile.cpp
@@ -23,9 +23,6 @@
#ifdef HAVE_EXCEPTIONS
# include <new>
#endif
-#include <iostream>
-#include <iomanip>
-#include <sstream>
#include <ctype.h>
#include <string.h>
@@ -135,35 +132,27 @@ bool SidTune::SID_fileSupport(const void* dataBuffer, uint_least32_t dataBufLen,
}
// Create whitespace eating (!) input string stream.
- std::string s (pParseBuf, restLen);
-
- std::istringstream parseStream (s);
- // A second one just for copying.
- std::istringstream parseCopyStream (s);
- if ( !parseStream || !parseCopyStream )
- {
- break;
- }
+ const char *s = pParseBuf;
+ int pos = 0;
+ int posCopy = 0;
// Now copy the next X characters except white-spaces.
for ( uint_least16_t i = 0; i < parseChunkLen; i++ )
{
- char c;
- parseCopyStream >> c;
- pParseChunk[i] = c;
+ pParseChunk[i] = s[i];
}
pParseChunk[parseChunkLen]=0;
// Now check for the possible keywords.
// ADDRESS
if ( SidTuneTools::myStrNcaseCmp( pParseChunk, keyword_address ) == 0 )
{
- SidTuneTools::skipToEqu( parseStream );
- info.loadAddr = (uint_least16_t)SidTuneTools::readHex( parseStream );
- if ( !parseStream )
+ SidTuneTools::skipToEqu( s, restLen, pos );
+ info.loadAddr = (uint_least16_t)SidTuneTools::readHex( s, restLen, pos );
+ if ( pos>=restLen )
break;
- info.initAddr = (uint_least16_t)SidTuneTools::readHex( parseStream );
- if ( !parseStream )
+ info.initAddr = (uint_least16_t)SidTuneTools::readHex( s, restLen, pos );
+ if ( pos>=restLen )
break;
- info.playAddr = (uint_least16_t)SidTuneTools::readHex( parseStream );
+ info.playAddr = (uint_least16_t)SidTuneTools::readHex( s, restLen, pos );
hasAddress = true;
}
// NAME
@@ -197,16 +186,16 @@ bool SidTune::SID_fileSupport(const void* dataBuffer, uint_least32_t dataBufLen,
// SONGS
else if ( SidTuneTools::myStrNcaseCmp( pParseChunk, keyword_songs ) == 0 )
{
- SidTuneTools::skipToEqu( parseStream );
- info.songs = (uint_least16_t)SidTuneTools::readDec( parseStream );
- info.startSong = (uint_least16_t)SidTuneTools::readDec( parseStream );
+ SidTuneTools::skipToEqu( s, restLen, pos );
+ info.songs = (uint_least16_t)SidTuneTools::readDec( s, restLen, pos );
+ info.startSong = (uint_least16_t)SidTuneTools::readDec( s, restLen, pos );
hasSongs = true;
}
// SPEED
else if ( SidTuneTools::myStrNcaseCmp( pParseChunk, keyword_speed ) == 0 )
{
- SidTuneTools::skipToEqu( parseStream );
- oldStyleSpeed = SidTuneTools::readHex(parseStream);
+ SidTuneTools::skipToEqu( s, restLen, pos );
+ oldStyleSpeed = SidTuneTools::readHex( s, restLen, pos );
hasSpeed = true;
}
// SIDSONG
@@ -217,10 +206,10 @@ bool SidTune::SID_fileSupport(const void* dataBuffer, uint_least32_t dataBufLen,
// RELOC
else if ( SidTuneTools::myStrNcaseCmp( pParseChunk, keyword_reloc ) == 0 )
{
- info.relocStartPage = (uint_least8_t)SidTuneTools::readHex( parseStream );
- if ( !parseStream )
+ info.relocStartPage = (uint_least8_t)SidTuneTools::readHex( s, restLen, pos );
+ if ( pos >= restLen )
break;
- info.relocPages = (uint_least8_t)SidTuneTools::readHex( parseStream );
+ info.relocPages = (uint_least8_t)SidTuneTools::readHex( s, restLen, pos );
}
// CLOCK
else if ( SidTuneTools::myStrNcaseCmp( pParseChunk, keyword_clock ) == 0 )
@@ -307,6 +296,7 @@ bool SidTune::SID_fileSupport(const void* dataBuffer, uint_least32_t dataBufLen,
}
+#if 0
bool SidTune::SID_fileSupportSave( std::ofstream& toFile )
{
toFile << keyword_id << std::endl
@@ -396,3 +386,4 @@ bool SidTune::SID_fileSupportSave( std::ofstream& toFile )
return true;
}
}
+#endif
diff --git a/plugins/sid/sidplay-libs/libsidplay/src/sidtune/PSID.cpp b/plugins/sid/sidplay-libs/libsidplay/src/sidtune/PSID.cpp
index 0cc96969..a6322c36 100644
--- a/plugins/sid/sidplay-libs/libsidplay/src/sidtune/PSID.cpp
+++ b/plugins/sid/sidplay-libs/libsidplay/src/sidtune/PSID.cpp
@@ -242,6 +242,7 @@ bool SidTune::PSID_fileSupport(const void* buffer, const uint_least32_t bufLen)
}
+#if 0
bool SidTune::PSID_fileSupportSave(std::ofstream& fMyOut, const uint_least8_t* dataBuffer)
{
psidHeader myHeader;
@@ -311,3 +312,4 @@ bool SidTune::PSID_fileSupportSave(std::ofstream& fMyOut, const uint_least8_t* d
else
return true;
}
+#endif
diff --git a/plugins/sid/sidplay-libs/libsidplay/src/sidtune/SidTune.cpp b/plugins/sid/sidplay-libs/libsidplay/src/sidtune/SidTune.cpp
index 29638775..4dfba1d7 100644
--- a/plugins/sid/sidplay-libs/libsidplay/src/sidtune/SidTune.cpp
+++ b/plugins/sid/sidplay-libs/libsidplay/src/sidtune/SidTune.cpp
@@ -24,12 +24,11 @@
#include "SidTuneTools.h"
#include "sidendian.h"
#include "PP20.h"
+#include <stdio.h>
#ifdef HAVE_EXCEPTIONS
# include <new>
#endif
-#include <iostream>
-#include <iomanip>
#include <string.h>
#include <limits.h>
@@ -100,6 +99,7 @@ inline void SidTune::setFileNameExtensions(const char **fileNameExt)
{
fileNameExtensions = ((fileNameExt!=0)?fileNameExt:defaultFileNameExt);
}
+#define SIDTUNE_NO_STDIN_LOADER
SidTune::SidTune(const char* fileName, const char **fileNameExt,
const bool separatorIsSlash)
@@ -252,39 +252,18 @@ bool SidTune::loadFile(const char* fileName, Buffer_sidtt<const uint_least8_t>&
Buffer_sidtt<uint_least8_t> fileBuf;
uint_least32_t fileLen = 0;
- // This sucks big time
- //openmode createAtrr = std::ios::in;
- std::_Ios_Openmode createAtrr = std::ios::in;
-#ifdef HAVE_IOS_NOCREATE
- createAtrr |= std::ios::nocreate;
-#endif
- // Open binary input file stream at end of file.
-#if defined(HAVE_IOS_BIN)
- createAtrr |= std::ios::bin;
-#else
- createAtrr |= std::ios::binary;
-#endif
+ FILE *fp = fopen (fileName, "rb");
- std::fstream myIn(fileName,createAtrr);
- // As a replacement for !is_open(), bad() and the NOT-operator don't seem
- // to work on all systems.
-#if defined(DONT_HAVE_IS_OPEN)
- if ( !myIn )
-#else
- if ( !myIn.is_open() )
-#endif
+ if (!fp)
{
info.statusString = SidTune::txt_cantOpenFile;
return false;
}
else
{
-#if defined(HAVE_SEEKG_OFFSET)
- fileLen = (myIn.seekg(0,std::ios::end)).offset();
-#else
- myIn.seekg(0,std::ios::end);
- fileLen = (uint_least32_t)myIn.tellg();
-#endif
+ fseek (fp, 0, SEEK_END);
+ fileLen = ftell (fp);
+ rewind (fp);
#ifdef HAVE_EXCEPTIONS
if ( !fileBuf.assign(new(std::nothrow) uint_least8_t[fileLen],fileLen) )
#else
@@ -294,19 +273,9 @@ bool SidTune::loadFile(const char* fileName, Buffer_sidtt<const uint_least8_t>&
info.statusString = SidTune::txt_notEnoughMemory;
return false;
}
- myIn.seekg(0,std::ios::beg);
uint_least32_t restFileLen = fileLen;
- // 16-bit compatible loading. Is this really necessary?
- while ( restFileLen > INT_MAX )
- {
- myIn.read((char*)fileBuf.get()+(fileLen-restFileLen),INT_MAX); // !cast!
- restFileLen -= INT_MAX;
- }
- if ( restFileLen > 0 )
- {
- myIn.read((char*)fileBuf.get()+(fileLen-restFileLen),restFileLen); // !cast!
- }
- if ( myIn.bad() )
+ int res = fread((char*)fileBuf.get()+(fileLen-restFileLen),1,restFileLen,fp);
+ if ( res != restFileLen )
{
info.statusString = SidTune::txt_cantLoadFile;
return false;
@@ -316,7 +285,7 @@ bool SidTune::loadFile(const char* fileName, Buffer_sidtt<const uint_least8_t>&
info.statusString = SidTune::txt_noErrors;
}
}
- myIn.close();
+ fclose(fp);
if ( fileLen==0 )
{
info.statusString = SidTune::txt_empty;
@@ -443,6 +412,7 @@ void SidTune::cleanup()
status = false;
}
+#define SIDTUNE_NO_STDIN_LOADER
#if !defined(SIDTUNE_NO_STDIN_LOADER)
void SidTune::getFromStdIn()
@@ -839,7 +809,8 @@ void SidTune::convertOldStyleSpeedToTables(uint_least32_t speed, int clock)
//
// File format conversion ---------------------------------------------------
//
-
+
+#if 0
bool SidTune::saveToOpenFile(std::ofstream& toFile, const uint_least8_t* buffer,
uint_least32_t bufLen )
{
@@ -984,6 +955,7 @@ bool SidTune::savePSIDfile( const char* fileName, bool overWriteFlag )
}
return success;
}
+#endif
bool SidTune::checkRealC64Info (uint_least32_t speed)
{
diff --git a/plugins/sid/sidplay-libs/libsidplay/src/sidtune/SidTuneTools.cpp b/plugins/sid/sidplay-libs/libsidplay/src/sidtune/SidTuneTools.cpp
index 450795b9..6a100062 100644
--- a/plugins/sid/sidplay-libs/libsidplay/src/sidtune/SidTuneTools.cpp
+++ b/plugins/sid/sidplay-libs/libsidplay/src/sidtune/SidTuneTools.cpp
@@ -101,15 +101,16 @@ char* SidTuneTools::fileExtOfPath(char* s)
// Parse input string stream. Read and convert a hexa-decimal number up
// to a ``,'' or ``:'' or ``\0'' or end of stream.
-uint_least32_t SidTuneTools::readHex( std::istringstream& hexin )
+uint_least32_t SidTuneTools::readHex( const char *s, int size, int &pos)
{
uint_least32_t hexLong = 0;
char c;
do
{
- hexin >> c;
- if ( !hexin )
+ if (pos >= size) {
break;
+ }
+ c = s[pos++];
if (( c != ',') && ( c != ':' ) && ( c != 0 ))
{
// machine independed to_upper
@@ -120,25 +121,27 @@ uint_least32_t SidTuneTools::readHex( std::istringstream& hexin )
}
else
{
- if ( c == 0 )
- hexin.putback(c);
+ if ( c == 0 ) {
+ pos--;
+ }
break;
}
- } while ( hexin );
+ } while ( pos < size );
return hexLong;
}
// Parse input string stream. Read and convert a decimal number up
// to a ``,'' or ``:'' or ``\0'' or end of stream.
-uint_least32_t SidTuneTools::readDec( std::istringstream& decin )
+uint_least32_t SidTuneTools::readDec( const char *s, int size, int &pos )
{
uint_least32_t hexLong = 0;
char c;
do
{
- decin >> c;
- if ( !decin )
+ if (pos >= size) {
break;
+ }
+ c = s[pos++];
if (( c != ',') && ( c != ':' ) && ( c != 0 ))
{
c &= 0x0f;
@@ -147,11 +150,12 @@ uint_least32_t SidTuneTools::readDec( std::istringstream& decin )
}
else
{
- if ( c == 0 )
- decin.putback(c);
+ if ( c == 0 ) {
+ pos--;
+ }
break;
}
- } while ( decin );
+ } while ( pos < size);
return hexLong;
}
@@ -187,12 +191,15 @@ const char* SidTuneTools::returnNextLine(const char* s)
}
// Skip any characters in an input string stream up to '='.
-void SidTuneTools::skipToEqu( std::istringstream& parseStream )
+void SidTuneTools::skipToEqu( const char *s, int size, int &pos )
{
char c;
do
{
- parseStream >> c;
+ if (pos >= size) {
+ break;
+ }
+ c = s[pos++];
}
while ( c != '=' );
}
diff --git a/plugins/sid/sidplay-libs/libsidplay/src/sidtune/SidTuneTools.h b/plugins/sid/sidplay-libs/libsidplay/src/sidtune/SidTuneTools.h
index 5a06046b..7c3fabfa 100644
--- a/plugins/sid/sidplay-libs/libsidplay/src/sidtune/SidTuneTools.h
+++ b/plugins/sid/sidplay-libs/libsidplay/src/sidtune/SidTuneTools.h
@@ -26,8 +26,6 @@
#include <string.h>
-#include <sstream>
-
#define MYSTRICMP stricmp
#if defined(HAVE_STRCASECMP)
#undef MYSTRICMP
@@ -66,18 +64,17 @@ class SidTuneTools
// Parse input string stream. Read and convert a hexa-decimal number up
// to a ``,'' or ``:'' or ``\0'' or end of stream.
- static uint_least32_t readHex(std::istringstream& parseStream);
+ static uint_least32_t readHex(const char *parseStream, int size, int &pos);
// Parse input string stream. Read and convert a decimal number up
// to a ``,'' or ``:'' or ``\0'' or end of stream.
- static uint_least32_t readDec(std::istringstream& parseStream);
-
+ static uint_least32_t readDec(const char *parseStream, int size, int &pos);
// Search terminated string for next newline sequence.
// Skip it and return pointer to start of next line.
static const char* returnNextLine(const char* pBuffer);
// Skip any characters in an input string stream up to '='.
- static void skipToEqu(std::istringstream& parseStream);
+ static void skipToEqu(const char *parseStream, int size, int &pos);
// Start at first character behind '=' and copy rest of string.
static void copyStringValueToEOL(const char* pSourceStr, char* pDestStr, int destMaxLen);
diff --git a/plugins/sid/sidplay-libs/resid/envelope.cc b/plugins/sid/sidplay-libs/resid/envelope.cpp
index a4bbd511..a4bbd511 100644
--- a/plugins/sid/sidplay-libs/resid/envelope.cc
+++ b/plugins/sid/sidplay-libs/resid/envelope.cpp
diff --git a/plugins/sid/sidplay-libs/resid/extfilt.cc b/plugins/sid/sidplay-libs/resid/extfilt.cpp
index 461cdaf7..461cdaf7 100644
--- a/plugins/sid/sidplay-libs/resid/extfilt.cc
+++ b/plugins/sid/sidplay-libs/resid/extfilt.cpp
diff --git a/plugins/sid/sidplay-libs/resid/filter.cc b/plugins/sid/sidplay-libs/resid/filter.cpp
index 9ca793e0..9ca793e0 100644
--- a/plugins/sid/sidplay-libs/resid/filter.cc
+++ b/plugins/sid/sidplay-libs/resid/filter.cpp
diff --git a/plugins/sid/sidplay-libs/resid/pot.cc b/plugins/sid/sidplay-libs/resid/pot.cpp
index 805f9a7c..805f9a7c 100644
--- a/plugins/sid/sidplay-libs/resid/pot.cc
+++ b/plugins/sid/sidplay-libs/resid/pot.cpp
diff --git a/plugins/sid/sidplay-libs/resid/sid.cc b/plugins/sid/sidplay-libs/resid/sid.cpp
index f3cd02a3..f3cd02a3 100644
--- a/plugins/sid/sidplay-libs/resid/sid.cc
+++ b/plugins/sid/sidplay-libs/resid/sid.cpp
diff --git a/plugins/sid/sidplay-libs/resid/version.cc b/plugins/sid/sidplay-libs/resid/version.cpp
index ebb0e607..ebb0e607 100644
--- a/plugins/sid/sidplay-libs/resid/version.cc
+++ b/plugins/sid/sidplay-libs/resid/version.cpp
diff --git a/plugins/sid/sidplay-libs/resid/voice.cc b/plugins/sid/sidplay-libs/resid/voice.cpp
index 049e0530..049e0530 100644
--- a/plugins/sid/sidplay-libs/resid/voice.cc
+++ b/plugins/sid/sidplay-libs/resid/voice.cpp
diff --git a/plugins/sid/sidplay-libs/resid/wave.cc b/plugins/sid/sidplay-libs/resid/wave.cpp
index 6f5ec5dd..6f5ec5dd 100644
--- a/plugins/sid/sidplay-libs/resid/wave.cc
+++ b/plugins/sid/sidplay-libs/resid/wave.cpp
diff --git a/plugins/sid/sidplay-libs/resid/wave6581_PST.cc b/plugins/sid/sidplay-libs/resid/wave6581_PST.cpp
index 37b54734..37b54734 100644
--- a/plugins/sid/sidplay-libs/resid/wave6581_PST.cc
+++ b/plugins/sid/sidplay-libs/resid/wave6581_PST.cpp
diff --git a/plugins/sid/sidplay-libs/resid/wave6581_PS_.cc b/plugins/sid/sidplay-libs/resid/wave6581_PS_.cpp
index 9304df8c..9304df8c 100644
--- a/plugins/sid/sidplay-libs/resid/wave6581_PS_.cc
+++ b/plugins/sid/sidplay-libs/resid/wave6581_PS_.cpp
diff --git a/plugins/sid/sidplay-libs/resid/wave6581_P_T.cc b/plugins/sid/sidplay-libs/resid/wave6581_P_T.cpp
index 35a246af..35a246af 100644
--- a/plugins/sid/sidplay-libs/resid/wave6581_P_T.cc
+++ b/plugins/sid/sidplay-libs/resid/wave6581_P_T.cpp
diff --git a/plugins/sid/sidplay-libs/resid/wave6581__ST.cc b/plugins/sid/sidplay-libs/resid/wave6581__ST.cpp
index 55ec36b7..55ec36b7 100644
--- a/plugins/sid/sidplay-libs/resid/wave6581__ST.cc
+++ b/plugins/sid/sidplay-libs/resid/wave6581__ST.cpp
diff --git a/plugins/sid/sidplay-libs/resid/wave8580_PST.cc b/plugins/sid/sidplay-libs/resid/wave8580_PST.cpp
index 5141f0f7..5141f0f7 100644
--- a/plugins/sid/sidplay-libs/resid/wave8580_PST.cc
+++ b/plugins/sid/sidplay-libs/resid/wave8580_PST.cpp
diff --git a/plugins/sid/sidplay-libs/resid/wave8580_PS_.cc b/plugins/sid/sidplay-libs/resid/wave8580_PS_.cpp
index 15de9f9a..15de9f9a 100644
--- a/plugins/sid/sidplay-libs/resid/wave8580_PS_.cc
+++ b/plugins/sid/sidplay-libs/resid/wave8580_PS_.cpp
diff --git a/plugins/sid/sidplay-libs/resid/wave8580_P_T.cc b/plugins/sid/sidplay-libs/resid/wave8580_P_T.cpp
index f3a3d835..f3a3d835 100644
--- a/plugins/sid/sidplay-libs/resid/wave8580_P_T.cc
+++ b/plugins/sid/sidplay-libs/resid/wave8580_P_T.cpp
diff --git a/plugins/sid/sidplay-libs/resid/wave8580__ST.cc b/plugins/sid/sidplay-libs/resid/wave8580__ST.cpp
index 08e7c5a8..08e7c5a8 100644
--- a/plugins/sid/sidplay-libs/resid/wave8580__ST.cc
+++ b/plugins/sid/sidplay-libs/resid/wave8580__ST.cpp
diff --git a/plugins/vtx/vtx.c b/plugins/vtx/vtx.c
index 9bb4efa7..3e4ed6b9 100644
--- a/plugins/vtx/vtx.c
+++ b/plugins/vtx/vtx.c
@@ -100,7 +100,7 @@ vtx_init (DB_fileinfo_t *_info, DB_playItem_t *it) {
ayemu_set_chip_freq (&info->ay, info->decoder->chipFreq);
ayemu_set_stereo (&info->ay, info->decoder->stereo, NULL);
- int samplerate = deadbeef->conf_get_int ("synth.samplerate", 48000);
+ int samplerate = deadbeef->conf_get_int ("synth.samplerate", 44100);
ayemu_set_sound_format (&info->ay, samplerate, deadbeef->get_output ()->channels (), deadbeef->get_output ()->bitspersample ());
diff --git a/plugins/wavpack/wavpack.c b/plugins/wavpack/wavpack.c
index 38621383..fb11bb5b 100644
--- a/plugins/wavpack/wavpack.c
+++ b/plugins/wavpack/wavpack.c
@@ -18,7 +18,11 @@
*/
#include <string.h>
+#ifdef TINYWV
+#include <wavpack.h>
+#else
#include <wavpack/wavpack.h>
+#endif
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
@@ -35,12 +39,20 @@ static DB_functions_t *deadbeef;
typedef struct {
DB_fileinfo_t info;
- DB_FILE *file, *c_file;
+ DB_FILE *file;
+#ifndef TINYWV
+ DB_FILE *c_file;
+#endif
WavpackContext *ctx;
int startsample;
int endsample;
} wvctx_t;
+#ifdef TINYWV
+int32_t wv_read_stream(void *buf, int32_t sz, void *file_handle) {
+ return deadbeef->fread (buf, 1, sz, (DB_FILE *)file_handle);
+}
+#else
int32_t wv_read_bytes(void *id, void *data, int32_t bcount) {
// trace ("wv_read_bytes\n");
return deadbeef->fread (data, 1, bcount, id);
@@ -91,6 +103,7 @@ static WavpackStreamReader wsr = {
.can_seek = wv_can_seek,
.write_bytes = wv_write_bytes
};
+#endif
static DB_fileinfo_t *
wv_open (void) {
@@ -107,6 +120,7 @@ wv_init (DB_fileinfo_t *_info, DB_playItem_t *it) {
return -1;
}
+#ifndef TINYWV
char *c_fname = alloca (strlen (it->fname) + 2);
if (c_fname) {
strcpy (c_fname, it->fname);
@@ -116,9 +130,14 @@ wv_init (DB_fileinfo_t *_info, DB_playItem_t *it) {
else {
fprintf (stderr, "wavpack warning: failed to alloc memory for correction file name\n");
}
+#endif
char error[80];
+#ifdef TINYWV
+ info->ctx = WavpackOpenFileInput (wv_read_stream, info->file, error);
+#else
info->ctx = WavpackOpenFileInputEx (&wsr, info->file, info->c_file, error, OPEN_2CH_MAX | OPEN_NORMALIZE, 0);
+#endif
if (!info->ctx) {
fprintf (stderr, "wavpack error: %s\n", error);
return -1;
@@ -150,10 +169,12 @@ wv_free (DB_fileinfo_t *_info) {
deadbeef->fclose (info->file);
info->file = NULL;
}
+#ifndef TINYWV
if (info->c_file) {
deadbeef->fclose (info->c_file);
info->c_file = NULL;
}
+#endif
if (info->ctx) {
WavpackCloseFile (info->ctx);
info->ctx = NULL;
@@ -210,7 +231,9 @@ wv_read_int16 (DB_fileinfo_t *_info, char *bytes, int size) {
}
_info->readpos = (float)(WavpackGetSampleIndex (info->ctx)-info->startsample)/WavpackGetSampleRate (info->ctx);
+#ifndef TINYWV
deadbeef->streamer_set_bitrate (WavpackGetInstantBitrate (info->ctx) / 1000);
+#endif
return size;
}
@@ -247,15 +270,19 @@ wv_read_float32 (DB_fileinfo_t *_info, char *bytes, int size) {
}
}
_info->readpos = (float)(WavpackGetSampleIndex (info->ctx)-info->startsample)/WavpackGetSampleRate (info->ctx);
+#ifndef TINYWV
deadbeef->streamer_set_bitrate (WavpackGetInstantBitrate (info->ctx) / 1000);
+#endif
return size;
}
static int
wv_seek_sample (DB_fileinfo_t *_info, int sample) {
+#ifndef TINYWV
wvctx_t *info = (wvctx_t *)_info;
WavpackSeekSample (info->ctx, sample + info->startsample);
_info->readpos = (float)(WavpackGetSampleIndex (info->ctx) - info->startsample) / WavpackGetSampleRate (info->ctx);
+#endif
return 0;
}
@@ -273,7 +300,11 @@ wv_insert (DB_playItem_t *after, const char *fname) {
return NULL;
}
char error[80];
+#ifdef TINYWV
+ WavpackContext *ctx = WavpackOpenFileInput (wv_read_stream, fp, error);
+#else
WavpackContext *ctx = WavpackOpenFileInputEx (&wsr, fp, NULL, error, 0, 0);
+#endif
if (!ctx) {
fprintf (stderr, "wavpack error: %s\n", error);
deadbeef->fclose (fp);
diff --git a/threading_pthread.c b/threading_pthread.c
index 00712266..66db5844 100644
--- a/threading_pthread.c
+++ b/threading_pthread.c
@@ -40,7 +40,7 @@ thread_start (void (*fn)(void *ctx), void *ctx) {
s = pthread_attr_destroy (&attr);
if (s != 0) {
fprintf (stderr, "pthread_attr_destroy failed: %s\n", strerror (s));
- pthread_cancel (tid);
+// pthread_cancel (tid); // missing on android
return 0;
}
return tid;