Make FS9 works with ISimulatorListener

* The FS9 host is started in the Listener
* When FS9 starts up, it is called via the lobby to join the multiplayer
* Some minor changes in CContextSimulator
This commit is contained in:
Michał Garapich
2015-03-08 22:58:42 +01:00
committed by Roland Winklmeier
parent edc0646ab2
commit 570f4aa4ea
9 changed files with 196 additions and 125 deletions

View File

@@ -92,9 +92,6 @@ namespace BlackSimPlugin
GUID pAppGuid = CFs9Sdk::guid();
// Set to true in order to automatically launch FS9. Perfect for testing.
bool bLaunchNotFound = false;
// Setup the DPL_CONNECT_INFO struct
DPL_CONNECT_INFO dnConnectInfo;
ZeroMemory(&dnConnectInfo, sizeof(DPL_CONNECT_INFO));
@@ -102,7 +99,6 @@ namespace BlackSimPlugin
dnConnectInfo.pvLobbyConnectData = nullptr;
dnConnectInfo.dwLobbyConnectDataSize = 0;
dnConnectInfo.dwFlags = 0;
if (bLaunchNotFound) dnConnectInfo.dwFlags |= DPLCONNECT_LAUNCHNOTFOUND;
dnConnectInfo.guidApplication = pAppGuid;
if (FAILED(hr = allocAndInitConnectSettings(address, &pAppGuid, &dnConnectInfo.pdplConnectionSettings)))
@@ -113,21 +109,18 @@ namespace BlackSimPlugin
&m_applicationHandle,
INFINITE,
0);
if (FAILED(hr))
{
if (hr == DPNERR_NOCONNECTION && !bLaunchNotFound)
qWarning() << "There were no waiting application.";
else
return printDirectPlayError(hr);
}
else
{
if (FAILED(hr)) {
return hr == DPNERR_NOCONNECTION ? S_FALSE : printDirectPlayError(hr);
} else {
qDebug() << "Connected!";
freeConnectSettings(dnConnectInfo.pdplConnectionSettings);
return S_OK;
}
}
freeConnectSettings(dnConnectInfo.pdplConnectionSettings);
void CLobbyClient::cleanup()
{
return S_OK;
}
HRESULT CLobbyClient::allocAndInitConnectSettings(const QString &address, GUID *pAppGuid, DPL_CONNECTION_SETTINGS **ppdplConnectSettings)
@@ -247,7 +240,9 @@ namespace BlackSimPlugin
{
PDPL_MESSAGE_DISCONNECT pDisconnectMsg;
pDisconnectMsg = (PDPL_MESSAGE_DISCONNECT)msgBuffer;
Q_UNUSED(pDisconnectMsg)
Q_UNUSED(pDisconnectMsg);
emit disconnected();
// We should free any data associated with the
// app here, but there is none.