diff --git a/README.md b/README.md
index fe408d7..92a170b 100644
--- a/README.md
+++ b/README.md
@@ -1,9 +1,13 @@
-# 原神成就导出工具
+
+
+# YaeAchievement
    
-- 支持导出所有成就
-- 支持官服,B服与国际服
+
+
+- 支持导出所有类别的成就
+- 支持官服,渠道服与国际服
- 支持导出至[椰羊](https://cocogoat.work/achievement)、[SnapGenshin](https://github.com/DGP-Studio/Snap.Genshin)、[Paimon.moe](https://paimon.moe/achievement/)、[Seelie.me](https://seelie.me/achievements)和表格文件(csv)
- 没有窗口大小、游戏语言等要求
diff --git a/app.js b/app.js
index 8d831ab..18deb9e 100644
--- a/app.js
+++ b/app.js
@@ -2,12 +2,13 @@ const proxy = require("udp-proxy")
const cp = require("child_process")
const appcenter = require("./appcenter")
const regionServer = require("./regionServer")
+const cloud = require("./generated/secret")
const {
initConfig, splitPacket, upload, decodeProto, log, setupHost, KPacket, debug, checkUpdate,
brotliCompressSync, brotliDecompressSync, checkGameIsRunning, checkPortIsUsing
} = require("./utils")
const { exportData } = require("./export")
-const { enablePrivilege, pause } = require("./native")
+const { enablePrivilege, pause } = require("./generated/native")
const onExit = () => {
setupHost(true)
@@ -37,6 +38,7 @@ const onExit = () => {
}
appcenter.startup()
let conf = await initConfig()
+ cloud.init(conf)
checkPortIsUsing()
checkGameIsRunning()
log("检查更新")
@@ -121,7 +123,7 @@ const onExit = () => {
log(`请求ID: ${response.headers["x-api-requestid"]}`)
log("请联系开发者以获取帮助")
} else {
- const proto = await decodeProto(data,"AllAchievement")
+ const proto = await decodeProto(data, "Notify1")
await exportData(proto)
}
process.exit(0)
diff --git a/appcenter.js b/appcenter.js
index 10357c5..0b30430 100644
--- a/appcenter.js
+++ b/appcenter.js
@@ -1,7 +1,7 @@
const axios = require("axios")
const crypto = require("crypto")
const { version } = require("./version")
-const { getDeviceID, getDeviceInfo } = require("./native")
+const { getDeviceID, getDeviceInfo } = require("./generated/native")
const getTimestamp = (d = new Date()) => {
const p = i => i.toString().padStart(2, "0")
diff --git a/export.js b/export.js
index b5a3fe5..85ff727 100644
--- a/export.js
+++ b/export.js
@@ -3,7 +3,7 @@ const axios = require("axios")
const readline = require("readline")
const { version } = require("./version")
const { loadCache, log, openUrl } = require("./utils")
-const { checkSnapFastcall, copyToClipboard } = require("./native")
+const { checkSnapFastcall, copyToClipboard } = require("./generated/native")
const exportToSeelie = proto => {
const out = { achievements: {} }
@@ -76,7 +76,7 @@ const exportToCocogoat = async proto => {
if (retcode > 32) {
log("在浏览器内进行下一步操作")
} else {
- log(`导出失败,请联系开发者以获取帮助 (26-3-${retcode})`)
+ log(`打开此链接以进行下一步操作: https://cocogoat.work/achievement?memo=${response.data.key}`)
}
}
diff --git a/native/binding.gyp b/native/binding.gyp
index 857123c..446ad3d 100644
--- a/native/binding.gyp
+++ b/native/binding.gyp
@@ -12,6 +12,7 @@
"src/wmi/wmi.cpp",
"src/wmi/wmi.hpp",
"src/wmi/unistd.h",
+ "src/VMProtectSDK.h",
"src/wmi/wmiresult.cpp",
"src/wmi/wmiresult.hpp",
"src/wmi/wmiclasses.hpp",
@@ -35,7 +36,12 @@
"AdditionalOptions": [
"-std:c++latest",
"-DUNICODE",
- "-sdl"
+ "-sdl",
+ "-O2",
+ "-Ot",
+ "-Oi",
+ "-GL",
+ "-Gw"
]
}
}
diff --git a/native/package.json b/native/package.json
index a1c9a31..ea4e2bb 100644
--- a/native/package.json
+++ b/native/package.json
@@ -3,7 +3,8 @@
"version": "1.0.0",
"description": "",
"scripts": {
- "build": "node-gyp rebuild && copy .\\build\\Release\\native.node ..\\genshin-export\\generated",
+ "build": "node-gyp build && copy .\\build\\Release\\native.node ..\\genshin-export\\generated",
+ "rebuild": "node-gyp rebuild && copy .\\build\\Release\\native.node ..\\genshin-export\\generated",
"build-for-win7": "node-gyp rebuild --target=v14.17.0 && copy .\\build\\Release\\native.node ..\\genshin-export\\generated"
},
"gypfile": true,
diff --git a/proto/Messages.proto b/proto/Messages.proto
deleted file mode 100644
index 5acb745..0000000
--- a/proto/Messages.proto
+++ /dev/null
@@ -1,89 +0,0 @@
-syntax = "proto3";
-
-message QueryRegionList {
- message SimpleInfo {
- string name = 2;
- string url = 4;
- }
- int32 retcode = 1;
- repeated SimpleInfo list = 2;
-}
-
-message QueryCurRegion {
- message ResVersion {
- uint32 v = 1;
- }
- message RegionInfo {
- string ip = 1;
- uint32 port = 2;
- uint32 cdv = 14;
- uint32 csv = 18;
- ResVersion res = 22;
- bytes sec = 23;
- }
- int32 retcode = 1;
- string message = 2;
- RegionInfo info = 3;
-}
-
-
-message Req1 {
- uint32 t = 1;
- string u = 2;
- string tk = 3;
- uint32 pl = 7;
- uint32 ch = 11;
- uint32 sc = 12;
-}
-
-message Rsp1 {
- int32 ret = 1;
- string msg = 2;
- uint32 uid = 3;
- uint64 sd = 11;
- bytes rc = 12;
- string cv = 22;
-}
-
-message Req2 {
- string tk = 1;
- string cv = 2;
- string sv = 3;
- string dn = 4;
- string du = 5;
- uint32 ln = 9;
- uint32 at = 10;
- string di = 13;
- uint32 pf = 14;
- string cs = 18;
- bytes rc = 21;
- uint32 sc = 25;
- string cvc = 26;
- uint32 cvd = 30;
- string cvh = 34;
-}
-
-message Notify1 {
- message Achievement {
- enum Status {
- INVALID = 0;
- UNFINISHED = 1;
- FINISHED = 2;
- REWARD_TAKEN = 3;
- }
- uint32 id = 1;
- Status status = 2;
- uint32 current = 3;
- uint32 require = 4;
- uint32 finishTimestamp = 5;
- }
- repeated Achievement list = 1;
-}
-
-message Notify2 { // 4612 HWAvatarReward
- repeated uint32 id = 1;
-}
-
-message Notify3 { // 4571 HWBGM
- repeated uint32 id = 1;
-}
diff --git a/regionServer.js b/regionServer.js
index 62f1770..362f0fe 100644
--- a/regionServer.js
+++ b/regionServer.js
@@ -3,7 +3,7 @@ const https = require("https")
const axios = require("axios")
const { decodeProto, encodeProto, debug } = require("./utils")
const path = require("path")
-const cert = path.join(__dirname, "./cert/root.p12")
+const cert = path.join(__dirname, "./cache/cert/root.p12")
const preparedRegions = {}
let currentProxy = undefined
diff --git a/utils.js b/utils.js
index 6f11ff8..8a860b9 100644
--- a/utils.js
+++ b/utils.js
@@ -2,8 +2,8 @@ const fs = require("fs")
const dns = require("dns")
const ini = require("ini")
const zlib = require("zlib")
-const cloud = require("./secret")
-const native = require("./native")
+const cloud = require("./generated/secret")
+const native = require("./generated/native")
const readline = require("readline")
const protobuf = require("protobufjs")
const { version } = require("./version")
@@ -11,17 +11,16 @@ const { promisify } = require("util")
const { createHash } = require("crypto")
const path = require("path")
const { uploadEvent } = require("./appcenter")
-const messages = path.join(__dirname, "./proto/Messages.proto")
-const encodeProto = (object, name) => protobuf.load(messages).then(r => {
- const msgType = r.lookupType(name)
+const messages = protobuf.loadSync(path.join(__dirname, "./generated/Messages.proto"))
+
+const encodeProto = (object, name) => {
+ const msgType = messages.lookupType(name)
const msgInst = msgType.create(object)
return msgType.encode(msgInst).finish()
-})
+}
-const decodeProto = (buf, name) => protobuf.load(messages).then(r => {
- return r.lookupType(name).decode(buf)
-})
+const decodeProto = (buf, name) => messages.lookupType(name).decode(buf)
const checkPath = path => new Promise((resolve, reject) => {
if (!fs.existsSync(`${path}/UnityPlayer.dll`) || !fs.existsSync(`${path}/pkg_version`)) {
@@ -189,7 +188,7 @@ const loadCache = async (fp = "latest-data") => {
}
}
-const isDebug = false
+const isDebug = true
const debug = (msg, ...params) => {
if (isDebug) log(msg, ...params)
@@ -208,11 +207,12 @@ const upload = async data => {
const checkUpdate = async () => {
const data = (await cloud.fetchBucket("/latest.json")).data
if (data["vc"] !== version.code) {
- log(`有可用更新: ${version.name} => ${data["vn"]}`)
- log(`更新内容: \n${data["ds"]}`)
- log("下载地址: https://github.com/HolographicHat/genshin-achievement-export/releases\n")
+ console.log(`有可用更新: ${version.name} => ${data["vn"]}`)
+ console.log(`更新内容: \n${data["ds"]}`)
+ console.log("下载地址: https://github.com/HolographicHat/YaeAchievement/releases")
}
if (data["fc"] === true) {
+ console.log(" * 这是一次强制更新")
process.exit(410)
}
}