# HG changeset patch # User Matti Hamalainen # Date 1211445157 -10800 # Node ID ca594ca1056f03ffdb4d0a6fd6fcafa7fbb8b258 # Parent fd81a16434edbd6d237df70d7ef27fdfd44aa7be COM API support works now. diff -r fd81a16434ed -r ca594ca1056f src/xs_sidplay2.cc --- a/src/xs_sidplay2.cc Thu May 22 10:54:25 2008 +0300 +++ b/src/xs_sidplay2.cc Thu May 22 11:32:37 2008 +0300 @@ -35,7 +35,8 @@ #endif -typedef struct { +class xs_sidplay2_t { +public: #ifdef HAVE_SIDPLAY2_COMI SidIPtr currEng; SidLazyIPtr currBuilder; @@ -47,7 +48,10 @@ SidTune *currTune; guint8 *buf; size_t bufSize; -} xs_sidplay2_t; + + xs_sidplay2_t(void); + virtual ~xs_sidplay2_t(void) { ; } +}; #ifdef HAVE_RESID_BUILDER @@ -58,6 +62,20 @@ #endif +xs_sidplay2_t::xs_sidplay2_t(void) +#ifdef HAVE_SIDPLAY2_COMI +:currEng(sidplay2::create()) +#else +:currEng(NULL) +#endif +{ + buf = NULL; + bufSize = 0; + currTune = NULL; + currBuilder = NULL; +} + + /* We need to 'export' all this pseudo-C++ crap */ extern "C" { @@ -101,14 +119,12 @@ assert(myStatus); /* Allocate internal structures */ - myEngine = (xs_sidplay2_t *) g_malloc0(sizeof(xs_sidplay2_t)); + myEngine = new xs_sidplay2_t(); myStatus->sidEngine = myEngine; if (!myEngine) return FALSE; /* Initialize the engine */ -#ifdef HAVE_SIDPLAY2_COMI -// myEngine->currEng(); -#else +#ifndef HAVE_SIDPLAY2_COMI myEngine->currEng = new sidplay2; #endif if (!myEngine->currEng) { @@ -423,7 +439,7 @@ xs_sidplay2_delete(myStatus); - g_free(myEngine); + delete myEngine; myStatus->sidEngine = NULL; }