Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions MaiChartManager/Launcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,25 @@ private void StartClicked(object? sender, EventArgs? e)
return;
}

string mlDllPath = Path.Combine(StaticSettings.GamePath, "..", "MelonLoader", "MelonLoader.dll");

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The path construction for MelonLoader.dll using .. assumes the game files are always in a subfolder (e.g., Package). In a standard installation where Sinmai_Data is in the root folder, StaticSettings.GamePath will be the root, and .. will point to the parent directory of the game, causing the check to fail. Consider checking both the current GamePath and its parent to support both installation layouts.

        string mlDllPath = Path.Combine(StaticSettings.GamePath, "MelonLoader", "MelonLoader.dll");
        if (!File.Exists(mlDllPath))
        {
            mlDllPath = Path.Combine(StaticSettings.GamePath, "..", "MelonLoader", "MelonLoader.dll");
        }

if (File.Exists(mlDllPath))
Comment thread
sourcery-ai[bot] marked this conversation as resolved.
Outdated
{
var versionInfo = System.Diagnostics.FileVersionInfo.GetVersionInfo(mlDllPath);
string? version = versionInfo.ProductVersion;

if (version == null || !version.StartsWith("0.6.4"))
{
var dialougResult = MessageBox.Show(
// Add i8n pls :)
$"Detected MelonLoader version {version}, but 0.6.4 is recommended for stability. Continue anyway?",
"MelonLoader Version Warning",
MessageBoxButtons.YesNo,
MessageBoxIcon.Warning);

if (dialougResult == DialogResult.No) return;
Comment thread
sourcery-ai[bot] marked this conversation as resolved.
Outdated

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The MessageBox strings are hardcoded in English, and there is a typo in the variable name dialougResult. Since the project supports multiple languages and you've explicitly requested i18n, these strings should be moved to the Locale.resx resource file.

Note: You will need to add the keys MelonLoaderVersionWarning and MelonLoaderVersionWarningTitle to your resource files.

                var dialogResult = MessageBox.Show(
                    string.Format(Locale.MelonLoaderVersionWarning, version ?? "unknown"),
                    Locale.MelonLoaderVersionWarningTitle,
                    MessageBoxButtons.YesNo,
                    MessageBoxIcon.Warning);

                if (dialogResult == DialogResult.No) return;

}
}

if (ContainsSpecialCharacters(StaticSettings.GamePath))
{
MessageBox.Show(Locale.PathContainsSpecialChars, Locale.PathContainsSpecialCharsTitle, MessageBoxButtons.OK, MessageBoxIcon.Warning);
Expand Down