Jump to content
The simFlight Network Forums

Recommended Posts

Hi,
what's the best practice to spoof reads of an offset variable?
Some fixed gear planes report always "gear down" and I don't want the gear down indicator on my panel lit when using those planes, so at the moment I have the following in the profiles' lua of the affected planes:

function spoof_gear(t)
    ipc.writeStruct(0x0024, "1UW", 0x0BEC, "1UW", 2, "1UW", 0)
    ipc.writeStruct(0x0024, "1UW", 0x0BF0, "1UW", 2, "1UW", 0)
    ipc.writeStruct(0x0024, "1UW", 0x0BF4, "1UW", 2, "1UW", 0)
end

function cleanup()
    ipc.writeStruct(0x0024, "1UW", 0x0BEC, "1UW", 0)
    ipc.writeStruct(0x0024, "1UW", 0x0BF0, "1UW", 0)
    ipc.writeStruct(0x0024, "1UW", 0x0BF4, "1UW", 0)
end

event.timer(1000, "spoof_gear")
event.terminate("cleanup")

I found offset 0x0024 and its usage in the offset list and I'm not sure if using a timer there is the best way, but the spoofed values always reset after a few seconds. I know there is event.offset that fires when an offset changes, is there also an event that fires on an offset read where you could spoof the read result? In the documentation I didn't see something like that...

jaxx

Share this post


Link to post
Share on other sites
On 6/18/2020 at 11:55 AM, jaxx said:

is there also an event that fires on an offset read where you could spoof the read result? In the documentation I didn't see something like that...

No, there is no such function.

You are probably better off using a user offset to drive your gear light indicator (e.g. starting offset 66C0). You could have a lua script that simply copies the gear offsets (0BEC, OBF0, 0BF4) to this area if gear is retractable (offset 060C), or otherwise writes 0.

John

 

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.