News:

Precision Simulator update 10.156 (3 July 2022) is now available.
Navburo update 12 (18 November 2021) is now available.
NG FMC and More is released.

Main Menu

Partial success - PSX rendering as a gauge in P3D

Started by Lashrathius, Fri, 23 Sep 2022 04:29

Lashrathius

Hey all,

As the title says, I've managed to get PSX rendering as a gauge within Prepar3D v5. In the screenshot below, you can see the gauge in the top left, which is an actual C++ gauge rendering the PSX window within Prepar3D. The original PSX window is located bottom right.

Hardy - before you panic - no, I did not do any reverse engineering of PSX or any of its assets. I can render ANYTHING on Prepar3D v5 - including my desktop or a Spotify window. This is using a certain rendering function found within the Windows API. I just set the target to PSX.

This shows me that it may be possible to render the PSX displays (PFD, ND, EICAS, Lower DU, FMS screens, etc.) onto a 3D model within Prepar3D. (imagine - a 3D 747 model with PSX displays rendering on the displays)

I am currently working with the 2D display, as I have to find a way to draw onto the screens in the virtual cockpit (find the HWND of the draw surface, as it's drawing to the HWND of the active window at the moment)

The limitation is that this is RENDERING ONLY - which means you will not be able to click a button on the 3D model and have those changes appear in PSX - it is purely for visuals only.

And I know someone will ask - no, this will not work in Microsoft Flight Sim. It will only work in Prepar3D because Asobo / Microsoft disabled the ability to reference the Windows API in the MSFS SDK.

Disclaimer - this is all a proof of concept, showing that it is entirely possible to render PSX within Prepar3D v5. However, it does not mean I am promising this will work, as I need to drill into the simulator to find the HWND for a 3D surface. It is only rendering on a 2D surface's HWND at the moment. If there are any programmers in this forum who know how to locate a specific HWND (and save me the time of researching), please let me know!

Best regards,
Henry D. C.

Gary Oliver

Henry,

It looks like the same kind of thing can be done using a WASM module in MSFS which is exactly how the Fenix gauges appear to be working.

Exciting stuff...

Hardy Heinlin

Quote from: Gary Oliver on Fri, 23 Sep 2022 15:19... can be done using a WASM module in MSFS which is exactly how the Fenix gauges appear to be working.

Fascinating. If that is true, it's easier than I've thought. Some weeks ago I got an inquiry from Fenix. They'd like to buy the copyright on PSX and integrate it in MSFS. I declined for several reasons; one being the expected high technical efforts (ProSim code is MSFS oriented, PSX code isn't), and because of the very low mass market street price of Fenix add-ons which would kill my existing business. I would lose my independence and thus my creative freedom and motivation. So I suggested them to use PSX just as a "panel provider" in the background, free of charge; the user still had to be a legal owner of PSX which would still be sold separately and not by Fenix. Fenix would just provide the add-on that transfers the "pixels" from PSX to MSFS. -- Well, they declined that suggestion :-)


|-|ardy

evaamo

Quote from: Gary Oliver on Fri, 23 Sep 2022 15:19Henry,

It looks like the same kind of thing can be done using a WASM module in MSFS which is exactly how the Fenix gauges appear to be working.

Exciting stuff...

I think TDS does the same with the GTN 750/650 and the Garmin Trainers. The rest is just manipulating the controls / LVARs.

Quote from: Lashrathius on Fri, 23 Sep 2022 04:29If there are any programmers in this forum who know how to locate a specific HWND (and save me the time of researching), please let me know![/i]

It's been a while since I did some MFC programming, but I think you're looking for something like this:

https://stackoverflow.com/questions/64256501/how-to-get-a-list-of-window-rectangle-from-enumchildwindow-and-store-them

--
Along the lines of this post...

There was a conversation on an X-Plane developer channel on Discord the other day about doing something similar. Some options came up, including using platform-independent options such as vnc, but I don't think that'd be elegant nor practical.

This weekend I'll get back to work on my X-Plane plugin in substitution of Xview now that XP12 is out. If only there were more hours in a day ;-).
Enrique Vaamonde

Lashrathius

Quote from: Gary Oliver on Fri, 23 Sep 2022 15:19Henry,

It looks like the same kind of thing can be done using a WASM module in MSFS which is exactly how the Fenix gauges appear to be working.

Exciting stuff...

If I had access to the source of PSX, then yes, it would be very possible with WASM. But... the method I'm using - I don't need the source of anything. I rendered my Spotify window in P3D, for example.

The methodology I'm using, which is universal for any software, is using the Windows API, which is banned from MSFS due to its closed state. No VNCs, no streaming services / APIs.

The idea of this project is so Hardy can do what he does best without any interruptions and zero software modifications, while I can bring this over to a 3D perspective for many of us looking for a virtual 3D cockpit. The requirements to run the addon would, of course, be that the user owns a legal copy of PSX.
Best regards,
Henry D. C.

Ton van Bochove

QuoteThey'd like to buy the copyright on PSX and integrate it in MSFS. I declined for several reasons

One of your better ideas  ;)

Ton