Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support FinalSun/FinalAlert from Steam #520

Open
SadPencil opened this issue Mar 12, 2024 · 2 comments
Open

Support FinalSun/FinalAlert from Steam #520

SadPencil opened this issue Mar 12, 2024 · 2 comments
Milestone

Comments

@SadPencil
Copy link
Member

SadPencil commented Mar 12, 2024

I summarized the changes below.

  • FinalSun and FinalAlert now reads the game path from registry, no matter how the configuration file writes.
  • FinalSun.ini and FinalAlert.ini now uses UTF-8 encoding instead of the old ANSI (note: ANSI does not refer to any specific encoding! )
  • FinalSun.ini and FinalAlert.ini now resides in both map editor folder and %localappdata%\FinalSun\FinalSun.ini / %localappdata%\FinalAlert 2\FinalAlert.ini

The client needs these change:

  • Make FinalSunSettings.WriteFinalSunIni() optional.
    The option should be enabled when modders distribute the legacy FinalSun/Final Alert 2. If they choose the new FinalSun/Final Alert 2 comes with Steam, or WorldAlteringEditor, this option should be disabled.

  • Differ WriteInstallPathToRegistry() from game registry.
    TS/RA2 writes the game path to registry in WOW6432Node view, while the client writes the registry in normal view and it is not intended for registering the game.
    Since the new map editors from steam reads the game path (in WOW6432Node), the client should probably writes the game path in WOW6432View if a new option is enabled

@SadPencil SadPencil added this to the 2.11.0.0 milestone Mar 12, 2024
@SadPencil
Copy link
Member Author

SadPencil commented Mar 12, 2024

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
Copy link
Member Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant