mirror of
https://github.com/HolographicHat/Yae.git
synced 2025-12-12 17:38:13 +08:00
better pause impl
This commit is contained in:
4
app.js
4
app.js
@@ -7,12 +7,12 @@ const {
|
|||||||
brotliCompressSync, brotliDecompressSync, checkGameIsRunning, checkPortIsUsing
|
brotliCompressSync, brotliDecompressSync, checkGameIsRunning, checkPortIsUsing
|
||||||
} = require("./utils")
|
} = require("./utils")
|
||||||
const { exportData } = require("./export")
|
const { exportData } = require("./export")
|
||||||
const { enablePrivilege } = require("./native")
|
const { enablePrivilege, pause } = require("./native")
|
||||||
|
|
||||||
const onExit = () => {
|
const onExit = () => {
|
||||||
setupHost(true)
|
setupHost(true)
|
||||||
console.log("按任意键退出")
|
console.log("按任意键退出")
|
||||||
cp.execSync("pause > nul", { stdio: "inherit" })
|
pause()
|
||||||
};
|
};
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ const { copyToClipboard } = require("./native")
|
|||||||
|
|
||||||
const exportToSeelie = proto => {
|
const exportToSeelie = proto => {
|
||||||
const out = { achievements: {} }
|
const out = { achievements: {} }
|
||||||
proto.list.filter(achievement => achievement.status === 3).forEach(({id}) => {
|
proto.list.filter(a => a.status === 3 || a.status === 2).forEach(({id}) => {
|
||||||
out.achievements[id] = { done: true }
|
out.achievements[id] = { done: true }
|
||||||
})
|
})
|
||||||
const fp = `./export-${Date.now()}-seelie.json`
|
const fp = `./export-${Date.now()}-seelie.json`
|
||||||
@@ -20,7 +20,7 @@ const exportToPaimon = async proto => {
|
|||||||
excel.forEach(({GoalId, Id}) => {
|
excel.forEach(({GoalId, Id}) => {
|
||||||
achTable.set(Id, GoalId === undefined ? 0 : GoalId)
|
achTable.set(Id, GoalId === undefined ? 0 : GoalId)
|
||||||
})
|
})
|
||||||
proto.list.filter(achievement => achievement.status === 3).forEach(({id}) => {
|
proto.list.filter(a => a.status === 3 || a.status === 2).forEach(({id}) => {
|
||||||
const gid = achTable.get(id)
|
const gid = achTable.get(id)
|
||||||
if (out.achievement[gid] === undefined) {
|
if (out.achievement[gid] === undefined) {
|
||||||
out.achievement[gid] = {}
|
out.achievement[gid] = {}
|
||||||
@@ -52,7 +52,7 @@ const exportToCocogoat = async proto => {
|
|||||||
const d = new Date(parseInt(`${ts}000`))
|
const d = new Date(parseInt(`${ts}000`))
|
||||||
return `${d.getFullYear()}/${p(d.getMonth()+1)}/${p(d.getDate())}`
|
return `${d.getFullYear()}/${p(d.getMonth()+1)}/${p(d.getDate())}`
|
||||||
}
|
}
|
||||||
proto.list.filter(achievement => achievement.status === 3).forEach(({current, finishTimestamp, id, require}) => {
|
proto.list.filter(a => a.status === 3 || a.status === 2).forEach(({current, finishTimestamp, id, require}) => {
|
||||||
out.value.achievements.push({
|
out.value.achievements.push({
|
||||||
id: id,
|
id: id,
|
||||||
status: current === undefined || current === 0 || preStageAchievementIdList.includes(id) ? `${require}/${require}` : `${current}/${require}`,
|
status: current === undefined || current === 0 || preStageAchievementIdList.includes(id) ? `${require}/${require}` : `${current}/${require}`,
|
||||||
|
|||||||
1
native.d.ts
vendored
1
native.d.ts
vendored
@@ -5,3 +5,4 @@ export function copyToClipboard(value: string): any
|
|||||||
export function enablePrivilege(): any
|
export function enablePrivilege(): any
|
||||||
export function getDeviceInfo(): any
|
export function getDeviceInfo(): any
|
||||||
export function getDeviceID(): string
|
export function getDeviceID(): string
|
||||||
|
export function pause(): any
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
#include "wmi/wmi.hpp"
|
#include "wmi/wmi.hpp"
|
||||||
#include "wmi/wmiclasses.hpp"
|
#include "wmi/wmiclasses.hpp"
|
||||||
#include "registry/registry.hpp"
|
#include "registry/registry.hpp"
|
||||||
|
#include <conio.h>
|
||||||
#include <iphlpapi.h>
|
#include <iphlpapi.h>
|
||||||
#pragma comment(lib,"ws2_32.lib")
|
#pragma comment(lib,"ws2_32.lib")
|
||||||
#pragma comment(lib,"iphlpapi.lib")
|
#pragma comment(lib,"iphlpapi.lib")
|
||||||
@@ -161,7 +162,15 @@ namespace native {
|
|||||||
return env.Undefined();
|
return env.Undefined();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Value pause(const CallbackInfo &info) {
|
||||||
|
while(!_kbhit()) {
|
||||||
|
Sleep(10);
|
||||||
|
}
|
||||||
|
return info.Env().Undefined();
|
||||||
|
}
|
||||||
|
|
||||||
Object init(Env env, Object exports) {
|
Object init(Env env, Object exports) {
|
||||||
|
exports.Set("pause", Function::New(env, pause));
|
||||||
exports.Set("getDeviceID", Function::New(env, getDeviceID));
|
exports.Set("getDeviceID", Function::New(env, getDeviceID));
|
||||||
exports.Set("getDeviceInfo", Function::New(env, getDeviceInfo));
|
exports.Set("getDeviceInfo", Function::New(env, getDeviceInfo));
|
||||||
exports.Set("whoUseThePort", Function::New(env, whoUseThePort));
|
exports.Set("whoUseThePort", Function::New(env, whoUseThePort));
|
||||||
|
|||||||
Reference in New Issue
Block a user