Moving mods instead of unpatching GC
No mods and a patched game is just as good as an unpatched game This fixes some issues with the wrong backup being restored
This commit is contained in:
parent
706e9c5393
commit
678217b281
5 changed files with 75 additions and 16 deletions
7
GCMM/MainForm.Designer.cs
generated
7
GCMM/MainForm.Designer.cs
generated
|
@ -196,17 +196,20 @@
|
|||
//
|
||||
// unpatched
|
||||
//
|
||||
this.unpatched.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.unpatched.AutoSize = true;
|
||||
this.unpatched.Location = new System.Drawing.Point(12, 534);
|
||||
this.unpatched.Name = "unpatched";
|
||||
this.unpatched.Size = new System.Drawing.Size(100, 17);
|
||||
this.unpatched.Size = new System.Drawing.Size(218, 17);
|
||||
this.unpatched.TabIndex = 8;
|
||||
this.unpatched.Text = "Run unpatched";
|
||||
this.unpatched.Text = "Disable mods (check if game is crashing)";
|
||||
this.unpatched.UseVisualStyleBackColor = true;
|
||||
this.unpatched.CheckedChanged += new System.EventHandler(this.unpatched_CheckedChanged);
|
||||
//
|
||||
// modinfobox
|
||||
//
|
||||
this.modinfobox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.modinfobox.BackColor = System.Drawing.Color.Black;
|
||||
this.modinfobox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.modinfobox.ForeColor = System.Drawing.Color.Lime;
|
||||
|
|
|
@ -26,21 +26,22 @@ namespace GCMM
|
|||
private string defaultInfo = @"
|
||||
Gamecraft Mod Manager
|
||||
|
||||
If you click on a mod it will show some info about it. The install instructions there are for manual installs.
|
||||
If you click on a mod it will show some info about it. The install instructions there are usually for manual installs.
|
||||
To get started, click on a mod and select Install mod. Most mods need GamecraftModdingAPI as well.
|
||||
Then, simply click Play. This will first download and run the patcher (GCIPA) if needed.
|
||||
If all goes well, after some time a modded Gamecraft should launch.
|
||||
|
||||
After a Gamecraft update there's a good chance that mods will break. If this happens you may get errors when trying to start Gamecraft.
|
||||
Until updated versions are released, use the ""Run unpatched"" checkbox at the bottom to launch the game without mods.
|
||||
Until updated versions are released, use the ""Disable mods"" checkbox at the bottom to launch the game without mods.
|
||||
|
||||
You don't have to use the mod manager to run the game each time, though it will tell you about mod updates when they come.
|
||||
However, make sure to click Play each time you want to switch between modded and unmodded.
|
||||
However, you need to run it and click ""Patch & Play"" each time there's a Gamecraft update.
|
||||
|
||||
Disclaimer:
|
||||
This mod manager and the mods in the list are made by the ExMods developers. We are not associated with Freejam or Gamecraft. Modify Gamecraft at your own risk.
|
||||
|
||||
If you encounter an issue while the game is patched, report it to us. If you think it's an issue with the game, test again with the unpatched option checked before reporting to Freejam.
|
||||
If you encounter an issue while any mods are installed, report it to us. If you think it's an issue with the game, test again with the ""Disable mods"" option checked before reporting to Freejam.
|
||||
You may also want to verify the game's files by right clicking the game in Steam and choosing Properties, going to Local files and clicking Verify integrity of game files.
|
||||
";
|
||||
|
||||
private void Form1_Load(object sender, EventArgs e)
|
||||
|
@ -68,6 +69,9 @@ If you encounter an issue while the game is patched, report it to us. If you thi
|
|||
status.Text = "Status: Game not found";
|
||||
return;
|
||||
}
|
||||
DeleteEmptyPluginsDir(out bool pexists, out bool dexists);
|
||||
if (!pexists && dexists)
|
||||
unpatched.Checked = true; //It will call the event but that won't do anything
|
||||
CheckIfPatched();
|
||||
GetInstalledMods();
|
||||
GetAvailableMods();
|
||||
|
@ -141,6 +145,14 @@ If you encounter an issue while the game is patched, report it to us. If you thi
|
|||
installbtn.Text = "Install mod";
|
||||
break;
|
||||
}
|
||||
if (unpatched.Checked)
|
||||
{ //Don't allow (un)installing mods if mods are disabled
|
||||
UpdateButton(installbtn, false);
|
||||
UpdateButton(uninstallbtn, false);
|
||||
modlist.Enabled = false;
|
||||
}
|
||||
else
|
||||
modlist.Enabled = true;
|
||||
}
|
||||
|
||||
private async void installbtn_Click(object sender, EventArgs e)
|
||||
|
@ -176,8 +188,48 @@ If you encounter an issue while the game is patched, report it to us. If you thi
|
|||
}
|
||||
|
||||
private void unpatched_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
{ //Not using the patcher's revert option because sometimes it restores the wrong files - the game can be patched without mods
|
||||
CheckIfPatched();
|
||||
modlist_SelectedIndexChanged(modlist, null);
|
||||
string plugins = GamePath("\\Plugins");
|
||||
string disabled = GamePath("\\Plugins_Disabled");
|
||||
DeleteEmptyPluginsDir(out bool pexists, out bool dexists);
|
||||
if (unpatched.Checked)
|
||||
{
|
||||
if (pexists)
|
||||
{
|
||||
if (dexists)
|
||||
Directory.Delete(disabled, true); //Resolving conflicts would be complicated so delete the other mods - this shouldn't happen normally
|
||||
Directory.Move(plugins, disabled);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (dexists)
|
||||
{
|
||||
if (pexists)
|
||||
Directory.Delete(plugins, true);
|
||||
Directory.Move(disabled, plugins);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void DeleteEmptyPluginsDir(out bool pexists, out bool dexists)
|
||||
{
|
||||
string plugins = GamePath("\\Plugins");
|
||||
string disabled = GamePath("\\Plugins_Disabled");
|
||||
pexists = Directory.Exists(plugins);
|
||||
dexists = Directory.Exists(disabled);
|
||||
if (pexists && !Directory.EnumerateFiles(plugins).Any())
|
||||
{
|
||||
Directory.Delete(plugins);
|
||||
pexists = false;
|
||||
}
|
||||
if (dexists && !Directory.EnumerateFiles(disabled).Any())
|
||||
{
|
||||
Directory.Delete(disabled);
|
||||
dexists = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -130,7 +130,7 @@ namespace GCMM
|
|||
File.Delete(file);
|
||||
var parent = Directory.GetParent(file);
|
||||
if (!parent.EnumerateFiles().Any())
|
||||
parent.Delete();
|
||||
parent.Delete(); //May delete the Plugins dir if empty
|
||||
}
|
||||
}
|
||||
File.Delete(mod.Name + ".json");
|
||||
|
|
|
@ -19,7 +19,12 @@ namespace GCMM
|
|||
|
||||
public void GetInstalledMods()
|
||||
{
|
||||
foreach (var modPath in Directory.GetFiles(GamePath(@"\Plugins"), "*.dll"))
|
||||
bool disabled = false;
|
||||
if (!Directory.Exists(GamePath("\\Plugins")))
|
||||
if (Directory.Exists(GamePath("\\Plugins_Disabled")))
|
||||
disabled = true;
|
||||
else return;
|
||||
foreach (var modPath in Directory.GetFiles(GamePath(disabled ? @"\Plugins_Disabled" : @"\Plugins"), "*.dll"))
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
|
@ -17,14 +17,14 @@ namespace GCMM
|
|||
{
|
||||
public bool? CheckIfPatched()
|
||||
{
|
||||
string pnp = unpatched.Checked ? "Play" : "Patch && Play";
|
||||
string pnp = "Patch && Play";
|
||||
if (!File.Exists(GamePath(@"\IPA.exe")))
|
||||
{
|
||||
status.Text = "Status: Patcher missing\nClicking Play will install it";
|
||||
playbtn.Text = pnp;
|
||||
return null;
|
||||
}
|
||||
string nopatch = "Status: Unpatched" + (unpatched.Checked ? "" : "\nClicking Play patches it");
|
||||
string nopatch = "Status: Unpatched\nClicking Play patches it";
|
||||
string gc = GetExe().Replace(".exe", "");
|
||||
string backups = GamePath(@"\IPA\Backups\" + gc);
|
||||
if (!Directory.Exists(backups))
|
||||
|
@ -48,8 +48,8 @@ namespace GCMM
|
|||
playbtn.Text = pnp;
|
||||
return false;
|
||||
}
|
||||
status.Text = "Status: Patched" + (unpatched.Checked ? "\nClicking Play unpatches it" : "");
|
||||
playbtn.Text = unpatched.Checked ? "Unpatch && Play" : "Play";
|
||||
status.Text = "Status: " + (unpatched.Checked ? "Mods disabled" : "Patched");
|
||||
playbtn.Text = "Play" + (unpatched.Checked ? " unmodded" : "");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -82,10 +82,9 @@ namespace GCMM
|
|||
EndWork(false);
|
||||
return;
|
||||
}
|
||||
if (!status.Value ^ unpatched.Checked)
|
||||
if (!status.Value)
|
||||
{ //TODO: Wine
|
||||
var psi = new ProcessStartInfo(GamePath(@"\IPA.exe"), GetExe() + " "
|
||||
+ (unpatched.Checked ? "--revert " : "") + "--nowait")
|
||||
var psi = new ProcessStartInfo(GamePath(@"\IPA.exe"), GetExe() + " --nowait")
|
||||
{
|
||||
UseShellExecute = false,
|
||||
RedirectStandardError = true,
|
||||
|
|
Loading…
Reference in a new issue