Convert ESP to Recorder
This commit is contained in:
1 parent
0a150391b8
commit
3a9db68e74
12 files changed
+271
-316
No files matched your search
+45
-21
@@ -3,7 +3,7 @@
|
||||
SimConnect::SimConnect(
|
||||
HWND hWnd,
|
||||
std::function<void(const std::string)> toLog,
|
||||
std::shared_ptr<germanairlinesva::file::config::Config> &configuration)
|
||||
std::shared_ptr<germanairlinesva::file::config::Config> configuration)
|
||||
: configuration(configuration), toLog(std::move(toLog))
|
||||
{
|
||||
HRESULT hr = SimConnect_Open(&this->simConnect,
|
||||
@@ -304,24 +304,7 @@ void SimConnect::getStates() const
|
||||
|
||||
bool SimConnect::isConnected() const { return this->connectedToSim; }
|
||||
|
||||
const std::string SimConnect::getVersion() const
|
||||
{
|
||||
switch (this->version) {
|
||||
case MSFS_VERSION:
|
||||
return "MSFS";
|
||||
case FSX_VERSION:
|
||||
return "FSX";
|
||||
case P3D5_VERSION:
|
||||
return "P3D5";
|
||||
case P3D4_VERSION:
|
||||
return "P3D4";
|
||||
break;
|
||||
case P3D3_VERSION:
|
||||
return "P3D3";
|
||||
default:
|
||||
return "Unknown";
|
||||
}
|
||||
}
|
||||
char SimConnect::getVersion() const { return this->version; }
|
||||
|
||||
void SimConnect::getData(
|
||||
struct germanairlinesva::gaconnector::websocket::data *data)
|
||||
@@ -330,7 +313,8 @@ void SimConnect::getData(
|
||||
memcpy(data, &this->simData, sizeof(this->simData));
|
||||
}
|
||||
|
||||
void SimConnect::handleMessage()
|
||||
void SimConnect::handleMessage(std::function<void(int)> callbackOpen,
|
||||
std::function<void()> callbackData)
|
||||
{
|
||||
SIMCONNECT_RECV *pData;
|
||||
DWORD cbData;
|
||||
@@ -340,6 +324,7 @@ void SimConnect::handleMessage()
|
||||
switch (pData->dwID) {
|
||||
case SIMCONNECT_RECV_ID_OPEN: {
|
||||
this->handleOpen((SIMCONNECT_RECV_OPEN *)pData);
|
||||
callbackOpen(this->version);
|
||||
break;
|
||||
}
|
||||
case SIMCONNECT_RECV_ID_EVENT: {
|
||||
@@ -352,6 +337,7 @@ void SimConnect::handleMessage()
|
||||
}
|
||||
case SIMCONNECT_RECV_ID_SIMOBJECT_DATA: {
|
||||
this->handleData((SIMCONNECT_RECV_SIMOBJECT_DATA *)pData);
|
||||
callbackData();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@@ -379,7 +365,7 @@ void SimConnect::handleOpen(SIMCONNECT_RECV_OPEN *data)
|
||||
this->version = FSX_VERSION;
|
||||
break;
|
||||
case FSXSE_SUBVERSION:
|
||||
if (configuration->getFSXSEPath().length() > 0) {
|
||||
if (configuration->getPath(FSXSE_VERSION).length() > 0) {
|
||||
this->version = FSXSE_VERSION;
|
||||
} else {
|
||||
this->version = FSX_VERSION;
|
||||
@@ -458,3 +444,41 @@ void SimConnect::handleData(SIMCONNECT_RECV_SIMOBJECT_DATA *data)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const std::string SimConnect::resolveVersion(char version)
|
||||
{
|
||||
switch (version) {
|
||||
case MSFS_VERSION:
|
||||
return "MSFS";
|
||||
case FSX_VERSION:
|
||||
return "FSX";
|
||||
case P3D5_VERSION:
|
||||
return "P3D5";
|
||||
case P3D4_VERSION:
|
||||
return "P3D4";
|
||||
break;
|
||||
case P3D3_VERSION:
|
||||
return "P3D3";
|
||||
default:
|
||||
return "Unknown";
|
||||
}
|
||||
}
|
||||
|
||||
const std::string SimConnect::resolveScenery(char version)
|
||||
{
|
||||
switch (version) {
|
||||
case FSX_VERSION:
|
||||
return FSX_SCENERY;
|
||||
case FSXSE_VERSION:
|
||||
return FSXSE_SCENERY;
|
||||
case P3D5_VERSION:
|
||||
return P3D5_SCENREY;
|
||||
case P3D4_VERSION:
|
||||
return P3D4_SCENREY;
|
||||
break;
|
||||
case P3D3_VERSION:
|
||||
return P3D3_SCENREY;
|
||||
default:
|
||||
return "/";
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user