Skip to content

Commit d38cd38

Browse files
authored
Add msvcp140.dll version check (#119)
* Add msvcp140.dll version check Add a check that msvcp140.dll is >= v14.40 * Requested changes * Localization for MSVCP Message * Rename variable --------- Co-authored-by: NCSGeek <18708328+NCSGeek@users.noreply.github.com>
1 parent 34746e1 commit d38cd38

9 files changed

Lines changed: 84 additions & 7 deletions

File tree

Celeste_Launcher_Gui/Properties/Resources.Designer.cs

Lines changed: 12 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Celeste_Launcher_Gui/Properties/Resources.de-DE.resx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -838,7 +838,6 @@ Age of Empires Online - Celeste Fan Project</value>
838838
<data name="ServerResponse_USERNAME_ALREADY_TAKEN" xml:space="preserve">
839839
<value>Dieser Benutzername ist schon vergeben.</value>
840840
</data>
841-
842841
<data name="ColorPickerGamePathNotYetSet" xml:space="preserve">
843842
<value>Bevor du die Farben änderst, musst du erst mal einen Spiel-Scan machen.</value>
844843
</data>
@@ -932,4 +931,7 @@ Age of Empires Online - Celeste Fan Project</value>
932931
<data name="ColorPickerWindowTitle" xml:space="preserve">
933932
<value>Farbwähler</value>
934933
</data>
934+
<data name="MSVCPUpdateNeeded" xml:space="preserve">
935+
<value>Ihre Visual C++-Runtime ist veraltet oder fehlt.\nDas Spiel wird ohne Aktualisierung wahrscheinlich abstürzen.\nDen Runtime-Installer jetzt herunterladen?</value>
936+
</data>
935937
</root>

Celeste_Launcher_Gui/Properties/Resources.es-ES.resx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -931,4 +931,7 @@ Age of Empires Online - Celeste Fan Project</value>
931931
<data name="ColorPickerWindowTitle" xml:space="preserve">
932932
<value>Selector de color</value>
933933
</data>
934+
<data name="MSVCPUpdateNeeded" xml:space="preserve">
935+
<value>Su entorno de ejecución de Visual C++ está desactualizado o falta.\nEs probable que el juego se bloquee sin actualizarlo.\n¿Descargar ahora el instalador del entorno de ejecución?</value>
936+
</data>
934937
</root>

Celeste_Launcher_Gui/Properties/Resources.fr-FR.resx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -940,4 +940,7 @@ Age of Empires Online - Celeste Fan Project</value>
940940
<data name="ColorPickerWindowTitle" xml:space="preserve">
941941
<value>Sélecteur de couleur</value>
942942
</data>
943+
<data name="MSVCPUpdateNeeded" xml:space="preserve">
944+
<value>Votre environnement d’exécution Visual C++ est obsolète ou manquant.\nLe jeu risque de planter sans mise à jour.\nTélécharger l’installateur de l’environnement d’exécution maintenant?</value>
945+
</data>
943946
</root>

Celeste_Launcher_Gui/Properties/Resources.it-IT.resx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -839,7 +839,7 @@ Age of Empires Online - Celeste Fan Project</value>
839839
<value>Questo nome utente è già stato utilizzato.</value>
840840
</data>
841841
<data name="ColorPickerGamePathNotYetSet" xml:space="preserve">
842-
<value>Devi prima eseguire una scansione del gioco prima di modificare i colori.</value>
842+
<value>Devi prima eseguire una scansione del gioco prima di modificare i colori.</value>
843843
</data>
844844
<data name="ColorPickerTitleColor" xml:space="preserve">
845845
<value>Colore</value>
@@ -931,4 +931,7 @@ Age of Empires Online - Celeste Fan Project</value>
931931
<data name="ColorPickerWindowTitle" xml:space="preserve">
932932
<value>Selettore colore</value>
933933
</data>
934+
<data name="MSVCPUpdateNeeded" xml:space="preserve">
935+
<value>Il runtime di Visual C++ è obsoleto o mancante.\nIl gioco potrebbe bloccarsi senza un aggiornamento.\nScaricare ora il programma di installazione del runtime?</value>
936+
</data>
934937
</root>

Celeste_Launcher_Gui/Properties/Resources.pt-BR.resx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -860,10 +860,13 @@ Age of Empires Online - Projeto de Fãs Celeste</value>
860860
<data name="ColorPickerRedFoe" type="System.Resources.ResXNullRef, System.Windows.Forms">
861861
<value />
862862
</data>
863+
<data name="ColorPickerWindowTitle" type="System.Resources.ResXNullRef, System.Windows.Forms">
864+
<value />
865+
</data>
863866
<data name="ColorPickerPlayer" xml:space="preserve">
864867
<value>Player</value>
865868
</data>
866-
<data name="ColorPickerWindowTitle" type="System.Resources.ResXNullRef, System.Windows.Forms">
867-
<value />
869+
<data name="MSVCPUpdateNeeded" xml:space="preserve">
870+
<value>Seu runtime do Visual C++ está desatualizado ou ausente.\nO jogo provavelmente vai travar sem uma atualização.\nBaixar o instalador do runtime agora?</value>
868871
</data>
869872
</root>

Celeste_Launcher_Gui/Properties/Resources.resx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -940,4 +940,7 @@ Age of Empires Online - Celeste Fan Project</value>
940940
<data name="ColorPickerWindowTitle" xml:space="preserve">
941941
<value>Color Picker</value>
942942
</data>
943+
<data name="MSVCPUpdateNeeded" xml:space="preserve">
944+
<value>Your Visual C++ Runtime is outdated or missing.\nThe game will likely crash without updating.\nDownload the Runtime installer now?</value>
945+
</data>
943946
</root>

Celeste_Launcher_Gui/Properties/Resources.zh-CHT.resx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -919,4 +919,7 @@ Age of Empires Online - Celeste Fan Project</value>
919919
<data name="ColorPickerWindowTitle" xml:space="preserve">
920920
<value>颜色选取</value>
921921
</data>
922+
<data name="MSVCPUpdateNeeded" xml:space="preserve">
923+
<value>您的 Visual C++ 執行階段已過時或遺失。\n如果不更新,遊戲很可能會當機。\n要立即下載執行階段安裝程式嗎?</value>
924+
</data>
922925
</root>

Celeste_Launcher_Gui/Services/GameService.cs

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using Celeste_Launcher_Gui.Helpers;
2+
using Celeste_Launcher_Gui.Properties;
23
using Celeste_Launcher_Gui.Win32;
34
using Celeste_Launcher_Gui.Windows;
45
using Celeste_Public_Api.Helpers;
@@ -41,6 +42,53 @@ public static async Task StartGame(bool isOffline = false)
4142
return;
4243
}
4344

