Convert ESP to Recorder
This commit is contained in:
@@ -108,14 +108,35 @@ namespace file
|
||||
}
|
||||
}
|
||||
|
||||
inline const char *resolveFilename(int simVersion) const
|
||||
{
|
||||
switch (simVersion) {
|
||||
case FSX_VERSION:
|
||||
return BASE_DIRECTORY FSX_PREFIX SIMDATABASE;
|
||||
case FSXSE_VERSION:
|
||||
return BASE_DIRECTORY FSXSE_PREFIX SIMDATABASE;
|
||||
case P3D3_VERSION:
|
||||
return BASE_DIRECTORY P3D3_PREFIX SIMDATABASE;
|
||||
case P3D4_VERSION:
|
||||
return BASE_DIRECTORY P3D4_PREFIX SIMDATABASE;
|
||||
case P3D5_VERSION:
|
||||
return BASE_DIRECTORY P3D5_PREFIX SIMDATABASE;
|
||||
case MSFS_VERSION:
|
||||
return "NONE";
|
||||
default:
|
||||
return BASE_DIRECTORY SIMDATABASE;
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
inline SimDatabase(int simVersion,
|
||||
const char *hash,
|
||||
std::shared_ptr<config::Config> &configuration,
|
||||
std::function<void(const std::string)> toLog)
|
||||
{
|
||||
if (strcmp(configuration->getScenery().c_str(), hash) != 0 ||
|
||||
!utilities::fileExists(BASE_DIRECTORY SIMDATABASE)) {
|
||||
if (strcmp(configuration->getScenery(simVersion).c_str(), hash) !=
|
||||
0 ||
|
||||
!utilities::fileExists(resolveFilename(simVersion))) {
|
||||
#ifdef XP
|
||||
scan(simVersion < 12000 ? XPLANE11_BASE_SCENERY
|
||||
: XPLANE12_BASE_SCENERY,
|
||||
@@ -129,52 +150,16 @@ namespace file
|
||||
BASE_DIRECTORY "db_log.txt",
|
||||
airports);
|
||||
#endif
|
||||
configuration->updateScenery(hash);
|
||||
#ifdef XP
|
||||
this->toFile(SIMDATABASE);
|
||||
#endif
|
||||
configuration->updateScenery(simVersion, hash);
|
||||
|
||||
#ifndef MSFS
|
||||
switch (simVersion) {
|
||||
case FSX_VERSION:
|
||||
this->toFile(FSX_PREFIX SIMDATABASE);
|
||||
break;
|
||||
case FSXSE_VERSION:
|
||||
this->toFile(FSXSE_PREFIX SIMDATABASE);
|
||||
break;
|
||||
case P3D3_VERSION:
|
||||
this->toFile(P3D3_PREFIX SIMDATABASE);
|
||||
break;
|
||||
case P3D4_VERSION:
|
||||
this->toFile(P3D4_PREFIX SIMDATABASE);
|
||||
break;
|
||||
case P3D5_VERSION:
|
||||
this->toFile(P3D5_PREFIX SIMDATABASE);
|
||||
break;
|
||||
}
|
||||
this->toFile(resolveFilename(simVersion));
|
||||
#endif
|
||||
toLog("Sim Database updated");
|
||||
} else {
|
||||
#ifdef XP
|
||||
this->fromFile(SIMDATABASE);
|
||||
#endif
|
||||
|
||||
#ifndef MSFS
|
||||
switch (simVersion) {
|
||||
case FSX_VERSION:
|
||||
this->fromFile(FSX_PREFIX SIMDATABASE);
|
||||
break;
|
||||
case FSXSE_VERSION:
|
||||
this->fromFile(FSXSE_PREFIX SIMDATABASE);
|
||||
break;
|
||||
case P3D3_VERSION:
|
||||
this->fromFile(P3D3_PREFIX SIMDATABASE);
|
||||
break;
|
||||
case P3D4_VERSION:
|
||||
this->fromFile(P3D4_PREFIX SIMDATABASE);
|
||||
break;
|
||||
case P3D5_VERSION:
|
||||
this->fromFile(P3D5_PREFIX SIMDATABASE);
|
||||
break;
|
||||
}
|
||||
this->fromFile(resolveFilename(simVersion));
|
||||
#endif
|
||||
toLog("Sim Database loaded");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user