Steam In-Home Streaming


#1

Lots of myths going on about this service.

Anyone want to work on dispelling a few of them?

The facts:

You can stream ANYTHING via steam in-home streaming. This isn’t hyperbole, steam in-home streaming acts as a screen sharing type service that latches onto an exe.

Meaning you can stream notepad.exe and minimize it and then stream whatever you want to stream!

Some suggestions though:

You’ll want to have steam running as an administrator and possibly “streaming_client.exe” as well.

You may need to apply the same logic to any non-steam games that you want to stream. An example would be:

Star Wars: The old republic
\Origin Games\Star Wars - The Old Republic\launcher.exe
\Origin Games\Star Wars - The Old Republic\swtor\retailclient\swtor.exe

may both need to be ran at admin level.

This has to do with, as far as I have read, security issues with password inputs.

FINALLY, the script to solve all problems with non-steam games and launchers:

found at: http://forums.steampowered.com/forums/showthread.php?t=2439050

and rehosted here:


Update 1/1:

Simplified the steps.

Tweaked the code to be more reliable.


Update 12/31:

Added a description of what should happen if everything is correctly setup.


Update 12/30:

I changed some stuff in the code. I hope this works for everyone.


OK. I think this will work for everyone with Vista/Win 7. It seems steam works normally with XP users.

I still don’t want to give out an exe as a matter of principle, so you
are going to make it yourself. But don’t worry, you don’t have to
download anything to make it, which is another of my self given
requirements.

Step 1:

  • copy/paste this code into a text editor (ex. notepad) and save it as
    ’Star Wars - The Old Republic.txt’ without the quotes and save it on
    your desktop
