mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2026-04-01 06:39:45 +08:00
@@ -740,13 +740,17 @@ async function tryLaunchGame(): Promise<void> {
|
||||
}
|
||||
return;
|
||||
}
|
||||
const tryCopy = await tryCopyYae();
|
||||
if (!tryCopy) return;
|
||||
const isMsix = await invoke<boolean>("is_msix");
|
||||
if (isMsix) {
|
||||
const copy = await tryCopyYae();
|
||||
if (!copy) return;
|
||||
}
|
||||
try {
|
||||
await invoke("call_yae_dll", {
|
||||
gamePath: gamePath,
|
||||
uid: account.value.gameUid,
|
||||
ticket: resp,
|
||||
is_msix: isMsix,
|
||||
});
|
||||
} catch (err) {
|
||||
showSnackbar.error(`调用Yae DLL失败: ${err}`);
|
||||
|
||||
@@ -19,10 +19,12 @@
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { invoke } from "@tauri-apps/api/core";
|
||||
import { appConfigDir, resourceDir } from "@tauri-apps/api/path";
|
||||
import { copyFile, exists } from "@tauri-apps/plugin-fs";
|
||||
|
||||
async function test() {
|
||||
await invoke("is_msix");
|
||||
const filePath = `${await resourceDir()}\\resources\\YaeAchievementLib.dll`;
|
||||
console.log(filePath);
|
||||
const check = await exists(filePath);
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
import showDialog from "@comp/func/dialog.js";
|
||||
import showSnackbar from "@comp/func/snackbar.js";
|
||||
import { invoke } from "@tauri-apps/api/core";
|
||||
import { appConfigDir, resourceDir, sep } from "@tauri-apps/api/path";
|
||||
import { documentDir, resourceDir, sep } from "@tauri-apps/api/path";
|
||||
import { copyFile, exists, readTextFile, readTextFileLines } from "@tauri-apps/plugin-fs";
|
||||
import { platform } from "@tauri-apps/plugin-os";
|
||||
import TGLogger from "@utils/TGLogger.js";
|
||||
@@ -67,19 +67,17 @@ export async function isRunInAdmin(): Promise<boolean> {
|
||||
*/
|
||||
export async function tryCopyYae(): Promise<boolean> {
|
||||
const srcDllPath = `${await resourceDir()}${sep()}resources${sep()}YaeAchievementLib.dll`;
|
||||
console.log(srcDllPath);
|
||||
const srcCheck = await exists(srcDllPath);
|
||||
if (!srcCheck) {
|
||||
showSnackbar.warn("未检测到本地 dll");
|
||||
return false;
|
||||
}
|
||||
const targetPath = `${await appConfigDir()}${sep()}YaeAchievementLib.dll`;
|
||||
const targetPath = `${await documentDir()}${sep()}TeyvatGuide${sep()}YaeAchievementLib.dll`;
|
||||
console.log(targetPath);
|
||||
await copyFile(srcDllPath, targetPath);
|
||||
const check2 = await exists(targetPath);
|
||||
if (!check2) {
|
||||
showSnackbar.warn("移动 dll 失败,请手动移动");
|
||||
// TODO: 跳转手动移动说明站点
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -131,8 +129,8 @@ export async function tryCallYae(gameDir: string, uid?: string): Promise<void> {
|
||||
}
|
||||
return;
|
||||
}
|
||||
const tryCopy = await tryCopyYae();
|
||||
if (!tryCopy) return;
|
||||
const isMsix = await invoke<boolean>("is_msix");
|
||||
if (isMsix) await tryCopyYae();
|
||||
const input = await showDialog.input("请输入存档UID", "UID:", uid);
|
||||
if (!input) {
|
||||
showSnackbar.cancel("已取消存档导入");
|
||||
@@ -143,7 +141,7 @@ export async function tryCallYae(gameDir: string, uid?: string): Promise<void> {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
await invoke("call_yae_dll", { gamePath: gamePath, uid: input });
|
||||
await invoke("call_yae_dll", { gamePath: gamePath, uid: input, is_msix: isMsix });
|
||||
} catch (err) {
|
||||
showSnackbar.error(`调用Yae DLL失败: ${err}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user