Skip to content

Commit

Permalink
Terraria legacy beta branch support (#4178)
Browse files Browse the repository at this point in the history
* Provide helpful error message for Terraria 1.0.6.1 users

* Open up FAQ for out of date or legacy terraria branch fatal exits
  • Loading branch information
JavidPack authored and Solxanich committed Apr 28, 2024
1 parent f7ebd6d commit 2f47ff2
Show file tree
Hide file tree
Showing 12 changed files with 33 additions and 0 deletions.
Expand Up @@ -580,6 +580,7 @@
"AntivirusHint": "Tipp: Falls du einen Antivirenprogramm hast, versuche Terraria zu dessen Whitelist/Ausschließungsliste hinzuzufügen.",
"TypeInitializationHint": "Tipp: Starte das Spiel neu. Wenn das Problem bestehen bleibt, versuche Terraria vollständig zu deinstallieren, es über Steam neu zu installieren und dann tModLoader erneut zu installieren.",
// "TerrariaOutOfDateMessage": "Terraria is out of date, you need to update Terraria in Steam.",
// "TerrariaLegacyBranchMessage": "Terraria is on a legacy version, you need to switch back to the normal Terraria version in Steam for tModLoader to load.",

// Tag categories are not displayed in game currently, but are shown on workshop
// "TagsCategoryModFeatures": "Mod Features",
Expand Down
Expand Up @@ -580,6 +580,7 @@
"AntivirusHint": "Tip: If you have an antivirus, try adding Terraria to its whitelist/exclusion list",
"TypeInitializationHint": "Tip: Restart the game. If this issue persists, try uninstalling Terraria completely, then reinstalling through Steam, and then reinstalling tModLoader",
"TerrariaOutOfDateMessage": "Terraria is out of date, you need to update Terraria in Steam.",
"TerrariaLegacyBranchMessage": "Terraria is on a legacy version, you need to switch back to the normal Terraria version in Steam for tModLoader to load.",

// Tag categories are not displayed in game currently, but are shown on workshop
"TagsCategoryModFeatures": "Mod Features",
Expand Down
Expand Up @@ -580,6 +580,7 @@
"AntivirusHint": "Sugerencia: Si tienes antivirus, prueba a añadir Terraria a tu lista de exclusiones.",
"TypeInitializationHint": "Sugerencia: Reinicia el juego. Si el problema persiste, prueba a desinstalar Terraria completamente, reinstala el juego a través de Steam y vuelve a instalar tModLoader.",
"TerrariaOutOfDateMessage": "El juego está desactualizado. Debes actualizar Terraria en Steam.",
// "TerrariaLegacyBranchMessage": "Terraria is on a legacy version, you need to switch back to the normal Terraria version in Steam for tModLoader to load.",

// Tag categories are not displayed in game currently, but are shown on workshop
"TagsCategoryModFeatures": "Características del mod",
Expand Down
Expand Up @@ -580,6 +580,7 @@
"AntivirusHint": "Conseil: Si vous avez un antivirus, essayez d’ajouter Terraria à sa liste blanche/d’exclusion",
"TypeInitializationHint": "Conseil: Redémarrez le jeu. Si ce problème persiste, essayez de désinstaller complètement Terraria, puis de réinstaller via Steam, puis de réinstaller tModLoader",
// "TerrariaOutOfDateMessage": "Terraria is out of date, you need to update Terraria in Steam.",
// "TerrariaLegacyBranchMessage": "Terraria is on a legacy version, you need to switch back to the normal Terraria version in Steam for tModLoader to load.",

// Tag categories are not displayed in game currently, but are shown on workshop
// "TagsCategoryModFeatures": "Mod Features",
Expand Down
Expand Up @@ -582,6 +582,7 @@
// "AntivirusHint": "Tip: If you have an antivirus, try adding Terraria to its whitelist/exclusion list",
// "TypeInitializationHint": "Tip: Restart the game. If this issue persists, try uninstalling Terraria completely, then reinstalling through Steam, and then reinstalling tModLoader",
// "TerrariaOutOfDateMessage": "Terraria is out of date, you need to update Terraria in Steam.",
// "TerrariaLegacyBranchMessage": "Terraria is on a legacy version, you need to switch back to the normal Terraria version in Steam for tModLoader to load.",

// Tag categories are not displayed in game currently, but are shown on workshop
// "TagsCategoryModFeatures": "Mod Features",
Expand Down
Expand Up @@ -580,6 +580,7 @@
"AntivirusHint": "Wskazówka: Jeśli masz antywirusa, spróbuj dodać Terrarię do jego białej listy/listy wykluczeń.",
"TypeInitializationHint": "Wskazówka: Uruchom ponownie grę. Jeśli problem nadal występuje, spróbuj całkowicie odinstalować Terrarię, zainstalować ją ponownie poprzez Steam, a następnie ponownie zainstalować tModLoader.",
"TerrariaOutOfDateMessage": "Terraria jest nieaktualna, musisz zaktualizować Terraria w Steamie.",
// "TerrariaLegacyBranchMessage": "Terraria is on a legacy version, you need to switch back to the normal Terraria version in Steam for tModLoader to load.",

// Tag categories are not displayed in game currently, but are shown on workshop
"TagsCategoryModFeatures": "Cechy Modu",
Expand Down
Expand Up @@ -580,6 +580,7 @@
"AntivirusHint": "Dica: Se você tiver um antivírus, tente adicionar Terraria à sua lista de permissão/lista de exclusão",
"TypeInitializationHint": "Dica: Reinicie o jogo. Se o problema persistir, tente desinstalar o Terraria completamente, reinstalar por meio do Steam e, em seguida, reinstalar o tModLoader",
"TerrariaOutOfDateMessage": "O Terraria está desatualizado, você precisa atualizar o Terraria no Steam.",
// "TerrariaLegacyBranchMessage": "Terraria is on a legacy version, you need to switch back to the normal Terraria version in Steam for tModLoader to load.",

// Tag categories are not displayed in game currently, but are shown on workshop
"TagsCategoryModFeatures": "Recursos do mod",
Expand Down
Expand Up @@ -580,6 +580,7 @@
"AntivirusHint": "Совет: Если у вас установлен антивирус, попробуйте добавить Terraria в список исключений/белый список антивируса.",
"TypeInitializationHint": "Совет: Перезапустите игру. Если проблема не исчезла, то попробуйте полностью удалить Terraria, а затем повторно установить игру через Steam, после чего переустановите tModLoader.",
"TerrariaOutOfDateMessage": "Ваша версия Terraria устарела, пожалуйста, обновите её через Steam.",
// "TerrariaLegacyBranchMessage": "Terraria is on a legacy version, you need to switch back to the normal Terraria version in Steam for tModLoader to load.",

// Tag categories are not displayed in game currently, but are shown on workshop
"TagsCategoryModFeatures": "Особенности мода",
Expand Down
Expand Up @@ -584,6 +584,7 @@
"AntivirusHint": "提示:如果你开启了杀毒软件,请尝试将Terraria和tModLoader加入白名单。",
"TypeInitializationHint": "提示:重启游戏。如果问题仍然发生,你可以尝试以下步骤:\n\n1、卸载Terraria\n2、从Steam重新安装Terraria\n3、从Steam重新安装tModLoader",
"TerrariaOutOfDateMessage": "泰拉瑞亚(Terraria)是过时的,你需要在Steam中更新泰拉瑞亚。",
// "TerrariaLegacyBranchMessage": "Terraria is on a legacy version, you need to switch back to the normal Terraria version in Steam for tModLoader to load.",

// Tag categories are not displayed in game currently, but are shown on workshop
"TagsCategoryModFeatures": "模组功能",
Expand Down
7 changes: 7 additions & 0 deletions patches/tModLoader/Terraria/Main.TML.cs
Expand Up @@ -497,8 +497,15 @@ internal void InitTMLContentManager()
ErrorReporting.FatalExit(Language.GetTextValue("tModLoader.ContentFolderNotFound"));
}

