# HG changeset patch # User Matti Hamalainen # Date 1169696764 0 # Node ID 6963982fcbb678f5b82ce2ab9e1805ff68dc4bbe # Parent 9dafc55c4270067e6803cf3ee9c87a8840309e82 New songinfo system. diff -r 9dafc55c4270 -r 6963982fcbb6 src/xs_sidplay.h --- a/src/xs_sidplay.h Thu Jan 25 03:46:02 2007 +0000 +++ b/src/xs_sidplay.h Thu Jan 25 03:46:04 2007 +0000 @@ -29,7 +29,7 @@ tuneInfo.songs, tuneInfo.startSong, tuneInfo.infoString[0], tuneInfo.infoString[1], tuneInfo.infoString[2], tuneInfo.loadAddr, tuneInfo.initAddr, tuneInfo.playAddr, - tuneInfo.dataFileLen, tuneInfo.formatString, -1, -1, -1); + tuneInfo.dataFileLen, tuneInfo.formatString, -1); delete testTune; @@ -39,36 +39,63 @@ gboolean TFUNCTION2(t_xs_status *myStatus) { - TTUNEINFO tuneInfo; -#ifdef _XS_SIDPLAY1_H - t_xs_sidplay1 *myEngine; -#endif -#ifdef _XS_SIDPLAY2_H - t_xs_sidplay2 *myEngine; -#endif + TTUNEINFO myInfo; + TTUNE *myTune; + TENGINE *myEngine; + t_xs_tuneinfo *i; + + /* Check if we have required structures initialized */ + if (!myStatus || !myStatus->tuneInfo || !myStatus->sidEngine) + return FALSE; - if (!myStatus || !myStatus->tuneInfo) + myEngine = (TENGINE *) myStatus->sidEngine; + myTune = myEngine->currTune; + if (!myTune) return FALSE; - /* Get general tune information */ + /* Get currently playing tune information */ #ifdef _XS_SIDPLAY1_H - testTune->getInfo(tuneInfo); + myTune->getInfo(myInfo); #endif #ifdef _XS_SIDPLAY2_H - tuneInfo = testTune->getInfo(); + myInfo = myTune->getInfo(); #endif - if (!tuneInfo) - return FALSE; - - - /* Allocate tuneinfo structure */ - pResult = xs_tuneinfo_new(->pcFilename, - tuneInfo.songs, tuneInfo.startSong, - tuneInfo.infoString[0], tuneInfo.infoString[1], tuneInfo.infoString[2], - tuneInfo.loadAddr, tuneInfo.initAddr, tuneInfo.playAddr, - tuneInfo.dataFileLen, tuneInfo.formatString, - tuneInfo.sidModel, tuneInfo.songSpeed, tuneInfo.clockSpeed); + /* Here we assume that libSIDPlay[12] headers define SIDTUNE_SIDMODEL_* + * similarly to our enums in xs_config.h ... + */ + i = myStatus->tuneInfo; + i->sidModel = myInfo.sidModel; + + if ((myStatus->currSong >= 1) && (myStatus->currSong < i->nsubTunes)) { + t_xs_subtuneinfo *t = &(i->subTunes[myStatus->currSong - 1]); + + switch (myInfo.songSpeed) { + case SIDTUNE_SPEED_VBI: + switch (myInfo.clockSpeed) { + case SIDTUNE_CLOCK_PAL: + t->tuneSpeed = 50; + break; + + case SIDTUNE_CLOCK_NTSC: + t->tuneSpeed = 60; + break; + + default: + t->tuneSpeed = -1; + break; + } + break; + + case SIDTUNE_SPEED_CIA_1A: + t->tuneSpeed = 60; + break; + + default: + t->tuneSpeed = -1; + break; + } + } return TRUE; }