Profile image

Program Window Display

78.9k hpgbproductions  4 months ago
609 downloads
Version 1.0 Part

READ BEFORE USE

Program Window Display is a mod that lets you display windows in the game. It contains two parts and two commands.

I wanted to make a mod that feeds data to external programs, and use them to draw UI and cockpit objects. However, I failed and didn't want to continue, so this is the half I managed to make. You can still use it to watch VTuber livestreams during long flights, I guess.

! WINDOWS ONLY !

This mod uses user32.dll and Unity built-in System.Drawing.dll. There is no platform check, and what happens on Mac is untested.

INFO

"My window is white!"

  • Check that the window is open. Open them before entering the level, or you will have to restart.
  • Check that the class name and window title are spelt correctly and are an exact match to the window information. If you can get away with leaving one empty (usually the window title), do it.
  • Check for IndexOutOfRangeException. Increase the size.

"My window is black!"

  • If possible, turn off hardware acceleration for the application.
  • If not possible, you cannot display that window.

Notice:

  • It CANNOT control other applications from the game
  • It CANNOT perform remote internet access

Warnings:

  • The mod can cause sensitive information to be captured during screen recordings, or written to the log files.

Limitations:

  • Windows drawn directly to the hardware (e.g. pretty much every game) cannot be shown. (Read up by searching "printwindow black screen")
  • Turn off hardware accelerated graphics on windows you want to show, including Chromium-based browsers.

PARTS

The mod adds the parts "Program Window" and "Unlit Program Window", which use standard and unlit (always illuminated) shaders respectively.

  • Class Name, Window Title: Used to find the correct window. Must be a perfect match to the window data. Use the provided commands to find it. Further reading
  • Max Size: The size of the texture. It must be a power of two and should be larger than the window you want to capture. If you get IndexOutOfRangeException, increase the size.
  • Update Period: The rate of capture of window contents, in the number of frames.
  • Filter Mode: Choose the amount of smoothing applied to the texture.
  • Opacity: Global opacity to render a window with.
  • Transparency Options: When enabled, colors in the window that are close enough to the defined color will be transparent. A threshold of zero means that only exact matches are turned transparent.
  • Display Rect Options: When enabled, pixels outside of the defined coordinates will be transparent. It can be used to hide unwanted contents.

DEMO AIRCRAFT

Notice: Due to device differences, you may need to adjust the display rectangle.

pwdTest
Use with the following Processing PDE file. Try out the transparency and display rectangle options.
Class Name: SunAwtFrame
Window Title: PWDTEST

pwdTest_YouTube
The display rectangle lines up with the video in normal mode.
Class Name: Chrome_WidgetWin_1
Window Title: (null)

COMMANDS

ListWindows (void)
Writes information of all available windows. Click on each entry in the dev console to view the window title, class name, and pointer of the window.

ListWindowsWithName (string)
Writes information of all windows which have the entered string in the title. For example, ListWindowsWithName SimplePlanes will show all windows that contain "SimplePlanes" in the title.

REFERENCES

(i.e. some code copied from the following webpages)

  • Log in to leave a comment
  • Profile image

    @UberAte it is a hardware-drawn window, so it's incompatible with this mod

    7 days ago
  • Profile image

    @hpgbproductions Im really trying to get this to work lol, I dunno man. I tried streaming my browser, typed in the exact window/class name found in the dev console, gave me a white screen. Tried streaming "SimplePlanes" (class name was UnityWndClass), gave me a black screen. Think you can make a quick screen recording, dont know what im doing wrong xd

    7 days ago
  • Profile image

    @UberAte
    1. Look at name of window at the top of the window
    2. Use dev console command to search for it (see COMMANDS section)
    3. Type the class name in the part. Must be exactly correct including upper/lowercase. Window title is optional, but if you happen to have multiple windows with the same class name, this will select the correct one.
    4. Set the window size larger than the window (just guess using your monitor resolution)
    5. Test it (see INFO section for FAQ)

    8 days ago
  • Profile image

    Can someone make a tutorial on how to get this to work? instructions aren't clear to me.

    8 days ago
  • Profile image
    4,582 LotusCarsSub

    Certified doog moment

    24 days ago
  • Profile image

    @hpgbproductions fun

    one month ago
  • Profile image

    @PostalDude failed to make external flight display, but can watch vtubers and anime during long flights

    one month ago
  • Profile image

    why tho

    one month ago
  • Profile image

    Been having way too much fun with this mod, even though the video quality isn't as good as the source. Something about the novelty of the experience, pretty fun.

    Hey do you think you can make a version of this that just plays video file instead of streaming a window?

    one month ago
  • Profile image
    464 se34ruy

    roleplaying purposes (that could actually become true one day)

    one month ago
  • Profile image
    332 CursedA10

    What happened @se34ruy

    one month ago
  • Profile image
    464 se34ruy

    oh i cant wait for mp screen sharing. (days later) oh god that was the biggest mistake of my life

    2 months ago
  • Profile image

    @FujiwaraAutoShop use the dev console command ListWindowsWithName to find it

    3 months ago
  • Profile image

    How do i know my window's "Class name"?

    3 months ago
  • Profile image

    Gonna start playing War Thunder in SP

    3 months ago
  • Profile image

    Using MGR as an example is great, ngl

    3 months ago
  • Profile image
    4,060 TRD6932

    I see koron I updoot

    3 months ago
  • Profile image

    so.... you can watch a live stream... in simpleplanes

    +2 3 months ago
  • Profile image
    3,925 RC1138Boss

    We can play SP in SP. Finally. Thank you for this masterpiece, I shall never be able to use it though. DAMN YOU APPLE.

    +7 4 months ago
  • Profile image

    I hope I had a powerful pc so I can enjoy this masterpiece

    4 months ago
  • Profile image

    Finally I can watch some wholesome anime while committing warcrimes!

    +19 4 months ago
  • Profile image
    11.6k beenz

    @PyrrhaNikos and then play SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP in SP

    +10 4 months ago
  • Profile image
    47.7k PyrrhaNikos

    @Johnnyynf and then play SP in SP in SP

    +8 4 months ago
  • Profile image

    Nonetheless this is pretty cool

    4 months ago
  • Profile image
    15.7k ALTMTR

    Manages SP account in a middle of an auto plane flight in sp.

    +9 4 months ago
  • Log in to see more comments