1. Do not share user accounts! Any account that is shared by another person will be blocked and closed. This means: we will close not only the account that is shared, but also the main account of the user who uses another person's account. We have the ability to detect account sharing, so please do not try to cheat the system. This action will take place on 04/18/2023. Read all forum rules.
    Dismiss Notice
  2. For downloading SimTools plugins you need a Download Package. Get it with virtual coins that you receive for forum activity or Buy Download Package - We have a zero Spam tolerance so read our forum rules first.

    Buy Now a Download Plan!
  3. Do not try to cheat our system and do not post an unnecessary amount of useless posts only to earn credits here. We have a zero spam tolerance policy and this will cause a ban of your user account. Otherwise we wish you a pleasant stay here! Read the forum rules
  4. We have a few rules which you need to read and accept before posting anything here! Following these rules will keep the forum clean and your stay pleasant. Do not follow these rules can lead to permanent exclusion from this website: Read the forum rules.
    Are you a company? Read our company rules

How to use Prepar3D add-on DLL as data source

Discussion in 'FlyPt Mover' started by Vikkor Mallansohn, Dec 12, 2024.

Tags:
  1. Vikkor Mallansohn

    Vikkor Mallansohn New Member

    Joined:
    Dec 12, 2024
    Messages:
    15
    Location:
    Shanghai, China
    Balance:
    95Coins
    Ratings:
    +1 / 1 / -0
    My Motion Simulator:
    3DOF, AC motor, Motion platform, 6DOF
    To get data from P3D, I tried to configure the FlyPT_P3D_DLL.dll file in the FlyPT "Files for sources" folder.
    However, after exhaustedly tried every combination of dll.xml and SimConnect SDK, I eventually got an " Error loading dll" message in the Content errors.txt log file.

    Is there any instruction or clue on how to install and configure FlyPT_P3D_DLL.dll? And which version of P3D and SimConnect it supports?


    Thanks so much @pmvcda !
  2. Vikkor Mallansohn

    Vikkor Mallansohn New Member

    Joined:
    Dec 12, 2024
    Messages:
    15
    Location:
    Shanghai, China
    Balance:
    95Coins
    Ratings:
    +1 / 1 / -0
    My Motion Simulator:
    3DOF, AC motor, Motion platform, 6DOF
    I'm considering DLL version compatibility issues..... What's your Visual Studio version & compiler setting?
  3. pmvcda

    pmvcda aka FlyPT

    Joined:
    Nov 3, 2010
    Messages:
    2,159
    Location:
    Portugal
    Balance:
    15,270Coins
    Ratings:
    +2,534 / 17 / -0
    My Motion Simulator:
    6DOF
    Are you using Mover 3.7?
    If so, I will have a source for it soon.
    For the older Mover you have a dll in the zip.
  4. Vikkor Mallansohn

    Vikkor Mallansohn New Member

    Joined:
    Dec 12, 2024
    Messages:
    15
    Location:
    Shanghai, China
    Balance:
    95Coins
    Ratings:
    +1 / 1 / -0
    My Motion Simulator:
    3DOF, AC motor, Motion platform, 6DOF
    I'm using 3.5.3 and yes I have a dll in the zip, which is exactly FlyPT_P3D_DLL.dll .
    But I can't find any instruction on how to configure it (NEVER mentioned on flyptmover com-sources-games). Could tell me some clues? And which version of P3D it supports?
  5. pmvcda

    pmvcda aka FlyPT

    Joined:
    Nov 3, 2010
    Messages:
    2,159
    Location:
    Portugal
    Balance:
    15,270Coins
    Ratings:
    +2,534 / 17 / -0
    My Motion Simulator:
    6DOF
    Sorry, been some time i dont use 3.5.3 for p3d.
    Give me an hour, i will be at the pc and check it.
  6. Vikkor Mallansohn

    Vikkor Mallansohn New Member

    Joined:
    Dec 12, 2024
    Messages:
    15
    Location:
    Shanghai, China
    Balance:
    95Coins
    Ratings:
    +1 / 1 / -0
    My Motion Simulator:
    3DOF, AC motor, Motion platform, 6DOF
    Thank you and no hurry. ;- )
    It's bed time in my timezone. Will be back to this page after 8 hours.
    BTW, I'm using P3Dv4 and I volunteer to test add-on dll for P3Dv4.
    • Like Like x 1
  7. pmvcda

    pmvcda aka FlyPT

    Joined:
    Nov 3, 2010
    Messages:
    2,159
    Location:
    Portugal
    Balance:
    15,270Coins
    Ratings:
    +2,534 / 17 / -0
    My Motion Simulator:
    6DOF
    It works.
    Just follow the steps of FSX, but for P3D.

    upload_2024-12-12_23-34-19.png

    upload_2024-12-12_23-42-9.png

    To check if it's installed, when runnig the sim (NOT ON THE MAIN MENU) look at the addons (last item in the right of the sdk menu)

    Steps would be:

    You need to install the Microsoft VC++ Redist for 32 bits. Download the file “vc_redist.x86.exe” here:

    https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads

    Download and install the sdk from the P3D website

    Copy the “FlyPT_P3D_DLL.dll” file included in the “Sources files” folder of the download, to the installation folder of P3D.

    Go to the folder "C:\Users\YOUR USERNAME\AppData\Roaming\Lockheed Martin\Prepar3D v4" and edit the file “dll.xml”. If she doesn't exist, create it with a text editor and copy the text bellow.
    If the file exists, you need to add a “<Launch.Addon>” section like shown bellow.

    It should end with this aspect (you might have more addons in the file):

    Code:
    <?xml version="1.0" encoding="Windows-1252"?>
    <SimBase.Document Type="Launch" version="1,0">
    <Descr>Launch</Descr>
    <Filename>dll.xml</Filename>
    <Disabled>False</Disabled>
    <Launch.ManualLoad>False</Launch.ManualLoad>
    <Launch.Addon>
    <Name>FlyPT Mover</Name>
    <Disabled>False</Disabled>
    <ManualLoad>False</ManualLoad>
    <Path>INSTAL FOLDER\Lockheed Martin\Prepar3D v4\FlyPT_P3D_DLL.dll</Path>
    </Launch.Addon>
    </SimBase.Document>
    

    The path INSTALL FOLDER, should be the one where you have the dll. Like said above, I recommend the installation folder of P3D.


    Please do some testing to check if the data is ok.
  8. Vikkor Mallansohn

    Vikkor Mallansohn New Member

    Joined:
    Dec 12, 2024
    Messages:
    15
    Location:
    Shanghai, China
    Balance:
    95Coins
    Ratings:
    +1 / 1 / -0
    My Motion Simulator:
    3DOF, AC motor, Motion platform, 6DOF
    Unfortunately, it didn't work on my computer. ;-(
    VC++ Redist 32bit installed.
    P3D SDK installed.
    I got the diagnostic log prompt from P3D:
    upload_2024-12-13_14-52-19.png

    And I'm pretty sure the dll.xml setting is correct. Because I tried copy and rename another add-on DLL file, then rename it as 'FlyPT_P3D_DLL.dll', then I got that DLL file loaded successfully.

    Must be some DLL compatibility issue. What's your P3Dv4 tiny version ? And what's your Visual Studio compiler configuration ?

    ====================

    My last solution is to develop an P3D add-on on my own, which compatible with your MMF protocol. Could you please tell me the MMF file name and layout definition? Thanks!
  9. pmvcda

    pmvcda aka FlyPT

    Joined:
    Nov 3, 2010
    Messages:
    2,159
    Location:
    Portugal
    Balance:
    15,270Coins
    Ratings:
    +2,534 / 17 / -0
    My Motion Simulator:
    6DOF
    I'm using this version of P3D: Prepar3D_v4_Academic_4.5.14.34698
    With the SDK we have on the P3D site also: Prepar3D_v4_SDK_Setup_4.5.14.34698

    If you have other plugins, can you check if there's a simconnect dll inside the p3d folder?
    My dll might be trying to use that one since it's the first one found and if there's a problem there it might be because of different versions of the dll (simconnect).

    I installed everything yesterday to test (and to develop for Mover 3.7 and 4.0) and it works well.

    I will check the mmf and post here. I'm at work right now.
    • Like Like x 1
  10. Vikkor Mallansohn

    Vikkor Mallansohn New Member

    Joined:
    Dec 12, 2024
    Messages:
    15
    Location:
    Shanghai, China
    Balance:
    95Coins
    Ratings:
    +1 / 1 / -0
    My Motion Simulator:
    3DOF, AC motor, Motion platform, 6DOF
    No, I don't have any simconnect.dll inside the p3d folder.
    By search whole disk using keyword "simconnect.dll", I got
    upload_2024-12-14_0-18-51.png

    Pretty sure thoes are ALL files named "simconnect.dll"
  11. pmvcda

    pmvcda aka FlyPT

    Joined:
    Nov 3, 2010
    Messages:
    2,159
    Location:
    Portugal
    Balance:
    15,270Coins
    Ratings:
    +2,534 / 17 / -0
    My Motion Simulator:
    6DOF
    Sorry i will look at this tomorrow. Day got complicated at work.
    • Like Like x 1
  12. Vikkor Mallansohn

    Vikkor Mallansohn New Member

    Joined:
    Dec 12, 2024
    Messages:
    15
    Location:
    Shanghai, China
    Balance:
    95Coins
    Ratings:
    +1 / 1 / -0
    My Motion Simulator:
    3DOF, AC motor, Motion platform, 6DOF
    I have made some progress by myself.
    By installing VC++ Redist 64bit,not 32bit, now I can load the 'FlyPT_P3D_DLL.dll' successfully (No error anymore in the log)

    That makes me confused. The FlyPT_P3D_DLL.dll in the FlyPT 3.5.3 “Sources files” folder is a x64 machine (you may confirm this fact by dumpbin.exe /HEADERS FlyPT_P3D_DLL.dll), it can only successfully load when vcruntime140_1.dll file presented, which is a part of VC++ Redist 64bit.


    However, when runnig the sim (NOT ON THE MAIN MENU) , I don't have the add-ons menu (last item in the right of the sdk menu). As a result, my FlyPT can open(Connect) MMF, but can't get realtime data correctly.

    I suspect that's the old simconnect.dll issue. We have a lot of simconnect versions avaliable and which one matches with your dll?
    upload_2024-12-15_20-27-29.png

    And mabe find a better practice to load simconnect.dll, rather than just use the one inside the p3d folder ;-)
  13. Vikkor Mallansohn

    Vikkor Mallansohn New Member

    Joined:
    Dec 12, 2024
    Messages:
    15
    Location:
    Shanghai, China
    Balance:
    95Coins
    Ratings:
    +1 / 1 / -0
    My Motion Simulator:
    3DOF, AC motor, Motion platform, 6DOF
    And (maybe) post your SimConnect.xml file here.
    Local server port parameters matter?
  14. pmvcda

    pmvcda aka FlyPT

    Joined:
    Nov 3, 2010
    Messages:
    2,159
    Location:
    Portugal
    Balance:
    15,270Coins
    Ratings:
    +2,534 / 17 / -0
    My Motion Simulator:
    6DOF
    Sorry for the late reply.

    EDIT:
    Also, maybe before what is bellow:

    Install all the simconnects in the redist folder.... "Just run every installer there, except FSX-RTM-JPN and FSX-SP1-RUS versions. They need to be installed manually for some other addons, so i think this can be your problem."
    It should solve the problem

    If this does not work, try bellow:



    Please test the dll's I send attached. Recompiled and the simconnect dll that comes with the P3D sdk. Put them in the P3D folder (where is the executable).
    When installing the sdk a reference is added to simconnect, so it should work...
    Also, you are right, it's 64 bits not 32 (FSX is 32).

    The data in the shared memory:

    Name of the shared memory = FlyPT_P3D_MMF

    The data is floats:
    Code:
                        toMMF(counter, 0);
                        toMMF(-pS->lateralAcceleration, 8);
                        toMMF(pS->longitudinalAcceleration, 16);
                        toMMF(-pS->verticalAcceleration, 24);
                        toMMF(pS->lateralSpeed, 32);
                        toMMF(pS->longitudinalSpeed, 40);
                        toMMF(pS->verticalSpeed, 48);
                        toMMF(pS->yawSpeed, 56);
                        toMMF(pS->rollSpeed, 64);
                        toMMF(pS->pitchSpeed, 72);
                        toMMF(pS->yaw - 180.0, 80);
                        toMMF(-pS->roll, 88);
                        toMMF(pS->pitch, 96);
                        toMMF((pS->engine0RPM + pS->engine1RPM + pS->engine2RPM + pS->engine3RPM) / pS->numberEngines, 104);
                        toMMF((pS->engine0Torque + pS->engine1Torque + pS->engine2Torque + pS->engine2Torque) / pS->numberEngines, 112);
                        toMMF(pS->airSpeed, 120);
                        toMMF(pS->stall, 128);
                        toMMF(pS->overspeed, 136);
                        toMMF(pS->landingGear, 144);
                        toMMF(pS->flaps, 152);
                        toMMF(pS->altitude, 160);
                        toMMF(pS->altitudeAboveGround, 168);
                        toMMF(pS->onGround, 176);
                        toMMF(pS->gearFrontPosition / 100, 184);
                        toMMF(pS->gearLeftPosition / 100, 192);
                        toMMF(pS->gearRightPosition / 100, 200);
                        toMMF(pS->gearRearPosition / 100, 208);
                        toMMF(pS->canopy / 100, 216);
                        toMMF(pS->surfaceType, 224);
                        toMMF(pS->lateralWindSpeed, 232);
                        toMMF(pS->longitudinalWindSpeed, 240);
                        toMMF(pS->verticalWindSpeed, 248);
    
    For Mover 3.7 I will make changes and will send doubles instead of floats.
    Might add extra data also.

    Attached Files:

    Last edited: Dec 15, 2024
  15. Vikkor Mallansohn

    Vikkor Mallansohn New Member

    Joined:
    Dec 12, 2024
    Messages:
    15
    Location:
    Shanghai, China
    Balance:
    95Coins
    Ratings:
    +1 / 1 / -0
    My Motion Simulator:
    3DOF, AC motor, Motion platform, 6DOF
    Problem solved! ...........in a surprising way....

    My Prepar3D minor version was 4.4.16, your DLL do NOT support it !
    I instead installed P3D v4.5.14, and immediately got everything work !

    And, only VC++ Redist 64bit is essential.
    P3D SDK, not necessary.
    legacy simconnects (all of them), not necessary
    latest recompiled dll , not necessary
    And no need put dll in the P3D folder or edit dll.xml. Just put dll in the %USERPROFILE%\Documents\Prepar3D v4 Add-ons\FlyPT, and create an add-on.xml
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <SimBase.Document Type="AddOnXml" version="4,5" id="add-on">
        <AddOn.Name>FlyPT</AddOn.Name>
        <AddOn.Description>FlyPT MMF add-on</AddOn.Description>
        <AddOn.Component>
            <Category>DLL</Category>
            <Disabled>False</Disabled>
            <Path>FlyPT_P3D_DLL.dll</Path>
        </AddOn.Component>
    </SimBase.Document>
    

    This is the recommended way of distributing add-ons(according to Prepar3D Learning Center) because the package provides a centralized list of all of the Add-on Components necessary to load the Add-on. and will show on the start-up main menu. ;-)

    Would be happy if you update www#flyptmover#com/sources/games page according to my story.

    Thank you so much for all your effort to help!
    ======================
    PS:
    Why does your add-on only support P3D v4.5.x ? That's beyond my knowledge.
    I guess you use some Class that not exist in old version. e.g. IBaseObjectV450
  16. pmvcda

    pmvcda aka FlyPT

    Joined:
    Nov 3, 2010
    Messages:
    2,159
    Location:
    Portugal
    Balance:
    15,270Coins
    Ratings:
    +2,534 / 17 / -0
    My Motion Simulator:
    6DOF
    I will,
    Thanks for testing
    • Friendly Friendly x 1
  17. Vikkor Mallansohn

    Vikkor Mallansohn New Member

    Joined:
    Dec 12, 2024
    Messages:
    15
    Location:
    Shanghai, China
    Balance:
    95Coins
    Ratings:
    +1 / 1 / -0
    My Motion Simulator:
    3DOF, AC motor, Motion platform, 6DOF
    If you want to develop add-on for all P3Dv4.x (technically entirely feasible), try installing SDK v4.0.x and recompile dll. Then test them under v4.1~v4.5
  18. pmvcda

    pmvcda aka FlyPT

    Joined:
    Nov 3, 2010
    Messages:
    2,159
    Location:
    Portugal
    Balance:
    15,270Coins
    Ratings:
    +2,534 / 17 / -0
    My Motion Simulator:
    6DOF
    From the Prepar3D website:

    So using the FlyPT_FSX_DLL.dll should work on older Prepar3D versions and on the newest also.