using System;
using System.Diagnostics;
using System.IO;
using System.IO.Pipes;
using System.Management;
using System.Threading;
using System.Windows.Forms;
namespace steamswtor
{
    class Program
    {
        static bool IsPreVista()
        {
            //Vista or higher check
            if (System.Environment.OSVersion.Version.Major < 6)
            {
                MessageBox.Show("Windows Vista or higher is required.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return true;
            }
            return false;
        }
        static void Main(string[] args)
        {
            // If Operating System is before Vista, then exit
            if (IsPreVista())
                return;
            if (args.Length == 0)
            {
                string pipeName = "swtorsteam";
                             
                // run ourself as admin
                try
                {
                    Process admin = new Process();
                    admin.StartInfo.FileName = System.Reflection.Assembly.GetEntryAssembly().Location;
                    admin.StartInfo.Arguments = pipeName;
                    admin.StartInfo.Verb = "runas";
                    admin.Start();
                }
                catch(Exception e)
                {
                    string errmsg = e.Message + "\n";
                    errmsg += "Failed to escalate. Program will now exit.";
                    MessageBox.Show(errmsg, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                // run the swtor launcher
                try
                {
                    Process launcher = new Process();
                    launcher.StartInfo.FileName = Directory.GetCurrentDirectory() + "\\launcher.exe";
                    launcher.Start();
                }
                catch(Exception e)
                {
                    string errmsg = e.Message + "\n";
                    errmsg += "Launcher failed to begin. Is this exe in SWTOR's home directory? Program will now exit.";
                    MessageBox.Show(errmsg, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                // loop waiting for our temp file to be filled with swtor's commandline arguments
                Console.WriteLine("Waiting for our other program to finish...");
                // grab data from the commandline arguments
                string exe, arguments, workingdirectory;
                try
                {
                    NamedPipeServerStream server = new NamedPipeServerStream(pipeName);
                    server.WaitForConnection();
                    StreamReader sr = new StreamReader(server);
                    string cmdline = sr.ReadLine();
                    // grab data from the commandline arguments
                    exe = cmdline.Substring(1, cmdline.IndexOf('"', 1) - 1);
                    arguments = cmdline.Substring(cmdline.IndexOf("\" ") + 2);
                    workingdirectory = cmdline.Substring(1, cmdline.IndexOf("swtor.exe") - 1);
                }
                catch(Exception e)
                {
                    string errmsg = e.Message + "\n";
                    errmsg += "Failed to read command line arguments from other program. Program will now exit.";
                    MessageBox.Show(errmsg, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                try
                {
                    // start swtor's client
                    Process swtor = new Process();
                    swtor.StartInfo.FileName = exe;
                    swtor.StartInfo.Arguments = arguments;
                    swtor.StartInfo.WorkingDirectory = workingdirectory;
                    swtor.Start();
                }
                catch(Exception e)
                {
                    string errmsg = e.Message + "\n";
                    errmsg += "swtor.exe failed to begin. Is this exe in SWTOR's home directory? Program will now exit.";
                    MessageBox.Show(errmsg, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                // exit the program
                return;
            }
            else
            {
                // Connect to pipe server
                string pipeName = args[0];
                NamedPipeClientStream client = new NamedPipeClientStream(pipeName);
                try
                {
                    client.Connect(10000);
                }
                catch (Exception e)
                {
                    string errmsg = e.Message + "\n";
                    errmsg += "Failed to connect to other program. Program will now exit.";
                    MessageBox.Show(errmsg, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
               
                //Create the query
                ObjectQuery query = new ObjectQuery("Select * from Win32_Process Where Name =\"swtor.exe\"");
                // check once a second for swtor.exe that the launcher starts when the user hit's play in the launcher
                Console.WriteLine("Waiting for launcher to start swtor...");
                while (true)
                {
                    ManagementObjectSearcher searcher = new ManagementObjectSearcher(query);
                    ManagementObjectCollection processList = searcher.Get();
                    foreach (ManagementObject obj in processList)
                    {
                        string cmdline = obj.GetPropertyValue("CommandLine").ToString();
                        if (cmdline.Contains("username"))
                        {
                            // kill the process
                            obj.InvokeMethod("Terminate", null);
                            // write command line to the pipe
                            try
                            {
                                StreamWriter sw = new StreamWriter(client);
                                sw.AutoFlush = true;
                                sw.WriteLine(cmdline);
                            }
                            catch(Exception e)
                            {
                                string errmsg = e.Message + "\n";
                                errmsg += "Failed to write commandline arguments to pipe. Program will now exit.";
                                MessageBox.Show(errmsg, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                return;
                            }
                            // exit the program
                            return;
                        }
                    }
                    Thread.Sleep(1000);
                }
            }
        }
    }
}

Step 2):

  • Open a command prompt- Start Menu->All Programs->Accessories->Command Prompt- Now copy/paste this long command in and hit enter. The quotes are important.

%windir%\Microsoft.Net\Framework\v3.5\csc /platform:x86 "/out:%USERPROFILE%\Desktop\Star Wars - The Old Republic.exe" "%USERPROFILE%\Desktop\Star Wars - The Old Republic.txt"

  • Here’s what it looked like when I did it.
C:\Users\renegadelink>%windir%\Microsoft.Net\Framework\v3.5\csc /platform:x86 "/out:%USERPROFILE%\Desktop\Star Wars - The Old Republic.exe" "%USERPROFILE%\Desktop\Star Wars - The Old Republic.txt"
Microsoft (R) Visual C# 2008 Compiler version 3.5.30729.5420
for Microsoft (R) .NET Framework version 3.5
Copyright (C) Microsoft Corporation. All rights reserved.
  • For advanced users: you don’t have to use v3.5, I just
    picked v3.5 because I think almost everyone will have that directory,
    you can use any that has a csc.exe in it- csc is the c# compiler if you were wondering- There should now be a Star Wars - The Old Republic.exe on your desktop. You can exit out of the command prompt.

Step 3:

  • Now that you have an exe, move it into your swtor’s home directory.
    The home directory is the one with swtor’s launcher.exe in it- An example swtor home directory is:

C:\Program Files (x86)\Electronic Arts\BioWare\Star Wars - The Old Republic

  • Go into steam and do the normal ‘add non-steam game’ and browse to the
    exe you just placed in swtor’s home directory and add it

Step 4(Optional):

  • Right click on the newly made game in steam’s library and go to properties

  • Click Choose Icon and browse to swtor’s launcher.exe and select it to get the swtor icon- Or you can change the exe’s icon image by following a couple steps in a post of mine on the third page of this threadIf
    everything is working right, when you launch Star Wars - The Old
    Republic.exe from steam, two command prompts will pop up. One will say,
    “Waiting for our other program to finish…”, and the other will say,
    “Waiting for launcher to start swtor…”. Then swtor’s launcher will
    start. Log in to the launcher like normal, then when you hit the Play
    button, both of the command prompts should go away. Then the game
    should start and you should have the steam overlay.

If you try it and the steam overlay still doesn’t work, then try exiting
steam entirely and running steam in admin-mode then try again. This is
what my friend had to do.

Thanks to all that posted on my previous thread. It helped seeing what problems people were having.

If anyone has any problems, let me know. I will try and fix it.

Enjoy!


#2

Great post. I have been debating whether I should get one or not, but you have shown the sky is the limit. I would love to be able to stream my entire PC to another room to watch movies on or something. I don’t know if you can go that far, but this a step in the right direction.


#3

You could, it is intended to stream games at 60ish FPS, you made me interested and I’ll check to see if it streams all of the audio channels and not just stereo.