mirror of
https://github.com/HolographicHat/Yae.git
synced 2025-12-12 01:18:15 +08:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4417feab53 | ||
|
|
28080dbafd | ||
|
|
a8b6419157 |
@@ -36,3 +36,6 @@
|
||||
|
||||
4. Q: 原神进门后没有自动退出,程序输出停留在“加载完成”
|
||||
A: 关闭代理后重试
|
||||
|
||||
5. Q: 网络错误,请检查网络后重试 (21-x)
|
||||
A: 如果你是校园网用户,使用流量上网并重试;如果你是海外用户,打开config.json,将oversea_api的值设置为true并重试
|
||||
|
||||
@@ -2,8 +2,8 @@ const fs = require("fs")
|
||||
const axios = require("axios")
|
||||
const readline = require("readline")
|
||||
const { randomUUID } = require("crypto")
|
||||
const { loadCache, log } = require("./utils")
|
||||
const { openUrl, checkSnapFastcall, copyToClipboard } = require("./native")
|
||||
const { loadCache, log, openUrl } = require("./utils")
|
||||
const { checkSnapFastcall, copyToClipboard } = require("./native")
|
||||
|
||||
const exportToSeelie = proto => {
|
||||
const out = { achievements: {} }
|
||||
|
||||
@@ -1,28 +1,19 @@
|
||||
#include "utils.h"
|
||||
#include "define.h"
|
||||
|
||||
string GBKToUTF8(const wstring& src) {
|
||||
int len = WideCharToMultiByte(CP_UTF8, 0, src.c_str(), -1, nullptr, 0, nullptr, nullptr);
|
||||
auto *buffer = new CHAR[len];
|
||||
WideCharToMultiByte(CP_UTF8, 0, src.c_str(), -1, buffer, len, nullptr, nullptr);
|
||||
string strTemp(buffer);
|
||||
delete[] buffer;
|
||||
return strTemp;
|
||||
}
|
||||
|
||||
wstring StringToWString(const string &src) {
|
||||
int len = MultiByteToWideChar(CP_ACP, 0, src.c_str(), -1, nullptr, 0);
|
||||
wstring StringToWString(const string &src, UINT codePage) {
|
||||
int len = MultiByteToWideChar(codePage, 0, src.c_str(), -1, nullptr, 0);
|
||||
auto *buffer = new WCHAR[len];
|
||||
MultiByteToWideChar(CP_ACP, 0, src.c_str(), -1, buffer, len);
|
||||
MultiByteToWideChar(codePage, 0, src.c_str(), -1, buffer, len);
|
||||
wstring strTemp(buffer);
|
||||
delete[] buffer;
|
||||
return strTemp;
|
||||
}
|
||||
|
||||
string WStringToString(const wstring &src) {
|
||||
int len = WideCharToMultiByte(CP_ACP, 0, src.c_str(), -1, nullptr, 0, nullptr, nullptr);
|
||||
string WStringToString(const wstring &src, UINT codePage) {
|
||||
int len = WideCharToMultiByte(codePage, 0, src.c_str(), -1, nullptr, 0, nullptr, nullptr);
|
||||
auto *buffer = new CHAR[len];
|
||||
WideCharToMultiByte(CP_ACP, 0, src.c_str(), -1, buffer, len, nullptr, nullptr);
|
||||
WideCharToMultiByte(codePage, 0, src.c_str(), -1, buffer, len, nullptr, nullptr);
|
||||
string strTemp(buffer);
|
||||
delete[] buffer;
|
||||
return strTemp;
|
||||
@@ -51,11 +42,7 @@ LSTATUS OpenFile(Env env, Napi::String &result, HWND parent) {
|
||||
open.lpstrFilter = L"国服/国际服主程序 (YuanShen/GenshinImpact.exe)\0YuanShen.exe;GenshinImpact.exe\0";
|
||||
open.lStructSize = sizeof(open);
|
||||
if(GetOpenFileName(&open)) {
|
||||
if (GetACP() == 936) {
|
||||
result = Napi::String::New(env, GBKToUTF8(file));
|
||||
} else {
|
||||
result = Napi::String::New(env, WStringToString(file));
|
||||
}
|
||||
result = GetACP() == 936 ? Napi::String::New(env, WStringToString(file, CP_UTF8)) : Napi::String::New(env, WStringToString(file));
|
||||
return ERROR_SUCCESS;
|
||||
} else {
|
||||
return ERROR_ERRORS_ENCOUNTERED;
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
#include "define.h"
|
||||
|
||||
string WStringToString(const wstring &src);
|
||||
wstring StringToWString(const string &src);
|
||||
string WStringToString(const wstring &src, UINT codePage = CP_ACP);
|
||||
wstring StringToWString(const string &src, UINT codePage = CP_ACP);
|
||||
LSTATUS OpenFile(Env env, Napi::String &result, HWND parent = GetConsoleWindow());
|
||||
BOOL EnablePrivilege(Env env, const wstring &name);
|
||||
void Log(Env env, const string &msg);
|
||||
|
||||
@@ -36,22 +36,22 @@ const cleanUp = () => {
|
||||
|
||||
|
||||
const c = {
|
||||
finalName: `${name}-Win7`,
|
||||
nodeVersion: "14.19.1",
|
||||
forWin7: false,
|
||||
sevenZipPath: "\"C:/Program Files/7-Zip/7z.exe\""
|
||||
};
|
||||
|
||||
(async () => {
|
||||
console.log(c)
|
||||
const fn = c.forWin7 ? `${name}-Win7` : name
|
||||
const nv = c.forWin7 ? "14.19.1" : "16.14.2"
|
||||
log("Generate and compile version info")
|
||||
generateAndCompileVersionInfo()
|
||||
log("Modify executable file resources")
|
||||
const path = `C:/Users/holog/.pkg-cache/v3.3/built-v${c.nodeVersion}-win-x64`
|
||||
const path = `C:/Users/holog/.pkg-cache/v3.3/built-v${nv}-win-x64`
|
||||
generateScript(path)
|
||||
execSync(`rh.exe -script tmp.script`)
|
||||
cleanUp()
|
||||
log("Build and compress package")
|
||||
await pkg.exec(`../app.js -t node${c.nodeVersion.split(".")[0]}-win-x64 -C Brotli --build -o ${c.finalName}.exe`.split(" "))
|
||||
execSync(`${c.sevenZipPath} a ${c.finalName}.7z ${c.finalName}.exe -mx=9 -myx=9 -mmt=4 -sdel -stl`)
|
||||
await pkg.exec(`../app.js -t node${nv.split(".")[0]}-win-x64 -C Brotli --build -o ${fn}.exe`.split(" "))
|
||||
execSync(`${c.sevenZipPath} a ${fn}.7z ${fn}.exe -mx=9 -myx=9 -mmt=4 -sdel -stl`)
|
||||
log("Done")
|
||||
})()
|
||||
|
||||
4
utils.js
4
utils.js
@@ -122,6 +122,8 @@ const checkPortIsUsing = () => {
|
||||
}
|
||||
}
|
||||
|
||||
const openUrl = url => native.openUrl(encodeURI(url))
|
||||
|
||||
const splitPacket = buf => {
|
||||
let offset = 0
|
||||
let arr = []
|
||||
@@ -290,5 +292,5 @@ class KPacket {
|
||||
|
||||
module.exports = {
|
||||
log, encodeProto, decodeProto, initConfig, splitPacket, upload, brotliCompressSync, brotliDecompressSync,
|
||||
setupHost, loadCache, debug, checkUpdate, KPacket, checkGameIsRunning, checkPortIsUsing
|
||||
setupHost, loadCache, debug, checkUpdate, KPacket, checkGameIsRunning, checkPortIsUsing, openUrl
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
const version = {
|
||||
code: 7,
|
||||
name: "1.6",
|
||||
isDev: false
|
||||
name: "1.6.50",
|
||||
isDev: true
|
||||
}
|
||||
|
||||
module.exports = { version }
|
||||
|
||||
Reference in New Issue
Block a user