45+
try
46+
{
47+
var dllPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.SystemX86), "msvcp140.dll");
48+
var msvcpOutdated = false;
49+
50+
if (!File.Exists(dllPath))
51+
{
52+
Logger.Warning("msvcp140.dll not found at {@path}", dllPath);
53+
msvcpOutdated = true;
54+
}
55+
else
56+
{
57+
var versionInfo = FileVersionInfo.GetVersionInfo(dllPath);
58+
var version = new Version(versionInfo.FileMajorPart, versionInfo.FileMinorPart,
59+
versionInfo.FileBuildPart, versionInfo.FilePrivatePart);
60+
61+
if (version < new Version(14, 40, 0, 0))
62+
{
63+
Logger.Warning("msvcp140.dll version too old: {@version}", version);
64+
msvcpOutdated = true;
65+
}
66+
}
67+
68+
if (msvcpOutdated)
69+
{
70+
var dialog = new GenericMessageDialog(
71+
Resources.MSVCPUpdateNeeded,
72+
DialogIcon.Warning,
73+
DialogOptions.YesNo);
74+
75+
var dr = dialog.ShowDialog();
76+
if (dr.Value == true)
77+
{
78+
Process.Start(new ProcessStartInfo("https://aka.ms/vs/17/release/vc_redist.x86.exe")
79+
{
80+
UseShellExecute = true
81+
});
82+
return;
83+
}
84+
85+
}
86+
}
87+
catch (Exception ex)
88+
{
89+
Logger.Warning(ex, "Could not verify MSVC runtime version, proceeding anyway. Error Message: " + ex.Message);
90+
}
91+
4492
BackupOrRestorePlayerColors();
4593

4694
//QuickGameScan

0 commit comments

Comments
 (0)