Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions PolyMod.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
</RestoreAdditionalProjectSources>
<Configurations>IL2CPP</Configurations>
<RootNamespace>PolyMod</RootNamespace>
<Version>1.2.13</Version>
<PolytopiaVersion>2.16.8.15757</PolytopiaVersion>
<Version>1.2.14</Version>
<PolytopiaVersion>2.17.0.16256</PolytopiaVersion>
<Authors>PolyModdingTeam</Authors>
<Description>The Battle of Polytopia's mod loader.</Description>
<NoWarn>IDE0130</NoWarn>
Expand Down
6 changes: 3 additions & 3 deletions src/Managers/AutoUpdate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ internal static class AutoUpdate
/// Checks for updates when the start screen is shown.
/// </summary>
[HarmonyPostfix]
[HarmonyPatch(typeof(StartScreen), nameof(StartScreen.Start))]
private static void StartScreen_Start()
[HarmonyPatch(typeof(StartScreen_UI2), nameof(StartScreen_UI2.OnShow))]
private static void StartScreen_UI2_OnShow()
{
if (!Plugin.config.autoUpdate) return;
if (Environment.GetEnvironmentVariable("WINEPREFIX") != null)
Expand Down Expand Up @@ -154,7 +154,7 @@ exit 0
}

// Show a popup to the user asking if they want to update
PopupManager.GetBasicPopup(new(
PopupManager.GetBasicPopupWithData(new(
Localization.Get("polymod.autoupdate"),
Localization.Get("polymod.autoupdate.description"),
new(new PopupBase.PopupButtonData[] {
Expand Down
45 changes: 24 additions & 21 deletions src/Managers/Compatibility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public static void HashSignatures(StringBuilder checksumString)
/// Checks the signature of a saved game to ensure it is compatible with the current mods.
/// </summary>
/// <returns>True if the signatures match or if the check is ignored, false otherwise.</returns>
private static bool CheckSignatures(Action<int, BaseEventData> action, int id, BaseEventData eventData, Il2CppSystem.Guid gameId)
private static bool CheckSignatures(Action action, Il2CppSystem.Guid gameId)
{
if (sawSignatureWarning)
{
Expand Down Expand Up @@ -67,13 +67,14 @@ private static bool CheckSignatures(Action<int, BaseEventData> action, int id, B
}
if (!doChecksumsMatch)
{
PopupManager.GetBasicPopup(new(
PopupManager.GetBasicPopupWithData(new(
Localization.Get("polymod.signature.mismatch"),
Localization.Get("polymod.signature.incompatible"),
new(new PopupBase.PopupButtonData[] {
new("OK")
})
)).Show();

return false;
}
return true;
Expand All @@ -83,8 +84,8 @@ private static bool CheckSignatures(Action<int, BaseEventData> action, int id, B
/// Performs compatibility checks when the start screen is shown.
/// </summary>
[HarmonyPostfix]
[HarmonyPatch(typeof(StartScreen), nameof(StartScreen.Start))]
private static void StartScreen_Start()
[HarmonyPatch(typeof(StartScreen_UI2), nameof(StartScreen_UI2.OnShow))]
private static void StartScreen_UI2_OnShow()
{
string lastChecksum = checksum;
try
Expand Down Expand Up @@ -113,18 +114,20 @@ private static void StartScreen_Start()
VersionManager.SemanticVersion.Cast().CutRevision().ToString()
);
PlayerPrefs.Save();
PopupManager.GetBasicPopup(new(
Localization.Get("polymod.version.mismatch"),
Localization.Get("polymod.version.mismatch.description"),
new(new PopupBase.PopupButtonData[] {
new("buttons.stay", customColorStates: ColorConstants.redButtonColorStates),
new(
"buttons.exitgame",
PopupBase.PopupButtonData.States.None,
(Il2CppSystem.Action)Application.Quit,
closesPopup: false
)
}))
PopupManager.GetBasicPopupWithData(
new(
Localization.Get("polymod.version.mismatch"),
Localization.Get("polymod.version.mismatch.description"),
new PopupBase.PopupButtonData[] {
new("buttons.stay", customColorStates: ColorConstants.redButtonColorStates),
new(
"buttons.exitgame",
PopupBase.PopupButtonData.States.None,
(Il2CppSystem.Action)Application.Quit,
closesPopup: false
)
}
)
).Show();
}
}
Expand All @@ -134,19 +137,19 @@ private static void StartScreen_Start()
/// </summary>
[HarmonyPrefix]
[HarmonyPatch(typeof(GameInfoPopup), nameof(GameInfoPopup.OnMainButtonClicked))]
private static bool GameInfoPopup_OnMainButtonClicked(GameInfoPopup __instance, int id, BaseEventData eventData)
private static bool GameInfoPopup_OnMainButtonClicked(GameInfoPopup __instance)
{
return CheckSignatures(__instance.OnMainButtonClicked, id, eventData, __instance.gameId);
return CheckSignatures(__instance.OnMainButtonClicked, __instance.gameId);
}

/// <summary>
/// Checks the signature of a single-player game before resuming it.
/// </summary>
[HarmonyPrefix]
[HarmonyPatch(typeof(StartScreen), nameof(StartScreen.OnResumeButtonClick))]
private static bool StartScreen_OnResumeButtonClick(StartScreen __instance, int id, BaseEventData eventData)
[HarmonyPatch(typeof(StartScreen_UI2), nameof(StartScreen_UI2.OnResumeButtonLongPress))]
private static bool StartScreen_OnResumeButtonClick(StartScreen_UI2 __instance)
{
return CheckSignatures(__instance.OnResumeButtonClick, id, eventData, LocalSaveFileUtils.GetSaveFiles(PolytopiaBackendBase.Game.GameType.SinglePlayer)[0]);
return CheckSignatures(__instance.OnResumeButtonLongPress, LocalSaveFileUtils.GetSaveFiles(PolytopiaBackendBase.Game.GameType.SinglePlayer)[0]);
}

/// <summary>
Expand Down
Loading
Loading