Skip to content

Commit

Permalink
Restore compatibility with old lib version
Browse files Browse the repository at this point in the history
  • Loading branch information
drfiemost committed Feb 11, 2021
1 parent 112ffff commit 74e8f49
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 12 deletions.
8 changes: 5 additions & 3 deletions src/IniConfig.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* This file is part of sidplayfp, a console SID player.
*
* Copyright 2011-2020 Leandro Nini
* Copyright 2011-2021 Leandro Nini
* Copyright 2000-2001 Simon White
*
* This program is free software; you can redistribute it and/or modify
Expand Down Expand Up @@ -110,7 +110,9 @@ void IniConfig::clear()
emulation_s.modelForced = false;
emulation_s.sidModel = SidConfig::MOS6581;
emulation_s.forceModel = false;
#if LIBSIDPLAYFP_VERSION_MAJ > 1
emulation_s.ciaModel = SidConfig::MOS6526;
#endif
emulation_s.filter = true;
emulation_s.engine.clear();

Expand Down Expand Up @@ -380,7 +382,7 @@ void IniConfig::readEmulation(iniHandler &ini)

readBool(ini, TEXT("ForceC64Model"), emulation_s.modelForced);
readBool(ini, TEXT("DigiBoost"), emulation_s.digiboost);

#if LIBSIDPLAYFP_VERSION_MAJ > 1
{
SID_STRING str = readString(ini, TEXT("CiaModel"));
if (!str.empty())
Expand All @@ -391,7 +393,7 @@ void IniConfig::readEmulation(iniHandler &ini)
emulation_s.ciaModel = SidConfig::MOS8521;
}
}

#endif
{
SID_STRING str = readString(ini, TEXT("SidModel"));
if (!str.empty())
Expand Down
4 changes: 3 additions & 1 deletion src/IniConfig.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* This file is part of sidplayfp, a console SID player.
*
* Copyright 2011-2019 Leandro Nini
* Copyright 2011-2021 Leandro Nini
* Copyright 2000 Simon White
*
* This program is free software; you can redistribute it and/or modify
Expand Down Expand Up @@ -71,7 +71,9 @@ class IniConfig
bool modelForced;
SidConfig::sid_model_t sidModel;
bool forceModel;
#if LIBSIDPLAYFP_VERSION_MAJ > 1
SidConfig::cia_model_t ciaModel;
#endif
bool digiboost;
bool filter;
double bias;
Expand Down
8 changes: 5 additions & 3 deletions src/args.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* This file is part of sidplayfp, a console SID player.
*
* Copyright 2011-2020 Leandro Nini
* Copyright 2011-2021 Leandro Nini
* Copyright 2000-2001 Simon White
*
* This program is free software; you can redistribute it and/or modify
Expand Down Expand Up @@ -312,11 +312,12 @@ int ConsolePlayer::args(int argc, const char *argv[])
{
m_engCfg.defaultSidModel = SidConfig::MOS8580;
}
#if LIBSIDPLAYFP_VERSION_MAJ > 1
else if (strcmp (&argv[i][1], "-digiboost") == 0)
{
m_engCfg.digiBoost = true;
}

#endif
// Video/Verbose Options
else if (strcmp (&argv[i][1], "vnf") == 0)
{
Expand Down Expand Up @@ -612,8 +613,9 @@ void ConsolePlayer::displayArgs (const char *arg)

<< " -m<o|n>[f] set SID new/old chip model (default: old)" << endl
<< " Use 'f' to force the model" << endl
#if LIBSIDPLAYFP_VERSION_MAJ > 1
<< " --digiboost Enable digiboost for 8580 model" << endl

#endif
<< " -r[i|r][f] set resampling method (default: resample interpolate)" << endl
<< " Use 'f' to enable fast resampling (only for reSID)" << endl

Expand Down
6 changes: 3 additions & 3 deletions src/menu.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* This file is part of sidplayfp, a console SID player.
*
* Copyright 2011-2019 Leandro Nini
* Copyright 2011-2021 Leandro Nini
* Copyright 2000-2001 Simon White
*
* This program is free software; you can redistribute it and/or modify
Expand Down Expand Up @@ -351,13 +351,13 @@ void ConsolePlayer::menu ()
cerr << " SID Filter : ";
consoleColour (white, false);
cerr << (m_filter.enabled ? "Yes" : "No") << endl;

#if LIBSIDPLAYFP_VERSION_MAJ > 1
consoleTable (tableMiddle);
consoleColour (yellow, true);
cerr << " DigiBoost : ";
consoleColour (white, false);
cerr << (m_engCfg.digiBoost ? "Yes" : "No") << endl;

#endif
consoleTable (tableMiddle);
consoleColour (yellow, true);
cerr << " SID Model : ";
Expand Down
17 changes: 15 additions & 2 deletions src/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,11 @@ bool ConsolePlayer::open (void)
// so try the songlength database or keep the default
if (!m_timer.valid)
{
#if LIBSIDPLAYFP_VERSION_MAJ > 1
const int_least32_t length = newSonglengthDB ? m_database.lengthMs(m_tune) : (m_database.length(m_tune) * 1000);
#else
const int_least32_t length = m_database.length(m_tune) * 1000;
#endif
if (length > 0)
m_timer.length = length;
}
Expand Down Expand Up @@ -717,9 +721,13 @@ void ConsolePlayer::stop ()
// External Timer Event
void ConsolePlayer::updateDisplay()
{
#if LIBSIDPLAYFP_VERSION_MAJ > 1
const uint_least32_t milliseconds = m_engine.timeMs();
const uint_least32_t seconds = milliseconds / 1000;

#else
const uint_least32_t seconds = m_engine.time();
const uint_least32_t milliseconds = seconds * 1000;
#endif
if (!m_quietLevel && (seconds != (m_timer.current / 1000)))
{
cerr << "\b\b\b\b\b" << std::setw(2) << std::setfill('0')
Expand Down Expand Up @@ -791,7 +799,12 @@ void ConsolePlayer::decodeKeys ()
if (!m_track.single)
{ // Only select previous song if less than timeout
// else restart current song
if ((m_engine.timeMs()) < SID2_PREV_SONG_TIMEOUT)
#if LIBSIDPLAYFP_VERSION_MAJ > 1
const uint_least32_t milliseconds = m_engine.timeMs();
#else
const uint_least32_t milliseconds = m_engine.time() * 1000;
#endif
if (milliseconds < SID2_PREV_SONG_TIMEOUT)
{
m_track.selected--;
if (m_track.selected < 1)
Expand Down

0 comments on commit 74e8f49

Please sign in to comment.