|
1 | 1 | using Celeste_Launcher_Gui.Helpers; |
| 2 | +using Celeste_Launcher_Gui.Properties; |
2 | 3 | using Celeste_Launcher_Gui.Win32; |
3 | 4 | using Celeste_Launcher_Gui.Windows; |
4 | 5 | using Celeste_Public_Api.Helpers; |
@@ -41,6 +42,53 @@ public static async Task StartGame(bool isOffline = false) |
41 | 42 | return; |
42 | 43 | } |
43 | 44 |
|
| 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 | + |
44 | 92 | BackupOrRestorePlayerColors(); |
45 | 93 |
|
46 | 94 | //QuickGameScan |
|
0 commit comments