Jump to content
The simFlight Network Forums

Recommended Posts

Posted

I've read most of the documentation from the FSUIPC SDK, I'm using Prepar3D v4.5, Visual Studio 2017 (free version), and am a retired software developer (Java, C/C+, Smalltalk, etc.).  Using the Borland C++ example I tried to open an connection to FSUIPC using this code (a snippet):

    m_is_fsuipc_connection_made = FSUIPCInterface.FSUIPC_Open(SIM_ANY, &dwClosed);
    
    if (m_is_fsuipc_connection_made)
    {
        m_read_sim_version_success = FSUIPCInterface.FSUIPC_Read(0x3308, 4, &FSVersion, &pdwResult);
    }
    if (m_read_sim_version_success)
    {
    ... rest of code omitted for brevity.

In debug, the read function returns false.  I can't see why it is returning false, I have FSUIPC installed properly and can see it in the sim.   

Posted

It looks like you are using the C library provided (FSUIOPC_User.lib).  What value is returned in pdwResult. That's supposed to be the error number and should give a clue.

// Error numbers
#define FSUIPC_ERR_OK		0
#define FSUIPC_ERR_OPEN		1	// Attempt to Open when already Open
#define FSUIPC_ERR_NOFS		2	// Cannot link to FSUIPC or WideClient
#define FSUIPC_ERR_REGMSG	3	// Failed to Register common message with Windows
#define FSUIPC_ERR_ATOM		4	// Failed to create Atom for mapping filename
#define FSUIPC_ERR_MAP		5	// Failed to create a file mapping object
#define FSUIPC_ERR_VIEW		6	// Failed to open a view to the file map
#define FSUIPC_ERR_VERSION	7	// Incorrect version of FSUIPC, or not FSUIPC
#define FSUIPC_ERR_WRONGFS	8	// Sim is not version requested
#define FSUIPC_ERR_NOTOPEN	9	// Call cannot execute, link not Open
#define FSUIPC_ERR_NODATA	10	// Call cannot execute: no requests accumulated
#define FSUIPC_ERR_TIMEOUT	11	// IPC timed out all retries
#define FSUIPC_ERR_SENDMSG	12	// IPC sendmessage failed all retries
#define FSUIPC_ERR_DATA		13	// IPC request contains bad data
#define FSUIPC_ERR_RUNNING	14	// Maybe running on WideClient, but FS not running on Server, or wrong FSUIPC
#define FSUIPC_ERR_SIZE		15	// Read or Write request cannot be added, memory for Process is full

And, additionally, the following data should already be available to you if the Open successed:

// Globals accessible from main code
extern DWORD FSUIPC_Version;    // HIWORD is 1000 x Version Number, minimum 1998
                                        // LOWORD is build letter, with a = 1 etc. For 1998 this must be at least 5 (1998e)
extern DWORD FSUIPC_FS_Version;
                                        // FS98=1, FS2k=2, CFS2=3. See above.
extern DWORD FSUIPC_Lib_Version;
                                        // HIWORD is 1000 x version, LOWORD is build letter, a = 1 etc.

You might also want to check out Paul Henty's more modern interface for .NET languages -- see his SubForum above.

Pete

 

 

Posted

Hi Pete,

No, I'm not using the Library.  I thought the borland example excluded it so I left it out. Basically I ported the example into a C++ gauge that needs to mask controls that are mapped through FSUIPC.  I stripped out the form code, and kept the relevant code. That may be why pdwResult gave me a value that didn't make sense and why it didn't connect.

Very Respectfully,

Jim

P.S. I haven't had time to look at the .NET examples due to time constraints and that its in a different language.  I'll take a look later this evening.

Posted
28 minutes ago, flyboy7798 said:

No, I'm not using the Library.  I thought the borland example excluded it so I left it out.

Oh, it might do. Sorry, I don't know any of the supplied packets except those for C and ASM. The others are contributions from users. And most are very dated now.

29 minutes ago, flyboy7798 said:

Basically I ported the example into a C++ gauge that needs to mask controls that are mapped through FSUIPC. 

A gauge runs inside the Sim so it uses a subtlely different interface and a different library (the Module one). 

31 minutes ago, flyboy7798 said:

 I stripped out the form code, and kept the relevant code. That may be why pdwResult gave me a value that didn't make sense and why it didn't connect.

Sorry, this is now beyond me. I suggest you look at using the Module users LIB file, or incorporate the raw code directly.

32 minutes ago, flyboy7798 said:

I haven't had time to look at the .NET examples due to time constraints and that its in a different language.  I'll take a look later this evening.

I don't think we provide .NET examples as such. I was talking anout Paul Henty's .NET language DLL, which is aimed at making interfacing to FSUIPC much simpler. it also provides many powerful functions. But I think that's only for external programs, not gauges.

C++ is one of the .NET supported languages, of course. Is Borland still going? In those days i weas using WatCom.

Pete

 

Posted

I actually used a WatCom compiler once for C early in my programming career.  Borland software is now part of Micro Focus, but I don't think there are many that use the old compilers by them.

1 hour ago, Pete Dowson said:

A gauge runs inside the Sim so it uses a subtlely different interface and a different library (the Module one). 

Ok, the Borland 5 example basically had all the UIPC code that made it self contained as far as I could tell.  When you specify "different interface and a different library (the Module one)." Which example is that in?

1 hour ago, Pete Dowson said:

Sorry, this is now beyond me. I suggest you look at using the Module users LIB file, or incorporate the raw code directly.

When I used the Borland 5 example code, I removed the GUI stuff and used the FSUIPC related code there to build my solution on.  I include in this post a zip with the code for the class that provides the FSUIPC interface to the other classes that need it like masking things like Elevator and Aileron input. In a sense, the attached code is like I masking code used for the events for Prepar3D.  

As for the .NET example if its not for a gauge then I'm not interested in it. I did look at it, but there was so much there that it would take a bit for me to find anything useful.

And thank you for your help, it means a lot as I just started learning to develop sim objects as a hobby.

V/R

Jim

IFSUIPC.zip

Posted
14 hours ago, flyboy7798 said:

When you specify "different interface and a different library (the Module one)." Which example is that in?

No example. I think we expected anyone brave enough to try wrtiing a DLL running within the Sim would be experienced enough.

The interface is almost the same.  Please refer to the text documentation within the relevant ZIP in the SDK:

Library for FS Internal Users.zip (32-bit sim) or
ModuleUser64.zip (64 bit sim -- i.e. P3D4)

14 hours ago, flyboy7798 said:

As for the .NET example if its not for a gauge then I'm not interested in it.

I wasn't referring to anything in the FSUIPC5 SDK, but to Paul Henty's .NET DLL, an independent development. I don't know if that can be used for an internal DLL -- I doubt it. But there's no harm in asking him if it looks interesting. See his website:

http://fsuipc.paulhenty.com/#home

Pete

 

Posted

I see the 64 bit module zip and its contents.  I'll try that and see where it goes. If I run into more trouble then I'll contact Paul.  Thanks for the assistance.

Posted

As Pete suspected, my DLL only implements the external FSUIPC interface, not the internal (gauge) one.

The DLL is aimed at people who want to use .NET instead of C or C++. Since a gauge can only be written in C/C++, I didn't see any point in implementing the internal interface for .NET.

Paul

Posted

Paul, thank you.  I think the 64 bit library may work for me within the gauge.  In fact I think I may be able to compile the whole thing with the gauge.  I'll be back on here to report whether it works or not.  BTW, great work and kudo's to both of you guys for providing this stuff!

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.