6 Commits

Author SHA1 Message Date
Kilian 20aa5c2416 Update to 1.1.28 2026-04-05 17:21:46 +02:00
Kilian 01e0a155ed 1.1.26+ FS24 adjustments 2026-03-28 21:02:15 +01:00
Kilian b772119e2c 1.1.18 EFB 2026-02-21 04:25:26 +01:00
Kilian 4628c6646c 1.1.17 EFB 2026-02-16 22:57:09 +01:00
Kilian 487ed3f589 GSX synced loading of fuel 2026-02-13 21:34:56 +01:00
Kilian 69680ced03 Initial GSX Sync for fuel 2026-02-13 02:50:43 +01:00
39 changed files with 7067 additions and 500 deletions
+367 -4
View File
@@ -1,20 +1,383 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Mono auto generated files
mono_crash.*
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
[Ww][Ii][Nn]32/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Oo]bj/
[Oo]ut/
[Ll]og/
[Ll]ogs/
# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# Visual Studio 2017 auto generated files
Generated\ Files/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUnit
*.VisualState.xml
TestResult.xml
nunit-*.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/
# ASP.NET Scaffolding
ScaffoldingReadMe.txt
# StyleCop
StyleCopReport.xml
# Files built by Visual Studio
*_i.c
*_p.c
*_h.h
*.ilk
*.meta
*.obj
*.iobj
*.pch
*.pdb
*.ipdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*_wpftmp.csproj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# Visual Studio Trace Files
*.e2e
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
# Coverlet is a free, cross platform Code Coverage Tool
coverage*.json
coverage*.xml
coverage*.info
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# NuGet Symbol Packages
*.snupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
*.appxbundle
*.appxupload
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!?*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs
# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
ServiceFabricBackup/
*.rptproj.bak
# SQL Server files
*.mdf
*.ldf
*.ndf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
*- [Bb]ackup.rdl
*- [Bb]ackup ([0-9]).rdl
*- [Bb]ackup ([0-9][0-9]).rdl
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# CodeRush personal settings
.cr/personal
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Tabs Studio
*.tss
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
# OpenCover UI analysis results
OpenCover/
# Azure Stream Analytics local run output
ASALocalRun/
# MSBuild Binary and Structured Log
*.binlog
# NVidia Nsight GPU debugger configuration file
*.nvuser
# MFractors (Xamarin productivity tool) working folder
.mfractor/
# Local History for Visual Studio
.localhistory/
# BeatPulse healthcheck temp database
healthchecksdb
# Backup folder for Package Reference Convert tool in Visual Studio 2017
MigrationBackup/
# Ionide (cross platform F# VS Code tools) working folder
.ionide/
# Fody - auto-generated XML schema
FodyWeavers.xsda
# Custom
Packages
_PackageInt
PackagesMetadata
PackageSources/js-bundle/__generated__
PackageSources/js-bundle/.rollup.cache
PackageSources/js-bundle/node_modules
PackageSources/html_ui
PackageSources/wasm-module/.vs
PackageSources/wasm-module/MSFS
PackageSources/wasm-module/x64
node_modules
*.blend1
*.tsbuildinfo
PackageSources/SimObjects/Airplanes/**/panel/*.wasm
PackageSources/SimObjects/Airplanes/**/*.wasm
EFB/efb.css
EFB/efb.js
EFB/efb.html
+29
View File
@@ -0,0 +1,29 @@
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**",
"${workspaceFolder}/.vscode",
"C:\\MSFS 2024 SDK\\WASM\\wasi-sysroot\\include",
"C:\\MSFS 2024 SDK\\WASM\\wasi-sysroot\\include\\c++\\v1",
"C:\\MSFS 2024 SDK\\WASM\\include",
"C:\\MSFS 2024 SDK\\SimConnect SDK\\include"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"compilerArgs": [
"/Zc:__cplusplus"
],
"windowsSdkVersion": "10.0.26100.0",
"compilerPath": "cl.exe",
"cStandard": "c17",
"intelliSenseMode": "windows-msvc-x64",
"cppStandard": "c++14"
}
],
"version": 4
}
+1 -2
View File
@@ -10,6 +10,5 @@ Index: EFB.html
-<script type="text/html" import-async="false" import-script="/Pages/VCockpit/Instruments/aircraft_efb/TFDi_MD11_efb/efb.index.js"></script>
+<script type="text/html" import-async="false" import-script="/Pages/VCockpit/Instruments/aircraft_efb/KH_TFDi_MD11_efb/efb.index.js"></script>
-<link rel="stylesheet" href="/Pages/VCockpit/Instruments/aircraft_efb/TFDi_MD11_efb/efb.css" />
+<link rel="stylesheet" href="/Pages/VCockpit/Instruments/aircraft_efb/KH_TFDi_MD11_efb/efb.css" />
<link rel="stylesheet" href="/Pages/VCockpit/Instruments/aircraft_efb/TFDi_MD11_efb/efb.css" />
+<link rel="stylesheet" href="/Pages/VCockpit/Instruments/aircraft_efb/KH_TFDi_MD11_efb/App.css" />
+2 -2
View File
@@ -2,7 +2,7 @@ Index: EFB.js
===================================================================
--- EFB.js
+++ EFB.js
@@ -40265,11 +40265,11 @@
@@ -50833,11 +50833,11 @@
),
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
"button",
@@ -16,7 +16,7 @@ Index: EFB.js
),
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
"button",
@@ -40767,8 +40767,27 @@
@@ -51343,8 +51343,27 @@
] })
] }) }) });
}
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<AssetPackage Version="1.1.0">
<AssetPackage Version="1.3.0">
<ItemSettings>
<ContentType>MISC</ContentType>
<Title>TFDi Design MD-11 Load Manager</Title>
@@ -31,13 +31,16 @@
<Exclude>vendor-*</Exclude>
</Config>
</AssetGroup>
<AssetGroup Name="md-11-panel-config">
<AssetGroup Name="wasm">
<Type Version="0">Copy</Type>
<Flags>
<FSXCompatibility>false</FSXCompatibility>
</Flags>
<AssetDir>PackageSources\SimObjects\Airplanes\</AssetDir>
<OutputDir>SimObjects\Airplanes\</OutputDir>
<Config>
<Exclude>.gitkeep</Exclude>
</Config>
</AssetGroup>
</AssetGroups>
</AssetPackage>
@@ -7,17 +7,17 @@ visible=1
pixel_size=2048,2048
texture=vc1
background_color=0,0,0
htmlgauge00=WasmInstrument/WasmInstrument.html?wasm_module=md11host.wasm&wasm_gauge=Core, 0,0,509,510
htmlgauge01=WasmInstrument/WasmInstrument.html?wasm_module=md11host.wasm&wasm_gauge=DU1,0,0,508,508
htmlgauge02=WasmInstrument/WasmInstrument.html?wasm_module=md11host.wasm&wasm_gauge=DU2,514,0,510,510
htmlgauge03=WasmInstrument/WasmInstrument.html?wasm_module=md11host.wasm&wasm_gauge=DU3,1027,0,510,510
htmlgauge04=WasmInstrument/WasmInstrument.html?wasm_module=md11host.wasm&wasm_gauge=DU4,1539,0,510,508
htmlgauge05=WasmInstrument/WasmInstrument.html?wasm_module=md11host.wasm&wasm_gauge=DU5,0,513,511,509
htmlgauge06=WasmInstrument/WasmInstrument.html?wasm_module=md11host.wasm&wasm_gauge=DU6,513,512,510,511
htmlgauge07=WasmInstrument/WasmInstrument.html?wasm_module=md11host.wasm&wasm_gauge=LMCDU, 0,1050,666,574
htmlgauge08=WasmInstrument/WasmInstrument.html?wasm_module=md11host.wasm&wasm_gauge=RMCDU,678,1050,666,574
htmlgauge09=WasmInstrument/WasmInstrument.html?wasm_module=md11host.wasm&wasm_gauge=CMCDU,1353,1050,666,574
htmlgauge10=WasmInstrument/WasmInstrument.html?wasm_module=md11host.wasm&wasm_gauge=ISFD,1032,519,544,505
htmlgauge00=WasmInstrument/WasmInstrument.html?wasm_module=md11host.wasm&wasm_gauge=DU1,0,0,509,510
htmlgauge01=WasmInstrument/WasmInstrument.html?wasm_module=md11host.wasm&wasm_gauge=DU2,514,0,510,510
htmlgauge02=WasmInstrument/WasmInstrument.html?wasm_module=md11host.wasm&wasm_gauge=DU3,1027,0,510,510
htmlgauge03=WasmInstrument/WasmInstrument.html?wasm_module=md11host.wasm&wasm_gauge=DU4,1539,0,510,510
htmlgauge04=WasmInstrument/WasmInstrument.html?wasm_module=md11host.wasm&wasm_gauge=DU5,0,513,511,510
htmlgauge05=WasmInstrument/WasmInstrument.html?wasm_module=md11host.wasm&wasm_gauge=DU6,513,512,510,511
htmlgauge06=WasmInstrument/WasmInstrument.html?wasm_module=md11host.wasm&wasm_gauge=LMCDU, 0,1050,666,574
htmlgauge07=WasmInstrument/WasmInstrument.html?wasm_module=md11host.wasm&wasm_gauge=RMCDU,678,1050,666,574
htmlgauge08=WasmInstrument/WasmInstrument.html?wasm_module=md11host.wasm&wasm_gauge=CMCDU,1353,1050,666,574
htmlgauge09=WasmInstrument/WasmInstrument.html?wasm_module=md11host.wasm&wasm_gauge=ISFD,1032,519,544,505
htmlgauge10=WasmInstrument/WasmInstrument.html?wasm_module=md11host.wasm&wasm_gauge=Core,0,0,1,1
//KH new gauge
htmlgauge11=WasmInstrument/WasmInstrument.html?wasm_module=load-manager.wasm&wasm_gauge=Load_Manager,0,0,509,510
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "tfdidesign-md11-load-manager",
"version": "0.2.8",
"name": "js-bundle",
"version": "0.2.34",
"description": "",
"main": "index.js",
"type": "module",
@@ -1,41 +1,41 @@
| Department | Related to | Name | License period | Material not material | License type | Link | Remote version | Installed version | Defined version | Author |
| :--------- | :--------- | :------------------------------- | :------------- | :-------------------- | :----------- | :------------------------------------------------------------------------ | :------------- | :---------------- | :-------------- | :---------------------------------------------------------- |
| kessler | stuff | lucide-react | perpetual | material | ISC | git+https://github.com/lucide-icons/lucide.git | 0.555.0 | 0.555.0 | ^0.555.0 | Eric Fennis |
| kessler | stuff | react | perpetual | material | MIT | git+https://github.com/facebook/react.git | 19.2.4 | 19.1.0 | ^19.1.0 | n/a |
| kessler | stuff | react-dom | perpetual | material | MIT | git+https://github.com/facebook/react.git | 19.2.4 | 19.1.0 | ^19.1.0 | n/a |
| kessler | stuff | uuid | perpetual | material | MIT | git+https://github.com/uuidjs/uuid.git | 11.1.0 | 11.1.0 | ^11.1.0 | n/a |
| kessler | stuff | @microsoft/msfs-types | perpetual | material | MIT | git+https://github.com/microsoft/msfs-avionics-mirror.git | 1.14.6 | 1.14.6 | ^1.14.6 | Asobo Studio / Working Title Simulations |
| kessler | stuff | @rollup/plugin-commonjs | perpetual | material | MIT | git+https://github.com/rollup/plugins.git | 28.0.9 | 28.0.3 | ^28.0.3 | Rich Harris <richard.a.harris@gmail.com> |
| kessler | stuff | @rollup/plugin-json | perpetual | material | MIT | git+https://github.com/rollup/plugins.git | 6.1.0 | 6.1.0 | ^6.1.0 | rollup |
| kessler | stuff | @rollup/plugin-node-resolve | perpetual | material | MIT | git+https://github.com/rollup/plugins.git | 16.0.3 | 16.0.1 | ^16.0.1 | Rich Harris <richard.a.harris@gmail.com> |
| kessler | stuff | @rollup/plugin-replace | perpetual | material | MIT | git+https://github.com/rollup/plugins.git | 6.0.3 | 6.0.2 | ^6.0.2 | Rich Harris <richard.a.harris@gmail.com> |
| kessler | stuff | @rollup/plugin-terser | perpetual | material | MIT | git+https://github.com/rollup/plugins.git | 0.4.4 | 0.4.4 | ^0.4.4 | Peter Placzek <peter.placzek1996@gmail.com> |
| kessler | stuff | @rollup/plugin-typescript | perpetual | material | MIT | git+https://github.com/rollup/plugins.git | 12.3.0 | 12.1.2 | ^12.1.2 | Oskar Segersvärd |
| kessler | stuff | @types/node | perpetual | material | MIT | https://github.com/DefinitelyTyped/DefinitelyTyped.git | 24.10.11 | 24.3.1 | ^24.3.1 | n/a |
| kessler | stuff | @types/react | perpetual | material | MIT | https://github.com/DefinitelyTyped/DefinitelyTyped.git | 19.2.13 | 19.1.6 | ^19.1.6 | n/a |
| kessler | stuff | @types/react-dom | perpetual | material | MIT | https://github.com/DefinitelyTyped/DefinitelyTyped.git | 19.2.3 | 19.1.6 | ^19.1.6 | n/a |
| kessler | stuff | @types/uuid | perpetual | material | MIT | https://github.com/DefinitelyTyped/DefinitelyTyped.git | 10.0.0 | 10.0.0 | ^10.0.0 | n/a |
| kessler | stuff | @typescript-eslint/eslint-plugin | perpetual | material | MIT | git+https://github.com/typescript-eslint/typescript-eslint.git | 6.21.0 | 6.21.0 | ^6.21.0 | n/a |
| kessler | stuff | @typescript-eslint/parser | perpetual | material | BSD-2-Clause | git+https://github.com/typescript-eslint/typescript-eslint.git | 6.21.0 | 6.21.0 | ^6.21.0 | n/a |
| kessler | stuff | autoprefixer | perpetual | material | MIT | git+https://github.com/postcss/autoprefixer.git | 10.4.24 | 10.4.21 | ^10.4.21 | Andrey Sitnik <andrey@sitnik.ru> |
| kessler | stuff | cross-env | perpetual | material | MIT | git+https://github.com/kentcdodds/cross-env.git | 7.0.3 | 7.0.3 | ^7.0.3 | Kent C. Dodds <me@kentcdodds.com> (https://kentcdodds.com) |
| kessler | stuff | eslint | perpetual | material | MIT | git+https://github.com/eslint/eslint.git | 8.57.1 | 8.57.1 | ^8.57.1 | Nicholas C. Zakas <nicholas+npm@nczconsulting.com> |
| kessler | stuff | eslint-plugin-import | perpetual | material | MIT | git+https://github.com/import-js/eslint-plugin-import.git | 2.32.0 | 2.31.0 | ^2.31.0 | Ben Mosher <me@benmosher.com> |
| kessler | stuff | eslint-plugin-react | perpetual | material | MIT | git+https://github.com/jsx-eslint/eslint-plugin-react.git | 7.37.5 | 7.37.5 | ^7.37.5 | Yannick Croissant <yannick.croissant+npm@gmail.com> |
| kessler | stuff | eslint-plugin-react-hooks | perpetual | material | MIT | git+https://github.com/facebook/react.git | 4.6.2 | 4.6.2 | ^4.6.2 | n/a |
| kessler | stuff | license-report | perpetual | material | MIT | git+https://github.com/kessler/license-report.git | 6.8.1 | 6.7.2 | ^6.7.2 | Yaniv Kessler |
| kessler | stuff | postcss | perpetual | material | MIT | git+https://github.com/postcss/postcss.git | 8.5.6 | 8.5.4 | ^8.5.4 | Andrey Sitnik <andrey@sitnik.ru> |
| kessler | stuff | postcss-import | perpetual | material | MIT | git+https://github.com/postcss/postcss-import.git | 16.1.1 | 16.1.0 | ^16.1.0 | Maxime Thirouin |
| kessler | stuff | prettier | perpetual | material | MIT | git+https://github.com/prettier/prettier.git | 3.8.1 | 3.5.3 | ^3.5.3 | James Long |
| kessler | stuff | prettier-plugin-organize-imports | perpetual | material | MIT | git+https://github.com/simonhaenisch/prettier-plugin-organize-imports.git | 4.3.0 | 4.1.0 | ^4.1.0 | Simon Haenisch (https://github.com/simonhaenisch) |
| kessler | stuff | rimraf | perpetual | material | ISC | git+ssh://git@github.com/isaacs/rimraf.git | 6.1.2 | 6.0.1 | ^6.0.1 | Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/) |
| kessler | stuff | rollup | perpetual | material | MIT | git+https://github.com/rollup/rollup.git | 4.57.1 | 4.42.0 | ^4.42.0 | Rich Harris |
| kessler | stuff | rollup-plugin-copy | perpetual | material | MIT | git+https://github.com/vladshcherbin/rollup-plugin-copy.git | 3.5.0 | 3.5.0 | ^3.5.0 | Vlad Shcherbin <vlad.shcherbin@gmail.com> |
| kessler | stuff | rollup-plugin-postcss | perpetual | material | MIT | git+https://github.com/egoist/rollup-plugin-postcss.git | 4.0.2 | 4.0.2 | ^4.0.2 | EGOIST <0x142857@gmail.com> |
| kessler | stuff | rollup-plugin-react-svg | perpetual | material | MIT | git+https://github.com/boopathi/react-svg-loader.git | 3.0.3 | 3.0.3 | ^3.0.3 | boopathi |
| kessler | stuff | rollup-plugin-version-injector | perpetual | material | ISC | git+https://github.com/djhouseknecht/rollup-plugin-version-injector.git | 1.3.3 | 1.3.3 | ^1.3.3 | David Houseknecht <david.j.houseknecht@gmail.com> |
| kessler | stuff | sass | perpetual | material | MIT | git+https://github.com/sass/dart-sass.git | 1.97.3 | 1.89.1 | ^1.89.1 | Natalie Weizenbaum nweiz@google.com https://github.com/nex3 |
| kessler | stuff | tslib | perpetual | material | 0BSD | git+https://github.com/Microsoft/tslib.git | 2.8.1 | 2.8.1 | ^2.8.1 | Microsoft Corp. |
| kessler | stuff | typed-scss-modules | perpetual | material | MIT | git+https://github.com/skovy/typed-scss-modules.git | 8.1.1 | 8.1.1 | ^8.1.1 | Spencer Miskoviak <smiskoviak@gmail.com> |
| kessler | stuff | typescript | perpetual | material | Apache-2.0 | git+https://github.com/microsoft/TypeScript.git | 5.8.3 | 5.8.3 | 5.8.3 | Microsoft Corp. |
| Department | Related to | Name | License period | Material not material | License type | Link | Remote version | Installed version | Defined version | Author |
| :--------- | :--------- | :------------------------------- | :------------- | :-------------------- | :------------ | :------------------------------------------------------------------------ | :------------- | :---------------- | :-------------- | :---------------------------------------------------------- |
| kessler | stuff | lucide-react | perpetual | material | ISC | git+https://github.com/lucide-icons/lucide.git | 0.555.0 | 0.555.0 | ^0.555.0 | Eric Fennis |
| kessler | stuff | react | perpetual | material | MIT | git+https://github.com/facebook/react.git | 19.2.4 | 19.2.4 | ^19.1.0 | n/a |
| kessler | stuff | react-dom | perpetual | material | MIT | git+https://github.com/facebook/react.git | 19.2.4 | 19.2.4 | ^19.1.0 | n/a |
| kessler | stuff | uuid | perpetual | material | MIT | git+https://github.com/uuidjs/uuid.git | 11.1.0 | 11.1.0 | ^11.1.0 | n/a |
| kessler | stuff | @microsoft/msfs-types | perpetual | material | MIT | git+https://github.com/microsoft/msfs-avionics-mirror.git | 1.14.6 | 1.14.6 | ^1.14.6 | Asobo Studio / Working Title Simulations |
| kessler | stuff | @rollup/plugin-commonjs | perpetual | material | MIT | git+https://github.com/rollup/plugins.git | 28.0.9 | 28.0.9 | ^28.0.3 | Rich Harris <richard.a.harris@gmail.com> |
| kessler | stuff | @rollup/plugin-json | perpetual | material | MIT | git+https://github.com/rollup/plugins.git | 6.1.0 | 6.1.0 | ^6.1.0 | rollup |
| kessler | stuff | @rollup/plugin-node-resolve | perpetual | material | MIT | git+https://github.com/rollup/plugins.git | 16.0.3 | 16.0.3 | ^16.0.1 | Rich Harris <richard.a.harris@gmail.com> |
| kessler | stuff | @rollup/plugin-replace | perpetual | material | MIT | git+https://github.com/rollup/plugins.git | 6.0.3 | 6.0.3 | ^6.0.2 | Rich Harris <richard.a.harris@gmail.com> |
| kessler | stuff | @rollup/plugin-terser | perpetual | material | MIT | git+https://github.com/rollup/plugins.git | 0.4.4 | 0.4.4 | ^0.4.4 | Peter Placzek <peter.placzek1996@gmail.com> |
| kessler | stuff | @rollup/plugin-typescript | perpetual | material | MIT | git+https://github.com/rollup/plugins.git | 12.3.0 | 12.3.0 | ^12.1.2 | Oskar Segersvärd |
| kessler | stuff | @types/node | perpetual | material | MIT | https://github.com/DefinitelyTyped/DefinitelyTyped.git | 24.12.2 | 24.12.0 | ^24.3.1 | n/a |
| kessler | stuff | @types/react | perpetual | material | MIT | https://github.com/DefinitelyTyped/DefinitelyTyped.git | 19.2.14 | 19.2.14 | ^19.1.6 | n/a |
| kessler | stuff | @types/react-dom | perpetual | material | MIT | https://github.com/DefinitelyTyped/DefinitelyTyped.git | 19.2.3 | 19.2.3 | ^19.1.6 | n/a |
| kessler | stuff | @types/uuid | perpetual | material | MIT | https://github.com/DefinitelyTyped/DefinitelyTyped.git | 10.0.0 | 10.0.0 | ^10.0.0 | n/a |
| kessler | stuff | @typescript-eslint/eslint-plugin | perpetual | material | MIT | git+https://github.com/typescript-eslint/typescript-eslint.git | 6.21.0 | 6.21.0 | ^6.21.0 | n/a |
| kessler | stuff | @typescript-eslint/parser | perpetual | material | BSD-2-Clause | git+https://github.com/typescript-eslint/typescript-eslint.git | 6.21.0 | 6.21.0 | ^6.21.0 | n/a |
| kessler | stuff | autoprefixer | perpetual | material | MIT | git+https://github.com/postcss/autoprefixer.git | 10.4.27 | 10.4.27 | ^10.4.21 | Andrey Sitnik <andrey@sitnik.ru> |
| kessler | stuff | cross-env | perpetual | material | MIT | git+https://github.com/kentcdodds/cross-env.git | 7.0.3 | 7.0.3 | ^7.0.3 | Kent C. Dodds <me@kentcdodds.com> (https://kentcdodds.com) |
| kessler | stuff | eslint | perpetual | material | MIT | git+https://github.com/eslint/eslint.git | 8.57.1 | 8.57.1 | ^8.57.1 | Nicholas C. Zakas <nicholas+npm@nczconsulting.com> |
| kessler | stuff | eslint-plugin-import | perpetual | material | MIT | git+https://github.com/import-js/eslint-plugin-import.git | 2.32.0 | 2.32.0 | ^2.31.0 | Ben Mosher <me@benmosher.com> |
| kessler | stuff | eslint-plugin-react | perpetual | material | MIT | git+https://github.com/jsx-eslint/eslint-plugin-react.git | 7.37.5 | 7.37.5 | ^7.37.5 | Yannick Croissant <yannick.croissant+npm@gmail.com> |
| kessler | stuff | eslint-plugin-react-hooks | perpetual | material | MIT | git+https://github.com/facebook/react.git | 4.6.2 | 4.6.2 | ^4.6.2 | n/a |
| kessler | stuff | license-report | perpetual | material | MIT | git+https://github.com/kessler/license-report.git | 6.8.2 | 6.8.2 | ^6.7.2 | Yaniv Kessler |
| kessler | stuff | postcss | perpetual | material | MIT | git+https://github.com/postcss/postcss.git | 8.5.8 | 8.5.8 | ^8.5.4 | Andrey Sitnik <andrey@sitnik.ru> |
| kessler | stuff | postcss-import | perpetual | material | MIT | git+https://github.com/postcss/postcss-import.git | 16.1.1 | 16.1.1 | ^16.1.0 | Maxime Thirouin |
| kessler | stuff | prettier | perpetual | material | MIT | git+https://github.com/prettier/prettier.git | 3.8.1 | 3.8.1 | ^3.5.3 | James Long |
| kessler | stuff | prettier-plugin-organize-imports | perpetual | material | MIT | git+https://github.com/simonhaenisch/prettier-plugin-organize-imports.git | 4.3.0 | 4.3.0 | ^4.1.0 | Simon Haenisch (https://github.com/simonhaenisch) |
| kessler | stuff | rimraf | perpetual | material | BlueOak-1.0.0 | git+ssh://git@github.com/isaacs/rimraf.git | 6.1.3 | 6.1.3 | ^6.0.1 | Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/) |
| kessler | stuff | rollup | perpetual | material | MIT | git+https://github.com/rollup/rollup.git | 4.60.1 | 4.60.0 | ^4.42.0 | Rich Harris |
| kessler | stuff | rollup-plugin-copy | perpetual | material | MIT | git+https://github.com/vladshcherbin/rollup-plugin-copy.git | 3.5.0 | 3.5.0 | ^3.5.0 | Vlad Shcherbin <vlad.shcherbin@gmail.com> |
| kessler | stuff | rollup-plugin-postcss | perpetual | material | MIT | git+https://github.com/egoist/rollup-plugin-postcss.git | 4.0.2 | 4.0.2 | ^4.0.2 | EGOIST <0x142857@gmail.com> |
| kessler | stuff | rollup-plugin-react-svg | perpetual | material | MIT | git+https://github.com/boopathi/react-svg-loader.git | 3.0.3 | 3.0.3 | ^3.0.3 | boopathi |
| kessler | stuff | rollup-plugin-version-injector | perpetual | material | ISC | git+https://github.com/djhouseknecht/rollup-plugin-version-injector.git | 1.3.3 | 1.3.3 | ^1.3.3 | David Houseknecht <david.j.houseknecht@gmail.com> |
| kessler | stuff | sass | perpetual | material | MIT | git+https://github.com/sass/dart-sass.git | 1.99.0 | 1.98.0 | ^1.89.1 | Natalie Weizenbaum nweiz@google.com https://github.com/nex3 |
| kessler | stuff | tslib | perpetual | material | 0BSD | git+https://github.com/Microsoft/tslib.git | 2.8.1 | 2.8.1 | ^2.8.1 | Microsoft Corp. |
| kessler | stuff | typed-scss-modules | perpetual | material | MIT | git+https://github.com/skovy/typed-scss-modules.git | 8.1.1 | 8.1.1 | ^8.1.1 | Spencer Miskoviak <smiskoviak@gmail.com> |
| kessler | stuff | typescript | perpetual | material | Apache-2.0 | git+https://github.com/microsoft/TypeScript.git | 5.8.3 | 5.8.3 | 5.8.3 | Microsoft Corp. |
@@ -11,10 +11,11 @@ interface SBEntryProps {
WASMData: WASMDataF;
loadingState: LoadingState;
gsxActive: boolean;
gsxFuelActive: boolean;
setLoadingState: (newState: LoadingState) => void;
}
const SBEntryF: FC<SBEntryProps> = ({ WASMData, loadingState, gsxActive, setLoadingState }) => {
const SBEntryF: FC<SBEntryProps> = ({ WASMData, loadingState, gsxActive, gsxFuelActive, setLoadingState }) => {
const [CGTarget, setCGTarget] = useState(WASMData.targetPayload.CGTarget);
const [fuel, setFuel] = useState(Math.round(WASMData.targetPayload.fuel));
const [SBInFlight, setSBInFlight] = useState(false);
@@ -102,7 +103,7 @@ const SBEntryF: FC<SBEntryProps> = ({ WASMData, loadingState, gsxActive, setLoad
className={`w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 text-right`}
value={fuel}
onChange={(value) => handleInput(value, WASMData.limits.maxFuel, setFuel)}
disabled={loadingState !== 'preview' || gsxActive}
disabled={loadingState !== 'preview' || gsxFuelActive}
/>
</div>
</div>
@@ -11,13 +11,13 @@ interface SBEntryProps {
WASMData: WASMDataPax;
loadingState: LoadingState;
gsxActive: boolean;
gsxFuelActive: boolean;
setLoadingState: (newState: LoadingState) => void;
}
const SBEntryPax: FC<SBEntryProps> = ({ WASMData, loadingState, gsxActive, setLoadingState }) => {
const SBEntryPax: FC<SBEntryProps> = ({ WASMData, loadingState, gsxActive, gsxFuelActive, setLoadingState }) => {
const [CGTarget, setCGTarget] = useState(WASMData.targetPayload.CGTarget);
const [fuel, setFuel] = useState(Math.round(WASMData.targetPayload.fuel));
const [fuelEnabled, setFuelEnabled] = useState(true);
const [SBInFlight, setSBInFlight] = useState(false);
// FROM EFB
@@ -106,7 +106,7 @@ const SBEntryPax: FC<SBEntryProps> = ({ WASMData, loadingState, gsxActive, setLo
className={`w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 text-right`}
value={fuel}
onChange={(value) => handleInput(value, WASMData.limits.maxFuel, setFuel)}
disabled={loadingState !== 'preview' || gsxActive}
disabled={loadingState !== 'preview' || gsxFuelActive}
/>
</div>
</div>
@@ -1,6 +1,6 @@
import { FC, useEffect, useState } from 'react';
import { LoadingState } from '../../types/general';
import { GSXLoadingState, WASMDataF } from '../../types/WASMData';
import { GSXFuelingState, GSXLoadingState, WASMDataF } from '../../types/WASMData';
import OptionsF from '../options/OptionsF';
import Profile from '../profile/Profile';
import SBEntryF from '../SBEntry/SBEntryF';
@@ -65,6 +65,9 @@ const Freighter: FC<FreighterProps> = ({ WASMData, username }) => {
WASMData.GSX.loadingState !== GSXLoadingState.DEBOARDED
);
};
const GSXFuelActive = () => {
return WASMData.GSX.couatlStarted && WASMData.GSX.fuelingState !== GSXFuelingState.IDLE;
};
const CGs = (): [string, boolean, string, boolean] => {
if (loadingState !== 'loaded' && !GSXActive()) {
@@ -118,9 +121,7 @@ const Freighter: FC<FreighterProps> = ({ WASMData, username }) => {
}
/>
<Tabbar
tabs={
username ? ['Simbrief', 'ZFW', 'Cargo', 'Options'] : ['ZFW', 'Cargo', 'Options']
}
tabs={username ? ['Simbrief', 'ZFW', 'Cargo', 'Options'] : ['ZFW', 'Cargo', 'Options']}
selectedTab={selectedTab}
setSelectedTab={setSelectedTab}
/>
@@ -130,6 +131,7 @@ const Freighter: FC<FreighterProps> = ({ WASMData, username }) => {
loadingState={loadingState}
setLoadingState={setLoadingState}
gsxActive={GSXActive()}
gsxFuelActive={GSXFuelActive()}
/>
)}
{((username && selectedTab === 1) || (!username && selectedTab === 0)) && (
@@ -138,6 +140,7 @@ const Freighter: FC<FreighterProps> = ({ WASMData, username }) => {
loadingState={loadingState}
setLoadingState={setLoadingState}
gsxActive={GSXActive()}
gsxFuelActive={GSXFuelActive()}
/>
)}
{((username && selectedTab === 2) || (!username && selectedTab === 1)) && (
@@ -146,6 +149,7 @@ const Freighter: FC<FreighterProps> = ({ WASMData, username }) => {
loadingState={loadingState}
setLoadingState={setLoadingState}
gsxActive={GSXActive()}
gsxFuelActive={GSXFuelActive()}
/>
)}
{((username && selectedTab === 3) || (!username && selectedTab === 2)) && (
@@ -21,14 +21,28 @@ export default function Input(props: {
const blurRef = useRef<boolean>(false);
const [isFocused, setFocused] = useState(false);
const [showKeyboard, setShowKeyboard] = useState(false);
const [unfocusTimer, setUnfocusTimer] = useState<NodeJS.Timeout | null>(null);
useEffect(() => {
if (unfocusTimer) {
clearTimeout(unfocusTimer);
setUnfocusTimer(null);
}
if (isFocused) {
setUnfocusTimer(setTimeout(() => ref.current?.blur(), 5e3));
Coherent.trigger('FOCUS_INPUT_FIELD', guid, '', '', '', false);
} else {
console.log('UNFOCUS_INPUT_FIELD');
Coherent.trigger('UNFOCUS_INPUT_FIELD', guid);
}
return () => {
if (unfocusTimer) {
clearTimeout(unfocusTimer);
setUnfocusTimer(null);
}
};
}, [isFocused, guid]);
return (
@@ -60,6 +74,11 @@ export default function Input(props: {
}}
onChange={(e) => {
if (props.onChange) props.onChange(e.target.value);
if (unfocusTimer) {
clearTimeout(unfocusTimer);
setUnfocusTimer(null);
}
if (isFocused) setUnfocusTimer(setTimeout(() => ref.current?.blur(), 5e3));
}}
value={props.value}
className={props.className}
@@ -1,6 +1,6 @@
import { FC, useEffect, useState } from 'react';
import { LoadingState } from '../../types/general';
import { GSXLoadingState, WASMDataPax } from '../../types/WASMData';
import { GSXFuelingState, GSXLoadingState, WASMDataPax } from '../../types/WASMData';
import OptionsPax from '../options/OptionsPax';
import Profile from '../profile/Profile';
import SBEntryPax from '../SBEntry/SBEntryPax';
@@ -65,6 +65,9 @@ const Pax: FC<PaxProps> = ({ WASMData, username }) => {
WASMData.GSX.loadingState !== GSXLoadingState.DEBOARDED
);
};
const GSXFuelActive = () => {
return WASMData.GSX.couatlStarted && WASMData.GSX.fuelingState !== GSXFuelingState.IDLE;
};
const CGs = (): [string, boolean, string, boolean] => {
if (loadingState !== 'loaded' && !GSXActive()) {
@@ -134,6 +137,7 @@ const Pax: FC<PaxProps> = ({ WASMData, username }) => {
loadingState={loadingState}
setLoadingState={setLoadingState}
gsxActive={GSXActive()}
gsxFuelActive={GSXFuelActive()}
/>
)}
{((username && selectedTab === 1) || (!username && selectedTab === 0)) && (
@@ -142,6 +146,7 @@ const Pax: FC<PaxProps> = ({ WASMData, username }) => {
loadingState={loadingState}
setLoadingState={setLoadingState}
gsxActive={GSXActive()}
gsxFuelActive={GSXFuelActive()}
/>
)}
{((username && selectedTab === 2) || (!username && selectedTab === 1)) && (
@@ -150,6 +155,7 @@ const Pax: FC<PaxProps> = ({ WASMData, username }) => {
loadingState={loadingState}
setLoadingState={setLoadingState}
gsxActive={GSXActive()}
gsxFuelActive={GSXFuelActive()}
/>
)}
{((username && selectedTab === 3) || (!username && selectedTab === 2)) && (
@@ -9,10 +9,11 @@ interface StationEntryProps {
WASMData: WASMDataF;
loadingState: LoadingState;
gsxActive: boolean;
gsxFuelActive: boolean;
setLoadingState: (newState: LoadingState) => void;
}
const StationEntryF: FC<StationEntryProps> = ({ WASMData, loadingState, gsxActive, setLoadingState }) => {
const StationEntryF: FC<StationEntryProps> = ({ WASMData, loadingState, gsxActive, gsxFuelActive, setLoadingState }) => {
const [upper1, setUpper1] = useState(WASMData.targetPayload.upper1);
const [upper2, setUpper2] = useState(WASMData.targetPayload.upper2);
const [upper3, setUpper3] = useState(WASMData.targetPayload.upper3);
@@ -76,7 +77,7 @@ const StationEntryF: FC<StationEntryProps> = ({ WASMData, loadingState, gsxActiv
className={`w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 text-right`}
value={fuel}
onChange={(value) => handleInput(value, WASMData.limits.maxFuel, setFuel)}
disabled={loadingState !== 'preview' || gsxActive}
disabled={loadingState !== 'preview' || gsxFuelActive}
/>
</div>
</div>
@@ -9,17 +9,24 @@ interface StationEntryProps {
WASMData: WASMDataPax;
loadingState: LoadingState;
gsxActive: boolean;
gsxFuelActive: boolean;
setLoadingState: (newState: LoadingState) => void;
}
const StationEntryPax: FC<StationEntryProps> = ({ WASMData, loadingState, gsxActive, setLoadingState }) => {
const StationEntryPax: FC<StationEntryProps> = ({
WASMData,
loadingState,
gsxActive,
gsxFuelActive,
setLoadingState,
}) => {
const [business1, setBusiness1] = useState(WASMData.targetPayload.business1);
const [business2, setBusiness2] = useState(WASMData.targetPayload.business2);
const [economy1, setEconomy1] = useState(WASMData.targetPayload.economy1);
const [economy2, setEconomy2] = useState(WASMData.targetPayload.economy2);
const [forwardCargo, setForwardCargo] = useState(WASMData.targetPayload.forwardCargo);
const [rearCargo, setRearCargo] = useState(WASMData.targetPayload.rearCargo);
const [fuel, setFuel] = useState(Math.round(WASMData.livePayload.fuel));
const [fuel, setFuel] = useState(Math.round(WASMData.targetPayload.fuel));
const ZFW = () => {
if (loadingState !== 'loaded' && !gsxActive) return Math.round(WASMData.targetPayload.total);
@@ -76,7 +83,7 @@ const StationEntryPax: FC<StationEntryProps> = ({ WASMData, loadingState, gsxAct
className={`w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 text-right`}
value={fuel}
onChange={(value) => handleInput(value, WASMData.limits.maxFuel, setFuel)}
disabled={loadingState !== 'preview' || gsxActive}
disabled={loadingState !== 'preview' || gsxFuelActive}
/>
</div>
</div>
@@ -10,10 +10,11 @@ interface ZFWEntryProps {
WASMData: WASMDataF;
loadingState: LoadingState;
gsxActive: boolean;
gsxFuelActive: boolean;
setLoadingState: (newState: LoadingState) => void;
}
const ZFWEntryF: FC<ZFWEntryProps> = ({ WASMData, loadingState, gsxActive, setLoadingState }) => {
const ZFWEntryF: FC<ZFWEntryProps> = ({ WASMData, loadingState, gsxActive, gsxFuelActive, setLoadingState }) => {
const [CGTarget, setCGTarget] = useState(WASMData.targetPayload.CGTarget);
const [fuel, setFuel] = useState(Math.round(WASMData.targetPayload.fuel));
const [ZFWTarget, setZFWTarget] = useState(Math.round(WASMData.targetPayload.total));
@@ -102,7 +103,7 @@ const ZFWEntryF: FC<ZFWEntryProps> = ({ WASMData, loadingState, gsxActive, setLo
className={`w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 text-right`}
value={fuel}
onChange={(value) => handleInput(value, WASMData.limits.maxFuel, setFuel)}
disabled={loadingState !== 'preview' || gsxActive}
disabled={loadingState !== 'preview' || gsxFuelActive}
/>
</div>
</div>
@@ -10,10 +10,11 @@ interface ZFWEntryProps {
WASMData: WASMDataPax;
loadingState: LoadingState;
gsxActive: boolean;
gsxFuelActive: boolean;
setLoadingState: (newState: LoadingState) => void;
}
const ZFWEntryPax: FC<ZFWEntryProps> = ({ WASMData, loadingState, gsxActive, setLoadingState }) => {
const ZFWEntryPax: FC<ZFWEntryProps> = ({ WASMData, loadingState, gsxActive, gsxFuelActive, setLoadingState }) => {
const [CGTarget, setCGTarget] = useState(WASMData.targetPayload.CGTarget);
const [fuel, setFuel] = useState(Math.round(WASMData.targetPayload.fuel));
const [ZFWTarget, setZFWTarget] = useState(Math.round(WASMData.targetPayload.total));
@@ -102,7 +103,7 @@ const ZFWEntryPax: FC<ZFWEntryProps> = ({ WASMData, loadingState, gsxActive, set
className={`w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 text-right`}
value={fuel}
onChange={(value) => handleInput(value, WASMData.limits.maxFuel, setFuel)}
disabled={loadingState !== 'preview' || gsxActive}
disabled={loadingState !== 'preview' || gsxFuelActive}
/>
</div>
</div>
@@ -59,6 +59,7 @@ type LivePayloadF = TargetPayloadF;
interface GSX {
couatlStarted: boolean;
loadingState: GSXLoadingState;
fuelingState: GSXFuelingState;
}
interface Limits {
@@ -107,3 +108,8 @@ export enum GSXLoadingState {
DEBOARDING = 3,
DEBOARDED = 4,
}
export enum GSXFuelingState {
IDLE = 0,
FUELING = 1,
}
@@ -20,6 +20,7 @@
#include <algorithm>
// Own headers
#include "fuel.h"
#include "log.h"
#include "shared.h"
/******************************** Constants ********************************/
@@ -108,10 +109,11 @@ void distribute(fPayloadData_t *const targetPayload, const FuelData_t *const fue
// Updates pax stations with their respective weights
// Used internally and used for Station Entry (pax only, cargo is ste directly)
// STATION WEIGHTS ARE NOT NORMALISED TO POUNDS
void generatePayload(fPayloadData_t *const targetPayload, const bool isImperial);
void generatePayload(fPayloadData_t *const targetPayload);
// Normalise to Pounds
// For Station Entry: CALL AFTER `generatePayload`
void normalisePayload(fPayloadData_t *const targetPayload, const bool isImperial);
void calculateCGs(fPayloadData_t *const targetPayload, const FuelData_t *const fuel, const bool isImperial);
void load(const fPayloadData_t *const targetPayload, const HANDLE simConnect, const bool isImperial);
void unloadF(const HANDLE simConnect, const bool isER);
void load(const fPayloadData_t *const targetPayload, const FuelData_t *const fuel, const HANDLE simConnect,
const bool isImperial);
void unloadF(const HANDLE simConnect, const FuelData_t *const fuel, const double empty, const bool isER);
@@ -22,7 +22,12 @@
#include "shared.h"
/******************************** Constants ********************************/
// Pounds to gallons conversion
#define LBS_PER_GAL 6.699999809
// Fueling rate
#define FUELING_RATE ((LBS_PER_GAL * 1000) / 60)
// Max tank capacity gallons
#define MAX_TANK_1_3_MAIN_GAL 5167.907
#define MAX_TANK_1_3_TIP_GAL 874.5
#define MAX_TANK_1_3_GAL (5167.907 + 874.5)
@@ -31,6 +36,7 @@
#define MAX_LWR_AUX_GAL 1641.82
#define MAX_TAIL_GAL 1957.779
#define MAX_FWD_AUX_GAL 1970.8
// Max tank capacity pounds
#define MAX_TANK_1_3_MAIN_LBS (LBS_PER_GAL * MAX_TANK_1_3_MAIN_GAL)
#define MAX_TANK_1_3_TIP_LBS (LBS_PER_GAL * MAX_TANK_1_3_TIP_GAL)
#define MAX_TANK_1_3_LBS (LBS_PER_GAL * MAX_TANK_1_3_GAL)
@@ -39,7 +45,6 @@
#define MAX_LWR_AUX_LBS (LBS_PER_GAL * MAX_LWR_AUX_GAL)
#define MAX_TAIL_LBS (LBS_PER_GAL * MAX_TAIL_GAL)
#define MAX_FWD_AUX_LBS (LBS_PER_GAL * MAX_FWD_AUX_GAL)
// Max Fuel
#define MAX_FUEL(IS_IMPERIAL) ((IS_IMPERIAL) ? (256207) : (116213))
#define MAX_FUEL_ER(IS_IMPERIAL) ((IS_IMPERIAL) ? (282619) : (128193))
@@ -84,5 +89,6 @@ typedef struct {
} FuelDataSet_t;
/******************************** Functions ********************************/
void distribute(FuelData_t *const targetFuel, const double fuelTarget, const bool isImperial, const bool isER);
void distribute(FuelData_t *const targetFuel, const double fuelTarget, const UserData_t *const userData);
void fuel(const FuelData_t *const targetFuel, const HANDLE simConnect);
@@ -13,28 +13,25 @@
/********************************* Headers *********************************/
// MSFS headers
#include "rapidjson/filewritestream.h"
#include <MSFS/Legacy/gauges.h>
#include <MSFS/MSFS.h>
#include <MSFS/MSFS_CommBus.h>
#include <MSFS/MSFS_Core.h>
#include <MSFS/MSFS_GaugeContext.h>
#include <MSFS/MSFS_WindowsTypes.h>
#include <SimConnect.h>
#include <rapidjson/document.h>
#include <rapidjson/filereadstream.h>
#include <rapidjson/writer.h>
// C headers
#include <string.h>
// C++ headers
#include <ctime>
// Own headers
#include "freighter.h"
#include "fuel.h"
#include "log.h"
#include "pax.h"
#include "shared.h"
/******************************** Constants ********************************/
// Module identification
#define MODULE_NAME "[KHOFMANN TFDi MD-11 Load Manager] "
#define VERSION_STRING "2.9-beta"
// COMM BUS
#define COMM_BUS_LIVE_DATA_EVENT "khofmann_tfdi_md-11_load_manager_live_data"
#define COMM_BUS_UPDATE_TARGET_EVENT "khofmann_tfdi_md-11_load_manager_update_target"
@@ -44,4 +41,3 @@ void commBusUpdateTargetCallback(const char *args, unsigned int size, void *ctx)
int receiveData(const char *buf);
void sendData();
void CALLBACK MyDispatchProc(SIMCONNECT_RECV *pData, DWORD cbData, void *pContext);
void log(FILE *file, const char *format, void *optionalElement = NULL);
+25
View File
@@ -0,0 +1,25 @@
#pragma once
#ifndef __INTELLISENSE__
#define MODULE_EXPORT __attribute__((visibility("default")))
#define MODULE_WASM_MODNAME(mod) __attribute__((import_module(mod)))
#else
#define MODULE_EXPORT
#define MODULE_WASM_MODNAME(mod)
#define __attribute__(x)
#define __restrict__
#endif
// C headers
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
// C++ headers
#include <ctime>
/******************************** Constants ********************************/
// Module identification
#define MODULE_NAME "[KHOFMANN TFDi MD-11 Load Manager] "
#define VERSION_STRING "2.40"
void toLog(FILE *file, const char *format, double *optional = nullptr);
@@ -20,6 +20,7 @@
#include <algorithm>
// Own headers
#include "fuel.h"
#include "log.h"
#include "shared.h"
/******************************** Constants ********************************/
@@ -146,9 +147,10 @@ void generatePayload(paxPayloadData_t *const targetPayload, const bool isImperia
// For Station Entry: CALL AFTER `generatePayload`
void normalisePayload(paxPayloadData_t *const targetPayload, const bool isImperial);
void calculateCGs(paxPayloadData_t *const targetPayload, const FuelData_t *const fuel, const bool isImperial);
void load(const paxPayloadData_t *const targetPayload, const HANDLE simConnect, const bool isImperial);
void unload(const HANDLE simConnect, const bool isER);
void load(const paxPayloadData_t *const targetPayload, const FuelData_t *const fuel, const HANDLE simConnect,
const bool isImperial);
void unload(const HANDLE simConnect, const FuelData_t *const fuel, const double empty, const bool isER);
// Based on ICAO/LH findings
const double PAX_WEIGHT(const bool isImperial, const UserOptions_t *const options);
double PAX_WEIGHT(const bool isImperial, const UserOptions_t *const options);
// Based on ICAO/LH findings
const double BAG_WEIGHT(const bool isImperial, const UserOptions_t *const options);
double BAG_WEIGHT(const bool isImperial, const UserOptions_t *const options);
@@ -45,6 +45,8 @@
#define MAX_CG 34.0
#define CG_TOLERANCE 0.05
// GSX States
#define GSX_SERVICE_IDLE 1
#define GSX_SERVICE_CALLED 4
#define GSX_SERVICE_ACTIVE 5
#define GSX_SERVICE_FINISHED 6
@@ -84,6 +86,8 @@ enum LOADING_STATES {
LOADING_STATE_DEBOARDED,
};
enum FUELING_STATES { FUELING_STATE_IDLE, FUELING_STATE_CALLED, FUELING_STATE_FUELING, FUELING_STATE_FUELED };
enum CALL_MODES {
CALL_MODE_SB_SET,
CALL_MODE_ZFW_SET,
@@ -106,13 +110,16 @@ typedef struct {
double couatlStarted; // boolean
double boardingState; // See manual, 5 => active
double deboardingState; // See manual, 5 => active
double refuelingState; // See manual, 5 => active
double passengersBoarded; // Num pax
double passengersDeboarded; // Num pax
double cargoBoarded; // In percent
double cargoDeboarded; // In percent
double fuelConnected; // boolean
// Additional properties
enum LOADING_STATES loadingState;
enum FUELING_STATES fuelingState;
} GSXData_t;
typedef struct {
+19 -148
View File
@@ -5,18 +5,10 @@
<Configuration>Debug</Configuration>
<Platform>MSFS</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|MSFS">
<Configuration>Release</Configuration>
<Platform>MSFS</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion>
@@ -29,26 +21,13 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|MSFS'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>MSFS</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>MSFS</PlatformToolset>
<PlatformToolset>MSFS2024</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|MSFS'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>MSFS</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>MSFS</PlatformToolset>
<PlatformToolset>MSFS2024</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
@@ -60,37 +39,20 @@
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|MSFS'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|MSFS'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|MSFS'">
<TargetExt>.wasm</TargetExt>
<GenerateManifest />
<LinkIncremental />
<IncludePath>$(MSFS_IncludePath)</IncludePath>
<TargetName>$(ProjectName)</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<TargetExt>.wasm</TargetExt>
<GenerateManifest />
<LinkIncremental />
<IncludePath>$(MSFS_IncludePath)</IncludePath>
<IncludePath>$(MSFS_IncludePath);$(ProjectDir)include</IncludePath>
<TargetName>$(ProjectName)</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|MSFS'">
<TargetExt>.wasm</TargetExt>
<IncludePath>$(MSFS_IncludePath)</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<TargetExt>.wasm</TargetExt>
<IncludePath>$(MSFS_IncludePath)</IncludePath>
<IncludePath>$(MSFS_IncludePath);$(ProjectDir)include</IncludePath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|MSFS'">
<ClCompile>
@@ -114,7 +76,8 @@
</BasicRuntimeChecks>
<LanguageStandard>stdcpp14</LanguageStandard>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<AdditionalOptions>/clang:-fstack-usage %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions>/clang:-Wall /clang:-Wextra /clang:-pedantic /clang:-Wno-missing-braces
/clang:-Wno-unused-const-variable /clang:-fstack-usage %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
<Link>
<SubSystem>
@@ -144,57 +107,6 @@
Powershell.exe -File .\copy-debug.ps1</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>
</SDLCheck>
<ConformanceMode>true</ConformanceMode>
<BufferSecurityCheck>false</BufferSecurityCheck>
<AdditionalIncludeDirectories>
</AdditionalIncludeDirectories>
<PreprocessorDefinitions>__wasi__;_STRING_H_CPLUSPLUS_98_CONFORMANCE_;_WCHAR_H_CPLUSPLUS_98_CONFORMANCE_;_LIBCPP_HAS_NO_THREADS;_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ShowIncludes>false</ShowIncludes>
<ExceptionHandling>false</ExceptionHandling>
<RuntimeTypeInfo>
</RuntimeTypeInfo>
<SupportJustMyCode>
</SupportJustMyCode>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<BasicRuntimeChecks>
</BasicRuntimeChecks>
<LanguageStandard>stdcpp14</LanguageStandard>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<SubSystem>
</SubSystem>
<AdditionalDependencies>
</AdditionalDependencies>
<IgnoreAllDefaultLibraries>
</IgnoreAllDefaultLibraries>
<NoEntryPoint>true</NoEntryPoint>
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
<RandomizedBaseAddress>
</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>
</ProgramDatabaseFile>
<ImportLibrary>
</ImportLibrary>
<ProfileGuidedDatabase>
</ProfileGuidedDatabase>
<AdditionalLibraryDirectories>
</AdditionalLibraryDirectories>
</Link>
<PostBuildEvent>
<Command>
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|MSFS'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
@@ -212,7 +124,8 @@ Powershell.exe -File .\copy-debug.ps1</Command>
<SupportJustMyCode>
</SupportJustMyCode>
<LanguageStandard>stdcpp14</LanguageStandard>
<AdditionalOptions>/clang:-fstack-usage %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions>/clang:-Wall /clang:-Wextra /clang:-pedantic /clang:-Wno-missing-braces
/clang:-Wno-unused-const-variable /clang:-fstack-usage %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
<Link>
<SubSystem>
@@ -240,62 +153,20 @@ Powershell.exe -File .\copy-debug.ps1</Command>
Powershell.exe -File .\copy-release.ps1</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>
</AdditionalIncludeDirectories>
<PreprocessorDefinitions>__wasi__;__wasm32__;_STRING_H_CPLUSPLUS_98_CONFORMANCE_;_WCHAR_H_CPLUSPLUS_98_CONFORMANCE_;_LIBCPP_NO_EXCEPTIONS;_LIBCPP_HAS_NO_THREADS;_LIBCPP_STD_VER=14;_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BufferSecurityCheck>false</BufferSecurityCheck>
<ExceptionHandling>false</ExceptionHandling>
<DebugInformationFormat>false</DebugInformationFormat>
<SupportJustMyCode>
</SupportJustMyCode>
<LanguageStandard>stdcpp14</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>
</SubSystem>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<IgnoreAllDefaultLibraries>
</IgnoreAllDefaultLibraries>
<NoEntryPoint>true</NoEntryPoint>
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
<RandomizedBaseAddress>
</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
<GenerateDebugInformation>false</GenerateDebugInformation>
<ProgramDatabaseFile>
</ProgramDatabaseFile>
<ImportLibrary>
</ImportLibrary>
<ProfileGuidedDatabase>
</ProfileGuidedDatabase>
<AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories>
</Link>
<PostBuildEvent>
<Command>
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="freighter.cpp" />
<ClCompile Include="load-manager.cpp" />
<ClCompile Include="pax.cpp" />
<ClCompile Include="fuel.cpp" />
<ClCompile Include="src/freighter.cpp" />
<ClCompile Include="src/load-manager.cpp" />
<ClCompile Include="src/log.cpp" />
<ClCompile Include="src/pax.cpp" />
<ClCompile Include="src/fuel.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="freighter.h" />
<ClInclude Include="load-manager.h" />
<ClInclude Include="pax.h" />
<ClInclude Include="shared.h" />
<ClInclude Include="fuel.h" />
<ClInclude Include="include/freighter.h" />
<ClInclude Include="include/load-manager.h" />
<ClInclude Include="include/log.h" />
<ClInclude Include="include/pax.h" />
<ClInclude Include="include/shared.h" />
<ClInclude Include="include/fuel.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
@@ -1,27 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ClCompile Include="load-manager.cpp">
<ClCompile Include="src/freighter.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="pax.cpp">
<ClCompile Include="src/load-manager.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="freighter.cpp">
<ClCompile Include="src/log.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src/pax.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src/fuel.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="pax.h">
<ClInclude Include="include/freighter.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="load-manager.h">
<ClInclude Include="include/load-manager.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="shared.h">
<ClInclude Include="include/log.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="freighter.h">
<ClInclude Include="include/pax.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include/shared.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include/fuel.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
+15
View File
@@ -0,0 +1,15 @@
{
"name": "wasm-module",
"version": "0.0.16",
"description": "Load Manager WASM module",
"scripts": {
"clean": "rimraf ../SimObjects/Airplanes/TFDi_Design_MD-11/panel/load-manager.wasm && rimraf MSFS",
"build": "MSBuild.exe ./load-manager.sln /p:Platform=MSFS",
"build:rel": "MSBuild.exe ./load-manager.sln /p:Platform=MSFS /p:Configuration=Release",
"release": "pnpm clean && npm version patch && pnpm build:rel && node stack-analysis"
},
"keywords": [],
"author": "Kilian Kurt Hofmann",
"license": "MIT",
"packageManager": "pnpm@10.25.0"
}
@@ -22,7 +22,7 @@ void distribute(fPayloadData_t *const targetPayload, const FuelData_t *const fue
unsigned short _cargo = 0;
unsigned int count = MAX_UPPER_CARGO(userData->isImperial) * 4 + MAX_FRONT_CARGO(userData->isImperial) +
MAX_REAR_CARGO(userData->isImperial, userData->isER);
// Initial distributiob
// Initial distribution
while (cargo > 0 && count > 0) {
if (cargo >= 6) {
if (targetPayload->stations.upper1 < MAX_UPPER_CARGO(userData->isImperial)) {
@@ -126,7 +126,7 @@ void distribute(fPayloadData_t *const targetPayload, const FuelData_t *const fue
count = MAX_UPPER_CARGO(userData->isImperial) * 4 + MAX_FRONT_CARGO(userData->isImperial) +
MAX_REAR_CARGO(userData->isImperial, userData->isER);
while (count > 0) {
generatePayload(targetPayload, userData->isImperial);
generatePayload(targetPayload);
calculateCGs(targetPayload, fuel, userData->isImperial);
// in front of target
@@ -181,7 +181,7 @@ void distribute(fPayloadData_t *const targetPayload, const FuelData_t *const fue
// Refinement cargo
count = MAX_FRONT_CARGO(userData->isImperial) + MAX_REAR_CARGO(userData->isImperial, userData->isER);
while (count > 0) {
generatePayload(targetPayload, userData->isImperial);
generatePayload(targetPayload);
calculateCGs(targetPayload, fuel, userData->isImperial);
// in front of target
@@ -211,7 +211,7 @@ void distribute(fPayloadData_t *const targetPayload, const FuelData_t *const fue
// Updates pax stations with their respective weights
// Used internally and used for Station Entry (pax only, cargo is set directly)
void generatePayload(fPayloadData_t *const targetPayload, const bool isImperial) {
void generatePayload(fPayloadData_t *const targetPayload) {
targetPayload->upper1Left = targetPayload->upper1Right = (targetPayload->stations.upper1 / 2.0);
targetPayload->upper2Left = targetPayload->upper2Right = (targetPayload->stations.upper2 / 2.0);
targetPayload->upper3Left = targetPayload->upper3Right = (targetPayload->stations.upper3 / 2.0);
@@ -275,25 +275,33 @@ void calculateCGs(fPayloadData_t *const targetPayload, const FuelData_t *const f
targetPayload->TOCG = TO_PERCENT_MAC(totalMoment / totalWeight);
}
void load(const fPayloadData_t *const targetPayload, const HANDLE simConnect, const bool isImperial) {
void load(const fPayloadData_t *const targetPayload, const FuelData_t *const fuel, const HANDLE simConnect,
const bool isImperial) {
fPayloadData_t localPayload = {};
memcpy(&localPayload, targetPayload, sizeof(localPayload));
normalisePayload(&localPayload, isImperial);
calculateCGs(&localPayload, fuel, isImperial);
localPayload._ZFWCG = localPayload.ZFWCG / 100.0;
SimConnect_SetDataOnSimObject(simConnect, DATA_DEFINITION_PAYLOAD_F, SIMCONNECT_OBJECT_ID_USER, 0, 0, sizeof(fPayloadDataSet_t),
&localPayload);
toLog(stdout, "Payload set with ZFWCG: %f.\n", &localPayload.ZFWCG);
SimConnect_SetDataOnSimObject(simConnect, DATA_DEFINITION_PAYLOAD_F, SIMCONNECT_OBJECT_ID_USER_AIRCRAFT, 0, 0,
sizeof(fPayloadDataSet_t), &localPayload);
}
void unloadF(const HANDLE simConnect, const bool isER) {
void unloadF(const HANDLE simConnect, const FuelData_t *const fuel, const double empty, const bool isER) {
fPayloadData_t localPayload = {};
localPayload.empty = empty;
localPayload.leftAux = localPayload.rightAux = isER ? AUX_WEIGHT(true) : 0;
localPayload.pilot = localPayload.firstOfficer = localPayload.engineer = PILOT_WEIGHT(true);
localPayload._ZFWCG = -1;
calculateCGs(&localPayload, fuel, true);
localPayload._ZFWCG = localPayload.ZFWCG / 100.0;
SimConnect_SetDataOnSimObject(simConnect, DATA_DEFINITION_PAYLOAD_F, SIMCONNECT_OBJECT_ID_USER, 0, 0, sizeof(fPayloadDataSet_t),
&localPayload);
toLog(stdout, "Payload set with ZFWCG: %f.\n", &localPayload.ZFWCG);
SimConnect_SetDataOnSimObject(simConnect, DATA_DEFINITION_PAYLOAD_F, SIMCONNECT_OBJECT_ID_USER_AIRCRAFT, 0, 0,
sizeof(fPayloadDataSet_t), &localPayload);
}
@@ -1,8 +1,7 @@
#include "fuel.h"
// ZFW Entry
void distribute(FuelData_t *const targetFuel, const double fuelTarget, const UserData_t *const userData) {
double fuelLbs = TO_POUNDS(userData->isImperial, fuelTarget);
void distribute(FuelData_t *const targetFuel, const double fuelTarget, const bool isImperial, const bool isER) {
double fuelLbs = TO_POUNDS(isImperial, fuelTarget);
// Equal mains
if (fuelLbs <= MAX_TANK_1_3_LBS * 3) {
@@ -98,7 +97,7 @@ void distribute(FuelData_t *const targetFuel, const double fuelTarget, const Use
targetFuel->forwardAux1 = 0;
targetFuel->forwardAux2 = 0;
} else if (userData->isER) {
} else if (isER) {
targetFuel->main1 = MAX_TANK_1_3_MAIN_LBS;
targetFuel->main3 = MAX_TANK_1_3_MAIN_LBS;
targetFuel->main1Tip = MAX_TANK_1_3_TIP_LBS;
@@ -118,6 +117,10 @@ void distribute(FuelData_t *const targetFuel, const double fuelTarget, const Use
targetFuel->forwardAux2;
}
void distribute(FuelData_t *const targetFuel, const double fuelTarget, const UserData_t *const userData) {
distribute(targetFuel, fuelTarget, userData->isImperial, userData->isER);
}
void fuel(const FuelData_t *const targetFuel, const HANDLE simConnect) {
FuelDataSet_t localFuel = {};
@@ -130,6 +133,6 @@ void fuel(const FuelData_t *const targetFuel, const HANDLE simConnect) {
localFuel.forwardAux1 = min(MAX_FWD_AUX_GAL, targetFuel->forwardAux1 / LBS_PER_GAL);
localFuel.forwardAux2 = min(MAX_FWD_AUX_GAL, targetFuel->forwardAux2 / LBS_PER_GAL);
SimConnect_SetDataOnSimObject(simConnect, DATA_DEFINITION_FUEL_SET, SIMCONNECT_OBJECT_ID_USER, 0, 0, sizeof(FuelDataSet_t),
&localFuel);
SimConnect_SetDataOnSimObject(simConnect, DATA_DEFINITION_FUEL_SET, SIMCONNECT_OBJECT_ID_USER_AIRCRAFT, 0, 0,
sizeof(FuelDataSet_t), &localFuel);
}
@@ -15,22 +15,14 @@ bool AircraftLoaded;
// Operational
bool commBusCallbackRegistered;
HANDLE simConnect;
FILE *logFile;
MODULE_VAR tick18 = {TICK18};
#pragma region Module callbacks
// Init
extern "C" MSFS_CALLBACK void module_init(void) {
log(stdout, "Starting init.\n");
toLog(stdout, "Starting init.\n");
logFile = fopen("\\work\\log.txt", "w");
if (logFile == NULL) {
log(stderr, "Error creating logfile.\n");
}
log(stdout, "Logfile created.\n");
log(stdout, "WASM Version " VERSION_STRING " startup.\n");
toLog(stdout, "WASM Version " VERSION_STRING " startup.\n");
UserData = new UserData_t();
GSXData = new GSXData_t();
@@ -55,478 +47,492 @@ extern "C" MSFS_CALLBACK void module_init(void) {
HRESULT hr;
hr = SimConnect_Open(&simConnect, "KHOFMANN TFDi MD-11 Load Manager", nullptr, 0, 0, 0);
if (hr != S_OK) {
log(stderr, "Could not open SimConnect connection, terminating.\n");
toLog(stderr, "Could not open SimConnect connection, terminating.\n");
return;
}
// SimConnect Empty Weight data definition
hr = SimConnect_AddToDataDefinition(simConnect, DATA_DEFINITION_EMPTY_WEIGHT, "EMPTY WEIGHT", "pounds",
SIMCONNECT_DATATYPE_FLOAT64);
if (hr != S_OK) {
log(stderr, "Could not add EMPTY WEIGHT to data definition, terminating.\n");
toLog(stderr, "Could not add EMPTY WEIGHT to data definition, terminating.\n");
return;
}
// SimConnect Pax/F Weight data definition
hr = SimConnect_AddToDataDefinition(simConnect, DATA_DEFINITION_PAYLOAD_PAX, "PAYLOAD STATION WEIGHT:1", "pounds",
SIMCONNECT_DATATYPE_FLOAT64);
if (hr != S_OK) {
log(stderr, "Could not add PAYLOAD STATION WEIGHT:1 to PAX data definition, terminating.\n");
toLog(stderr, "Could not add PAYLOAD STATION WEIGHT:1 to PAX data definition, terminating.\n");
return;
}
hr = SimConnect_AddToDataDefinition(simConnect, DATA_DEFINITION_PAYLOAD_F, "PAYLOAD STATION WEIGHT:1", "pounds",
SIMCONNECT_DATATYPE_FLOAT64);
if (hr != S_OK) {
log(stderr, "Could not add PAYLOAD STATION WEIGHT:1 to F data definition, terminating.\n");
toLog(stderr, "Could not add PAYLOAD STATION WEIGHT:1 to F data definition, terminating.\n");
return;
}
hr = SimConnect_AddToDataDefinition(simConnect, DATA_DEFINITION_PAYLOAD_PAX, "PAYLOAD STATION WEIGHT:2", "pounds",
SIMCONNECT_DATATYPE_FLOAT64);
if (hr != S_OK) {
log(stderr, "Could not add PAYLOAD STATION WEIGHT:2 to PAX data definition, terminating.\n");
toLog(stderr, "Could not add PAYLOAD STATION WEIGHT:2 to PAX data definition, terminating.\n");
return;
}
hr = SimConnect_AddToDataDefinition(simConnect, DATA_DEFINITION_PAYLOAD_F, "PAYLOAD STATION WEIGHT:2", "pounds",
SIMCONNECT_DATATYPE_FLOAT64);
if (hr != S_OK) {
log(stderr, "Could not add PAYLOAD STATION WEIGHT:2 to F data definition, terminating.\n");
toLog(stderr, "Could not add PAYLOAD STATION WEIGHT:2 to F data definition, terminating.\n");
return;
}
hr = SimConnect_AddToDataDefinition(simConnect, DATA_DEFINITION_PAYLOAD_PAX, "PAYLOAD STATION WEIGHT:3", "pounds",
SIMCONNECT_DATATYPE_FLOAT64);
if (hr != S_OK) {
log(stderr, "Could not add PAYLOAD STATION WEIGHT:3 to PAX data definition, terminating.\n");
toLog(stderr, "Could not add PAYLOAD STATION WEIGHT:3 to PAX data definition, terminating.\n");
return;
}
hr = SimConnect_AddToDataDefinition(simConnect, DATA_DEFINITION_PAYLOAD_F, "PAYLOAD STATION WEIGHT:3", "pounds",
SIMCONNECT_DATATYPE_FLOAT64);
if (hr != S_OK) {
log(stderr, "Could not add PAYLOAD STATION WEIGHT:3 to F data definition, terminating.\n");
toLog(stderr, "Could not add PAYLOAD STATION WEIGHT:3 to F data definition, terminating.\n");
return;
}
hr = SimConnect_AddToDataDefinition(simConnect, DATA_DEFINITION_PAYLOAD_PAX, "PAYLOAD STATION WEIGHT:4", "pounds",
SIMCONNECT_DATATYPE_FLOAT64);
if (hr != S_OK) {
log(stderr, "Could not add PAYLOAD STATION WEIGHT:4 to PAX data definition, terminating.\n");
toLog(stderr, "Could not add PAYLOAD STATION WEIGHT:4 to PAX data definition, terminating.\n");
return;
}
hr = SimConnect_AddToDataDefinition(simConnect, DATA_DEFINITION_PAYLOAD_F, "PAYLOAD STATION WEIGHT:4", "pounds",
SIMCONNECT_DATATYPE_FLOAT64);
if (hr != S_OK) {
log(stderr, "Could not add PAYLOAD STATION WEIGHT:4 to F data definition, terminating.\n");
toLog(stderr, "Could not add PAYLOAD STATION WEIGHT:4 to F data definition, terminating.\n");
return;
}
hr = SimConnect_AddToDataDefinition(simConnect, DATA_DEFINITION_PAYLOAD_PAX, "PAYLOAD STATION WEIGHT:5", "pounds",
SIMCONNECT_DATATYPE_FLOAT64);
if (hr != S_OK) {
log(stderr, "Could not add PAYLOAD STATION WEIGHT:5 to PAX data definition, terminating.\n");
toLog(stderr, "Could not add PAYLOAD STATION WEIGHT:5 to PAX data definition, terminating.\n");
return;
}
hr = SimConnect_AddToDataDefinition(simConnect, DATA_DEFINITION_PAYLOAD_F, "PAYLOAD STATION WEIGHT:5", "pounds",
SIMCONNECT_DATATYPE_FLOAT64);
if (hr != S_OK) {
log(stderr, "Could not add PAYLOAD STATION WEIGHT:5 to F data definition, terminating.\n");
toLog(stderr, "Could not add PAYLOAD STATION WEIGHT:5 to F data definition, terminating.\n");
return;
}
hr = SimConnect_AddToDataDefinition(simConnect, DATA_DEFINITION_PAYLOAD_PAX, "PAYLOAD STATION WEIGHT:6", "pounds",
SIMCONNECT_DATATYPE_FLOAT64);
if (hr != S_OK) {
log(stderr, "Could not add PAYLOAD STATION WEIGHT:6 to PAX data definition, terminating.\n");
toLog(stderr, "Could not add PAYLOAD STATION WEIGHT:6 to PAX data definition, terminating.\n");
return;
}
hr = SimConnect_AddToDataDefinition(simConnect, DATA_DEFINITION_PAYLOAD_F, "PAYLOAD STATION WEIGHT:6", "pounds",
SIMCONNECT_DATATYPE_FLOAT64);
if (hr != S_OK) {
log(stderr, "Could not add PAYLOAD STATION WEIGHT:6 to F data definition, terminating.\n");
toLog(stderr, "Could not add PAYLOAD STATION WEIGHT:6 to F data definition, terminating.\n");
return;
}
hr = SimConnect_AddToDataDefinition(simConnect, DATA_DEFINITION_PAYLOAD_PAX, "PAYLOAD STATION WEIGHT:7", "pounds",
SIMCONNECT_DATATYPE_FLOAT64);
if (hr != S_OK) {
log(stderr, "Could not add PAYLOAD STATION WEIGHT:7 to PAX data definition, terminating.\n");
toLog(stderr, "Could not add PAYLOAD STATION WEIGHT:7 to PAX data definition, terminating.\n");
return;
}
hr = SimConnect_AddToDataDefinition(simConnect, DATA_DEFINITION_PAYLOAD_F, "PAYLOAD STATION WEIGHT:7", "pounds",
SIMCONNECT_DATATYPE_FLOAT64);
if (hr != S_OK) {
log(stderr, "Could not add PAYLOAD STATION WEIGHT:7 to F data definition, terminating.\n");
toLog(stderr, "Could not add PAYLOAD STATION WEIGHT:7 to F data definition, terminating.\n");
return;
}
hr = SimConnect_AddToDataDefinition(simConnect, DATA_DEFINITION_PAYLOAD_PAX, "PAYLOAD STATION WEIGHT:8", "pounds",
SIMCONNECT_DATATYPE_FLOAT64);
if (hr != S_OK) {
log(stderr, "Could not add PAYLOAD STATION WEIGHT:8 to PAX data definition, terminating.\n");
toLog(stderr, "Could not add PAYLOAD STATION WEIGHT:8 to PAX data definition, terminating.\n");
return;
}
hr = SimConnect_AddToDataDefinition(simConnect, DATA_DEFINITION_PAYLOAD_F, "PAYLOAD STATION WEIGHT:8", "pounds",
SIMCONNECT_DATATYPE_FLOAT64);
if (hr != S_OK) {
log(stderr, "Could not add PAYLOAD STATION WEIGHT:8 to F data definition, terminating.\n");
toLog(stderr, "Could not add PAYLOAD STATION WEIGHT:8 to F data definition, terminating.\n");
return;
}
hr = SimConnect_AddToDataDefinition(simConnect, DATA_DEFINITION_PAYLOAD_PAX, "PAYLOAD STATION WEIGHT:9", "pounds",
SIMCONNECT_DATATYPE_FLOAT64);
if (hr != S_OK) {
log(stderr, "Could not add PAYLOAD STATION WEIGHT:9 to PAX data definition, terminating.\n");
toLog(stderr, "Could not add PAYLOAD STATION WEIGHT:9 to PAX data definition, terminating.\n");
return;
}
hr = SimConnect_AddToDataDefinition(simConnect, DATA_DEFINITION_PAYLOAD_F, "PAYLOAD STATION WEIGHT:9", "pounds",
SIMCONNECT_DATATYPE_FLOAT64);
if (hr != S_OK) {
log(stderr, "Could not add PAYLOAD STATION WEIGHT:9 to F data definition, terminating.\n");
toLog(stderr, "Could not add PAYLOAD STATION WEIGHT:9 to F data definition, terminating.\n");
return;
}
hr = SimConnect_AddToDataDefinition(simConnect, DATA_DEFINITION_PAYLOAD_PAX, "PAYLOAD STATION WEIGHT:10", "pounds",
SIMCONNECT_DATATYPE_FLOAT64);
if (hr != S_OK) {
log(stderr, "Could not add PAYLOAD STATION WEIGHT:10 to PAX data definition, terminating.\n");
toLog(stderr, "Could not add PAYLOAD STATION WEIGHT:10 to PAX data definition, terminating.\n");
return;
}
hr = SimConnect_AddToDataDefinition(simConnect, DATA_DEFINITION_PAYLOAD_F, "PAYLOAD STATION WEIGHT:10", "pounds",
SIMCONNECT_DATATYPE_FLOAT64);
if (hr != S_OK) {
log(stderr, "Could not add PAYLOAD STATION WEIGHT:10 to F data definition, terminating.\n");
toLog(stderr, "Could not add PAYLOAD STATION WEIGHT:10 to F data definition, terminating.\n");
return;
}
hr = SimConnect_AddToDataDefinition(simConnect, DATA_DEFINITION_PAYLOAD_PAX, "PAYLOAD STATION WEIGHT:11", "pounds",
SIMCONNECT_DATATYPE_FLOAT64);
if (hr != S_OK) {
log(stderr, "Could not add PAYLOAD STATION WEIGHT:11 to PAX data definition, terminating.\n");
toLog(stderr, "Could not add PAYLOAD STATION WEIGHT:11 to PAX data definition, terminating.\n");
return;
}
hr = SimConnect_AddToDataDefinition(simConnect, DATA_DEFINITION_PAYLOAD_F, "PAYLOAD STATION WEIGHT:11", "pounds",
SIMCONNECT_DATATYPE_FLOAT64);
if (hr != S_OK) {
log(stderr, "Could not add PAYLOAD STATION WEIGHT:11 to F data definition, terminating.\n");
toLog(stderr, "Could not add PAYLOAD STATION WEIGHT:11 to F data definition, terminating.\n");
return;
}
hr = SimConnect_AddToDataDefinition(simConnect, DATA_DEFINITION_PAYLOAD_PAX, "PAYLOAD STATION WEIGHT:12", "pounds",
SIMCONNECT_DATATYPE_FLOAT64);
if (hr != S_OK) {
log(stderr, "Could not add PAYLOAD STATION WEIGHT:12 to PAX data definition, terminating.\n");
toLog(stderr, "Could not add PAYLOAD STATION WEIGHT:12 to PAX data definition, terminating.\n");
return;
}
hr = SimConnect_AddToDataDefinition(simConnect, DATA_DEFINITION_PAYLOAD_F, "PAYLOAD STATION WEIGHT:12", "pounds",
SIMCONNECT_DATATYPE_FLOAT64);
if (hr != S_OK) {
log(stderr, "Could not add PAYLOAD STATION WEIGHT:12 to F data definition, terminating.\n");
toLog(stderr, "Could not add PAYLOAD STATION WEIGHT:12 to F data definition, terminating.\n");
return;
}
hr = SimConnect_AddToDataDefinition(simConnect, DATA_DEFINITION_PAYLOAD_PAX, "PAYLOAD STATION WEIGHT:13", "pounds",
SIMCONNECT_DATATYPE_FLOAT64);
if (hr != S_OK) {
log(stderr, "Could not add PAYLOAD STATION WEIGHT:13 to PAX data definition, terminating.\n");
toLog(stderr, "Could not add PAYLOAD STATION WEIGHT:13 to PAX data definition, terminating.\n");
return;
}
hr = SimConnect_AddToDataDefinition(simConnect, DATA_DEFINITION_PAYLOAD_F, "PAYLOAD STATION WEIGHT:13", "pounds",
SIMCONNECT_DATATYPE_FLOAT64);
if (hr != S_OK) {
log(stderr, "Could not add PAYLOAD STATION WEIGHT:13 to F data definition, terminating.\n");
toLog(stderr, "Could not add PAYLOAD STATION WEIGHT:13 to F data definition, terminating.\n");
return;
}
hr = SimConnect_AddToDataDefinition(simConnect, DATA_DEFINITION_PAYLOAD_PAX, "PAYLOAD STATION WEIGHT:14", "pounds",
SIMCONNECT_DATATYPE_FLOAT64);
if (hr != S_OK) {
log(stderr, "Could not add PAYLOAD STATION WEIGHT:14 to PAX data definition, terminating.\n");
toLog(stderr, "Could not add PAYLOAD STATION WEIGHT:14 to PAX data definition, terminating.\n");
return;
}
hr = SimConnect_AddToDataDefinition(simConnect, DATA_DEFINITION_PAYLOAD_F, "PAYLOAD STATION WEIGHT:14", "pounds",
SIMCONNECT_DATATYPE_FLOAT64);
if (hr != S_OK) {
log(stderr, "Could not add PAYLOAD STATION WEIGHT:14 to F data definition, terminating.\n");
toLog(stderr, "Could not add PAYLOAD STATION WEIGHT:14 to F data definition, terminating.\n");
return;
}
hr = SimConnect_AddToDataDefinition(simConnect, DATA_DEFINITION_PAYLOAD_PAX, "PAYLOAD STATION WEIGHT:15", "pounds",
SIMCONNECT_DATATYPE_FLOAT64);
if (hr != S_OK) {
log(stderr, "Could not add PAYLOAD STATION WEIGHT:15 to PAX data definition, terminating.\n");
toLog(stderr, "Could not add PAYLOAD STATION WEIGHT:15 to PAX data definition, terminating.\n");
return;
}
hr = SimConnect_AddToDataDefinition(simConnect, DATA_DEFINITION_PAYLOAD_F, "PAYLOAD STATION WEIGHT:15", "pounds",
SIMCONNECT_DATATYPE_FLOAT64);
if (hr != S_OK) {
log(stderr, "Could not add PAYLOAD STATION WEIGHT:15 to F data definition, terminating.\n");
toLog(stderr, "Could not add PAYLOAD STATION WEIGHT:15 to F data definition, terminating.\n");
return;
}
hr = SimConnect_AddToDataDefinition(simConnect, DATA_DEFINITION_PAYLOAD_F, "L:MD11_EXTCTL_WBS_ZFWCG", "number",
SIMCONNECT_DATATYPE_FLOAT64);
if (hr != S_OK) {
log(stderr, "Could not add L:MD11_EXTCTL_WBS_ZFWCG to F data definition, terminating.\n");
toLog(stderr, "Could not add L:MD11_EXTCTL_WBS_ZFWCG to F data definition, terminating.\n");
return;
}
hr = SimConnect_AddToDataDefinition(simConnect, DATA_DEFINITION_PAYLOAD_PAX, "PAYLOAD STATION WEIGHT:16", "pounds",
SIMCONNECT_DATATYPE_FLOAT64);
if (hr != S_OK) {
log(stderr, "Could not add PAYLOAD STATION WEIGHT:16 to PAX data definition, terminating.\n");
toLog(stderr, "Could not add PAYLOAD STATION WEIGHT:16 to PAX data definition, terminating.\n");
return;
}
hr = SimConnect_AddToDataDefinition(simConnect, DATA_DEFINITION_PAYLOAD_PAX, "PAYLOAD STATION WEIGHT:17", "pounds",
SIMCONNECT_DATATYPE_FLOAT64);
if (hr != S_OK) {
log(stderr, "Could not add PAYLOAD STATION WEIGHT:17 to PAX data definition, terminating.\n");
toLog(stderr, "Could not add PAYLOAD STATION WEIGHT:17 to PAX data definition, terminating.\n");
return;
}
hr = SimConnect_AddToDataDefinition(simConnect, DATA_DEFINITION_PAYLOAD_PAX, "PAYLOAD STATION WEIGHT:18", "pounds",
SIMCONNECT_DATATYPE_FLOAT64);
if (hr != S_OK) {
log(stderr, "Could not add PAYLOAD STATION WEIGHT:18 to PAX data definition, terminating.\n");
toLog(stderr, "Could not add PAYLOAD STATION WEIGHT:18 to PAX data definition, terminating.\n");
return;
}
hr = SimConnect_AddToDataDefinition(simConnect, DATA_DEFINITION_PAYLOAD_PAX, "PAYLOAD STATION WEIGHT:19", "pounds",
SIMCONNECT_DATATYPE_FLOAT64);
if (hr != S_OK) {
log(stderr, "Could not add PAYLOAD STATION WEIGHT:19 to PAX data definition, terminating.\n");
toLog(stderr, "Could not add PAYLOAD STATION WEIGHT:19 to PAX data definition, terminating.\n");
return;
}
hr = SimConnect_AddToDataDefinition(simConnect, DATA_DEFINITION_PAYLOAD_PAX, "PAYLOAD STATION WEIGHT:20", "pounds",
SIMCONNECT_DATATYPE_FLOAT64);
if (hr != S_OK) {
log(stderr, "Could not add PAYLOAD STATION WEIGHT:20 to PAX data definition, terminating.\n");
toLog(stderr, "Could not add PAYLOAD STATION WEIGHT:20 to PAX data definition, terminating.\n");
return;
}
hr = SimConnect_AddToDataDefinition(simConnect, DATA_DEFINITION_PAYLOAD_PAX, "PAYLOAD STATION WEIGHT:21", "pounds",
SIMCONNECT_DATATYPE_FLOAT64);
if (hr != S_OK) {
log(stderr, "Could not add PAYLOAD STATION WEIGHT:21 to PAX data definition, terminating.\n");
toLog(stderr, "Could not add PAYLOAD STATION WEIGHT:21 to PAX data definition, terminating.\n");
return;
}
hr = SimConnect_AddToDataDefinition(simConnect, DATA_DEFINITION_PAYLOAD_PAX, "L:MD11_EXTCTL_WBS_ZFWCG", "number",
SIMCONNECT_DATATYPE_FLOAT64);
if (hr != S_OK) {
log(stderr, "Could not add L:MD11_EXTCTL_WBS_ZFWCG to PAX data definition, terminating.\n");
toLog(stderr, "Could not add L:MD11_EXTCTL_WBS_ZFWCG to PAX data definition, terminating.\n");
return;
}
// SimConnect Fuel data definition
hr = SimConnect_AddToDataDefinition(simConnect, DATA_DEFINITION_FUEL, "FUEL TANK LEFT MAIN QUANTITY", "gallons",
SIMCONNECT_DATATYPE_FLOAT64);
if (hr != S_OK) {
log(stderr, "Could not add FUEL TANK LEFT MAIN QUANTITY to data definition, terminating.\n");
toLog(stderr, "Could not add FUEL TANK LEFT MAIN QUANTITY to data definition, terminating.\n");
return;
}
hr = SimConnect_AddToDataDefinition(simConnect, DATA_DEFINITION_FUEL, "FUEL TANK RIGHT MAIN QUANTITY", "gallons",
SIMCONNECT_DATATYPE_FLOAT64);
if (hr != S_OK) {
log(stderr, "Could not add FUEL TANK RIGHT MAIN QUANTITY to data definition, terminating.\n");
toLog(stderr, "Could not add FUEL TANK RIGHT MAIN QUANTITY to data definition, terminating.\n");
return;
}
hr = SimConnect_AddToDataDefinition(simConnect, DATA_DEFINITION_FUEL, "FUEL TANK CENTER QUANTITY", "gallons",
SIMCONNECT_DATATYPE_FLOAT64);
if (hr != S_OK) {
log(stderr, "Could not add FUEL TANK CENTER QUANTITY to data definition, terminating.\n");
toLog(stderr, "Could not add FUEL TANK CENTER QUANTITY to data definition, terminating.\n");
return;
}
hr = SimConnect_AddToDataDefinition(simConnect, DATA_DEFINITION_FUEL, "FUEL TANK CENTER2 QUANTITY", "gallons",
SIMCONNECT_DATATYPE_FLOAT64);
if (hr != S_OK) {
log(stderr, "Could not add FUEL TANK CENTER2 QUANTITY to data definition, terminating.\n");
toLog(stderr, "Could not add FUEL TANK CENTER2 QUANTITY to data definition, terminating.\n");
return;
}
hr = SimConnect_AddToDataDefinition(simConnect, DATA_DEFINITION_FUEL, "FUEL TANK CENTER3 QUANTITY", "gallons",
SIMCONNECT_DATATYPE_FLOAT64);
if (hr != S_OK) {
log(stderr, "Could not add FUEL TANK CENTER3 QUANTITY to data definition, terminating.\n");
toLog(stderr, "Could not add FUEL TANK CENTER3 QUANTITY to data definition, terminating.\n");
return;
}
hr = SimConnect_AddToDataDefinition(simConnect, DATA_DEFINITION_FUEL, "FUEL TANK LEFT TIP QUANTITY", "gallons",
SIMCONNECT_DATATYPE_FLOAT64);
if (hr != S_OK) {
log(stderr, "Could not add FUEL TANK LEFT TIP QUANTITY to data definition, terminating.\n");
toLog(stderr, "Could not add FUEL TANK LEFT TIP QUANTITY to data definition, terminating.\n");
return;
}
hr = SimConnect_AddToDataDefinition(simConnect, DATA_DEFINITION_FUEL, "FUEL TANK RIGHT TIP QUANTITY", "gallons",
SIMCONNECT_DATATYPE_FLOAT64);
if (hr != S_OK) {
log(stderr, "Could not add FUEL TANK RIGHT TIP QUANTITY to data definition, terminating.\n");
toLog(stderr, "Could not add FUEL TANK RIGHT TIP QUANTITY to data definition, terminating.\n");
return;
}
hr = SimConnect_AddToDataDefinition(simConnect, DATA_DEFINITION_FUEL, "FUEL TANK EXTERNAL1 QUANTITY", "gallons",
SIMCONNECT_DATATYPE_FLOAT64);
if (hr != S_OK) {
log(stderr, "Could not add FUEL TANK EXTERNAL1 QUANTITY to data definition, terminating.\n");
toLog(stderr, "Could not add FUEL TANK EXTERNAL1 QUANTITY to data definition, terminating.\n");
return;
}
hr = SimConnect_AddToDataDefinition(simConnect, DATA_DEFINITION_FUEL, "FUEL TANK LEFT AUX QUANTITY", "gallons",
SIMCONNECT_DATATYPE_FLOAT64);
if (hr != S_OK) {
log(stderr, "Could not add FUEL TANK LEFT AUX QUANTITY to data definition, terminating.\n");
toLog(stderr, "Could not add FUEL TANK LEFT AUX QUANTITY to data definition, terminating.\n");
return;
}
hr = SimConnect_AddToDataDefinition(simConnect, DATA_DEFINITION_FUEL, "FUEL TANK RIGHT AUX QUANTITY", "gallons",
SIMCONNECT_DATATYPE_FLOAT64);
if (hr != S_OK) {
log(stderr, "Could not add FUEL TANK RIGHT AUX QUANTITY to data definition, terminating.\n");
toLog(stderr, "Could not add FUEL TANK RIGHT AUX QUANTITY to data definition, terminating.\n");
return;
}
// SimConnect Fuel Set data definition
hr = SimConnect_AddToDataDefinition(simConnect, DATA_DEFINITION_FUEL_SET, "L:MD11_EXTCTL_FUEL_TANK1", "number",
SIMCONNECT_DATATYPE_FLOAT64);
if (hr != S_OK) {
log(stderr, "Could not add L:MD11_EXTCTL_FUEL_TANK1 to data definition, terminating.\n");
toLog(stderr, "Could not add L:MD11_EXTCTL_FUEL_TANK1 to data definition, terminating.\n");
return;
}
hr = SimConnect_AddToDataDefinition(simConnect, DATA_DEFINITION_FUEL_SET, "L:MD11_EXTCTL_FUEL_TANK3", "number",
SIMCONNECT_DATATYPE_FLOAT64);
if (hr != S_OK) {
log(stderr, "Could not add L:MD11_EXTCTL_FUEL_TANK3 to data definition, terminating.\n");
toLog(stderr, "Could not add L:MD11_EXTCTL_FUEL_TANK3 to data definition, terminating.\n");
return;
}
hr = SimConnect_AddToDataDefinition(simConnect, DATA_DEFINITION_FUEL_SET, "L:MD11_EXTCTL_FUEL_TANK2", "number",
SIMCONNECT_DATATYPE_FLOAT64);
if (hr != S_OK) {
log(stderr, "Could not add L:MD11_EXTCTL_FUEL_TANK2 to data definition, terminating.\n");
toLog(stderr, "Could not add L:MD11_EXTCTL_FUEL_TANK2 to data definition, terminating.\n");
return;
}
hr = SimConnect_AddToDataDefinition(simConnect, DATA_DEFINITION_FUEL_SET, "L:MD11_EXTCTL_FUEL_AUXUPR", "number",
SIMCONNECT_DATATYPE_FLOAT64);
if (hr != S_OK) {
log(stderr, "Could not add L:MD11_EXTCTL_FUEL_AUXUPR to data definition, terminating.\n");
toLog(stderr, "Could not add L:MD11_EXTCTL_FUEL_AUXUPR to data definition, terminating.\n");
return;
}
hr = SimConnect_AddToDataDefinition(simConnect, DATA_DEFINITION_FUEL_SET, "L:MD11_EXTCTL_FUEL_AUXLWR", "number",
SIMCONNECT_DATATYPE_FLOAT64);
if (hr != S_OK) {
log(stderr, "Could not add L:MD11_EXTCTL_FUEL_AUXLWR to data definition, terminating.\n");
toLog(stderr, "Could not add L:MD11_EXTCTL_FUEL_AUXLWR to data definition, terminating.\n");
return;
}
hr = SimConnect_AddToDataDefinition(simConnect, DATA_DEFINITION_FUEL_SET, "L:MD11_EXTCTL_FUEL_TAIL", "number",
SIMCONNECT_DATATYPE_FLOAT64);
if (hr != S_OK) {
log(stderr, "Could not add L:MD11_EXTCTL_FUEL_TAIL to data definition, terminating.\n");
toLog(stderr, "Could not add L:MD11_EXTCTL_FUEL_TAIL to data definition, terminating.\n");
return;
}
hr = SimConnect_AddToDataDefinition(simConnect, DATA_DEFINITION_FUEL_SET, "L:MD11_EXTCTL_FUEL_FWDAUXL", "number",
SIMCONNECT_DATATYPE_FLOAT64);
if (hr != S_OK) {
log(stderr, "Could not add L:MD11_EXTCTL_FUEL_FWDAUXL to data definition, terminating.\n");
toLog(stderr, "Could not add L:MD11_EXTCTL_FUEL_FWDAUXL to data definition, terminating.\n");
return;
}
hr = SimConnect_AddToDataDefinition(simConnect, DATA_DEFINITION_FUEL_SET, "L:MD11_EXTCTL_FUEL_FWDAUXR", "number",
SIMCONNECT_DATATYPE_FLOAT64);
if (hr != S_OK) {
log(stderr, "Could not add L:MD11_EXTCTL_FUEL_FWDAUXR to data definition, terminating.\n");
toLog(stderr, "Could not add L:MD11_EXTCTL_FUEL_FWDAUXR to data definition, terminating.\n");
return;
}
// GSX LVars
hr = SimConnect_AddToDataDefinition(simConnect, DATA_DEFINITION_GSX, "L:FSDT_GSX_COUATL_STARTED", "number",
SIMCONNECT_DATATYPE_FLOAT64);
if (hr != S_OK) {
log(stderr, "Could not add L:FSDT_GSX_COUATL_STARTED to data definition, terminating.\n");
toLog(stderr, "Could not add L:FSDT_GSX_COUATL_STARTED to data definition, terminating.\n");
return;
}
hr = SimConnect_AddToDataDefinition(simConnect, DATA_DEFINITION_GSX, "L:FSDT_GSX_BOARDING_STATE", "number",
SIMCONNECT_DATATYPE_FLOAT64);
if (hr != S_OK) {
log(stderr, "Could not add L:FSDT_GSX_BOARDING_STATE to data definition, terminating.\n");
toLog(stderr, "Could not add L:FSDT_GSX_BOARDING_STATE to data definition, terminating.\n");
return;
}
hr = SimConnect_AddToDataDefinition(simConnect, DATA_DEFINITION_GSX, "L:FSDT_GSX_DEBOARDING_STATE", "number",
SIMCONNECT_DATATYPE_FLOAT64);
if (hr != S_OK) {
log(stderr, "Could not add L:FSDT_GSX_DEBOARDING_STATE to data definition, terminating.\n");
toLog(stderr, "Could not add L:FSDT_GSX_DEBOARDING_STATE to data definition, terminating.\n");
return;
}
hr = SimConnect_AddToDataDefinition(simConnect, DATA_DEFINITION_GSX, "L:FSDT_GSX_REFUELING_STATE", "number",
SIMCONNECT_DATATYPE_FLOAT64);
if (hr != S_OK) {
toLog(stderr, "Could not add L:FSDT_GSX_REFUELING_STATE to data definition, terminating.\n");
return;
}
hr = SimConnect_AddToDataDefinition(simConnect, DATA_DEFINITION_GSX, "L:FSDT_GSX_NUMPASSENGERS_BOARDING_TOTAL", "number",
SIMCONNECT_DATATYPE_FLOAT64);
if (hr != S_OK) {
log(stderr, "Could not add L:FSDT_GSX_NUMPASSENGERS_BOARDING_TOTAL to data definition, terminating.\n");
toLog(stderr, "Could not add L:FSDT_GSX_NUMPASSENGERS_BOARDING_TOTAL to data definition, terminating.\n");
return;
}
hr = SimConnect_AddToDataDefinition(simConnect, DATA_DEFINITION_GSX, "L:FSDT_GSX_NUMPASSENGERS_DEBOARDING_TOTAL", "number",
SIMCONNECT_DATATYPE_FLOAT64);
if (hr != S_OK) {
log(stderr, "Could not add L:FSDT_GSX_NUMPASSENGERS_DEBOARDING_TOTAL to data definition, terminating.\n");
toLog(stderr, "Could not add L:FSDT_GSX_NUMPASSENGERS_DEBOARDING_TOTAL to data definition, terminating.\n");
return;
}
hr = SimConnect_AddToDataDefinition(simConnect, DATA_DEFINITION_GSX, "L:FSDT_GSX_BOARDING_CARGO_PERCENT", "number",
SIMCONNECT_DATATYPE_FLOAT64);
if (hr != S_OK) {
log(stderr, "Could not add L:FSDT_GSX_BOARDING_CARGO_PERCENT to data definition, terminating.\n");
toLog(stderr, "Could not add L:FSDT_GSX_BOARDING_CARGO_PERCENT to data definition, terminating.\n");
return;
}
hr = SimConnect_AddToDataDefinition(simConnect, DATA_DEFINITION_GSX, "L:FSDT_GSX_DEBOARDING_CARGO_PERCENT", "number",
SIMCONNECT_DATATYPE_FLOAT64);
if (hr != S_OK) {
log(stderr, "Could not add L:FSDT_GSX_DEBOARDING_CARGO_PERCENT to data definition, terminating.\n");
toLog(stderr, "Could not add L:FSDT_GSX_DEBOARDING_CARGO_PERCENT to data definition, terminating.\n");
return;
}
hr = SimConnect_AddToDataDefinition(simConnect, DATA_DEFINITION_GSX, "L:FSDT_GSX_FUELHOSE_CONNECTED", "number",
SIMCONNECT_DATATYPE_FLOAT64);
if (hr != S_OK) {
toLog(stderr, "Could not add L:FSDT_GSX_FUELHOSE_CONNECTED to data definition, terminating.\n");
return;
}
// User LVars
hr = SimConnect_AddToDataDefinition(simConnect, DATA_DEFINITION_USER_DATA, "L:MD11_EFB_IS_CARGO", "bool",
SIMCONNECT_DATATYPE_FLOAT64);
if (hr != S_OK) {
log(stderr, "Could not add L:MD11_EFB_IS_CARGO to data definition, terminating.\n");
toLog(stderr, "Could not add L:MD11_EFB_IS_CARGO to data definition, terminating.\n");
return;
}
hr =
SimConnect_AddToDataDefinition(simConnect, DATA_DEFINITION_USER_DATA, "L:MD11_OPT_ER", "bool", SIMCONNECT_DATATYPE_FLOAT64);
if (hr != S_OK) {
log(stderr, "Could not add L:MD11_OPT_ER to data definition, terminating.\n");
toLog(stderr, "Could not add L:MD11_OPT_ER to data definition, terminating.\n");
return;
}
hr = SimConnect_AddToDataDefinition(simConnect, DATA_DEFINITION_USER_DATA, "L:MD11_EFB_OPTIONS_GENERAL", "number",
SIMCONNECT_DATATYPE_FLOAT64);
if (hr != S_OK) {
log(stderr, "Could not add L:MD11_EFB_OPTIONS_GENERAL to data definition, terminating.\n");
toLog(stderr, "Could not add L:MD11_EFB_OPTIONS_GENERAL to data definition, terminating.\n");
return;
}
log(stdout, "Data definitions created.\n");
toLog(stdout, "Data definitions created.\n");
// SimConnect Requests
hr = SimConnect_RequestDataOnSimObject(simConnect, DATA_REQUEST_EMPTY_WEIGHT, DATA_DEFINITION_EMPTY_WEIGHT,
SIMCONNECT_OBJECT_ID_USER, SIMCONNECT_PERIOD_VISUAL_FRAME,
SIMCONNECT_OBJECT_ID_USER_AIRCRAFT, SIMCONNECT_PERIOD_VISUAL_FRAME,
SIMCONNECT_DATA_REQUEST_FLAG_CHANGED);
if (hr != S_OK) {
log(stderr, "Could not request empty weight, terminating.\n");
toLog(stderr, "Could not request empty weight, terminating.\n");
return;
}
hr = SimConnect_RequestDataOnSimObject(simConnect, DATA_REQUEST_PAYLOAD_PAX, DATA_DEFINITION_PAYLOAD_PAX,
SIMCONNECT_OBJECT_ID_USER, SIMCONNECT_PERIOD_VISUAL_FRAME,
SIMCONNECT_OBJECT_ID_USER_AIRCRAFT, SIMCONNECT_PERIOD_VISUAL_FRAME,
SIMCONNECT_DATA_REQUEST_FLAG_CHANGED);
if (hr != S_OK) {
log(stderr, "Could not request payload pax, terminating.\n");
toLog(stderr, "Could not request payload pax, terminating.\n");
return;
}
hr = SimConnect_RequestDataOnSimObject(simConnect, DATA_REQUEST_PAYLOAD_F, DATA_DEFINITION_PAYLOAD_F, SIMCONNECT_OBJECT_ID_USER,
SIMCONNECT_PERIOD_VISUAL_FRAME, SIMCONNECT_DATA_REQUEST_FLAG_CHANGED);
hr = SimConnect_RequestDataOnSimObject(simConnect, DATA_REQUEST_PAYLOAD_F, DATA_DEFINITION_PAYLOAD_F,
SIMCONNECT_OBJECT_ID_USER_AIRCRAFT, SIMCONNECT_PERIOD_VISUAL_FRAME,
SIMCONNECT_DATA_REQUEST_FLAG_CHANGED);
if (hr != S_OK) {
log(stderr, "Could not request payload f, terminating.\n");
toLog(stderr, "Could not request payload f, terminating.\n");
return;
}
hr = SimConnect_RequestDataOnSimObject(simConnect, DATA_REQUEST_FUEL, DATA_DEFINITION_FUEL, SIMCONNECT_OBJECT_ID_USER,
hr = SimConnect_RequestDataOnSimObject(simConnect, DATA_REQUEST_FUEL, DATA_DEFINITION_FUEL, SIMCONNECT_OBJECT_ID_USER_AIRCRAFT,
SIMCONNECT_PERIOD_VISUAL_FRAME, SIMCONNECT_DATA_REQUEST_FLAG_CHANGED);
if (hr != S_OK) {
log(stderr, "Could not request fuel, terminating.\n");
toLog(stderr, "Could not request fuel, terminating.\n");
return;
}
hr = SimConnect_RequestDataOnSimObject(simConnect, DATA_REQUEST_GSX, DATA_DEFINITION_GSX, SIMCONNECT_OBJECT_ID_USER,
hr = SimConnect_RequestDataOnSimObject(simConnect, DATA_REQUEST_GSX, DATA_DEFINITION_GSX, SIMCONNECT_OBJECT_ID_USER_AIRCRAFT,
SIMCONNECT_PERIOD_VISUAL_FRAME, SIMCONNECT_DATA_REQUEST_FLAG_CHANGED);
if (hr != S_OK) {
log(stderr, "Could not request GSX, terminating.\n");
toLog(stderr, "Could not request GSX, terminating.\n");
return;
}
hr = SimConnect_RequestDataOnSimObject(simConnect, DATA_REQUEST_USER_DATA, DATA_DEFINITION_USER_DATA, SIMCONNECT_OBJECT_ID_USER,
SIMCONNECT_PERIOD_VISUAL_FRAME, SIMCONNECT_DATA_REQUEST_FLAG_CHANGED);
hr = SimConnect_RequestDataOnSimObject(simConnect, DATA_REQUEST_USER_DATA, DATA_DEFINITION_USER_DATA,
SIMCONNECT_OBJECT_ID_USER_AIRCRAFT, SIMCONNECT_PERIOD_VISUAL_FRAME,
SIMCONNECT_DATA_REQUEST_FLAG_CHANGED);
if (hr != S_OK) {
log(stderr, "Could not request user data, terminating.\n");
toLog(stderr, "Could not request user data, terminating.\n");
return;
}
log(stdout, "Requests created.\n");
toLog(stdout, "Requests created.\n");
hr = SimConnect_CallDispatch(simConnect, MyDispatchProc, nullptr);
if (hr != S_OK) {
log(stderr, "Could not set dispatch proc, terminating.\n");
toLog(stderr, "Could not set dispatch proc, terminating.\n");
return;
}
log(stdout, "Callback created.\n");
toLog(stdout, "Callback created.\n");
#pragma endregion
// CommBus
if (!fsCommBusRegister(COMM_BUS_UPDATE_TARGET_EVENT, commBusUpdateTargetCallback)) {
log(stderr, "Could not register CommBus, terminating.\n");
toLog(stderr, "Could not register CommBus, terminating.\n");
return;
} else {
log(stdout, "CommBus registered.\n");
toLog(stdout, "CommBus registered.\n");
}
// Options
@@ -543,12 +549,12 @@ extern "C" MSFS_CALLBACK void module_init(void) {
if (optionsDoc.HasMember("bagWeightLBS")) UserOptions->bagWeightLBS = optionsDoc["bagWeightLBS"].GetDouble();
fclose(optionsFile);
log(stdout, "Options loaded.\n");
toLog(stdout, "Options loaded.\n");
} else {
log(stdout, "Options file not present, skip.\n");
toLog(stdout, "Options file not present, skip.\n");
}
log(stdout, "Initialized.\n");
toLog(stdout, "Initialized.\n");
}
// Deinit
@@ -556,10 +562,10 @@ extern "C" MSFS_CALLBACK void module_deinit(void) {
HRESULT hr;
hr = SimConnect_Close(simConnect);
if (hr != S_OK) {
log(stderr, "Failed to close SimConnect.\n");
toLog(stderr, "Failed to close SimConnect.\n");
}
log(stdout, "SimConnect closed.\n");
toLog(stdout, "SimConnect closed.\n");
delete UserData;
delete GSXData;
@@ -571,11 +577,11 @@ extern "C" MSFS_CALLBACK void module_deinit(void) {
delete targetFuelData;
delete UserOptions;
log(stdout, "Global memory released.\n");
toLog(stdout, "Global memory released.\n");
fsCommBusUnregister(COMM_BUS_UPDATE_TARGET_EVENT, commBusUpdateTargetCallback);
log(stdout, "CommBus unregistered.\n");
toLog(stdout, "CommBus unregistered.\n");
// Options
rapidjson::Document optionsDoc;
@@ -594,23 +600,55 @@ extern "C" MSFS_CALLBACK void module_deinit(void) {
optionsDoc.Accept(writer);
fclose(optionsFile);
log(stdout, "Options written.\n");
toLog(stdout, "Options written.\n");
} else {
log(stdout, "Filed to open options file for write, skip.\n");
toLog(stdout, "Filed to open options file for write, skip.\n");
}
log(stdout, "Deinitialized.\n");
toLog(stdout, "Deinitialized.\n");
}
// Main loop
extern "C" MSFS_CALLBACK bool Load_Manager_gauge_callback(FsContext ctx, int service_id, void *pData) {
switch (service_id) {
case PANEL_SERVICE_PRE_UPDATE: {
lookup_var(&tick18);
if (fmod(tick18.var_value.n, 3) == 0) sendData();
extern "C" MSFS_CALLBACK bool Load_Manager_gauge_update(FsContext ctx, float dT) {
static double dataTimer = 0;
static double fuelTimer = 0;
if (dataTimer >= 0.25) {
sendData();
dataTimer = 0;
} else {
dataTimer += dT;
}
// Terminate
if (GSXData->fuelingState == FUELING_STATE_FUELING && abs(liveFuelData->total - targetFuelData->total) < 1) {
GSXData->fuelingState = FUELING_STATE_FUELED;
fuel(targetFuelData, simConnect);
}
FuelData_t toSet = {};
// Force set to lower before connection
if (GSXData->fuelingState == FUELING_STATE_CALLED && targetFuelData->total <= liveFuelData->total) {
distribute(&toSet, max(0, targetFuelData->total - 10000), true, UserData->isER);
fuel(&toSet, simConnect);
}
// Fuel
else if (GSXData->fuelingState == FUELING_STATE_FUELING && GSXData->fuelConnected > 0) {
if (fuelTimer >= 0.5) {
distribute(&toSet,
min(targetFuelData->total,
liveFuelData->total + min(max(targetFuelData->total - liveFuelData->total, 1), FUELING_RATE) * fuelTimer),
true, UserData->isER);
fuel(&toSet, simConnect);
fuelTimer = 0;
} else {
fuelTimer += dT;
}
default:
break;
}
return true;
@@ -620,8 +658,8 @@ extern "C" MSFS_CALLBACK bool Load_Manager_gauge_callback(FsContext ctx, int ser
// CommBus
void commBusUpdateTargetCallback(const char *args, unsigned int size, void *ctx) {
int hr = receiveData(args);
log(stdout, "Target update request exited with: %d.\n", (void *)hr);
double hr = (double)receiveData(args);
toLog(stdout, "Target update request exited with: %f.\n", &hr);
}
#pragma region JSON data handling
@@ -700,7 +738,7 @@ int receiveData(const char *buf) {
double fuelTarget = document["fuelTarget"].GetDouble();
distribute(targetFuelData, fuelTarget, UserData);
generatePayload(targetFPayloadData, UserData->isImperial);
generatePayload(targetFPayloadData);
} else {
if (!document.HasMember("business1") || !document.HasMember("business2") || !document.HasMember("economy1") ||
!document.HasMember("economy2") || !document.HasMember("forwardCargo") || !document.HasMember("rearCargo") ||
@@ -723,10 +761,10 @@ int receiveData(const char *buf) {
case CALL_MODE_LOAD_SET: {
if (UserData->isCargo) {
fuel(targetFuelData, simConnect);
load(targetFPayloadData, simConnect, UserData->isImperial);
load(targetFPayloadData, targetFuelData, simConnect, UserData->isImperial);
} else {
fuel(targetFuelData, simConnect);
load(targetPaxPayloadData, simConnect, UserData->isImperial);
load(targetPaxPayloadData, targetFuelData, simConnect, UserData->isImperial);
}
AircraftLoaded = true;
@@ -735,9 +773,9 @@ int receiveData(const char *buf) {
}
case CALL_MODE_UNLOAD_SET: {
if (UserData->isCargo) {
unloadF(simConnect, UserData->isER);
unloadF(simConnect, liveFuelData, liveFPayloadData->empty, UserData->isER);
} else {
unload(simConnect, UserData->isER);
unload(simConnect, liveFuelData, livePaxPayloadData->empty, UserData->isER);
}
AircraftLoaded = false;
@@ -775,12 +813,13 @@ int receiveData(const char *buf) {
optionsDoc.Accept(writer);
fclose(optionsFile);
log(stdout, "Options written.\n");
toLog(stdout, "Options written.\n");
}
break;
}
case CALL_MODE_GSX_RESET: {
GSXData->loadingState = LOADING_STATE_IDLE;
GSXData->fuelingState = FUELING_STATE_IDLE;
UserOptions->GSXSync = false;
}
default:
@@ -943,6 +982,7 @@ void sendData() {
// GSX
GSX.AddMember<bool>("couatlStarted", GSXData->couatlStarted, allocator);
GSX.AddMember("loadingState", GSXData->loadingState, allocator);
GSX.AddMember("fuelingState", GSXData->fuelingState, allocator);
// User Data
userData.AddMember<bool>("isCargo", UserData->isCargo, allocator);
@@ -1012,35 +1052,6 @@ void sendData() {
#pragma endregion
// Logfile
void log(FILE *file, const char *format, void *optionalElement) {
if (logFile != NULL) {
time_t rawtime;
time(&rawtime);
char *_new = (char *)calloc(strlen(format) + 24 + 1, sizeof(char));
if (_new == NULL) {
fprintf(stderr, MODULE_NAME "Failed to allocate string for log.\n");
return;
}
strftime(_new, 24, "%FT%TZ | ", gmtime(&rawtime));
strncat(_new, format, strlen(format));
fprintf(logFile, _new, optionalElement);
fflush(logFile);
free(_new);
}
char *_new = (char *)calloc(strlen(format) + strlen(MODULE_NAME) + 1, sizeof(char));
if (_new == NULL) {
fprintf(stderr, MODULE_NAME "Failed to allocate string for internal console.\n");
return;
}
strncpy(_new, MODULE_NAME, strlen(MODULE_NAME));
strncat(_new, format, strlen(format));
fprintf(file, _new, optionalElement);
free(_new);
}
// SimConnect
void CALLBACK MyDispatchProc(SIMCONNECT_RECV *pData, DWORD cbData, void *pContext) {
@@ -1051,6 +1062,8 @@ void CALLBACK MyDispatchProc(SIMCONNECT_RECV *pData, DWORD cbData, void *pContex
case DATA_REQUEST_EMPTY_WEIGHT: {
liveFPayloadData->empty = livePaxPayloadData->empty = *((double *)&pObjData->dwData);
targetFPayloadData->empty = targetPaxPayloadData->empty = FROM_POUNDS(UserData->isImperial, liveFPayloadData->empty);
break;
}
case DATA_REQUEST_PAYLOAD_F: {
@@ -1066,9 +1079,9 @@ void CALLBACK MyDispatchProc(SIMCONNECT_RECV *pData, DWORD cbData, void *pContex
if (UserData->isCargo && AircraftLoaded &&
abs(liveFPayloadData->total - TO_POUNDS(UserData->isImperial, targetFPayloadData->total)) > 100) {
log(stdout, "F AC loaded, Payload mismatch, resetting target\n");
toLog(stdout, "F AC loaded, Payload mismatch, resetting target\n");
load(targetFPayloadData, simConnect, UserData->isImperial);
load(targetFPayloadData, liveFuelData, simConnect, UserData->isImperial);
}
break;
@@ -1087,14 +1100,11 @@ void CALLBACK MyDispatchProc(SIMCONNECT_RECV *pData, DWORD cbData, void *pContex
livePaxPayloadData->forwardCargo + livePaxPayloadData->rearCargo + livePaxPayloadData->leftAux +
livePaxPayloadData->rightAux;
double curr = livePaxPayloadData->total;
double target = TO_POUNDS(UserData->isImperial, targetPaxPayloadData->total);
double diff = livePaxPayloadData->total - TO_POUNDS(UserData->isImperial, targetPaxPayloadData->total);
if (!UserData->isCargo && AircraftLoaded &&
abs(livePaxPayloadData->total - TO_POUNDS(UserData->isImperial, targetPaxPayloadData->total)) > 100) {
log(stdout, "PAX AC loaded, Payload mismatch, resetting target\n");
toLog(stdout, "PAX AC loaded, Payload mismatch, resetting target\n");
load(targetPaxPayloadData, simConnect, UserData->isImperial);
load(targetPaxPayloadData, liveFuelData, simConnect, UserData->isImperial);
}
break;
@@ -1122,10 +1132,12 @@ void CALLBACK MyDispatchProc(SIMCONNECT_RECV *pData, DWORD cbData, void *pContex
GSXData->couatlStarted = data->couatlStarted;
GSXData->boardingState = data->boardingState;
GSXData->deboardingState = data->deboardingState;
GSXData->refuelingState = data->refuelingState;
GSXData->passengersBoarded = data->passengersBoarded;
GSXData->passengersDeboarded = data->passengersDeboarded;
GSXData->cargoBoarded = data->cargoBoarded;
GSXData->cargoDeboarded = data->cargoDeboarded;
GSXData->fuelConnected = data->fuelConnected;
if (UserOptions->GSXSync && GSXData->couatlStarted == 1) {
switch ((char)GSXData->boardingState) {
@@ -1146,8 +1158,8 @@ void CALLBACK MyDispatchProc(SIMCONNECT_RECV *pData, DWORD cbData, void *pContex
localPayload.lowerForward = targetFPayloadData->lowerForward * (cargoBoarded / 100);
localPayload.lowerRear = targetFPayloadData->lowerRear * (cargoBoarded / 100);
generatePayload(&localPayload, UserData->isImperial);
load(&localPayload, simConnect, UserData->isImperial);
generatePayload(&localPayload);
load(&localPayload, liveFuelData, simConnect, UserData->isImperial);
} else {
double passengersBoarded = GSXData->passengersBoarded;
paxPayloadData_t localPayload = {};
@@ -1165,7 +1177,7 @@ void CALLBACK MyDispatchProc(SIMCONNECT_RECV *pData, DWORD cbData, void *pContex
localPayload.rearCargo = targetPaxPayloadData->rearCargo * (cargoBoarded / 100);
generatePayload(&localPayload, UserData->isImperial, UserOptions);
load(&localPayload, simConnect, UserData->isImperial);
load(&localPayload, liveFuelData, simConnect, UserData->isImperial);
}
break;
@@ -1179,14 +1191,14 @@ void CALLBACK MyDispatchProc(SIMCONNECT_RECV *pData, DWORD cbData, void *pContex
fPayloadData_t localPayload = {};
memcpy(&localPayload, targetFPayloadData, sizeof(localPayload));
generatePayload(&localPayload, UserData->isImperial);
load(&localPayload, simConnect, UserData->isImperial);
generatePayload(&localPayload);
load(&localPayload, liveFuelData, simConnect, UserData->isImperial);
} else {
paxPayloadData_t localPayload = {};
memcpy(&localPayload, targetPaxPayloadData, sizeof(localPayload));
generatePayload(&localPayload, UserData->isImperial, UserOptions);
load(&localPayload, simConnect, UserData->isImperial);
load(&localPayload, liveFuelData, simConnect, UserData->isImperial);
}
break;
@@ -1215,8 +1227,8 @@ void CALLBACK MyDispatchProc(SIMCONNECT_RECV *pData, DWORD cbData, void *pContex
localPayload.lowerForward -= targetFPayloadData->lowerForward * (cargoDeboarded / 100);
localPayload.lowerRear -= targetFPayloadData->lowerRear * (cargoDeboarded / 100);
generatePayload(&localPayload, UserData->isImperial);
load(&localPayload, simConnect, UserData->isImperial);
generatePayload(&localPayload);
load(&localPayload, liveFuelData, simConnect, UserData->isImperial);
} else {
double passengersDeboarded = GSXData->passengersDeboarded;
paxPayloadData_t localPayload = {};
@@ -1234,7 +1246,7 @@ void CALLBACK MyDispatchProc(SIMCONNECT_RECV *pData, DWORD cbData, void *pContex
localPayload.rearCargo -= targetPaxPayloadData->rearCargo * (cargoDeboarded / 100);
generatePayload(&localPayload, UserData->isImperial, UserOptions);
load(&localPayload, simConnect, UserData->isImperial);
load(&localPayload, liveFuelData, simConnect, UserData->isImperial);
}
break;
@@ -1256,8 +1268,8 @@ void CALLBACK MyDispatchProc(SIMCONNECT_RECV *pData, DWORD cbData, void *pContex
localPayload.lowerForward = 0;
localPayload.lowerRear = 0;
generatePayload(&localPayload, UserData->isImperial);
load(&localPayload, simConnect, UserData->isImperial);
generatePayload(&localPayload);
load(&localPayload, liveFuelData, simConnect, UserData->isImperial);
} else {
paxPayloadData_t localPayload = {};
memcpy(&localPayload, targetPaxPayloadData, sizeof(localPayload));
@@ -1270,7 +1282,7 @@ void CALLBACK MyDispatchProc(SIMCONNECT_RECV *pData, DWORD cbData, void *pContex
localPayload.rearCargo = 0;
generatePayload(&localPayload, UserData->isImperial, UserOptions);
load(&localPayload, simConnect, UserData->isImperial);
load(&localPayload, liveFuelData, simConnect, UserData->isImperial);
}
break;
@@ -1278,6 +1290,31 @@ void CALLBACK MyDispatchProc(SIMCONNECT_RECV *pData, DWORD cbData, void *pContex
default:
break;
}
switch ((char)GSXData->refuelingState) {
case GSX_SERVICE_IDLE: {
GSXData->fuelingState = FUELING_STATE_IDLE;
break;
}
case GSX_SERVICE_CALLED: {
GSXData->fuelingState = FUELING_STATE_CALLED;
break;
}
case GSX_SERVICE_ACTIVE: {
GSXData->fuelingState = FUELING_STATE_FUELING;
break;
}
case GSX_SERVICE_FINISHED: {
GSXData->fuelingState = FUELING_STATE_FUELED;
fuel(targetFuelData, simConnect);
break;
}
default:
break;
}
}
break;
@@ -1313,7 +1350,8 @@ void CALLBACK MyDispatchProc(SIMCONNECT_RECV *pData, DWORD cbData, void *pContex
}
case SIMCONNECT_RECV_ID_EXCEPTION: {
SIMCONNECT_RECV_EXCEPTION *pEx = (SIMCONNECT_RECV_EXCEPTION *)pData;
log(stderr, "SimConnect Exception: %i\n", &pEx->dwException);
double code = pEx->dwException;
toLog(stderr, "SimConnect Exception: %f\n", &code);
break;
}
+49
View File
@@ -0,0 +1,49 @@
#include "log.h"
void toLog(FILE *file, const char *format, double *optional) {
static FILE *logFile;
static bool logFileFailed = false;
if (logFile == NULL) {
logFile = fopen("\\work\\toLog.txt", "w");
if (logFile == NULL) {
logFileFailed = true;
toLog(stderr, "Error creating logfile.\n");
} else {
toLog(stdout, "Logfile created.\n");
}
}
if (!logFileFailed) {
time_t rawtime;
time(&rawtime);
char *_new = (char *)calloc(strlen(format) + 24 + 1, sizeof(char));
if (_new == NULL) {
fprintf(stderr, MODULE_NAME "Failed to allocate string for toLog.\n");
return;
}
strftime(_new, 24, "%FT%TZ | ", gmtime(&rawtime));
strncat(_new, format, strlen(format));
if (optional != nullptr) fprintf(logFile, _new, *optional);
else
fprintf(logFile, _new);
fflush(logFile);
free(_new);
}
char *_new = (char *)calloc(strlen(format) + strlen(MODULE_NAME) + 1, sizeof(char));
if (_new == NULL) {
fprintf(stderr, MODULE_NAME "Failed to allocate string for internal console.\n");
return;
}
strncpy(_new, MODULE_NAME, strlen(MODULE_NAME));
strncat(_new, format, strlen(format));
if (optional != nullptr) fprintf(file, _new, *optional);
else
fprintf(file, _new);
free(_new);
}
@@ -291,35 +291,43 @@ void calculateCGs(paxPayloadData_t *const targetPayload, const FuelData_t *const
targetPayload->TOCG = TO_PERCENT_MAC(totalMoment / totalWeight);
}
void load(const paxPayloadData_t *const targetPayload, const HANDLE simConnect, const bool isImperial) {
void load(const paxPayloadData_t *const targetPayload, const FuelData_t *const fuel, const HANDLE simConnect,
const bool isImperial) {
paxPayloadData_t localPayload = {};
memcpy(&localPayload, targetPayload, sizeof(localPayload));
normalisePayload(&localPayload, isImperial);
calculateCGs(&localPayload, fuel, isImperial);
localPayload._ZFWCG = localPayload.ZFWCG / 100.0;
SimConnect_SetDataOnSimObject(simConnect, DATA_DEFINITION_PAYLOAD_PAX, SIMCONNECT_OBJECT_ID_USER, 0, 0,
toLog(stdout, "Payload set with ZFWCG: %f.\n", &localPayload.ZFWCG);
SimConnect_SetDataOnSimObject(simConnect, DATA_DEFINITION_PAYLOAD_PAX, SIMCONNECT_OBJECT_ID_USER_AIRCRAFT, 0, 0,
sizeof(paxPayloadDataSet_t), &localPayload);
}
void unload(const HANDLE simConnect, const bool isER) {
void unload(const HANDLE simConnect, const FuelData_t *const fuel, const double empty, const bool isER) {
paxPayloadData_t localPayload = {};
localPayload.empty = empty;
localPayload.cabinCrewFront = FRONT_CREW_WEIGHT(true);
localPayload.cabinCrewRear = REAR_CREW_WEIGHT(true);
localPayload.leftAux = localPayload.rightAux = isER ? AUX_WEIGHT(true) : 0;
localPayload.pilot = localPayload.firstOfficer = localPayload.engineer = PILOT_WEIGHT(true);
localPayload._ZFWCG = -1;
calculateCGs(&localPayload, fuel, true);
localPayload._ZFWCG = localPayload.ZFWCG / 100.0;
SimConnect_SetDataOnSimObject(simConnect, DATA_DEFINITION_PAYLOAD_PAX, SIMCONNECT_OBJECT_ID_USER, 0, 0,
toLog(stdout, "Payload set with ZFWCG: %f.\n", &localPayload.ZFWCG);
SimConnect_SetDataOnSimObject(simConnect, DATA_DEFINITION_PAYLOAD_PAX, SIMCONNECT_OBJECT_ID_USER_AIRCRAFT, 0, 0,
sizeof(paxPayloadDataSet_t), &localPayload);
}
const double PAX_WEIGHT(const bool isImperial, const UserOptions_t *const options) {
double PAX_WEIGHT(const bool isImperial, const UserOptions_t *const options) {
return (isImperial) ? (options->paxWeightLBS) : (options->paxWeightKG);
}
const double BAG_WEIGHT(const bool isImperial, const UserOptions_t *const options) {
double BAG_WEIGHT(const bool isImperial, const UserOptions_t *const options) {
return (isImperial) ? (options->bagWeightLBS) : (options->bagWeightKG);
}
@@ -0,0 +1,64 @@
const fs = require('fs');
const path = require('path');
const BASE_DIRS = ['.'];
let THRESHOLD = parseInt(process.argv.at(-1) ?? 2048);
THRESHOLD = isNaN(THRESHOLD) ? 2048 : THRESHOLD;
console.log(`Threshold at ${THRESHOLD} bytes`);
let LEVEL =
process.argv.includes('--level') ? process.argv[process.argv.findIndex((p) => p === '--level') + 1] : undefined;
if (LEVEL !== 'info') LEVEL = undefined;
console.log(`Log level ${LEVEL ?? 'default'}`);
BASE_DIRS.forEach((BASE_DIR) => {
console.log(`Analysis for ${BASE_DIR}`);
const output = fs.openSync(path.join(BASE_DIR, 'stack-analysis.log'), 'w');
let functions = [];
let files = fs.readdirSync(BASE_DIR);
files = files.filter((file) => file.endsWith('.su'));
files.forEach((file) => {
const content = fs.readFileSync(path.join(BASE_DIR, file), {
encoding: 'utf8',
});
const _functions = content.split('\n');
_functions.forEach((_function) => {
const fields = _function.split('\t');
if (fields.length != 3) return;
functions.push({
name: fields[0],
cost: parseInt(fields[1]),
type: fields[2],
});
});
fs.unlinkSync(path.join(BASE_DIR, file));
});
functions = functions.sort((a, b) => b.cost - a.cost);
functions.forEach((_function) => {
if (_function.cost === THRESHOLD) {
console.warn(
`\x1b[33mFunction \x1b[1m${_function.name}\x1b[0m \x1b[33mat threshold (\x1b[1m${_function.cost}\x1b[0m\x1b[33m)\x1b[0m`
);
} else if (_function.cost >= THRESHOLD) {
console.error(
`\x1b[31mFunction \x1b[1m${_function.name}\x1b[0m \x1b[31mexceeds threshold (\x1b[1m${_function.cost}\x1b[0m\x1b[31m)\x1b[0m`
);
} else if (LEVEL === 'info') {
console.error(
`\x1b[32mFunction \x1b[1m${_function.name}\x1b[0m \x1b[32mbelow threshold (\x1b[1m${_function.cost}\x1b[0m\x1b[32m)\x1b[0m`
);
}
fs.writeSync(output, `${_function.cost}\t${_function.type}\t${_function.name}\n`, null, { encoding: 'utf8' });
});
fs.closeSync(output);
});
-20
View File
@@ -1,20 +0,0 @@
Fuel (once implemented)
ZFWCG for WBS (once implemented) `MD11_EXTCTL_WBS_ZFWCG`
https://discord.com/channels/589851727373795331/1165358675037270066/1469039399961497753
Fuel Schedule
Mains 1/2/3
Upper Aux
Lower Aux
Tail
LEft/Right Forward Aux
Fuel Limits from EFB
GSX Sync
When Fueling is called, fuel progressively using FuelDataSet_t and FUEL_SET enums
Find fueling rate of plane
In JS
Remove Set Fuel
Fuel is set with total load button
+19 -24
View File
@@ -1,45 +1,40 @@
const { applyPatch } = require("diff");
const fs = require("fs");
const util = require("node:util");
const exec = util.promisify(require("node:child_process").exec);
const readline = require("readline");
const { applyPatch } = require('diff');
const fs = require('fs');
const readline = require('readline');
const outPath =
"./PackageSources/html_ui/Pages/VCockpit/Instruments/aircraft_efb/KH_TFDi_MD11_efb";
const outPath = './PackageSources/html_ui/Pages/VCockpit/Instruments/aircraft_efb/KH_TFDi_MD11_efb';
fs.copyFileSync("./EFB/efb.css", `${outPath}/efb.css`);
let file1Contents = fs.readFileSync("./EFB/efb.js").toString();
let patch = fs.readFileSync("./EFB/efb-js.patch").toString();
let file1Contents = fs.readFileSync('./EFB/efb.js').toString();
let patch = fs.readFileSync('./EFB/efb-js.patch').toString();
let patchedFile = applyPatch(file1Contents, patch);
fs.writeFileSync(`${outPath}/efb.js`, patchedFile);
file1Contents = fs.readFileSync("./EFB/efb.index.js").toString();
patch = fs.readFileSync("./EFB/efb-index-js.patch").toString();
file1Contents = fs.readFileSync('./EFB/efb.index.js').toString();
patch = fs.readFileSync('./EFB/efb-index-js.patch').toString();
patchedFile = applyPatch(file1Contents, patch);
fs.writeFileSync(`${outPath}/efb.index.js`, patchedFile);
file1Contents = fs.readFileSync("./EFB/efb.html").toString();
patch = fs.readFileSync("./EFB/efb-html.patch").toString();
file1Contents = fs.readFileSync('./EFB/efb.html').toString();
patch = fs.readFileSync('./EFB/efb-html.patch').toString();
patchedFile = applyPatch(file1Contents, patch);
fs.writeFileSync(`${outPath}/efb.html`, patchedFile);
var output = "";
var output = '';
var lineReader = readline.createInterface({
input: fs.createReadStream(`${outPath}/App.js`),
});
lineReader.on("line", (line) => {
if (line.startsWith("import")) {
output += "// " + line + "\n";
} else if (line.startsWith("export")) {
output += "window.KH_LM = App;\n";
lineReader.on('line', (line) => {
if (line.startsWith('import')) {
output += '// ' + line + '\n';
} else if (line.startsWith('export')) {
output += 'window.KH_LM = App;\n';
} else {
output += line + "\n";
output += line + '\n';
}
});
lineReader.on("close", () => {
lineReader.on('close', () => {
fs.writeFile(`${outPath}/App.js`, output, (err) => {
if (err) console.log(err);
console.log("Import/Export removed.");
console.log('Import/Export removed.');
});
});
+19 -2
View File
@@ -1,9 +1,26 @@
{
"name": "xkhofmann-tfdidesign-md11-load-manager",
"version": "0.0.1",
"description": "TFDi MD11 Load Manager project",
"scripts": {
"debugger": "cd \"$env:MSFS_SDK/Tools/CoherentGT Debugger\" && ./Debugger.exe",
"locale": "cd \"$env:MSFS_SDK/Tools/MSFS_Localization\" && ./MSFSLocalizationManager.exe"
"locale": "cd \"$env:MSFS_SDK/Tools/MSFS_Localization\" && ./MSFSLocalizationManager.exe",
"build": "pnpm -r build",
"release": "pnpm -r release",
"archive:2024": "Compress-Archive -Path Packages/xkhofmann-tfdidesign-md11-load-manager -DestinationPath Packages/xkhofmann-tfdidesign-md11-load-manager",
"package": "rimraf Packages && pnpm release && & \"$env:MSFS2024_SDK/Tools/bin/fspackagetool.exe\" -nopause xkhofmann-tfdidesign-md11-load-manager.xml && pnpm archive:2024"
},
"keywords": [],
"author": "Kilian Kurt Hofmann",
"license": "MIT",
"packageManager": "pnpm@10.25.0",
"engines": {
"node": ">=22"
},
"devDependencies": {
"diff": "^8.0.2"
},
"dependencies": {
"rimraf": "^6.1.3"
}
}
}
+6012
View File
File diff suppressed because it is too large Load Diff
+3
View File
@@ -0,0 +1,3 @@
packages:
- PackageSources/js-bundle
- PackageSources/wasm-module
@@ -1,14 +1,15 @@
{
"folders": [
{
"path": "."
}
"path": ".",
},
],
"settings": {
"cSpell.words": [
"AUXLWR",
"AUXUPR",
"bksp",
"CMCDU",
"couatl",
"Deboarded",
"DEBOARDED",
@@ -17,13 +18,23 @@
"EXTCTL",
"FCOMs",
"FSDT",
"fspackagetool",
"FUELHOSE",
"FWDAUXL",
"FWDAUXR",
"HRESULT",
"htmlgauge",
"ISFD",
"khofmann",
"LEMAC",
"LMCDU",
"mbelow",
"mexceeds",
"msfs",
"MSFS",
"nopause",
"NUMPASSENGERS",
"RMCDU",
"SIMCONNECT",
"SIMOBJECT",
"SIMOBJECTS",
@@ -31,7 +42,10 @@
"TFDI",
"tfdidesign",
"TOCG",
"ZFWCG"
]
}
"Vcockpit",
"xkhofmann",
"XPNDR",
"ZFWCG",
],
},
}