Jump to content
The simFlight Network Forums


  • Posts

  • Joined

  • Last visited

Everything posted by andhog

  1. Unfortunately there's apparently something seriously wrong with the latest world update. Having a standalone WASM module in your community folder causes CTD when starting MSFS 😕
  2. @John DowsonYou have a pull request 🙂 https://github.com/jldowson/FSUIPC_WAPI/pulls
  3. Exactly, but that's only half true now. You can get LVar values by name but you can only set them by ID.
  4. My application is based around an .ini file with the names of the variables the user like to save/load, so I guess I'm using your API in the opposite direction from what you intended 🙂
  5. So, first I rebuilt the FSUIPC_WDLL with the latest WAPI lib (that's not necessary now that John have done it for you 🙂). Then I have the DLL functions declared like this (the ones I'm using in my app): [DllImport("FSUIPC_WAPID.dll", CallingConvention = CallingConvention.Cdecl)] private static extern void fsuipcw_init(IntPtr hWnd); [DllImport("FSUIPC_WAPID.dll", CallingConvention = CallingConvention.Cdecl)] private static extern void fsuipcw_start(); [DllImport("FSUIPC_WAPID.dll", CallingConvention = CallingConvention.Cdecl)] private static extern void fsuipcw_end(); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate void lvarValueRecvFunc(string lvarName, double value); [DllImport("FSUIPC_WAPID.dll", CallingConvention = CallingConvention.Cdecl)] private static extern void fsuipcw_getLvarValues(lvarValueRecvFunc callback); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate void lvarIDRecvFunc(string lvarName, int id); [DllImport("FSUIPC_WAPID.dll", CallingConvention = CallingConvention.Cdecl)] private static extern void fsuipcw_getLvarList(lvarIDRecvFunc callback); [DllImport("FSUIPC_WAPID.dll", CallingConvention = CallingConvention.Cdecl)] private static extern void fsuipcw_setLvarAsShort(int id, int value); Calling the functions fsuipcw_init, fsuipcw_getLvarValues and fsuipcw_getLvarList with: fsuipcw_init(this.Handle); var result = new Dictionary<string, double>(); fsuipcw_getLvarValues(result.Add); var lvars = new Dictionary<string, int>(); fsuipcw_getLvarList(lvars.Add); NOTE: I modified the code for fsuipcw_getLvarList so that it takes (const char*, int) instead of (int, const char*). Since there's no function to set an Lvar by name I use this function to get the Lvar ID for the fsuipcw_setLvarAs...(). Having a Dictionary/map with the name as key and id as value serves that purpose much better. Hope this helps. It's my first C# application ever so I had to google it all up, but if it seems to work 🙂 I'm not part of the VIP cabal with access to that part of the forum 🙂, so it would be super appreciated if you could do that.
  6. Now it works perfectly! I have also tried the dll in a C# WinForms application and it works as well. Thank you!
  7. Sorry, copy&paste error there. I can only access 1168 Lvars, as you can see in the log files.
  8. So I've finally tested version 0.4.8 and it finds more LVars than the previous version, but unfortunately not 2044. The CRJ has 1738 LVars and when I create the LVar file(s) it lists all of them (in 14 files), but I've only access to 1738 with the client and using the WAPI in my app. FSUIPC_WASMIF.log FSUIPC_WASM.log
  9. I have gone through all your posts on the forum now but I can't find that description. Could you please give me a link to it?
  10. The app I've built around your module and the API is for saving and loading the cockpit state (switches, knobs etc) in the CRJ (for now, but it should be relatively easy to apply it to other aircraft as well). At the moment one have to do this manually, but I would like to add an option so that it loads the state automatically when you start a flight and saves it when the flight ends. Super! I will look it up. It was just a side note, nothing I expect you to help me with. But I appreciate that you explained a little bit about it. Perhaps I should skip the idea of subscribing to the events, keeping the manual loading and do the saving on a regular interval instead.
  11. I've not been at home for a while, but now that I am I will have a look at your latest accomplishments 🙂. I must also learn some SimConnect and figure out a way to trigger the read and write of LVars when the sim is paused and started. I recon it's a pretty basic task, but without any prior experience in this particular department it's a challenge. But hey, who doesn't like a challenge? 🙂 I'll let you know as soon as I've tested.
  12. Unfortunately that didn't go so well. First I tried with the WASM client (see the log files that I for once managed to attach!). Then I compiled my application with the new FSUIPC_WAPI lib and that worked, but when I started the app I got "Microsoft C++ exception: std::out_of_range". I think I might have found the reason in WASM.h: typedef struct _CONFIG_CDA { char CDA_Names[MAX_NO_LVAR_CDAS + MAX_NO_HVAR_CDAS + 1][MAX_CDA_NAME_SIZE]; int CDA_Size[MAX_NO_LVAR_CDAS + MAX_NO_HVAR_CDAS + 1]; CDAType CDA_Type[MAX_NO_LVAR_CDAS + MAX_NO_HVAR_CDAS + 1]; } CONFIG_CDA; And since you increased MAX_NO_VALUE_CDAS it gets out of range here in WASMIF.cpp: for (int i = 0; i < MAX_NO_LVAR_CDAS + MAX_NO_HVAR_CDAS + MAX_NO_VALUE_CDAS; i++) FSUIPC_WASM.log FSUIPC_WASMIF.log
  13. Hi there! Hope you had a great easter! I will try that right away. The LVar files created by your WASM client gives me 1738 LVars. However, I don't think anyone need access to all of those at the same time so your suggestion to have a file with variables of interest together with the module would be great.
  14. It won't happen again! FSUIPC_WASMIF.log FSUIPC_WASM.log
  15. Now this got messy! Setting a Lvar double value triggers a completely different Lvar. Setting "ASCRJ_AUDIO1_VHF1_VOL" to 1 turns the knob, but setting it to 1.0 triggers the GPWS terrain warning sound! 🙂 This applies to both the WASMClient and using setLvar(unsigned short id, double value)
  16. Thank you for taking your time to answer my stupid questions. I have been using the paid version of FSUIPC for a long time now, I will have a look on how to use it in my app!
  17. Have you loaded an aircraft and started the flight? Before you have done that there aren't any Lvars to read.
  18. Yes that's what I meant. In my application I would like to do something when the sim is started, paused or stopped and I assume this triggers some kind of event. Looking at the in-game console I've noticed that when this happens there are printouts like "ASCRJ_INIT: Started" and "ASCRJ_INIT: Paused". Having a limited knowledge about these things I thought maybe that was a HEvent that was triggered with an argument with the sim state. But that was probably wrong then. I recon I need to 1 read up on the documentation and 2 develop my own SimConnect implementation to do these kind of things.
  19. Another question entirely, would it be possible to make it possible to subscribe to HEvents? Or is that already possible somehow?
  20. Wow, that was fast! Thank you so much for your efforts in this, super appreciated. And yes, I now get 1022 LVars. Unfortunately the armrest variables are not among them, but that's probably due to their position being outside the 1022 limit 😕
  21. I should have thought of that of course. It's like calling helpdesk without having restarted the computer first 🙂 Here are my logs. I can see that the WASM module reports finding 1022 LVars, but as you can see the client doesn't list more than 876. FSUIPC_WASMIF.log FSUIPC_WASM.log
  22. Forget about that question, I wasn't thinking straight. However, even with the latest version I still only get 876 LVars with getLvarList. There are two particular variables I'm trying to read in the CRJ. In the previous version they didn't show up either, but when I used "Execute Calculator Code" with for instance "1 (>L:ASCRJ_FO_ARMREST_UP)" I was able to set them. That's why I asked if it was possible to get Lvars with that method as well. Any idea what I'm doing wrong so that I don't get more variables?
  • 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.