Jump to content
The simFlight Network Forums
FwFreak

Writing Simrate Offset crashes P3D (v4.5)

Recommended Posts

Hi Paul!

First thanks for your great FSUIPCClient dll.

Yesterday I updated the NuGet package from 3.1.5 to 3.1.11. Since this update setting the Offset 0C1A for changing the Simulation Rate causes P3D to incease the RAM usage up to 100% till the PC runs out of memory.

The actual FSUIPC offset table says for Offset 0C1A "[Write] ]Not working, Sim Event seems broken" but with version 3.1.5 I can change the Simulation Rate without trouble (same FSUIPC version 5.15).

 

Have you changed something related between the dll versions or do you have any ideas how I can fix the issues?

 

Best regards

Karsten

 

Edited by FwFreak

Share this post


Link to post
Share on other sites

Hi Karsten,

The major difference between those two versions is that 'write-only' offsets now write on every process. In 3.1.5 they only wrote when the value changed. This caused a few problems so I had to change the way write-only offsets worked.

Do you have 0C1A declared as write-only? If so, you have two options:

1. Put this offset in its own group so you can process() that offset only when you need to change the sim rate.

or

2. Change this offset to a normal read/write offset. There's no harm in reading the sim rate back when you're not changing it.

Option 2 is the easiest fix.

Paul

Share this post


Link to post
Share on other sites

Yes, it is a write-only offset and already did it like your option 1.

This is my code which works for other offsets except the simrare (local time, pause sim, send text message).

Offset<short> simrate = new Offset<short>("simrate", 0x0C1A, true);

  (...)

List<string> types = new List<string>();
  
  (...)
  
public void setSimrate(int val)
{
  form1.write_log("Simulator", "Set -> Simrate: " + val);

  simrate.Value = (short)(val * 256);
  types.Add("simrate");
}

public bool Send()
{
  if(form1.monitor.status.connected)
  {
  foreach(string type in types)
  {
    try
    {
      form1.write_log("Simulator", "Start Send -> " + type);

      FSUIPCConnection.Process(0, type);
    }
    catch (FSUIPCException ex)
    {
      form1.write_log("Simulator", "Senden Fehler: " + ex.ToString());
    }
  }
}

 

(The part with the 'List' is not the best way I think but I'm not sure how to write more than one group in one process.)

 

Share this post


Link to post
Share on other sites

Yes. For every 'action' my program opens a new instance of the "Simulator" class which contains the code above.

private void btn_simrate_2_Click(object sender, EventArgs e)
{
	Simulator sim = new Simulator();
	
	sim.SetSimrate(2);
	sim.Send();
}

 

My idea was to create the class instance, setup all things to send and then send it to the sim.

Share this post


Link to post
Share on other sites

It's difficult to see what's happening when I don't have the complete code.

At the moment I suspect that the sim rate is being written more often than you want.

You can confirm this by using the logging in FSUIPC. If you enable the logging for 'IPC Writes' and send the log to the console you will be able to see when the sim rate is being written.

We can find out for sure if the sim rate is being 'spammed' (sent over and over again), or if it just gets written once when your program calls SetSimRate().

Thanks,

Paul

Share this post


Link to post
Share on other sites

Hi Paul!

Sorry for the delay but since yesterday evening I cannot reproduce the error any more.

Yesterday in the morning I've updated FSUIPC from 5.15 to 5.151 but I was sure that the error was still alive after the update.

 

FSUIPC log shows the offset is send once only.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • 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.