Verify that the launched exe belongs to the selected content package, and if not, ask if the player wants to relaunch with the correct exe. Closes #955
This commit is contained in:
@@ -11,6 +11,7 @@ using System.Diagnostics;
|
||||
using System.Reflection;
|
||||
using GameAnalyticsSDK.Net;
|
||||
using System.Threading;
|
||||
using System.IO;
|
||||
|
||||
namespace Barotrauma
|
||||
{
|
||||
@@ -386,6 +387,8 @@ namespace Barotrauma
|
||||
LocationType.Init();
|
||||
MainMenuScreen.Select();
|
||||
|
||||
CheckContentPackage();
|
||||
|
||||
TitleScreen.LoadState = 100.0f;
|
||||
hasLoaded = true;
|
||||
if (GameSettings.VerboseLogging)
|
||||
@@ -396,6 +399,27 @@ namespace Barotrauma
|
||||
|
||||
}
|
||||
|
||||
private void CheckContentPackage()
|
||||
{
|
||||
var exePaths = Config.SelectedContentPackage.GetFilesOfType(ContentType.Executable);
|
||||
if (exePaths.Count > 0 && AppDomain.CurrentDomain.FriendlyName != exePaths[0])
|
||||
{
|
||||
var msgBox = new GUIMessageBox(TextManager.Get("Error"),
|
||||
TextManager.Get("IncorrectExe")
|
||||
.Replace("[selectedpackage]", Config.SelectedContentPackage.Name)
|
||||
.Replace("[exename]", exePaths[0]),
|
||||
new string[] { TextManager.Get("Yes"), TextManager.Get("No") });
|
||||
msgBox.Buttons[0].OnClicked += (_, userdata) =>
|
||||
{
|
||||
string fullPath = Path.GetFullPath(exePaths[0]);
|
||||
Process.Start(fullPath);
|
||||
Exit();
|
||||
return true;
|
||||
};
|
||||
msgBox.Buttons[1].OnClicked = msgBox.Close;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// UnloadContent will be called once per game and is the place to unload
|
||||
/// all content.
|
||||
|
||||
Reference in New Issue
Block a user