Skip to content

Commit eb0ffb0

Browse files
committed
mmlio 依赖安装
1 parent 2336a35 commit eb0ffb0

File tree

9 files changed

+111
-11
lines changed

9 files changed

+111
-11
lines changed

AquaMai

MaiChartManager/Controllers/Mod/InstallationController.cs

Lines changed: 46 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,10 @@ public record GameModInfo(
3333
string BundledAquaMaiVersion,
3434
bool IsJudgeDisplay4BInstalled,
3535
bool IsHidConflictExist,
36-
AquaMaiSignatureV2.VerifyResult? Signature
36+
AquaMaiSignatureV2.VerifyResult? Signature,
37+
bool IsMmlLibInstalled
3738
);
3839

39-
private static readonly string[] HidModPaths = [@"Mods\Mai2InputMod.dll", @"Mods\hid_input_lib.dll", "hid_input_lib.dll", "mai2io.dll"];
40-
4140
[HttpGet]
4241
public GameModInfo GetGameModInfo()
4342
{
@@ -56,7 +55,7 @@ public GameModInfo GetGameModInfo()
5655
sig = AquaMaiSignatureV2.VerifySignature(System.IO.File.ReadAllBytes(ModPaths.AquaMaiDllInstalledPath));
5756
}
5857

59-
return new GameModInfo(IsMelonInstalled(), aquaMaiInstalled, aquaMaiVersion, aquaMaiBuiltinVersion!, GetIsJudgeDisplay4BInstalled(), GetIsHidConflictExist(), sig);
58+
return new GameModInfo(IsMelonInstalled(), aquaMaiInstalled, aquaMaiVersion, aquaMaiBuiltinVersion!, GetIsJudgeDisplay4BInstalled(), GetIsHidConflictExist(), sig, GetIsMmlLibInstalled());
6059
}
6160

6261
[NonAction]
@@ -68,6 +67,10 @@ private static bool GetIsJudgeDisplay4BInstalled()
6867
return filesShouldBeInstalled.Select(file => Path.Combine(StaticSettings.SkinAssetsDir, Path.GetFileName(file))).All(System.IO.File.Exists);
6968
}
7069

70+
#region ADX HID 冲突检测和删除
71+
72+
private static readonly string[] HidModPaths = [@"Mods\Mai2InputMod.dll", @"Mods\hid_input_lib.dll", "hid_input_lib.dll", "mai2io.dll"];
73+
7174
[NonAction]
7275
private static bool GetIsHidConflictExist()
7376
{
@@ -94,6 +97,45 @@ public void DeleteHidConflict()
9497
}
9598
}
9699

100+
#endregion
101+
102+
[NonAction]
103+
private static bool GetIsMmlLibInstalled()
104+
{
105+
if (System.IO.File.Exists(Path.Combine(StaticSettings.GamePath, "ADXHIDIOMod.dll")))
106+
{
107+
return false;
108+
}
109+
if (!System.IO.File.Exists(Path.Combine(StaticSettings.GamePath, @"Sinmai_Data\Plugins\hidapi.dll")))
110+
{
111+
return false;
112+
}
113+
if (!System.IO.File.Exists(Path.Combine(StaticSettings.GamePath, @"Sinmai_Data\Plugins\libadxhid.dll")))
114+
{
115+
return false;
116+
}
117+
118+
return true;
119+
}
120+
121+
[HttpPost]
122+
public void InstallMmlLibs()
123+
{
124+
if (GetIsMmlLibInstalled()) return;
125+
if (System.IO.File.Exists(Path.Combine(StaticSettings.GamePath, "ADXHIDIOMod.dll")))
126+
{
127+
System.IO.File.Delete(Path.Combine(StaticSettings.GamePath, "ADXHIDIOMod.dll"));
128+
}
129+
if (!System.IO.File.Exists(Path.Combine(StaticSettings.GamePath, @"Sinmai_Data\Plugins\hidapi.dll")))
130+
{
131+
System.IO.File.Copy(Path.Combine(StaticSettings.exeDir, @"hidapi.dll"), Path.Combine(StaticSettings.GamePath, @"Sinmai_Data\Plugins\hidapi.dll"));
132+
}
133+
if (!System.IO.File.Exists(Path.Combine(StaticSettings.GamePath, @"Sinmai_Data\Plugins\libadxhid.dll")))
134+
{
135+
System.IO.File.Copy(Path.Combine(StaticSettings.exeDir, @"libadxhid.dll"), Path.Combine(StaticSettings.GamePath, @"Sinmai_Data\Plugins\libadxhid.dll"));
136+
}
137+
}
138+
97139
[HttpPost]
98140
public void InstallJudgeDisplay4B()
99141
{

MaiChartManager/Front/src/client/apiGen.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ export interface GameModInfo {
113113
isJudgeDisplay4BInstalled?: boolean;
114114
isHidConflictExist?: boolean;
115115
signature?: VerifyResult;
116+
isMmlLibInstalled?: boolean;
116117
}
117118

118119
export interface GenreAddRequest {
@@ -1342,6 +1343,20 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
13421343
...params,
13431344
}),
13441345

