Skip to content

Commit

Permalink
Fix version mismatch check
Browse files Browse the repository at this point in the history
  • Loading branch information
Koi-3088 committed Jun 6, 2023
1 parent 093f0cc commit 607ae09
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion AutoLegalityMod/GUI/ALMSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ private void ALMSettings_FormClosing(object sender, FormClosingEventArgs e)
pluginSettings.Save();
}

private void EditSettingsProperties(object _settings)
private static void EditSettingsProperties(object _settings)
{
var lang = WinFormsTranslator.CurrentLanguage;
var translation = WinFormsTranslator.GetContext(lang);
Expand Down
14 changes: 8 additions & 6 deletions AutoLegalityMod/Plugins/AutoModPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,15 @@ private async Task TranslateInterface(CancellationToken token)
private static (bool, ALMError?) CheckForMismatch()
{
bool mismatch = ALMVersion.GetIsMismatch();
if (mismatch)
{
_settings.EnableDevMode = false;
bool reset = ALMVersion.Versions.CoreVersionCurrent > new Version(_settings.LatestAllowedVersion);
if (reset)
_settings.LatestAllowedVersion = "0.0.0.0";
return (mismatch, WinFormsUtil.ALMErrorMismatch(ALMVersion.Versions));
}
return (false, null);

_settings.EnableDevMode = _settings.EnableDevMode && !mismatch;
if (mismatch || reset)
_settings.Save();

return (mismatch, mismatch ? WinFormsUtil.ALMErrorMismatch(ALMVersion.Versions) : null);
}

private void LoadMenuStrip(ToolStrip menuStrip)
Expand Down
2 changes: 1 addition & 1 deletion PKHeX.Core.AutoMod/AutoMod/Util/Version.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public static bool GetIsMismatch(Version? currentCore, Version? currentALM, Vers
return false;

var latestAllowed = new Version(APILegality.LatestAllowedVersion);
if (APILegality.EnableDevMode && (latestCore > latestAllowed))
if (APILegality.EnableDevMode && (latestCore > latestAllowed) && (latestCore > currentCore))
return true;
return !APILegality.EnableDevMode && (currentCore > currentALM);
}
Expand Down
4 changes: 1 addition & 3 deletions PKHeX.Core.Injection/Enums/LiveHeXVersion.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System.Runtime.CompilerServices;

namespace PKHeX.Core.Injection
namespace PKHeX.Core.Injection
{
public enum LiveHeXVersion
{
Expand Down

0 comments on commit 607ae09

Please sign in to comment.