// Canary file for legacy Terraria branches.
if (!File.Exists(Path.Combine(vanillaContentFolder, "Images", "Projectile_56.xnb"))) {
Utils.OpenToURL("https://github.com/tModLoader/tModLoader/wiki/Basic-tModLoader-Usage-FAQ#terraria-is-out-of-date-or-terraria-is-on-a-legacy-version");
ErrorReporting.FatalExit(Language.GetTextValue("tModLoader.TerrariaLegacyBranchMessage"));
}

// Canary file, ensures that Terraria has updated to at least the version this tModLoader was built for. Alternate check to BuildID check in TerrariaSteamClient for non-Steam launches
if (!File.Exists(Path.Combine(vanillaContentFolder, "Images", "Projectile_981.xnb"))) {
Utils.OpenToURL("https://github.com/tModLoader/tModLoader/wiki/Basic-tModLoader-Usage-FAQ#terraria-is-out-of-date-or-terraria-is-on-a-legacy-version");
ErrorReporting.FatalExit(Language.GetTextValue("tModLoader.TerrariaOutOfDateMessage"));
}

Expand Down
Expand Up @@ -220,8 +220,13 @@ private static void CheckSteam()
ErrorReporting.FatalExit(Language.GetTextValue("tModLoader.TerrariaNotInstalled"));
break;
case TerrariaSteamClient.LaunchResult.ErrInstallOutOfDate:
Utils.OpenToURL("https://github.com/tModLoader/tModLoader/wiki/Basic-tModLoader-Usage-FAQ#terraria-is-out-of-date-or-terraria-is-on-a-legacy-version");
ErrorReporting.FatalExit(Language.GetTextValue("tModLoader.TerrariaOutOfDateMessage"));
break;
case TerrariaSteamClient.LaunchResult.ErrInstallLegacyVersion:
Utils.OpenToURL("https://github.com/tModLoader/tModLoader/wiki/Basic-tModLoader-Usage-FAQ#terraria-is-out-of-date-or-terraria-is-on-a-legacy-version");
ErrorReporting.FatalExit(Language.GetTextValue("tModLoader.TerrariaLegacyBranchMessage"));
break;
default:
throw new Exception("Unsupported result type: " + result);
}
Expand Down
Expand Up @@ -16,13 +16,15 @@ internal class TerrariaSteamClient
private static ILog Logger { get; } = LogManager.GetLogger("TerrariaSteamClient");

