diff --git a/src/common/repository/sqlite/SqliteDatabase.cxx b/src/common/repository/sqlite/SqliteDatabase.cxx index ecc8e3f8c..c30964c34 100644 --- a/src/common/repository/sqlite/SqliteDatabase.cxx +++ b/src/common/repository/sqlite/SqliteDatabase.cxx @@ -75,10 +75,22 @@ void SqliteDatabase::initialize() throw SqliteError("unable to initialize sqlite DB for unknown reason"); }; + Logger::log("successfully opened " + myDatabaseFile, 2); + exec("PRAGMA journal_mode=WAL"); - if (sqlite3_wal_checkpoint_v2(myHandle, nullptr, SQLITE_CHECKPOINT_TRUNCATE, nullptr, nullptr) != SQLITE_OK) - throw SqliteError(sqlite3_errmsg(myHandle)); + switch (sqlite3_wal_checkpoint_v2(myHandle, nullptr, SQLITE_CHECKPOINT_TRUNCATE, nullptr, nullptr)) { + case SQLITE_OK: + break; + + case SQLITE_MISUSE: + Logger::log("failed to checkpoint WAL on " + myDatabaseFile + " - WAL probably unavailable", 1); + break; + + default: + Logger::log("failed to checkpoint WAL on " + myDatabaseFile + " : " + sqlite3_errmsg(myHandle), 1); + break; + } } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/emucore/OSystem.cxx b/src/emucore/OSystem.cxx index 22224f867..3841cd32c 100644 --- a/src/emucore/OSystem.cxx +++ b/src/emucore/OSystem.cxx @@ -77,6 +77,7 @@ namespace { OSystem::OSystem() : myLauncherUsed(false), myQuitLoop(false), + mySettingsLoaded(false), myFpsMeter(FPS_METER_QUEUE_SIZE) { // Get built-in features @@ -224,6 +225,7 @@ void OSystem::loadConfig(const Settings::Options& options) Logger::log("Loading config options ...", 2); mySettings->load(options); + mySettingsLoaded = true; myPropSet->load(myPropertiesFile); } @@ -492,7 +494,7 @@ void OSystem::logMessage(const string& message, uInt8 level) cout << message << endl << std::flush; myLogMessages += message + "\n"; } - else if(level <= uInt8(mySettings->getInt("loglevel"))) + else if(level <= uInt8(mySettings->getInt("loglevel")) || !mySettingsLoaded) { if(mySettings->getBool("logtoconsole")) cout << message << endl << std::flush; diff --git a/src/emucore/OSystem.hxx b/src/emucore/OSystem.hxx index 8dd18e909..46a750ec0 100644 --- a/src/emucore/OSystem.hxx +++ b/src/emucore/OSystem.hxx @@ -537,6 +537,8 @@ class OSystem string myDefaultSaveDir; string myDefaultLoadDir; + bool mySettingsLoaded; + string myCheatFile; string myConfigFile; string myPaletteFile;