From 862ce94d7bfdcf70fd36ce1b4653506f2461ab5d Mon Sep 17 00:00:00 2001
From: shadow <81448108+shdwmtr@users.noreply.github.com>
Date: Sat, 11 Jan 2025 18:49:51 -0400
Subject: [PATCH] chore: Fix installer

---
 src/main.cc | 52 ++++++++++++++++++++++++++++------------------------
 1 file changed, 28 insertions(+), 24 deletions(-)

diff --git a/src/main.cc b/src/main.cc
index 410c86d9..6a4bbee0 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -73,30 +73,34 @@ const static void EntryMain()
 
     #ifdef _WIN32
 
-    // try {
-    //     if (std::filesystem::exists(SystemIO::GetInstallPath() / "user32.queue.dll"))
-    //     {
-    //         Logger.Log("Updating shim module from cache...");
-
-    //         while (true) {
-    //             try {
-    //                 std::filesystem::remove(SystemIO::GetInstallPath() / "user32.dll");
-    //                 break;
-    //             }
-    //             catch (std::filesystem::filesystem_error& e) {
-    //                 continue;
-    //             }
-    //         }
-
-    //         Logger.Log("Removed old inject shim...");
-
-    //         std::filesystem::rename(SystemIO::GetInstallPath() / "user32.queue.dll", SystemIO::GetInstallPath() / "user32.dll"); 
-    //         Logger.Log("Successfully updated user32.dll!");
-    //     }
-    // }
-    // catch (std::exception& e) {
-    //     LOG_ERROR("Failed to update user32.dll: {}", e.what());
-    // }
+    try {
+        if (std::filesystem::exists(SystemIO::GetInstallPath() / "user32.queue.dll"))
+        {
+            Logger.Log("Updating shim module from cache...");
+
+            while (true) {
+                try {
+                    std::filesystem::remove(SystemIO::GetInstallPath() / "user32.dll");
+                    break;
+                }
+                catch (std::filesystem::filesystem_error& e) {
+                    continue;
+                }
+            }
+
+            Logger.Log("Removed old inject shim...");
+
+            std::filesystem::rename(SystemIO::GetInstallPath() / "user32.queue.dll", SystemIO::GetInstallPath() / "user32.dll"); 
+            Logger.Log("Successfully updated user32.dll!");
+        }
+    }
+    catch (std::exception& e) {
+        LOG_ERROR("Failed to update user32.dll: {}", e.what());
+
+        #ifdef _WIN32
+        MessageBoxA(NULL, "Failed to update user32.dll, it's recommended that you reinstall Millennium.", "Oops!", MB_ICONERROR | MB_OK);
+        #endif
+    }
 
     std::unique_ptr<StartupParameters> startupParams = std::make_unique<StartupParameters>();