Skip to content

Commit

Permalink
- Sunshine doesn't like null properties, don't write them
Browse files Browse the repository at this point in the history
- Write blank string working dir since we're sending the full exe path to cmd
- Actually skip excluded word match
- Make xbox games be in detached mode due to some unknown issue with them not launching correctly
  • Loading branch information
JMTK committed Mar 25, 2023
1 parent dd76cb4 commit 890fc52
Showing 1 changed file with 23 additions and 5 deletions.
28 changes: 23 additions & 5 deletions SunshineGameFinder/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
if (exclusionWords.Any(ew => gameName.Contains(ew)))
{
Console.WriteLine($"Skipping {gameName} as it was an excluded word match...");
continue;
}
var exe = Directory.GetFiles(gameDir, "*.exe", SearchOption.AllDirectories).FirstOrDefault(exefile => !exeExclusionWords.Any(ew => new FileInfo(exefile).Name.Contains(ew)));
if (string.IsNullOrEmpty(exe)) {
Expand All @@ -32,11 +33,28 @@
var existingApp = sunshineAppInstance.apps.FirstOrDefault(g => g.cmd == exe || g.name == gameName);
if (existingApp == null)
{
existingApp = new SunshineApp()
if (exe.Contains("gamelaunchhelper.exe"))
{
//xbox game pass game
existingApp = new SunshineApp()
{
name = gameName,
detached = new List<string>()
{
exe
},
workingdir = ""
};
}
else
{
name = gameName,
cmd = exe
};
existingApp = new SunshineApp()
{
name = gameName,
cmd = exe,
workingdir = ""
};
}
Console.WriteLine($"Adding new game to Sunshine apps: {gameName} - {exe}");
sunshineAppInstance.apps.Add(existingApp);
}
Expand All @@ -47,4 +65,4 @@
}
}
Console.WriteLine("Complete!");
File.WriteAllText(sunshineAppsJson, JsonConvert.SerializeObject(sunshineAppInstance, Newtonsoft.Json.Formatting.Indented));
File.WriteAllText(sunshineAppsJson, JsonConvert.SerializeObject(sunshineAppInstance, Newtonsoft.Json.Formatting.Indented, new JsonSerializerSettings() { NullValueHandling = NullValueHandling.Ignore }));

0 comments on commit 890fc52

Please sign in to comment.