Skip to content

Commit

Permalink
v2.6.21 - With more KSP 1.1 and less x64 complains
Browse files Browse the repository at this point in the history
  • Loading branch information
sarbian committed Mar 29, 2016
1 parent 44d5342 commit 11bfda6
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 39 deletions.
5 changes: 5 additions & 0 deletions ModuleManager.csproj
Expand Up @@ -20,6 +20,7 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>False</ConsolePause>
<LangVersion>5</LangVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>none</DebugType>
Expand All @@ -38,16 +39,20 @@
<ItemGroup>
<Reference Include="Assembly-CSharp, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<Private>False</Private>
</Reference>
<Reference Include="KSPUtil, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL" />
<Reference Include="System, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, processorArchitecture=MSIL" />
<Reference Include="UnityEngine, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<Private>False</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Properties\Resources.resx" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
<None Include="Properties\cat" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
Expand Down
2 changes: 1 addition & 1 deletion Properties/AssemblyInfo.cs
Expand Up @@ -17,7 +17,7 @@
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.

[assembly: AssemblyVersion("2.6.20")]
[assembly: AssemblyVersion("2.6.21")]
[assembly: KSPAssembly("ModuleManager", 2, 5)]

// The following attributes are used to specify the signing key for the assembly,
Expand Down
82 changes: 44 additions & 38 deletions moduleManager.cs
Expand Up @@ -177,20 +177,20 @@ public void OnGUI()
offsetY += 25;
}

if (IsABadIdea())
{
GUIStyle centeredWarningStyle = new GUIStyle(GUI.skin.GetStyle("Label"))
{
alignment = TextAnchor.UpperCenter,
fontSize = 16,
normal = { textColor = Color.yellow }
};
const string warning = "You are using 64-bit KSP on Windows. This version of KSP is known to cause crashes unrelated to mods.";
Vector2 sizeOfWarningLabel = centeredWarningStyle.CalcSize(new GUIContent(warning));

GUI.Label(new Rect(Screen.width / 2f - (sizeOfWarningLabel.x / 2f), offsetY, sizeOfWarningLabel.x, sizeOfWarningLabel.y), warning, centeredWarningStyle);
offsetY += sizeOfWarningLabel.y;
}
//if (IsABadIdea())
//{
// GUIStyle centeredWarningStyle = new GUIStyle(GUI.skin.GetStyle("Label"))
// {
// alignment = TextAnchor.UpperCenter,
// fontSize = 16,
// normal = { textColor = Color.yellow }
// };
// const string warning = "You are using 64-bit KSP on Windows. This version of KSP is known to cause crashes unrelated to mods.";
// Vector2 sizeOfWarningLabel = centeredWarningStyle.CalcSize(new GUIContent(warning));
//
// GUI.Label(new Rect(Screen.width / 2f - (sizeOfWarningLabel.x / 2f), offsetY, sizeOfWarningLabel.x, sizeOfWarningLabel.y), warning, centeredWarningStyle);
// offsetY += sizeOfWarningLabel.y;
//}

GUIStyle centeredStyle = new GUIStyle(GUI.skin.GetStyle("Label"))
{
Expand All @@ -214,7 +214,7 @@ public void OnGUI()
}


if (IsABadIdea() || nyan)
if (nyan)
{
GUI.color = Color.white;
int scale = 1;
Expand Down Expand Up @@ -262,11 +262,14 @@ public void OnGUI()
}
}


internal static IntPtr intPtr = new IntPtr(long.MaxValue);
/* Not required anymore. At least
public static bool IsABadIdea()
{
return (intPtr.ToInt64() == long.MaxValue) && (Environment.OSVersion.Platform == PlatformID.Win32NT);
}
*/

