mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-09 05:28:09 +08:00
Revert "[xSwiftBus] Automatically find and load CSL packages"
This reverts commit 61adfefa7a.
This commit is contained in:
@@ -9,6 +9,10 @@ R"(<node>
|
||||
</method>
|
||||
<method name="cleanup">
|
||||
</method>
|
||||
<method name="loadPlanesPackage">
|
||||
<arg name="path" type="s" direction="in"/>
|
||||
<arg type="b" direction="out"/>
|
||||
</method>
|
||||
<method name="setDefaultIcao">
|
||||
<arg name="defaultIcao" type="s" direction="in"/>
|
||||
</method>
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
#include <XPLM/XPLMDisplay.h>
|
||||
#include <functional>
|
||||
#include <utility>
|
||||
#include <set>
|
||||
|
||||
//! \cond PRIVATE
|
||||
#define XSWIFTBUS_TRAFFIC_INTERFACENAME "org.swift_project.xswiftbus.traffic"
|
||||
@@ -147,9 +146,7 @@ namespace XSwiftBus
|
||||
bool m_initialized = false;
|
||||
bool m_enabledMultiplayer = false;
|
||||
CTerrainProbe m_terrainProbe;
|
||||
std::set<std::string> m_cslPackages;
|
||||
|
||||
void findAllCslPackages(const std::string &path);
|
||||
void emitSimFrame();
|
||||
void emitPlaneAdded(const std::string &callsign);
|
||||
void emitPlaneAddingFailed(const std::string &callsign);
|
||||
|
||||
Reference in New Issue
Block a user