Skip to content

Commit 53f0864

Browse files
committed
feat(mod): extend GameModInfo with MuMod fields
1 parent 6ef4ad7 commit 53f0864

1 file changed

Lines changed: 23 additions & 3 deletions

File tree

MaiChartManager/Controllers/Mod/InstallationController.cs

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace MaiChartManager.Controllers.Mod;
99

1010
[ApiController]
1111
[Route("MaiChartManagerServlet/[action]Api")]
12-
public class InstallationController(StaticSettings settings, ILogger<InstallationController> logger) : ControllerBase
12+
public class InstallationController(StaticSettings settings, ILogger<InstallationController> logger, MuModService muModService) : ControllerBase
1313
{
1414
private static string judgeDisplay4BPath = Path.Combine(StaticSettings.exeDir, "Resources", "JudgeDisplay4B");
1515

@@ -35,7 +35,12 @@ public record GameModInfo(
3535
bool IsHidConflictExist,
3636
AquaMaiSignatureV2.VerifyResult? Signature,
3737
bool IsAdxHidIoModAbsent,
38-
bool IsMmlLegacyLibsInstalled
38+
bool IsMmlLegacyLibsInstalled,
39+
bool MuModInstalled,
40+
string? MuModVersion,
41+
string? MuModChannel,
42+
string? MuModCacheVersion,
43+
bool IsBothModsPresent
3944
);
4045

4146
[HttpGet]
@@ -56,6 +61,16 @@ public GameModInfo GetGameModInfo()
5661
sig = AquaMaiSignatureV2.VerifySignature(System.IO.File.ReadAllBytes(ModPaths.AquaMaiDllInstalledPath));
5762
}
5863

64+
var muModInstalled = muModService.IsMuModInstalled();
65+
var muModVersion = muModInstalled ? muModService.GetMuModVersion() : null;
66+
string? muModChannel = null;
67+
string? muModCacheVersion = null;
68+
if (muModInstalled)
69+
{
70+
try { muModChannel = muModService.ReadConfig().Channel; } catch { }
71+
muModCacheVersion = muModService.GetCacheInfo();
72+
}
73+
5974
return new GameModInfo(
6075
IsMelonInstalled(),
6176
aquaMaiInstalled,
@@ -65,7 +80,12 @@ public GameModInfo GetGameModInfo()
6580
GetIsHidConflictExist(),
6681
sig,
6782
GetIsAdxHidIoModAbsent(),
68-
GetIsMmlLegacyLibsInstalled()
83+
GetIsMmlLegacyLibsInstalled(),
84+
muModInstalled,
85+
muModVersion,
86+
muModChannel,
87+
muModCacheVersion,
88+
aquaMaiInstalled && muModInstalled
6989
);
7090
}
7191

0 commit comments

Comments
 (0)