private void WindowGUI(int windowID)
{
Expand Down Expand Up @@ -382,11 +385,14 @@ public bool ElectionAndCheck()
string status =
"You have old versions of Module Manager (older than 1.5) or MMSarbianExt.\nYou will need to remove them for Module Manager and the mods using it to work\nExit KSP and delete those files :\n" +
String.Join("\n", badPaths.ToArray());
PopupDialog.SpawnPopupDialog("Old versions of Module Manager", status, "OK", false, HighLogic.Skin);
PopupDialog.SpawnPopupDialog(new Vector2(0f, 1f), new Vector2(0f, 1f), "Old versions of Module Manager", status, "OK", false, UISkinManager.defaultSkin);
log("Old version of Module Manager present. Stopping");
return false;
}


//PopupDialog.SpawnPopupDialog(new Vector2(0.1f, 1f), new Vector2(0.2f, 1f), "Test of the dialog", "Stuff", "OK", false, UISkinManager.defaultSkin);

Assembly currentAssembly = Assembly.GetExecutingAssembly();
IEnumerable<AssemblyLoader.LoadedAssembly> eligible = from a in AssemblyLoader.loadedAssemblies
let ass = a.assembly
Expand Down Expand Up @@ -569,34 +575,34 @@ private List<string> PrePatchInit()
// Build a list of subdirectory that won't be processed
List<string> excludePaths = new List<string>();

if (ModuleManager.IsABadIdea())
{
foreach (UrlDir.UrlConfig mod in GameDatabase.Instance.root.AllConfigs)
{
if (mod.name == "MODULEMANAGER[NOWIN64]")
{
string fullpath = mod.url.Substring(0, mod.url.LastIndexOf('/'));
string excludepath = fullpath.Substring(0, fullpath.LastIndexOf('/'));
excludePaths.Add(excludepath);
log("excludepath: " + excludepath);
}
}
if (excludePaths.Any())
log("will not process patches in these subdirectories since they were disbaled on KSP Win64:\n" + String.Join("\n", excludePaths.ToArray()));
}
//if (ModuleManager.IsABadIdea())
//{
// foreach (UrlDir.UrlConfig mod in GameDatabase.Instance.root.AllConfigs)
// {
// if (mod.name == "MODULEMANAGER[NOWIN64]")
// {
// string fullpath = mod.url.Substring(0, mod.url.LastIndexOf('/'));
// string excludepath = fullpath.Substring(0, fullpath.LastIndexOf('/'));
// excludePaths.Add(excludepath);
// log("excludepath: " + excludepath);
// }
// }
// if (excludePaths.Any())
// log("will not process patches in these subdirectories since they were disbaled on KSP Win64:\n" + String.Join("\n", excludePaths.ToArray()));
//}

#endregion Excluding directories

#region List of mods

string envInfo = "ModuleManager env info\n";
envInfo += " " + Environment.OSVersion.Platform + " " + ModuleManager.intPtr.ToInt64().ToString("X16") + "\n";
//string envInfo = "ModuleManager env info\n";
//envInfo += " " + Environment.OSVersion.Platform + " " + ModuleManager.intPtr.ToInt64().ToString("X16") + "\n";
//envInfo += " " + Convert.ToString(ModuleManager.intPtr.ToInt64(), 2) + " " + Convert.ToString(ModuleManager.intPtr.ToInt64() >> 63, 2) + "\n";
string gamePath = Environment.GetCommandLineArgs()[0];
envInfo += " Args: " + gamePath.Split(Path.DirectorySeparatorChar).Last() + " " + string.Join(" ", Environment.GetCommandLineArgs().Skip(1).ToArray()) + "\n";
envInfo += " Executable SHA256 " + FileSHA(gamePath);

log(envInfo);
//string gamePath = Environment.GetCommandLineArgs()[0];
//envInfo += " Args: " + gamePath.Split(Path.DirectorySeparatorChar).Last() + " " + string.Join(" ", Environment.GetCommandLineArgs().Skip(1).ToArray()) + "\n";
//envInfo += " Executable SHA256 " + FileSHA(gamePath);
//
//log(envInfo);

mods = new List<string>();

Expand Down

0 comments on commit 11bfda6

Please sign in to comment.