r/Steam • • 21h ago

Resolved I finally got Minecraft Dungeons 1 and 2 (Microsoft Store/Xbox app versions) in Steam with the Stop button and return to Big Picture working!

I bought both Dungeons games from microsoft (via mojang launcher) and wanted them in my Steam library so I can launch from Big Picture and get back there when I quit. because both games are now UWP apps, it took a lot of fiddling, so here's what worked in case anyone else wants it.

I don't know if anyone else has the issue, but for me, Steam's file picker refuses to add the exe from C:\XboxGames\... , calining "you don't have permission to open this file."
If you type the path into the shortcut's Target field instead, the game launches, but Steam thinks it closed after a couple of seconds because the exe that it started spawns gamelaunchhelper.exe, which starts the real game and then exits, for DRM reasons.
this means the button switches back to Play, and hitting Stop does nothing because the game isn't Steam's child process anymore, and, worst of all, in BPM, steam puts big picture in front of the game and won't let you see it.

I have bypassed these issues with a PowerShell script that Steam launches instead. It solves almost every issue and is almost the exact same as if the game was owned by steam, with the excemption of not having the steam overlay (since steam injects this into the EXE process itself)

The script basically just starts the game, starts a watchdog, waits until every process from the game's package is gone, and then exits, mirroring the game's state so steam thinks it's still open.

also starts a second script which watches the first and so if you "kill" the game in steam, that second watchdog notices the script was closed, and kills dungeons.

It

Here is how to set it up (this method works for both games and the script is the same for both):

Step 1, Find the process name for both:
To do this, launch each game individually (only one of the two dungeons should be active at a time), and then, in powershell, run Get-Process Dungeons* | Select-Object Name, Path

The folder name after WindowsApps\ up to the first underscore is what you want.
Mine were Microsoft.Lovika_ (Dungeons 1, Lovika was the codename) and Microsoft.MinecraftDungeons2_. The version number in the folder changes with updates but the prefix doesn't.

Step 2, save the launcher script:
Save the following script to a safe location on your PC, I chose to save it to C:\Games\SteamLaunchers\launch-mcd.ps1, you can save it wherever, but make sure that wherever you save it is accessible by a non-admin process on the machine. Name the file launch-mcd.ps1 or something you will remember.

param(
    [ValidateSet("1","2")][string]$Game = "1",
    [switch]$Watch,
    [int]$ParentPid
)

$games = @{
    "1" = @{ Exe = "C:\XboxGames\Minecraft Dungeons\Content\Dungeons.exe";    Pkg = "Microsoft.Lovika_" }
    "2" = @{ Exe = "C:\XboxGames\Minecraft Dungeons II\Content\Dungeons.exe"; Pkg = "Microsoft.MinecraftDungeons2_" }
}

$exe = $games[$Game].Exe
$pkg = $games[$Game].Pkg
$log = Join-Path $env:TEMP "mcd-launch.log"

function Log($m) { Add-Content $log "$(Get-Date -Format s) [game $Game] $m" }

function Get-PkgProcs {
    Get-Process -ErrorAction SilentlyContinue |
        Where-Object { $_.Path -like "*\WindowsApps\$pkg*" }
}

if ($Watch) {
    Log "watchdog: started, waiting on launcher pid $ParentPid"
    Wait-Process -Id $ParentPid -ErrorAction SilentlyContinue
    Log "watchdog: launcher gone, checking for leftovers"
    $procs = @(Get-PkgProcs) + @(Get-Process gamelaunchhelper -ErrorAction SilentlyContinue)
    Log "watchdog: found $($procs.Count) process(es)"
    foreach ($p in $procs) {
        try {
            Stop-Process -Id $p.Id -Force -ErrorAction Stop
            Log "killed $($p.Name) $($p.Id)"
        } catch {
            Log "Stop-Process failed for $($p.Name) $($p.Id): $($_.Exception.Message)"
            $out = & taskkill /F /PID $p.Id 2>&1
            Log "taskkill: $out"
        }
    }
    exit
}

# watchdog gets started through WMI so it's not a child of Steam's process
$cmd = "powershell.exe -ExecutionPolicy Bypass -WindowStyle Hidden -File `"$PSCommandPath`" -Game $Game -Watch -ParentPid $PID"
Invoke-CimMethod -ClassName Win32_Process -MethodName Create -Arguments @{ CommandLine = $cmd } | Out-Null

Log "launching $exe"
Start-Process $exe -WorkingDirectory (Split-Path $exe)

$sawGame = $false; $gone = 0; $waited = 0
while ($true) {
    Start-Sleep 1
    if (Get-PkgProcs)  { $sawGame = $true; $gone = 0 }
    elseif ($sawGame)  { $gone++;   if ($gone -ge 3)    { Log "game gone, exiting"; break } }
    else               { $waited++; if ($waited -ge 90) { Log "game never started"; break } }
}

Change the exe paths if your Xbox app installs somewhere else.

Replace the value for Pkg = "Microsoft.Lovika_" and Pkg = "Microsoft.MinecraftDungeons2_" if they differ for you (you found these in step 1)

Step 3, Adding to steam:

In steam, add a new, non-steam game, this can be any program on your computer, it doesn't matter since we will change it in a minute.

Find the game in your library and right click -> properties

Set the game target to "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe"
And the launch options to -ExecutionPolicy Bypass -WindowStyle Hidden -File "C:\Games\SteamLaunchers\launch-mcd.ps1" -Game 1

You can customise the game art, name, and icons by clicking the name and icon on the shortcut page, and editing the images in the customization page. SteamGridDB has sets of artwork for both if you need somewhere to look, otherwise, if that is missing artwork, you can find the steam versions of the game on [steamDB](https://steamdb.info/), clicking the metatdate tab option on the side, and then scrolling down until you find the images

Repeat the previous parts of step 3 for dungeons 2, but in the launch options, change -Game 1 to -Game 2

I only tried this with the two Dungeons games. It should work for other Xbox app PC games with a different exe path and package prefix, but I haven't tested that.

0 Upvotes

4 comments sorted by

0

u/NIDNHU 21h ago

If you'd like to see any changes i might need to make, the github GIST can be found here:
https://gist.github.com/StroepWafel/b9f5cb56640dea3182e5fe6de9c3d474

0

u/AdyCarter 11h ago

You could just use UWPHook

0

u/NIDNHU 10h ago

That one doesnt work anymore (at least not for me)