diff --git a/CMake/FindPowerShell.cmake b/CMake/FindPowerShell.cmake
new file mode 100644
index 0000000000..c0e92a269e
--- /dev/null
+++ b/CMake/FindPowerShell.cmake
@@ -0,0 +1,4 @@
+find_program(POWERSHELL_EXE NAMES powershell)
+
+INCLUDE(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(PowerShell DEFAULT_MSG POWERSHELL_EXE)
diff --git a/Source/Core/Common/CMakeLists.txt b/Source/Core/Common/CMakeLists.txt
index 134d38062c..4dc764408d 100644
--- a/Source/Core/Common/CMakeLists.txt
+++ b/Source/Core/Common/CMakeLists.txt
@@ -324,6 +324,17 @@ if(UNIX)
target_link_libraries(traversal_server PRIVATE ${SYSTEMD_LIBRARIES})
endif()
elseif(WIN32)
+ find_package(PowerShell REQUIRED)
+ execute_process(
+ COMMAND ${POWERSHELL_EXE} -Command "[System.Diagnostics.FileVersionInfo]::GetVersionInfo('$ENV{VCToolsRedistDir}vc_redist.x64.exe').ProductVersion"
+ OUTPUT_VARIABLE VC_TOOLS_VERSION
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+ configure_file(
+ "${CMAKE_CURRENT_SOURCE_DIR}/build_info.txt.in"
+ "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/build_info.txt"
+ )
+
target_link_libraries(common PRIVATE "-INCLUDE:enableCompatPatches")
endif()
diff --git a/Source/Core/Common/build_info.txt.in b/Source/Core/Common/build_info.txt.in
new file mode 100644
index 0000000000..3ae938cfc5
--- /dev/null
+++ b/Source/Core/Common/build_info.txt.in
@@ -0,0 +1,24 @@
+// Indicate the minimum OS version required for the binary to run properly.
+// Updater will fail the update if the user does not meet this requirement.
+OSMinimumVersionWin10=10.0.15063.0
+OSMinimumVersionWin11=10.0.22000.0
+OSMinimumVersionMacOS=10.14
+
+// This is the runtime which was compiled against - providing a way for Updater to detect if update
+// is needed before executing this binary. Note that, annoyingly, the version in environment
+// variables does not match the "real" version. Consider:
+// VersionInfo : File: C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Redist\MSVC\14.32.31326\vc_redist.x64.exe
+// InternalName: setup
+// OriginalFilename: VC_redist.x64.exe
+// FileVersion: 14.32.31332.0
+// FileDescription: Microsoft Visual C++ 2015-2022 Redistributable (x64) - 14.32.31332
+// Product: Microsoft Visual C++ 2015-2022 Redistributable (x64) - 14.32.31332
+// ProductVersion: 14.32.31332.0
+// Whereas the environment variables look like:
+// VCToolsInstallDir=C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.33.31629\
+// VCToolsRedistDir=C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Redist\MSVC\14.32.31326\
+// VCToolsVersion=14.33.31629
+// We're really looking for "14.32.31332.0" (because that's what will appear in the registry once
+// installed), NOT the other values!
+VCToolsVersion=${VC_TOOLS_VERSION}
+VCToolsUpdateURL=https://aka.ms/vs/17/release/vc_redist.x64.exe
diff --git a/Source/Core/DolphinLib.vcxproj b/Source/Core/DolphinLib.vcxproj
index ae19db8c19..1aad7a65c3 100644
--- a/Source/Core/DolphinLib.vcxproj
+++ b/Source/Core/DolphinLib.vcxproj
@@ -60,4 +60,38 @@
+
+ Common\build_info.txt.in
+ $(BinaryOutputDir)build_info.txt
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Source/Core/MacUpdater/MacUI.mm b/Source/Core/MacUpdater/MacUI.mm
index a2ac4a4a83..0b2699b1dd 100644
--- a/Source/Core/MacUpdater/MacUI.mm
+++ b/Source/Core/MacUpdater/MacUI.mm
@@ -3,6 +3,7 @@
#include "MacUpdater/ViewController.h"
+#include "UpdaterCommon/Platform.h"
#include "UpdaterCommon/UI.h"
#include
@@ -136,3 +137,21 @@ void UI::Stop()
void UI::Init()
{
}
+
+Platform::BuildInfo::BuildInfo(const std::string& content)
+{
+ map = {{"OSMinimumVersionMacOS", ""}};
+ Parse(content);
+}
+
+bool Platform::VersionCheck(const BuildInfo& this_build_info, const BuildInfo& next_build_info)
+{
+ // TODO implement OS Minimum Version check
+ // It should go something like this:
+ // auto target_version = next_build_info.GetVersion("OSMinimumVersionMacOS");
+ // if (!target_version.has_value() || current_version >= target_version)
+ // return true;
+ // show error
+ // return false;
+ return true;
+}
diff --git a/Source/Core/UICommon/AutoUpdate.cpp b/Source/Core/UICommon/AutoUpdate.cpp
index de8d426c7f..814f66c87b 100644
--- a/Source/Core/UICommon/AutoUpdate.cpp
+++ b/Source/Core/UICommon/AutoUpdate.cpp
@@ -246,11 +246,11 @@ void AutoUpdateChecker::TriggerUpdate(const AutoUpdateChecker::NewVersionInforma
#endif
// Run the updater!
- const std::string command_line = MakeUpdaterCommandLine(updater_flags);
+ std::string command_line = MakeUpdaterCommandLine(updater_flags);
INFO_LOG_FMT(COMMON, "Updater command line: {}", command_line);
#ifdef _WIN32
- STARTUPINFO sinfo = {sizeof(sinfo)};
+ STARTUPINFO sinfo{.cb = sizeof(sinfo)};
sinfo.dwFlags = STARTF_FORCEOFFFEEDBACK; // No hourglass cursor after starting the process.
PROCESS_INFORMATION pinfo;
if (CreateProcessW(UTF8ToWString(reloc_updater_path).c_str(), UTF8ToWString(command_line).data(),
diff --git a/Source/Core/UpdaterCommon/Platform.h b/Source/Core/UpdaterCommon/Platform.h
new file mode 100644
index 0000000000..9489ba9947
--- /dev/null
+++ b/Source/Core/UpdaterCommon/Platform.h
@@ -0,0 +1,100 @@
+// Copyright 2018 Dolphin Emulator Project
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#include