Libretro: Fixed long compilation/linking times

This commit is contained in:
Sour 2018-12-31 09:40:38 -05:00
parent 1606d0c5f6
commit a86bfa7636
4 changed files with 15580 additions and 15559 deletions

View file

@ -62,24 +62,29 @@ void GameDatabase::LoadGameDb(vector<string> data)
MessageManager::Log("[DB] Initialized - " + std::to_string(_gameDatabase.size()) + " games in DB");
}
void GameDatabase::LoadGameDb(std::istream &db)
{
vector<string> dbData;
while(db.good()) {
string lineContent;
std::getline(db, lineContent);
if(lineContent[lineContent.size() - 1] == '\r') {
lineContent = lineContent.substr(0, lineContent.size() - 1);
}
if(lineContent.empty() || lineContent[0] == '#') {
continue;
}
dbData.push_back(lineContent);
}
LoadGameDb(dbData);
}
void GameDatabase::InitDatabase()
{
if(_gameDatabase.size() == 0) {
string dbPath = FolderUtilities::CombinePath(FolderUtilities::GetHomeFolder(), "MesenDB.txt");
ifstream db(dbPath, ios::in | ios::binary);
vector<string> dbData;
while(db.good()) {
string lineContent;
std::getline(db, lineContent);
if(lineContent[lineContent.size() - 1] == '\r') {
lineContent = lineContent.substr(0, lineContent.size() - 1);
}
if(lineContent.empty() || lineContent[0] == '#') {
continue;
}
dbData.push_back(lineContent);
}
LoadGameDb(dbData);
LoadGameDb(db);
}
}

View file

@ -20,9 +20,10 @@ private:
static void InitDatabase();
static void UpdateRomData(GameInfo &info, RomData &romData);
static void LoadGameDb(vector<string> data);
public:
static void LoadGameDb(vector<string> data);
static void LoadGameDb(std::istream & db);
static void SetGameDatabaseState(bool enabled);
static bool IsEnabled();

File diff suppressed because it is too large Load diff

View file

@ -46,10 +46,8 @@ static int32_t _saveStateSize = -1;
static struct retro_memory_descriptor _descriptors[3];
static struct retro_memory_map _memoryMap;
//Include game database as an array of strings (need an automated way to generate the include file)
static vector<string> gameDb = {
//Include game database as a byte array (representing the MesenDB.txt file)
#include "MesenDB.inc"
};
static std::shared_ptr<Console> _console;
static std::unique_ptr<LibretroRenderer> _renderer;
@ -111,8 +109,6 @@ extern "C" {
logCallback = nullptr;
}
GameDatabase::LoadGameDb(gameDb);
_console.reset(new Console());
_console->Init();
@ -121,6 +117,10 @@ extern "C" {
_keyManager.reset(new LibretroKeyManager(_console));
_messageManager.reset(new LibretroMessageManager(logCallback, retroEnv));
std::stringstream databaseData;
databaseData.write((const char*)MesenDatabase, sizeof(MesenDatabase));
GameDatabase::LoadGameDb(databaseData);
_console->GetSettings()->SetFlags(EmulationFlags::FdsAutoLoadDisk);
_console->GetSettings()->SetFlags(EmulationFlags::AutoConfigureInput);
_console->GetSettings()->SetSampleRate(96000);