1346+
/**
1347+
* No description
1348+
*
1349+
* @tags Installation
1350+
* @name InstallMmlLibs
1351+
* @request POST:/MaiChartManagerServlet/InstallMmlLibsApi
1352+
*/
1353+
InstallMmlLibs: (params: RequestParams = {}) =>
1354+
this.request<void, any>({
1355+
path: `/MaiChartManagerServlet/InstallMmlLibsApi`,
1356+
method: "POST",
1357+
...params,
1358+
}),
1359+
13451360
/**
13461361
* No description
13471362
*

MaiChartManager/Front/src/components/ModManager/AquaMaiConfigurator.tsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ const ConfigSection = defineComponent({
2121
setup(props, { emit }) {
2222
const { t, te } = useI18n();
2323

24-
const CustomPanel = getSectionPanelOverride(props.section.path!);
24+
const CustomPanel = getSectionPanelOverride(props.section.path!)
25+
const customPanelPosition: 'top' | 'bottom' | 'override' = comments.customPanelPosition[props.section.path!] || 'override';
2526
const comment = computed(() => {
2627
const localeKey = 'mod.commentOverrides.' + props.section.path!.replace(/\./g, '_');
2728
if (te(localeKey)) {
@@ -53,14 +54,16 @@ const ConfigSection = defineComponent({
5354
{comment.value}
5455
</NFlex>
5556
</NFormItem>}
56-
{props.sectionState.enabled && (
57-
CustomPanel ?
57+
{props.sectionState.enabled && <>
58+
{customPanelPosition === 'top' && <CustomPanel entryStates={props.entryStates} sectionState={props.sectionState} section={props.section}/>}
59+
{(CustomPanel && customPanelPosition === 'override') ?
5860
<CustomPanel entryStates={props.entryStates} sectionState={props.sectionState} section={props.section}/> :
5961
!!props.section.entries?.length && <NFlex vertical class="p-l-15 max-[900px]:p-l-10 max-[500px]:p-l-5!">
6062
{props.section.entries?.filter(it => !it.attribute?.hideWhenDefault || (it.attribute?.hideWhenDefault && !props.entryStates[it.path!].isDefault))
6163
.map((entry) => <ConfigEntry key={entry.path!} entry={entry} entryState={props.entryStates[entry.path!]}/>)}
62-
</NFlex>
63-
)}
64+
</NFlex>}
65+
{customPanelPosition === 'bottom' && <CustomPanel entryStates={props.entryStates} sectionState={props.sectionState} section={props.section}/>}
66+
</>}
6467
</NFlex>;
6568
},
6669
});

MaiChartManager/Front/src/components/ModManager/modComments.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,6 @@ sectionNameEn:
2828
高级设置: Advanced Settings
2929
过新过热: Too New Too Hot
3030
不建议关闭: Not Recommend to Disable
31+
32+
customPanelPosition:
33+
GameSystem.MaimollerIO: top
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import api from '@/client/api';
2+
import { t } from '@/locales';
3+
import { globalCapture, modInfo, updateModInfo } from '@/store/refs';
4+
import { useAsyncState } from '@vueuse/core';
5+
import { NFlex, NButton } from 'naive-ui';
6+
import { defineComponent, PropType, ref, computed, watch } from 'vue';
7+
8+
export default defineComponent({
9+
// props: {
10+
// },
11+
setup(props, { emit }) {
12+
const install = useAsyncState(async () => {
13+
await api.InstallMmlLibs();
14+
await updateModInfo();
15+
}, undefined, {
16+
immediate: false,
17+
onError(e) {
18+
globalCapture(e, t('mod.mmlIo.installFailed'));
19+
},
20+
})
21+
22+
return () => <div class="">
23+
{!modInfo.value?.isMmlLibInstalled ? <NFlex align="center" class="m-l-35">
24+
<span class="c-orange">{t('mod.mmlIo.notInstalled')}</span>
25+
<NButton secondary onClick={() => install.execute()} loading={install.isLoading.value}>{t('mod.mmlIo.oneClickInstall')}</NButton>
26+
</NFlex>
27+
: <NFlex align="center" class="m-l-35">
28+
<span class="c-green-6">{t('mod.mmlIo.installed')}</span>
29+
</NFlex>}
30+
</div>;
31+
},
32+
});

MaiChartManager/Front/src/locales/zh.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,12 @@ mod:
364364
title: 社区贡献功能
365365
description: |-
366366
此功能由社区成员贡献,可能无法获得与核心功能相同级别的技术支持
367-
如遇技术问题,我们会尽力协助,但可能无法提供即时支持
367+
如遇技术问题,我们会尽力协调处理
368+
mmlIo:
369+
notInstalled: 依赖库未安装或存在冲突
370+
oneClickInstall: 一键安装
371+
installed: 已正确安装
372+
installFailed: 安装 Maimoller 依赖库时出现错误
368373
tools:
369374
title: 工具
370375
audioConvert: 音频转换(ACB + AWB)
159 KB
Binary file not shown.
82.2 KB
Binary file not shown.

0 commit comments

Comments
 (0)