private const int LatestTerrariaBuildID = 9653812; // Currently v1.4.4.4. Update this when any Terraria update changes any asset. Also update InitTMLContentManager with a newly added file
private static int[] LegacyTerrariaBuildIDs = new int[] { 13650765 }; // Terraria legacy branch build IDs (v1.0.6.1)
private static AnonymousPipeServerStream serverPipe;

private static string MsgInitFailed = "init_failed";
private static string MsgInitSuccess = "init_success";
private static string MsgFamilyShared = "family_shared";
private static string MsgNotInstalled = "not_installed";
private static string MsgInstallOutOfDate = "install_out_of_date";
private static string MsgInstallLegacyVersion = "install_legacy_version";
private static string MsgGrant = "grant:";
private static string MsgAck = "acknowledged";
private static string MsgShutdown = "shutdown";
Expand All @@ -34,6 +36,7 @@ public enum LaunchResult
ErrSteamInitFailed,
ErrNotInstalled,
ErrInstallOutOfDate,
ErrInstallLegacyVersion,
Ok
}

Expand Down Expand Up @@ -84,6 +87,9 @@ internal static LaunchResult Launch()
if (line == MsgInstallOutOfDate)
return LaunchResult.ErrInstallOutOfDate;

if (line == MsgInstallLegacyVersion)
return LaunchResult.ErrInstallLegacyVersion;

if (line == MsgInitSuccess)
break;

Expand Down Expand Up @@ -154,6 +160,12 @@ internal static void Run()

int TerrariaBuildID = SteamApps.GetAppBuildId();
Logger.Info("Terraria BuildID: " + TerrariaBuildID);
if (LegacyTerrariaBuildIDs.Contains(TerrariaBuildID)) {
Logger.Fatal("Terraria is on a legacy version, you need to switch back to the normal Terraria version in Steam for tModLoader to load.");
Send(MsgInstallLegacyVersion);
SteamShutdown();
return;
}
if (TerrariaBuildID < LatestTerrariaBuildID) {
Logger.Fatal("Terraria is out of date, you need to update Terraria in Steam.");
Send(MsgInstallOutOfDate);
Expand Down

0 comments on commit 2f47ff2

Please sign in to comment.