mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-02 06:35:52 +08:00
Revert "[xSwiftBus] Automatically find and load CSL packages"
This reverts commit 61adfefa7a.
This commit is contained in:
@@ -85,12 +85,6 @@ namespace XSwiftBus
|
||||
{
|
||||
if (! s_legacyDataOK) { return false; }
|
||||
|
||||
findAllCslPackages(g_xplanePath);
|
||||
for (const auto &package : m_cslPackages)
|
||||
{
|
||||
loadPlanesPackage(package);
|
||||
}
|
||||
|
||||
if (! m_initialized)
|
||||
{
|
||||
auto err = XPMPMultiplayerInit(preferences, preferences);
|
||||
@@ -145,36 +139,6 @@ namespace XSwiftBus
|
||||
}
|
||||
}
|
||||
|
||||
void CTraffic::findAllCslPackages(const std::string &path)
|
||||
{
|
||||
std::vector<char> nameBuffer(65536, '\0');
|
||||
std::vector<char *> indices(4096, nullptr);
|
||||
int returnedFiles;
|
||||
|
||||
// Remove trailing /
|
||||
std::string dir = path.substr(0, path.size() - 1);
|
||||
XPLMGetDirectoryContents(dir.c_str(), 0,
|
||||
nameBuffer.data(), static_cast<int>(nameBuffer.size()),
|
||||
indices.data(), static_cast<int>(indices.size()),
|
||||
nullptr, &returnedFiles);
|
||||
for (std::size_t i = 0; i < static_cast<std::size_t>(returnedFiles); i++)
|
||||
{
|
||||
std::string fileName(indices[i]);
|
||||
if (fileName == "xsb_aircraft.txt")
|
||||
{
|
||||
const std::string seperator = "/\\";
|
||||
const std::size_t sepPos = dir.find_last_of(seperator);
|
||||
std::string parentPath = dir.substr(0, sepPos);
|
||||
m_cslPackages.insert(parentPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string filePath(path + fileName + g_sep);
|
||||
findAllCslPackages(filePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CTraffic::emitSimFrame()
|
||||
{
|
||||
if (m_emitSimFrame) { sendDBusSignal("simFrame"); }
|
||||
@@ -562,6 +526,16 @@ namespace XSwiftBus
|
||||
cleanup();
|
||||
});
|
||||
}
|
||||
else if (message.getMethodName() == "loadPlanesPackage")
|
||||
{
|
||||
std::string path;
|
||||
message.beginArgumentRead();
|
||||
message.getArgument(path);
|
||||
queueDBusCall([ = ]()
|
||||
{
|
||||
sendDBusReply(sender, serial, loadPlanesPackage(path));
|
||||
});
|
||||
}
|
||||
else if (message.getMethodName() == "setDefaultIcao")
|
||||
{
|
||||
std::string defaultIcao;
|
||||
|
||||
Reference in New Issue
Block a user