CnCNet / xna-cncnet-client

XNA / MonoGame based client for playing classic Command & Conquer games both online and offline with a CnCNet game spawner.
Other
227 stars 90 forks source link

Support FinalSun/FinalAlert from Steam #520

Open SadPencil opened 6 months ago

SadPencil commented 6 months ago

I summarized the changes below.

The client needs these change:

SadPencil commented 6 months ago

The following lines show an example to write game registries. I suggest run this code every single time the map editor (from Steam) starts. This is because there might be multiple game installation instances, as a result, we have to register the game every single time to tell the map editor the right InstallPath. -- yeah registry is a bad design

https://github.com/SadPencil/Mo3RegUI/blob/db744010c3399f48928974df0c0dc469b6a5aae6/Mo3RegUI/Tasks/Ra2RegTask.cs#L38

            using var HKLM_32 = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32);
            using var ra2Key = HKLM_32.CreateSubKey(@"SOFTWARE\Westwood\Red Alert 2");
            // ra2Key.SetValue("Serial", sn);
            // ra2Key.SetValue("Name", "Red Alert 2");
            ra2Key.SetValue("InstallPath", Path.Combine(p.GameDir, "RA2.EXE"));
            // ra2Key.SetValue("SKU", 8448);
            // ra2Key.SetValue("Version", 65542);

            using var yrKey = HKLM_32.CreateSubKey(@"SOFTWARE\Westwood\Yuri's Revenge");
            // yrKey.SetValue("Serial", sn);
            // yrKey.SetValue("Name", "Yuri's Revenge");
            yrKey.SetValue("InstallPath", Path.Combine(p.GameDir, "RA2MD.EXE"));
            // yrKey.SetValue("SKU", 10496);
            // yrKey.SetValue("Version", 65537);
SadPencil commented 6 months ago

Updating the game registry requires admin privilege so it's probably not a good idea. I think we can just make FinalSunSettings.WriteFinalSunIni() optional -- it's only meaningful for legacy map editors