@overlayed/app 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +16 -0
- package/README.md +0 -0
- package/dist/config.d.ts +5 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +1388 -0
- package/dist/managers/errorManager.d.ts +34 -0
- package/dist/managers/gameBuildManager.d.ts +18 -0
- package/dist/managers/gameLaunchManager.d.ts +36 -0
- package/dist/managers/keybindManager.d.ts +38 -0
- package/dist/managers/manager.d.ts +18 -0
- package/dist/managers/nativeModuleManager.d.ts +31 -0
- package/dist/managers/processManager.d.ts +34 -0
- package/dist/managers/ravenManager.d.ts +35 -0
- package/dist/native-interface/build/overlayed_native_interface_x64.node +0 -0
- package/dist/native-interface/main.js +4 -0
- package/dist/overlayed.d.ts +4 -0
- package/dist/render-interface/build/overlayed_render_hook_x64.dll +0 -0
- package/dist/render-interface/build/overlayed_render_interface_x64.node +0 -0
- package/dist/render-interface/main.js +4 -0
- package/dist/types.d.ts +50 -0
- package/dist/utils.d.ts +2 -0
- package/package.json +63 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,1388 @@
|
|
|
1
|
+
var Fe = Object.defineProperty;
|
|
2
|
+
var xe = (r, t, e) => t in r ? Fe(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
|
|
3
|
+
var l = (r, t, e) => xe(r, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
import p, { resolve as Ke } from "node:path";
|
|
5
|
+
import { PipeEventServer as Le, ProcessMonitor as Oe, Process as L }from "./native-interface/main.js";
|
|
6
|
+
import { type as D } from "arktype";
|
|
7
|
+
import w, { existsSync as $e, mkdirSync as He, readFileSync as ye, writeFileSync as Ne, copyFileSync as je } from "node:fs";
|
|
8
|
+
import b from "node:fs/promises";
|
|
9
|
+
import me from "jszip";
|
|
10
|
+
import { RenderInterface as Ue }from "./render-interface/main.js";
|
|
11
|
+
import { createHash as Be } from "node:crypto";
|
|
12
|
+
var Ge = Object.defineProperty, Ve = (r, t, e) => t in r ? Ge(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e, R = (r, t, e) => Ve(r, typeof t != "symbol" ? t + "" : t, e);
|
|
13
|
+
function ze(r) {
|
|
14
|
+
return { all: r = r || /* @__PURE__ */ new Map(), on: function(t, e) {
|
|
15
|
+
var n = r.get(t);
|
|
16
|
+
n ? n.push(e) : r.set(t, [e]);
|
|
17
|
+
}, off: function(t, e) {
|
|
18
|
+
var n = r.get(t);
|
|
19
|
+
n && (e ? n.splice(n.indexOf(e) >>> 0, 1) : r.set(t, []));
|
|
20
|
+
}, emit: function(t, e) {
|
|
21
|
+
var n = r.get(t);
|
|
22
|
+
n && n.slice().map(function(s) {
|
|
23
|
+
s(e);
|
|
24
|
+
}), (n = r.get("*")) && n.slice().map(function(s) {
|
|
25
|
+
s(t, e);
|
|
26
|
+
});
|
|
27
|
+
} };
|
|
28
|
+
}
|
|
29
|
+
let We = class {
|
|
30
|
+
constructor() {
|
|
31
|
+
R(this, "emitter"), this.emitter = ze();
|
|
32
|
+
}
|
|
33
|
+
on(t, e) {
|
|
34
|
+
this.emitter.on(t, e);
|
|
35
|
+
}
|
|
36
|
+
off(t, e) {
|
|
37
|
+
this.emitter.off(t, e);
|
|
38
|
+
}
|
|
39
|
+
emit(t, e) {
|
|
40
|
+
this.emitter.emit(t, e);
|
|
41
|
+
}
|
|
42
|
+
removeAllListeners() {
|
|
43
|
+
this.emitter.off("*", () => {
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
function qe(r, ...t) {
|
|
48
|
+
var e;
|
|
49
|
+
return e = class extends r {
|
|
50
|
+
/**
|
|
51
|
+
* Lazy get the static instance
|
|
52
|
+
*/
|
|
53
|
+
static getInstance() {
|
|
54
|
+
return this._instance || (this._instance = new r(...t)), this._instance;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Release the instance (most of the time you won't need this)
|
|
58
|
+
*/
|
|
59
|
+
static clearInstance() {
|
|
60
|
+
this._instance = void 0;
|
|
61
|
+
}
|
|
62
|
+
}, R(e, "_instance"), e;
|
|
63
|
+
}
|
|
64
|
+
const Xe = p.join(process.env.APPDATA ?? "", "overlayed");
|
|
65
|
+
p.join(Xe, "logs");
|
|
66
|
+
let Je = class extends We {
|
|
67
|
+
constructor(t) {
|
|
68
|
+
super(), R(this, "server", null), R(this, "_hasConnection", !1), R(this, "pipeId"), this.pipeId = t, this.init();
|
|
69
|
+
}
|
|
70
|
+
get hasConnection() {
|
|
71
|
+
return this._hasConnection;
|
|
72
|
+
}
|
|
73
|
+
destroy() {
|
|
74
|
+
var t;
|
|
75
|
+
this.server && (this._hasConnection = !1, (t = this.server) == null || t.removeAllListeners(), this.server = null);
|
|
76
|
+
}
|
|
77
|
+
init() {
|
|
78
|
+
this.server = new Le(this.pipeId, { clientCount: 1, access: 1 }), this.server.on("event", (t) => {
|
|
79
|
+
try {
|
|
80
|
+
const e = JSON.parse(t);
|
|
81
|
+
this.emit("data", e);
|
|
82
|
+
} catch (e) {
|
|
83
|
+
this.emit("error", e);
|
|
84
|
+
}
|
|
85
|
+
}), this.server.on("connected", () => {
|
|
86
|
+
this._hasConnection = !0;
|
|
87
|
+
}), this.server.on("disconnected", () => {
|
|
88
|
+
this._hasConnection = !1;
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
const Qe = qe(Je, "overlayed"), Ye = D({
|
|
93
|
+
game: "string",
|
|
94
|
+
type: "string",
|
|
95
|
+
creation_time: "number"
|
|
96
|
+
});
|
|
97
|
+
function Ze(r) {
|
|
98
|
+
return { all: r = r || /* @__PURE__ */ new Map(), on: function(t, e) {
|
|
99
|
+
var n = r.get(t);
|
|
100
|
+
n ? n.push(e) : r.set(t, [e]);
|
|
101
|
+
}, off: function(t, e) {
|
|
102
|
+
var n = r.get(t);
|
|
103
|
+
n && (e ? n.splice(n.indexOf(e) >>> 0, 1) : r.set(t, []));
|
|
104
|
+
}, emit: function(t, e) {
|
|
105
|
+
var n = r.get(t);
|
|
106
|
+
n && n.slice().map(function(s) {
|
|
107
|
+
s(e);
|
|
108
|
+
}), (n = r.get("*")) && n.slice().map(function(s) {
|
|
109
|
+
s(t, e);
|
|
110
|
+
});
|
|
111
|
+
} };
|
|
112
|
+
}
|
|
113
|
+
class et {
|
|
114
|
+
constructor() {
|
|
115
|
+
l(this, "emitter");
|
|
116
|
+
this.emitter = Ze();
|
|
117
|
+
}
|
|
118
|
+
on(t, e) {
|
|
119
|
+
this.emitter.on(t, e);
|
|
120
|
+
}
|
|
121
|
+
off(t, e) {
|
|
122
|
+
this.emitter.off(t, e);
|
|
123
|
+
}
|
|
124
|
+
emit(t, e) {
|
|
125
|
+
this.emitter.emit(t, e);
|
|
126
|
+
}
|
|
127
|
+
removeAllListeners() {
|
|
128
|
+
this.emitter.off("*", () => {
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
function k(r, ...t) {
|
|
133
|
+
var n;
|
|
134
|
+
return n = class extends r {
|
|
135
|
+
/**
|
|
136
|
+
* Lazy get the static instance
|
|
137
|
+
*/
|
|
138
|
+
static getInstance() {
|
|
139
|
+
return this._instance || (this._instance = new r(...t)), this._instance;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Release the instance (most of the time you won't need this)
|
|
143
|
+
*/
|
|
144
|
+
static clearInstance() {
|
|
145
|
+
this._instance = void 0;
|
|
146
|
+
}
|
|
147
|
+
}, l(n, "_instance"), n;
|
|
148
|
+
}
|
|
149
|
+
function tt(r) {
|
|
150
|
+
try {
|
|
151
|
+
return [JSON.parse(r), null];
|
|
152
|
+
} catch (t) {
|
|
153
|
+
return [null, t];
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
function X(r, t) {
|
|
157
|
+
const e = {};
|
|
158
|
+
for (const n in t)
|
|
159
|
+
n in r ? typeof r[n] == "object" && r[n] !== null && typeof t[n] == "object" && t[n] !== null ? e[n] = X(r[n], t[n]) : e[n] = r[n] : e[n] = t[n];
|
|
160
|
+
for (const n in r)
|
|
161
|
+
n in e || (e[n] = r[n]);
|
|
162
|
+
return e;
|
|
163
|
+
}
|
|
164
|
+
class rt {
|
|
165
|
+
constructor(t) {
|
|
166
|
+
l(this, "options");
|
|
167
|
+
l(this, "_data");
|
|
168
|
+
this.options = t, this._data = this.load();
|
|
169
|
+
}
|
|
170
|
+
get data() {
|
|
171
|
+
return this._data;
|
|
172
|
+
}
|
|
173
|
+
set data(t) {
|
|
174
|
+
this._data = t, this.saveCurrentData();
|
|
175
|
+
}
|
|
176
|
+
onBeforeSave(t) {
|
|
177
|
+
return t;
|
|
178
|
+
}
|
|
179
|
+
onAfterLoad(t) {
|
|
180
|
+
return t;
|
|
181
|
+
}
|
|
182
|
+
saveCurrentData() {
|
|
183
|
+
try {
|
|
184
|
+
const t = this.onBeforeSave(this._data);
|
|
185
|
+
w.writeFileSync(this.options.path, JSON.stringify(t, null, 2));
|
|
186
|
+
} catch {
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
load() {
|
|
190
|
+
if (!this.fileExists(this.options.path))
|
|
191
|
+
return this.setupDefaultData();
|
|
192
|
+
if (!this.canReadWriteFile(this.options.path))
|
|
193
|
+
return this.setupDefaultData(!0);
|
|
194
|
+
const t = w.readFileSync(this.options.path, "utf8"), [e, n] = tt(t);
|
|
195
|
+
return n ? this.setupDefaultData(!0) : this.onAfterLoad(e);
|
|
196
|
+
}
|
|
197
|
+
canReadWriteFile(t) {
|
|
198
|
+
try {
|
|
199
|
+
return w.accessSync(t, w.constants.R_OK | w.constants.W_OK), !0;
|
|
200
|
+
} catch {
|
|
201
|
+
return !1;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
fileExists(t) {
|
|
205
|
+
try {
|
|
206
|
+
return w.accessSync(t, w.constants.F_OK), !0;
|
|
207
|
+
} catch {
|
|
208
|
+
return !1;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
setupDefaultData(t = !1) {
|
|
212
|
+
return this._data = this.options.default, t || this.saveCurrentData(), this.data;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
class nt extends rt {
|
|
216
|
+
constructor(e) {
|
|
217
|
+
super(e);
|
|
218
|
+
l(this, "options");
|
|
219
|
+
this.options = e;
|
|
220
|
+
}
|
|
221
|
+
get data() {
|
|
222
|
+
const e = this.options.schema["~standard"].validate(super.data);
|
|
223
|
+
if (e instanceof Promise)
|
|
224
|
+
throw new Error("StructuredConfigFile does not support async validation");
|
|
225
|
+
return e.issues ? this.options.default : e.value;
|
|
226
|
+
}
|
|
227
|
+
set data(e) {
|
|
228
|
+
const n = this.options.schema["~standard"].validate(e);
|
|
229
|
+
if (n instanceof Promise)
|
|
230
|
+
throw new Error("StructuredConfigFile does not support async validation");
|
|
231
|
+
n.issues || (super.data = n.value);
|
|
232
|
+
}
|
|
233
|
+
onAfterLoad(e) {
|
|
234
|
+
const n = this.options.schema["~standard"].validate(e);
|
|
235
|
+
if (n instanceof Promise)
|
|
236
|
+
throw new Error("StructuredConfigFile does not support async validation");
|
|
237
|
+
return n.issues ? X(e, this.options.default) : X(n.value, this.options.default);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
const ve = {
|
|
241
|
+
scope: (r) => ({
|
|
242
|
+
log: (...t) => {
|
|
243
|
+
console.log(r, ...t);
|
|
244
|
+
},
|
|
245
|
+
error: (...t) => {
|
|
246
|
+
console.error(r, ...t);
|
|
247
|
+
},
|
|
248
|
+
warn: (...t) => {
|
|
249
|
+
console.warn(r, ...t);
|
|
250
|
+
},
|
|
251
|
+
info: (...t) => {
|
|
252
|
+
console.info(r, ...t);
|
|
253
|
+
},
|
|
254
|
+
debug: (...t) => {
|
|
255
|
+
console.debug(r, ...t);
|
|
256
|
+
},
|
|
257
|
+
captureSentryException: (...t) => {
|
|
258
|
+
console.error(r, ...t);
|
|
259
|
+
},
|
|
260
|
+
sentryError: (...t) => {
|
|
261
|
+
console.error(r, ...t);
|
|
262
|
+
},
|
|
263
|
+
sentryLog: (...t) => {
|
|
264
|
+
console.log(r, ...t);
|
|
265
|
+
},
|
|
266
|
+
sentryWarn: (...t) => {
|
|
267
|
+
console.warn(r, ...t);
|
|
268
|
+
}
|
|
269
|
+
}),
|
|
270
|
+
error: (...r) => {
|
|
271
|
+
console.error(name, ...r);
|
|
272
|
+
},
|
|
273
|
+
warn: (...r) => {
|
|
274
|
+
console.warn(name, ...r);
|
|
275
|
+
},
|
|
276
|
+
info: (...r) => {
|
|
277
|
+
console.info(name, ...r);
|
|
278
|
+
},
|
|
279
|
+
debug: (...r) => {
|
|
280
|
+
console.debug(name, ...r);
|
|
281
|
+
},
|
|
282
|
+
captureSentryException: (...r) => {
|
|
283
|
+
console.error(name, ...r);
|
|
284
|
+
},
|
|
285
|
+
sentryError: (...r) => {
|
|
286
|
+
console.error(name, ...r);
|
|
287
|
+
},
|
|
288
|
+
sentryLog: (...r) => {
|
|
289
|
+
console.log(name, ...r);
|
|
290
|
+
},
|
|
291
|
+
sentryWarn: (...r) => {
|
|
292
|
+
console.warn(name, ...r);
|
|
293
|
+
},
|
|
294
|
+
sentryInfo: (...r) => {
|
|
295
|
+
console.info(name, ...r);
|
|
296
|
+
}
|
|
297
|
+
}, F = p.join(process.env.APPDATA ?? "", "overlayed");
|
|
298
|
+
p.join(F, "logs");
|
|
299
|
+
class st {
|
|
300
|
+
constructor(t) {
|
|
301
|
+
l(this, "logger");
|
|
302
|
+
l(this, "initialized", !1);
|
|
303
|
+
this.logger = ve.scope(t);
|
|
304
|
+
}
|
|
305
|
+
init() {
|
|
306
|
+
this.logger.log("Initializing"), this.initialized = !0;
|
|
307
|
+
}
|
|
308
|
+
destroy() {
|
|
309
|
+
this.logger.log("Destroying"), this.initialized = !1;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
class C extends et {
|
|
313
|
+
constructor(e) {
|
|
314
|
+
super();
|
|
315
|
+
l(this, "logger");
|
|
316
|
+
l(this, "initialized", !1);
|
|
317
|
+
this.logger = ve.scope(e);
|
|
318
|
+
}
|
|
319
|
+
init() {
|
|
320
|
+
this.logger.log("Initializing"), this.initialized = !0;
|
|
321
|
+
}
|
|
322
|
+
destroy() {
|
|
323
|
+
this.logger.log("Destroying"), this.initialized = !1, this.removeAllListeners();
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
class it extends C {
|
|
327
|
+
constructor() {
|
|
328
|
+
super("ErrorManager");
|
|
329
|
+
}
|
|
330
|
+
error(t, e, n) {
|
|
331
|
+
this.emit("error", {
|
|
332
|
+
code: e,
|
|
333
|
+
message: t,
|
|
334
|
+
data: n,
|
|
335
|
+
timestamp: Date.now()
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
warn(t, e, n) {
|
|
339
|
+
this.emit("warning", {
|
|
340
|
+
code: e,
|
|
341
|
+
message: t,
|
|
342
|
+
data: n,
|
|
343
|
+
timestamp: Date.now()
|
|
344
|
+
});
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
const be = k(it), ot = {
|
|
348
|
+
buildChannel: "dev"
|
|
349
|
+
};
|
|
350
|
+
function at() {
|
|
351
|
+
return p.normalize(F);
|
|
352
|
+
}
|
|
353
|
+
var I = "object", Ee = "function", we = "prototype", q = "text", re = "json", le = "abort", J = "paramsSerializer", ue = "addEventListener", O = "status", v = "headers", W = Object, _ = void 0, N = null, Q = W[we], j = W.keys, M = Array.isArray, he = "method", _e = "HEAD", Y = "GET", ke = "OPTIONS", ct = "POST", lt = "PUT", ut = "PATCH", ht = "DELETE";
|
|
354
|
+
function dt(r, t) {
|
|
355
|
+
let e = new AbortController();
|
|
356
|
+
function n(a) {
|
|
357
|
+
e.abort(a), i();
|
|
358
|
+
}
|
|
359
|
+
let s = [];
|
|
360
|
+
for (let a of r) {
|
|
361
|
+
if ((a == null ? void 0 : a.aborted) === !0) {
|
|
362
|
+
n(a.reason);
|
|
363
|
+
break;
|
|
364
|
+
}
|
|
365
|
+
if (a != null && a[ue]) {
|
|
366
|
+
let c = () => {
|
|
367
|
+
n(a.reason);
|
|
368
|
+
};
|
|
369
|
+
s.push(() => {
|
|
370
|
+
var d;
|
|
371
|
+
(d = a.removeEventListener) == null || d.call(a, le, c);
|
|
372
|
+
}), a[ue](le, c);
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
function i() {
|
|
376
|
+
s.forEach((a) => a()), t == null || t();
|
|
377
|
+
}
|
|
378
|
+
let o = e.signal;
|
|
379
|
+
return o.clear = i, o;
|
|
380
|
+
}
|
|
381
|
+
var de = W.getPrototypeOf, ge = (r) => {
|
|
382
|
+
if (r !== N && typeof r === I) {
|
|
383
|
+
if (typeof de === Ee) {
|
|
384
|
+
let t = de(r);
|
|
385
|
+
return t === Q || t === N;
|
|
386
|
+
}
|
|
387
|
+
return Q.toString.call(r) === `[${I} Object]`;
|
|
388
|
+
}
|
|
389
|
+
return !1;
|
|
390
|
+
}, ne = (...r) => r.reduce((t, e) => {
|
|
391
|
+
if (M(e)) throw new TypeError(`Arguments must be ${I}s, not arrays.`);
|
|
392
|
+
return j(e).forEach((n) => {
|
|
393
|
+
["__proto__", "constructor", we].includes(n) || (M(t[n]) && M(e[n]) ? t[n] = Array.from(new Set(t[n].concat(e[n]))) : ge(t[n]) && ge(e[n]) ? t[n] = ne(t[n], e[n]) : t[n] = e[n]);
|
|
394
|
+
}), t;
|
|
395
|
+
}, {});
|
|
396
|
+
function se(r, t = !0, e = N, n) {
|
|
397
|
+
if (r === _ || r === N) return "";
|
|
398
|
+
let s = [], i = t ? encodeURIComponent : (g) => g, o = M(r), { arrayFormat: a, allowDots: c, serializeDate: d } = n || {}, h = (g) => {
|
|
399
|
+
if (c && !o) return `.${g}`;
|
|
400
|
+
if (o) {
|
|
401
|
+
if (a === "brackets") return "[]";
|
|
402
|
+
if (a === "repeat") return "";
|
|
403
|
+
}
|
|
404
|
+
return `[${g}]`;
|
|
405
|
+
};
|
|
406
|
+
for (let g in r) if (Q.hasOwnProperty.call(r, g)) {
|
|
407
|
+
let u = r[g];
|
|
408
|
+
if (u !== _) {
|
|
409
|
+
let y = e ? `${e}${h(g)}` : i(g);
|
|
410
|
+
if (!isNaN(u) && u instanceof Date && (u = d ? d(u) : u.toISOString()), typeof u === I) {
|
|
411
|
+
let f = se(u, t, y, n);
|
|
412
|
+
f !== "" && s.push(f);
|
|
413
|
+
} else s.push(`${i(y)}=${i(u)}`);
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
return s.join("&");
|
|
417
|
+
}
|
|
418
|
+
function Z(r) {
|
|
419
|
+
return M(r) ? r.map(Z) : (r && typeof r === I && j(r).forEach((t) => {
|
|
420
|
+
let e = r[t];
|
|
421
|
+
e === _ ? delete r[t] : Z(e);
|
|
422
|
+
}), r);
|
|
423
|
+
}
|
|
424
|
+
function gt(r) {
|
|
425
|
+
return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(r);
|
|
426
|
+
}
|
|
427
|
+
function ft(r, t) {
|
|
428
|
+
return r ? t ? (r.endsWith("/") ? r : r + "/") + (t[0] === "/" ? t.slice(1) : t) : r : t || "";
|
|
429
|
+
}
|
|
430
|
+
var pt = "XiorError", yt = "XiorTimeoutError", Pe = class extends Error {
|
|
431
|
+
constructor(r, t, e) {
|
|
432
|
+
super(r), this.name = pt, this.request = t, this.config = t, this.response = e;
|
|
433
|
+
}
|
|
434
|
+
}, mt = class extends Pe {
|
|
435
|
+
constructor(t, e, n) {
|
|
436
|
+
super(t, e, n), this.name = yt;
|
|
437
|
+
}
|
|
438
|
+
}, vt = Object.defineProperty, bt = Object.defineProperties, Et = Object.getOwnPropertyDescriptors, U = Object.getOwnPropertySymbols, Ie = Object.prototype.hasOwnProperty, Ce = Object.prototype.propertyIsEnumerable, fe = (r, t, e) => t in r ? vt(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e, A = (r, t) => {
|
|
439
|
+
for (var e in t || (t = {})) Ie.call(t, e) && fe(r, e, t[e]);
|
|
440
|
+
if (U) for (var e of U(t)) Ce.call(t, e) && fe(r, e, t[e]);
|
|
441
|
+
return r;
|
|
442
|
+
}, $ = (r, t) => bt(r, Et(t)), wt = (r, t) => {
|
|
443
|
+
var e = {};
|
|
444
|
+
for (var n in r) Ie.call(r, n) && t.indexOf(n) < 0 && (e[n] = r[n]);
|
|
445
|
+
if (r != null && U) for (var n of U(r)) t.indexOf(n) < 0 && Ce.call(r, n) && (e[n] = r[n]);
|
|
446
|
+
return e;
|
|
447
|
+
}, T = (r, t, e) => new Promise((n, s) => {
|
|
448
|
+
var i = (c) => {
|
|
449
|
+
try {
|
|
450
|
+
a(e.next(c));
|
|
451
|
+
} catch (d) {
|
|
452
|
+
s(d);
|
|
453
|
+
}
|
|
454
|
+
}, o = (c) => {
|
|
455
|
+
try {
|
|
456
|
+
a(e.throw(c));
|
|
457
|
+
} catch (d) {
|
|
458
|
+
s(d);
|
|
459
|
+
}
|
|
460
|
+
}, a = (c) => c.done ? n(c.value) : Promise.resolve(c.value).then(i, o);
|
|
461
|
+
a((e = e.apply(r, t)).next());
|
|
462
|
+
}), ie = "application/", Se = `${ie}x-www-form-urlencoded`, Re = RegExp, _t = new Re(`^${Se}`, "i"), kt = `${ie}${re}`, Pt = new Re(`^${ie}.*${re}.*`, "i");
|
|
463
|
+
function It(r = Y) {
|
|
464
|
+
return [_e, Y, ke].includes(r);
|
|
465
|
+
}
|
|
466
|
+
var Ct = typeof URLSearchParams != `${_}`;
|
|
467
|
+
function St(r) {
|
|
468
|
+
return T(this, null, function* () {
|
|
469
|
+
let t = r[J] || se, e = r.encodeURI !== !1, n = r[he] && r[he].toUpperCase(), s = r.url, i = s, o = Ct && r.data instanceof URLSearchParams, a = o ? W.fromEntries(r.data.entries()) : r.data, c = a, d = r != null && r[v] ? A({}, r[v]) : {}, h = r.params, g = It(n);
|
|
470
|
+
if (a && typeof a.append !== Ee) {
|
|
471
|
+
let u = "", y = "content-type";
|
|
472
|
+
if (r != null && r[v]) {
|
|
473
|
+
let f = j(r[v]).find((E) => E.toLowerCase() === y);
|
|
474
|
+
f && (y = f, u = r[v][f]);
|
|
475
|
+
}
|
|
476
|
+
(!u || o) && (u = g || o ? Se : kt, d[y] = u), typeof a === I && (g && h && (h = ne(a, h)), Pt.test(u) ? c = JSON.stringify(Z(a)) : !g && _t.test(u) && (c = t(a)));
|
|
477
|
+
}
|
|
478
|
+
if (h && j(h).length > 0) {
|
|
479
|
+
let u = t(h, e);
|
|
480
|
+
s += s.includes("?") ? `&${u}` : `?${u}`;
|
|
481
|
+
}
|
|
482
|
+
return $(A({}, r), { _data: c, _url: s, data: a, url: i, method: n, [v]: d, isGet: g });
|
|
483
|
+
});
|
|
484
|
+
}
|
|
485
|
+
var Rt = typeof AbortController != `${_}`;
|
|
486
|
+
function Mt(r, t) {
|
|
487
|
+
return T(this, null, function* () {
|
|
488
|
+
let e;
|
|
489
|
+
if (!t || !r.ok || [q, re].includes(t)) {
|
|
490
|
+
if (e = yield r[q](), e && t !== q) try {
|
|
491
|
+
e = JSON.parse(e);
|
|
492
|
+
} catch {
|
|
493
|
+
}
|
|
494
|
+
} else {
|
|
495
|
+
if (t === "blob") return r.blob();
|
|
496
|
+
if (t === "arraybuffer") return r.arrayBuffer();
|
|
497
|
+
}
|
|
498
|
+
return e;
|
|
499
|
+
});
|
|
500
|
+
}
|
|
501
|
+
var At = (r) => new P(r), P = class {
|
|
502
|
+
constructor(t) {
|
|
503
|
+
this.REQI = [], this.RESI = [], this.P = [], this.config = t, this.defaults = { params: {}, [v]: {} };
|
|
504
|
+
}
|
|
505
|
+
get interceptors() {
|
|
506
|
+
return { request: { use: (t, e, n) => (this.REQI.push(t), t), eject: (t) => {
|
|
507
|
+
this.REQI = this.REQI.filter((e) => e !== t);
|
|
508
|
+
}, clear: () => {
|
|
509
|
+
this.REQI = [];
|
|
510
|
+
} }, response: { use: (t, e) => (this.RESI.push({ fn: t, onRejected: e }), t), eject: (t) => {
|
|
511
|
+
this.RESI = this.RESI.filter((e) => e.fn !== t);
|
|
512
|
+
}, clear: () => {
|
|
513
|
+
this.RESI = [];
|
|
514
|
+
} } };
|
|
515
|
+
}
|
|
516
|
+
get plugins() {
|
|
517
|
+
return { use: (t) => (this.P.push(t), t), eject: (t) => {
|
|
518
|
+
this.P = this.P.filter((e) => e !== t);
|
|
519
|
+
}, clear: () => {
|
|
520
|
+
this.P = [];
|
|
521
|
+
} };
|
|
522
|
+
}
|
|
523
|
+
request(t) {
|
|
524
|
+
return T(this, null, function* () {
|
|
525
|
+
let e = ne(this.config || {}, this.defaults, typeof t == "string" ? { url: t } : t), n = "credentials";
|
|
526
|
+
e.withCredentials && !e[n] && (e[n] = "include"), e[J] || (e[J] = se);
|
|
527
|
+
for (let o of this.REQI) e = yield o(e);
|
|
528
|
+
let s = this._.bind(this);
|
|
529
|
+
this.P.forEach((o) => {
|
|
530
|
+
s = o(s, this);
|
|
531
|
+
});
|
|
532
|
+
let i = s(e);
|
|
533
|
+
if (!e._did) {
|
|
534
|
+
let o = 0, a = [];
|
|
535
|
+
for (this.RESI.forEach(function(c) {
|
|
536
|
+
a.push(c.fn, c.onRejected);
|
|
537
|
+
}); a.length > o; ) i = i.then(a[o++], a[o++]);
|
|
538
|
+
}
|
|
539
|
+
return i;
|
|
540
|
+
});
|
|
541
|
+
}
|
|
542
|
+
_(t) {
|
|
543
|
+
return T(this, null, function* () {
|
|
544
|
+
let e = yield St(t), { url: n, method: s, headers: i, timeout: o, signal: a, data: c, _data: d, _url: h, isGet: g, fetch: u } = e, y = wt(e, ["url", "method", "headers", "timeout", "signal", "data", "_data", "_url", "isGet", "fetch"]);
|
|
545
|
+
t._url = h;
|
|
546
|
+
let f, E = [], x = _;
|
|
547
|
+
if (o && Rt) {
|
|
548
|
+
let m = new AbortController();
|
|
549
|
+
x = setTimeout(() => {
|
|
550
|
+
m.abort(new mt(`timeout of ${o}ms exceeded`, t));
|
|
551
|
+
}, o), E.push(m.signal);
|
|
552
|
+
}
|
|
553
|
+
a && E.push(a), f = E[0], E.length > 1 && (f = dt(E, () => {
|
|
554
|
+
clearTimeout(x);
|
|
555
|
+
}));
|
|
556
|
+
let K = h || n, ae = "baseURL";
|
|
557
|
+
return t[ae] && !gt(K) && (K = ft(t[ae], K)), (u || fetch)(K, $(A({ body: g ? _ : d }, y), { signal: f, method: s, headers: i })).then((m) => T(this, null, function* () {
|
|
558
|
+
let { responseType: Te } = t, ce = { data: yield Mt(m, Te), response: m, config: t, request: t, [O]: m[O], statusText: m.statusText, [v]: m[v] };
|
|
559
|
+
if (!m.ok) {
|
|
560
|
+
let De = new Pe(m[O] ? `Request failed with status code ${m[O]}` : "Network error", t, ce);
|
|
561
|
+
return Promise.reject(De);
|
|
562
|
+
}
|
|
563
|
+
return ce;
|
|
564
|
+
})).finally(() => {
|
|
565
|
+
var m;
|
|
566
|
+
x && clearTimeout(x), (m = f == null ? void 0 : f.clear) == null || m.call(f);
|
|
567
|
+
});
|
|
568
|
+
});
|
|
569
|
+
}
|
|
570
|
+
cG(t) {
|
|
571
|
+
return (e, n) => this.request(n ? $(A({}, n), { method: t, url: e }) : { method: t, url: e });
|
|
572
|
+
}
|
|
573
|
+
cP(t) {
|
|
574
|
+
return (e, n, s) => this.request(s ? $(A({}, s), { method: t, url: e, data: n }) : { method: t, url: e, data: n });
|
|
575
|
+
}
|
|
576
|
+
get(t, e) {
|
|
577
|
+
return this.cG(Y)(t, e);
|
|
578
|
+
}
|
|
579
|
+
head(t, e) {
|
|
580
|
+
return this.cG(_e)(t, e);
|
|
581
|
+
}
|
|
582
|
+
post(t, e, n) {
|
|
583
|
+
return this.cP(ct)(t, e, n);
|
|
584
|
+
}
|
|
585
|
+
put(t, e, n) {
|
|
586
|
+
return this.cP(lt)(t, e, n);
|
|
587
|
+
}
|
|
588
|
+
patch(t, e, n) {
|
|
589
|
+
return this.cP(ut)(t, e, n);
|
|
590
|
+
}
|
|
591
|
+
delete(t, e) {
|
|
592
|
+
return this.cG(ht)(t, e);
|
|
593
|
+
}
|
|
594
|
+
options(t, e) {
|
|
595
|
+
return this.cG(ke)(t, e);
|
|
596
|
+
}
|
|
597
|
+
};
|
|
598
|
+
P.create = At, P.VERSION = "0.7.7";
|
|
599
|
+
var Tt = Object.assign(P.create(), { create: P.create, VERSION: P.VERSION }), Me = Tt;
|
|
600
|
+
const Ae = Me.create({
|
|
601
|
+
baseURL: "https://updater.overlayed.gg",
|
|
602
|
+
headers: {
|
|
603
|
+
Accept: "application/json",
|
|
604
|
+
"Accept-Encoding": "gzip, deflate, br"
|
|
605
|
+
}
|
|
606
|
+
}), oe = Me.create({
|
|
607
|
+
baseURL: "https://api.overlayed.gg",
|
|
608
|
+
headers: {
|
|
609
|
+
Accept: "application/json",
|
|
610
|
+
"Accept-Encoding": "gzip, deflate, br"
|
|
611
|
+
}
|
|
612
|
+
});
|
|
613
|
+
function Dt(r, t) {
|
|
614
|
+
return Ae.get(`/v1/native/${r}/version.txt`, {
|
|
615
|
+
params: { channel: t },
|
|
616
|
+
responseType: "text"
|
|
617
|
+
});
|
|
618
|
+
}
|
|
619
|
+
function Ft(r, t) {
|
|
620
|
+
return Ae.get(`/v1/native/${r}/files`, {
|
|
621
|
+
params: { channel: t },
|
|
622
|
+
responseType: "arraybuffer"
|
|
623
|
+
});
|
|
624
|
+
}
|
|
625
|
+
function xt() {
|
|
626
|
+
return oe.get("/v1/raven/config");
|
|
627
|
+
}
|
|
628
|
+
function Kt(r, t) {
|
|
629
|
+
return oe.get(`/v1/raven/games/${r}/builds/${t}/check`);
|
|
630
|
+
}
|
|
631
|
+
function Lt(r, t) {
|
|
632
|
+
const e = new FormData();
|
|
633
|
+
return e.append("file", t), oe.post(`/v1/raven/games/${r}/builds/upload`, e, {});
|
|
634
|
+
}
|
|
635
|
+
function Ot(r) {
|
|
636
|
+
return r instanceof Error && (r.name === "XiorError" || r.name === "XiorTimeoutError");
|
|
637
|
+
}
|
|
638
|
+
function $t(r) {
|
|
639
|
+
return !!(r && "kind" in r.data && "message" in r.data);
|
|
640
|
+
}
|
|
641
|
+
class Ht extends C {
|
|
642
|
+
constructor() {
|
|
643
|
+
super("NativeDllManager");
|
|
644
|
+
l(this, "UPDATE_CHECK_INTERVAL_MS", 1e3 * 60 * 5);
|
|
645
|
+
// 5 minutes
|
|
646
|
+
l(this, "targetDir");
|
|
647
|
+
l(this, "updateInterval");
|
|
648
|
+
this.targetDir = p.join(F, "resources"), this.logger.log("Target directory", this.targetDir);
|
|
649
|
+
}
|
|
650
|
+
async initWithDlls(e) {
|
|
651
|
+
super.init(), await b.mkdir(this.targetDir, { recursive: !0 }), await this.checkForUpdates(e), clearInterval(this.updateInterval), this.updateInterval = setInterval(() => this.checkForUpdates(e), this.UPDATE_CHECK_INTERVAL_MS);
|
|
652
|
+
}
|
|
653
|
+
destroy() {
|
|
654
|
+
this.updateInterval && (clearInterval(this.updateInterval), this.updateInterval = void 0), super.destroy();
|
|
655
|
+
}
|
|
656
|
+
async getCurrentVersion(e) {
|
|
657
|
+
try {
|
|
658
|
+
const n = p.join(this.targetDir, e, "version.txt");
|
|
659
|
+
return await b.readFile(n, "utf-8");
|
|
660
|
+
} catch {
|
|
661
|
+
return null;
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
getTargetPath(e) {
|
|
665
|
+
return p.join(this.targetDir, e);
|
|
666
|
+
}
|
|
667
|
+
getTargetVersionPath(e, n) {
|
|
668
|
+
return p.join(this.getTargetPath(e), n);
|
|
669
|
+
}
|
|
670
|
+
async checkForUpdates(e) {
|
|
671
|
+
const n = ot.buildChannel;
|
|
672
|
+
this.logger.log("Checking for updates");
|
|
673
|
+
for (const s of e)
|
|
674
|
+
try {
|
|
675
|
+
const { data: i } = await Dt(s, n), o = await this.getCurrentVersion(s);
|
|
676
|
+
this.logger.log(`${s} > Update Check. current: ${o}, latest: ${i}`), i !== o ? (this.logger.log(`${s} > Update found: ${o} -> ${i}`), await this.downloadAndExtractDll(s, i, n), this.logger.log(`${s} > Downloaded and extracted`), await this.cleanupOldVersions(s, i), this.logger.log(`${s} > Cleaning up versions older than ${i}`), this.emit("dllUpdated", { identifier: s, version: i })) : this.logger.log(`${s} Up to date`);
|
|
677
|
+
} catch (i) {
|
|
678
|
+
this.logger.captureSentryException(`${s} > Error checking/updating`, i);
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
async downloadAndExtractDll(e, n, s) {
|
|
682
|
+
const { data: i } = await Ft(e, s), o = this.getTargetPath(e), a = this.getTargetVersionPath(e, n);
|
|
683
|
+
await b.mkdir(a, { recursive: !0 });
|
|
684
|
+
const c = new me();
|
|
685
|
+
await c.loadAsync(i);
|
|
686
|
+
const d = Object.keys(c.files).map(async (g) => {
|
|
687
|
+
const u = c.files[g];
|
|
688
|
+
if (u && !u.dir) {
|
|
689
|
+
const y = await u.async("nodebuffer"), f = p.join(a, g);
|
|
690
|
+
await b.writeFile(f, y);
|
|
691
|
+
}
|
|
692
|
+
});
|
|
693
|
+
await Promise.all(d);
|
|
694
|
+
const h = p.join(o, "version.txt");
|
|
695
|
+
this.logger.log("Saving version file", h), await b.writeFile(h, n);
|
|
696
|
+
}
|
|
697
|
+
async cleanupOldVersions(e, n) {
|
|
698
|
+
const s = p.join(this.targetDir, e), i = await b.readdir(s, { withFileTypes: !0 });
|
|
699
|
+
for (const o of i)
|
|
700
|
+
o.isDirectory() && o.name !== n && await b.rm(p.join(s, o.name), { recursive: !0, force: !0 });
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
const B = k(Ht);
|
|
704
|
+
class Nt extends C {
|
|
705
|
+
constructor() {
|
|
706
|
+
super("RavenManager");
|
|
707
|
+
l(this, "REFETCH_INTERVAL", 1e3 * 60 * 5);
|
|
708
|
+
l(this, "FAILED_REFETCH_INTERVAL", 1e3 * 30);
|
|
709
|
+
l(this, "_ravenConfig");
|
|
710
|
+
l(this, "_executableToGameMap", /* @__PURE__ */ new Map());
|
|
711
|
+
l(this, "_executablesArray", []);
|
|
712
|
+
l(this, "_refetchIntervalHandler", null);
|
|
713
|
+
l(this, "_failedRefetchTimeoutHandler", null);
|
|
714
|
+
}
|
|
715
|
+
init() {
|
|
716
|
+
super.init(), this.fetchRavenConfig(), this._refetchIntervalHandler = setInterval(() => {
|
|
717
|
+
this._failedRefetchTimeoutHandler && (clearTimeout(this._failedRefetchTimeoutHandler), this._failedRefetchTimeoutHandler = null), this.fetchRavenConfig();
|
|
718
|
+
}, this.REFETCH_INTERVAL);
|
|
719
|
+
}
|
|
720
|
+
getExecutableData(e) {
|
|
721
|
+
return this._executableToGameMap.get(e.toLowerCase()) ?? null;
|
|
722
|
+
}
|
|
723
|
+
get executables() {
|
|
724
|
+
return this._executablesArray;
|
|
725
|
+
}
|
|
726
|
+
get executablesMap() {
|
|
727
|
+
return this._executableToGameMap;
|
|
728
|
+
}
|
|
729
|
+
destroy() {
|
|
730
|
+
this._refetchIntervalHandler && clearInterval(this._refetchIntervalHandler), this._failedRefetchTimeoutHandler && clearTimeout(this._failedRefetchTimeoutHandler), B.getInstance().destroy(), super.destroy();
|
|
731
|
+
}
|
|
732
|
+
async fetchRavenConfig() {
|
|
733
|
+
try {
|
|
734
|
+
const e = await xt();
|
|
735
|
+
this._ravenConfig = e.data, this.resetState();
|
|
736
|
+
const n = /* @__PURE__ */ new Set();
|
|
737
|
+
for (const s of this._ravenConfig.games) {
|
|
738
|
+
for (const i of s.executables) {
|
|
739
|
+
const o = i.toLowerCase();
|
|
740
|
+
this._executableToGameMap.set(o, s), this._executablesArray.push(o);
|
|
741
|
+
}
|
|
742
|
+
s.dlls_to_inject.forEach((i) => n.add(i));
|
|
743
|
+
}
|
|
744
|
+
await B.getInstance().initWithDlls(Array.from(n)), this.logger.log("Raven updated", this._ravenConfig), this.emit("executablesUpdated", { executables: this.executables, map: this._executableToGameMap });
|
|
745
|
+
} catch (e) {
|
|
746
|
+
this.logger.captureSentryException("Failed to fetch Raven config", e), this._failedRefetchTimeoutHandler = setTimeout(() => this.fetchRavenConfig(), this.FAILED_REFETCH_INTERVAL);
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
resetState() {
|
|
750
|
+
this._executableToGameMap.clear(), this._executablesArray = [];
|
|
751
|
+
}
|
|
752
|
+
}
|
|
753
|
+
const G = k(Nt);
|
|
754
|
+
class jt extends C {
|
|
755
|
+
constructor() {
|
|
756
|
+
super("ProcessManager");
|
|
757
|
+
l(this, "_processMonitor");
|
|
758
|
+
l(this, "_processes", /* @__PURE__ */ new Map());
|
|
759
|
+
l(this, "boundOnRavenManagerExecutablesUpdated", this.onRavenManagerExecutablesUpdated.bind(this));
|
|
760
|
+
this._processMonitor = new Oe();
|
|
761
|
+
}
|
|
762
|
+
get hasAnyActiveProcesses() {
|
|
763
|
+
return this.activeProcesses.length > 0;
|
|
764
|
+
}
|
|
765
|
+
get activeProcesses() {
|
|
766
|
+
return Array.from(this._processes.values()).flat().filter((e) => !e.destroyedAt);
|
|
767
|
+
}
|
|
768
|
+
init() {
|
|
769
|
+
super.init(), G.getInstance().on("executablesUpdated", this.boundOnRavenManagerExecutablesUpdated), this._processMonitor.on("create", (e) => {
|
|
770
|
+
this.logger.log("Process created", e), this.addProcess(e), this.logger.log(`Active Process Count: ${this._processes.size}`), this.emit("create", { process: e });
|
|
771
|
+
}), this._processMonitor.on("destroy", (e) => {
|
|
772
|
+
this.logger.log("Process destroyed", e), this.deleteProcess(e), this.logger.log(`Active Process Count: ${this._processes.size}`), this.emit("destroy", { process: e });
|
|
773
|
+
});
|
|
774
|
+
}
|
|
775
|
+
destroy() {
|
|
776
|
+
G.getInstance().off("executablesUpdated", this.boundOnRavenManagerExecutablesUpdated), this._processes.clear(), this._processMonitor.removeAllListeners(), super.destroy();
|
|
777
|
+
}
|
|
778
|
+
isProcessRunning(e) {
|
|
779
|
+
const n = this._processes.get(e);
|
|
780
|
+
return (n == null ? void 0 : n.some((s) => !s.destroyedAt)) ?? !1;
|
|
781
|
+
}
|
|
782
|
+
onRavenManagerExecutablesUpdated(e) {
|
|
783
|
+
e.executables.forEach((n) => {
|
|
784
|
+
this.logger.log("Monitoring process", n), this._processMonitor.registerProcess(n);
|
|
785
|
+
});
|
|
786
|
+
}
|
|
787
|
+
addProcess(e) {
|
|
788
|
+
if (!e.name)
|
|
789
|
+
return;
|
|
790
|
+
const n = this._processes.get(e.name);
|
|
791
|
+
if (!n) {
|
|
792
|
+
this._processes.set(e.name, [e]);
|
|
793
|
+
return;
|
|
794
|
+
}
|
|
795
|
+
this._processes.set(e.name, n.concat(e));
|
|
796
|
+
}
|
|
797
|
+
deleteProcess(e) {
|
|
798
|
+
if (!e.name)
|
|
799
|
+
return;
|
|
800
|
+
const n = this._processes.get(e.name), s = (n == null ? void 0 : n.filter((i) => i.id !== e.id)) ?? [];
|
|
801
|
+
s.length === 0 ? this._processes.delete(e.name) : this._processes.set(e.name, s);
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
const S = k(jt);
|
|
805
|
+
var Ut = Object.defineProperty, Bt = (r, t, e) => t in r ? Ut(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e, H = (r, t, e) => Bt(r, typeof t != "symbol" ? t + "" : t, e);
|
|
806
|
+
class Gt {
|
|
807
|
+
constructor(t) {
|
|
808
|
+
H(this, "_instance"), H(this, "_resolution"), H(this, "boundOnResolutionChanged", this.onResolutionChanged.bind(this)), this._instance = t, this._resolution = { width: 0, height: 0 }, this._instance.on("resolution", this.boundOnResolutionChanged);
|
|
809
|
+
}
|
|
810
|
+
destroy() {
|
|
811
|
+
this._instance.off("resolution", this.boundOnResolutionChanged);
|
|
812
|
+
}
|
|
813
|
+
get instance() {
|
|
814
|
+
return this._instance;
|
|
815
|
+
}
|
|
816
|
+
get resolution() {
|
|
817
|
+
return this._resolution;
|
|
818
|
+
}
|
|
819
|
+
onResolutionChanged(t, e) {
|
|
820
|
+
this._resolution = { width: t, height: e };
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
class Vt {
|
|
824
|
+
constructor() {
|
|
825
|
+
H(this, "interfaces", {});
|
|
826
|
+
}
|
|
827
|
+
createInterface(t) {
|
|
828
|
+
return this.interfaces[t] ? this.interfaces[t] : (this.interfaces[t] = new Gt(new Ue(t, { access: 1 })), this.interfaces[t]);
|
|
829
|
+
}
|
|
830
|
+
getInterface(t) {
|
|
831
|
+
return this.interfaces[t] ? this.interfaces[t] : this.createInterface(t);
|
|
832
|
+
}
|
|
833
|
+
}
|
|
834
|
+
const ee = k(Vt);
|
|
835
|
+
class zt extends C {
|
|
836
|
+
constructor() {
|
|
837
|
+
super("GameLaunchManager");
|
|
838
|
+
l(this, "RENDER_INTERFACE_PATH", "./native-modules/render-interface/build/statscc_render_hook_x64.dll");
|
|
839
|
+
l(this, "boundOnProcessCreate", this.onProcessCreate.bind(this));
|
|
840
|
+
l(this, "boundOnProcessDestroy", this.onProcessDestroy.bind(this));
|
|
841
|
+
}
|
|
842
|
+
init() {
|
|
843
|
+
super.init(), ee.getInstance().createInterface("SCC_RAINBOW"), S.getInstance().on("create", this.boundOnProcessCreate), S.getInstance().on("destroy", this.boundOnProcessDestroy);
|
|
844
|
+
}
|
|
845
|
+
destroy() {
|
|
846
|
+
S.getInstance().off("create", this.boundOnProcessCreate), S.getInstance().off("destroy", this.boundOnProcessDestroy), super.destroy();
|
|
847
|
+
}
|
|
848
|
+
async onProcessCreate({ process: e }) {
|
|
849
|
+
const n = this.getRavenGame(e);
|
|
850
|
+
if (!n)
|
|
851
|
+
return;
|
|
852
|
+
if (this.logger.log("Game Launched", n), this.logger.log("Process is elevated: ", e.isElevated), this.logger.log("Current process is elevated: ", L.currentProcess.isElevated), e.isElevated && !L.currentProcess.isElevated) {
|
|
853
|
+
be.getInstance().error("Game is elevated but the App is not", "ELEVATION_MISMATCH", {
|
|
854
|
+
appElevated: L.currentProcess.isElevated,
|
|
855
|
+
gameElevated: e.isElevated
|
|
856
|
+
}), this.logger.sentryLog("Game elevated but App is not", {
|
|
857
|
+
appElevated: L.currentProcess.isElevated,
|
|
858
|
+
gameElevated: e.isElevated
|
|
859
|
+
});
|
|
860
|
+
return;
|
|
861
|
+
}
|
|
862
|
+
const s = this.copyDll(this.RENDER_INTERFACE_PATH);
|
|
863
|
+
if (s)
|
|
864
|
+
try {
|
|
865
|
+
await e.injectDll(s), this.logger.log("Render Interface Injection Successful", s);
|
|
866
|
+
} catch (o) {
|
|
867
|
+
this.logger.captureSentryException("Render Interface Injection Failed", o), this.logger.sentryError("Render Interface Injection Failed", {
|
|
868
|
+
renderInterfacePath: s
|
|
869
|
+
});
|
|
870
|
+
}
|
|
871
|
+
const i = n == null ? void 0 : n.dlls_to_inject.map(async (o) => {
|
|
872
|
+
const a = await B.getInstance().getCurrentVersion(o);
|
|
873
|
+
if (!a)
|
|
874
|
+
return this.logger.sentryError("No version found for DLL", { identifier: o }), Promise.resolve();
|
|
875
|
+
const c = B.getInstance().getTargetVersionPath(o, a);
|
|
876
|
+
this.logger.log("DLL Path", c);
|
|
877
|
+
const d = await this.getDllFiles(c);
|
|
878
|
+
return this.logger.log("DLL Files", d), Promise.all(
|
|
879
|
+
d.map(async (h) => {
|
|
880
|
+
const g = p.basename(h), u = p.join(c, g);
|
|
881
|
+
if (!u)
|
|
882
|
+
return Promise.resolve();
|
|
883
|
+
this.logger.log("Injecting: ", u);
|
|
884
|
+
try {
|
|
885
|
+
return e.injectDll(u).then(() => {
|
|
886
|
+
this.logger.log("Injection Successful", u);
|
|
887
|
+
}).catch((y) => {
|
|
888
|
+
this.logger.sentryError("Injection Failed [1]", { targetPath: u }, y);
|
|
889
|
+
});
|
|
890
|
+
} catch (y) {
|
|
891
|
+
return this.logger.sentryError("Injection Failed [2]", { targetPath: u }, y), Promise.reject(y);
|
|
892
|
+
}
|
|
893
|
+
})
|
|
894
|
+
);
|
|
895
|
+
});
|
|
896
|
+
await Promise.allSettled(i), this.emit("gameLaunch", { ravenGame: n, process: e });
|
|
897
|
+
}
|
|
898
|
+
copyDll(e) {
|
|
899
|
+
this.logger.log(at());
|
|
900
|
+
const n = e.split("/");
|
|
901
|
+
if (n.length < 2)
|
|
902
|
+
return this.logger.sentryError("Path is invalid", { dllPath: e }), !1;
|
|
903
|
+
const s = n.at(-1);
|
|
904
|
+
if (!s)
|
|
905
|
+
return this.logger.sentryError("Dll name is invalid", { dllPath: e }), !1;
|
|
906
|
+
const i = Ke(e), o = p.join(F, "resources"), a = p.join(o, s);
|
|
907
|
+
this.logger.debug("Copying", i, "to", a);
|
|
908
|
+
try {
|
|
909
|
+
$e(o) || He(o, { recursive: !0 });
|
|
910
|
+
const c = ye(i);
|
|
911
|
+
Ne(a, c), je(i, a);
|
|
912
|
+
} catch (c) {
|
|
913
|
+
return c.code === "EBUSY" ? a : (this.logger.captureSentryException("Failed to copy", c), this.logger.sentryError("Failed to copy", { originalPath: i, targetPath: a }), !1);
|
|
914
|
+
}
|
|
915
|
+
return a;
|
|
916
|
+
}
|
|
917
|
+
async getDllFiles(e) {
|
|
918
|
+
try {
|
|
919
|
+
return (await b.readdir(e)).filter((s) => s.endsWith(".dll")).map((s) => p.join(e, s));
|
|
920
|
+
} catch (n) {
|
|
921
|
+
return this.logger.captureSentryException("Failed to read DLL directory", n), this.logger.sentryError("Failed to read DLL directory", { dllPath: e }), [];
|
|
922
|
+
}
|
|
923
|
+
}
|
|
924
|
+
onProcessDestroy({ process: e }) {
|
|
925
|
+
const n = this.getRavenGame(e);
|
|
926
|
+
n && this.emit("gameClose", { ravenGame: n, process: e });
|
|
927
|
+
}
|
|
928
|
+
getRavenGame(e) {
|
|
929
|
+
if (!e.name)
|
|
930
|
+
return;
|
|
931
|
+
const n = G.getInstance().getExecutableData(e.name);
|
|
932
|
+
if (!n) {
|
|
933
|
+
this.logger.sentryError("No raven game found for process", { process: e });
|
|
934
|
+
return;
|
|
935
|
+
}
|
|
936
|
+
return n;
|
|
937
|
+
}
|
|
938
|
+
}
|
|
939
|
+
const V = k(zt);
|
|
940
|
+
class Wt extends st {
|
|
941
|
+
constructor() {
|
|
942
|
+
super("GameBuildManager");
|
|
943
|
+
l(this, "boundOnGameLaunch", this.onGameLaunch.bind(this));
|
|
944
|
+
}
|
|
945
|
+
init() {
|
|
946
|
+
super.init(), V.getInstance().on("gameLaunch", this.boundOnGameLaunch);
|
|
947
|
+
}
|
|
948
|
+
destroy() {
|
|
949
|
+
V.getInstance().off("gameLaunch", this.boundOnGameLaunch), super.destroy();
|
|
950
|
+
}
|
|
951
|
+
async onGameLaunch(e) {
|
|
952
|
+
const { ravenGame: n, process: s } = e;
|
|
953
|
+
if (!s.path || !s.name) {
|
|
954
|
+
this.logger.sentryError(
|
|
955
|
+
"Process path or name not found, could not check for build hash",
|
|
956
|
+
void 0,
|
|
957
|
+
s
|
|
958
|
+
);
|
|
959
|
+
return;
|
|
960
|
+
}
|
|
961
|
+
const i = ye(s.path), o = Be("sha256").update(i).digest("hex");
|
|
962
|
+
this.logger.log("Process Path", s.path), this.logger.log("Process Name", s.name), this.logger.log("Build Hash", o);
|
|
963
|
+
let a = !1;
|
|
964
|
+
try {
|
|
965
|
+
a = (await Kt(n.identifier, o)).data.upload;
|
|
966
|
+
} catch (h) {
|
|
967
|
+
this.logger.captureSentryException("Error checking game build hash", h);
|
|
968
|
+
return;
|
|
969
|
+
}
|
|
970
|
+
if (!a) {
|
|
971
|
+
this.logger.log("Build hash already exists, skipping upload");
|
|
972
|
+
return;
|
|
973
|
+
}
|
|
974
|
+
const c = new me();
|
|
975
|
+
c.file(s.name, i);
|
|
976
|
+
const d = await c.generateAsync({ type: "blob" });
|
|
977
|
+
try {
|
|
978
|
+
this.logger.log("Uploading build (size: ", d.size, " bytes)"), await Lt(n.identifier, d), this.logger.log("Build uploaded successfully");
|
|
979
|
+
} catch (h) {
|
|
980
|
+
Ot(h) ? $t(h.response) ? this.logger.captureSentryException("Error uploading build hash, api error", h) : this.logger.captureSentryException("Error uploading build hash, request error", h) : this.logger.captureSentryException("Error uploading build hash, unknown error", h);
|
|
981
|
+
}
|
|
982
|
+
}
|
|
983
|
+
}
|
|
984
|
+
const qt = k(Wt), te = /* @__PURE__ */ new Map([
|
|
985
|
+
[1, "LeftButton"],
|
|
986
|
+
[2, "RightButton"],
|
|
987
|
+
[3, "Cancel"],
|
|
988
|
+
[4, "MiddleButton"],
|
|
989
|
+
[5, "ExtraButton1"],
|
|
990
|
+
[6, "ExtraButton2"],
|
|
991
|
+
[8, "Backspace"],
|
|
992
|
+
[9, "Tab"],
|
|
993
|
+
[12, "Clear"],
|
|
994
|
+
[13, "Enter"],
|
|
995
|
+
[16, "ShiftLeft"],
|
|
996
|
+
[17, "ControlLeft"],
|
|
997
|
+
[18, "AltLeft"],
|
|
998
|
+
[19, "Pause"],
|
|
999
|
+
[20, "CapsLock"],
|
|
1000
|
+
[21, "KanaMode"],
|
|
1001
|
+
[23, "JunjaMode"],
|
|
1002
|
+
[24, "Finalize"],
|
|
1003
|
+
[25, "HanjaMode"],
|
|
1004
|
+
[27, "Escape"],
|
|
1005
|
+
[28, "Convert"],
|
|
1006
|
+
[29, "NonConvert"],
|
|
1007
|
+
[30, "Accept"],
|
|
1008
|
+
[31, "ModeChange"],
|
|
1009
|
+
[32, "Space"],
|
|
1010
|
+
[33, "PageUp"],
|
|
1011
|
+
[34, "PageDown"],
|
|
1012
|
+
[35, "End"],
|
|
1013
|
+
[36, "Home"],
|
|
1014
|
+
[37, "ArrowLeft"],
|
|
1015
|
+
[38, "ArrowUp"],
|
|
1016
|
+
[39, "ArrowRight"],
|
|
1017
|
+
[40, "ArrowDown"],
|
|
1018
|
+
[41, "Select"],
|
|
1019
|
+
[42, "PrintScreen"],
|
|
1020
|
+
[43, "Execute"],
|
|
1021
|
+
[44, "Snapshot"],
|
|
1022
|
+
[45, "Insert"],
|
|
1023
|
+
[46, "Delete"],
|
|
1024
|
+
[47, "Help"],
|
|
1025
|
+
[48, "Digit0"],
|
|
1026
|
+
[49, "Digit1"],
|
|
1027
|
+
[50, "Digit2"],
|
|
1028
|
+
[51, "Digit3"],
|
|
1029
|
+
[52, "Digit4"],
|
|
1030
|
+
[53, "Digit5"],
|
|
1031
|
+
[54, "Digit6"],
|
|
1032
|
+
[55, "Digit7"],
|
|
1033
|
+
[56, "Digit8"],
|
|
1034
|
+
[57, "Digit9"],
|
|
1035
|
+
[65, "KeyA"],
|
|
1036
|
+
[66, "KeyB"],
|
|
1037
|
+
[67, "KeyC"],
|
|
1038
|
+
[68, "KeyD"],
|
|
1039
|
+
[69, "KeyE"],
|
|
1040
|
+
[70, "KeyF"],
|
|
1041
|
+
[71, "KeyG"],
|
|
1042
|
+
[72, "KeyH"],
|
|
1043
|
+
[73, "KeyI"],
|
|
1044
|
+
[74, "KeyJ"],
|
|
1045
|
+
[75, "KeyK"],
|
|
1046
|
+
[76, "KeyL"],
|
|
1047
|
+
[77, "KeyM"],
|
|
1048
|
+
[78, "KeyN"],
|
|
1049
|
+
[79, "KeyO"],
|
|
1050
|
+
[80, "KeyP"],
|
|
1051
|
+
[81, "KeyQ"],
|
|
1052
|
+
[82, "KeyR"],
|
|
1053
|
+
[83, "KeyS"],
|
|
1054
|
+
[84, "KeyT"],
|
|
1055
|
+
[85, "KeyU"],
|
|
1056
|
+
[86, "KeyV"],
|
|
1057
|
+
[87, "KeyW"],
|
|
1058
|
+
[88, "KeyX"],
|
|
1059
|
+
[89, "KeyY"],
|
|
1060
|
+
[90, "KeyZ"],
|
|
1061
|
+
[91, "MetaLeft"],
|
|
1062
|
+
[92, "MetaRight"],
|
|
1063
|
+
[93, "ContextMenu"],
|
|
1064
|
+
[95, "Sleep"],
|
|
1065
|
+
[96, "Numpad0"],
|
|
1066
|
+
[97, "Numpad1"],
|
|
1067
|
+
[98, "Numpad2"],
|
|
1068
|
+
[99, "Numpad3"],
|
|
1069
|
+
[100, "Numpad4"],
|
|
1070
|
+
[101, "Numpad5"],
|
|
1071
|
+
[102, "Numpad6"],
|
|
1072
|
+
[103, "Numpad7"],
|
|
1073
|
+
[104, "Numpad8"],
|
|
1074
|
+
[105, "Numpad9"],
|
|
1075
|
+
[106, "NumpadMultiply"],
|
|
1076
|
+
[107, "NumpadAdd"],
|
|
1077
|
+
[108, "NumpadSeparator"],
|
|
1078
|
+
[109, "NumpadSubtract"],
|
|
1079
|
+
[110, "NumpadDecimal"],
|
|
1080
|
+
[111, "NumpadDivide"],
|
|
1081
|
+
[112, "F1"],
|
|
1082
|
+
[113, "F2"],
|
|
1083
|
+
[114, "F3"],
|
|
1084
|
+
[115, "F4"],
|
|
1085
|
+
[116, "F5"],
|
|
1086
|
+
[117, "F6"],
|
|
1087
|
+
[118, "F7"],
|
|
1088
|
+
[119, "F8"],
|
|
1089
|
+
[120, "F9"],
|
|
1090
|
+
[121, "F10"],
|
|
1091
|
+
[122, "F11"],
|
|
1092
|
+
[123, "F12"],
|
|
1093
|
+
[124, "F13"],
|
|
1094
|
+
[125, "F14"],
|
|
1095
|
+
[126, "F15"],
|
|
1096
|
+
[127, "F16"],
|
|
1097
|
+
[128, "F17"],
|
|
1098
|
+
[129, "F18"],
|
|
1099
|
+
[130, "F19"],
|
|
1100
|
+
[131, "F20"],
|
|
1101
|
+
[132, "F21"],
|
|
1102
|
+
[133, "F22"],
|
|
1103
|
+
[134, "F23"],
|
|
1104
|
+
[135, "F24"],
|
|
1105
|
+
[144, "NumLock"],
|
|
1106
|
+
[145, "ScrollLock"],
|
|
1107
|
+
[146, "NEC_Equal"],
|
|
1108
|
+
[147, "Fujitsu_Masshou"],
|
|
1109
|
+
[148, "Fujitsu_Touroku"],
|
|
1110
|
+
[149, "Fujitsu_Loya"],
|
|
1111
|
+
[150, "Fujitsu_Roya"],
|
|
1112
|
+
[160, "ShiftLeft"],
|
|
1113
|
+
[161, "ShiftRight"],
|
|
1114
|
+
[162, "ControlLeft"],
|
|
1115
|
+
[163, "ControlRight"],
|
|
1116
|
+
[164, "AltLeft"],
|
|
1117
|
+
[165, "AltRight"],
|
|
1118
|
+
[166, "BrowserBack"],
|
|
1119
|
+
[167, "BrowserForward"],
|
|
1120
|
+
[168, "BrowserRefresh"],
|
|
1121
|
+
[169, "BrowserStop"],
|
|
1122
|
+
[170, "BrowserSearch"],
|
|
1123
|
+
[171, "BrowserFavorites"],
|
|
1124
|
+
[172, "BrowserHome"],
|
|
1125
|
+
[173, "VolumeMute"],
|
|
1126
|
+
[174, "VolumeDown"],
|
|
1127
|
+
[175, "VolumeUp"],
|
|
1128
|
+
[176, "MediaTrackNext"],
|
|
1129
|
+
[177, "MediaTrackPrevious"],
|
|
1130
|
+
[178, "MediaStop"],
|
|
1131
|
+
[179, "MediaPlayPause"],
|
|
1132
|
+
[180, "LaunchMail"],
|
|
1133
|
+
[181, "LaunchMediaSelect"],
|
|
1134
|
+
[182, "LaunchApplication1"],
|
|
1135
|
+
[183, "LaunchApplication2"],
|
|
1136
|
+
[186, "OEM_1"],
|
|
1137
|
+
[187, "Equal"],
|
|
1138
|
+
[188, "Comma"],
|
|
1139
|
+
[189, "Minus"],
|
|
1140
|
+
[190, "Period"],
|
|
1141
|
+
[191, "Slash"],
|
|
1142
|
+
[192, "Backquote"],
|
|
1143
|
+
[219, "BracketLeft"],
|
|
1144
|
+
[220, "Backslash"],
|
|
1145
|
+
[221, "BracketRight"],
|
|
1146
|
+
[222, "Quote"],
|
|
1147
|
+
[223, "IntlRo"],
|
|
1148
|
+
[225, "OEM_AX"],
|
|
1149
|
+
[226, "IntlBackslash"],
|
|
1150
|
+
[227, "ICO_HELP"],
|
|
1151
|
+
[228, "ICO_00"],
|
|
1152
|
+
[229, "Process"],
|
|
1153
|
+
[230, "ICO_CLEAR"],
|
|
1154
|
+
[231, "Packet"],
|
|
1155
|
+
[233, "OEM_Reset"],
|
|
1156
|
+
[234, "OEM_Jump"],
|
|
1157
|
+
[235, "OEM_PA1"],
|
|
1158
|
+
[236, "OEM_PA2"],
|
|
1159
|
+
[237, "OEM_PA3"],
|
|
1160
|
+
[238, "OEM_WS_Ctrl"],
|
|
1161
|
+
[239, "OEM_CU_Sel"],
|
|
1162
|
+
[240, "OEM_ATTN"],
|
|
1163
|
+
[241, "OEM_Finish"],
|
|
1164
|
+
[242, "OEM_Copy"],
|
|
1165
|
+
[243, "OEM_Auto"],
|
|
1166
|
+
[244, "OEM_ENLW"],
|
|
1167
|
+
[245, "BackTab"],
|
|
1168
|
+
[246, "ATTN"],
|
|
1169
|
+
[247, "CRSel"],
|
|
1170
|
+
[248, "EXSel"],
|
|
1171
|
+
[249, "EREOF"],
|
|
1172
|
+
[250, "MediaPlay"],
|
|
1173
|
+
[251, "Zoom"],
|
|
1174
|
+
[252, "Noname"],
|
|
1175
|
+
[253, "PA1"],
|
|
1176
|
+
[254, "OEM_Clear"]
|
|
1177
|
+
]), pe = new Map(te.entries().map(([r, t]) => [t, r])), Xt = D({
|
|
1178
|
+
"[string]": {
|
|
1179
|
+
keys: "string[]",
|
|
1180
|
+
mode: D("'toggle' | 'hold'").pipe((r) => r ?? "toggle")
|
|
1181
|
+
}
|
|
1182
|
+
});
|
|
1183
|
+
class Jt extends C {
|
|
1184
|
+
constructor(e) {
|
|
1185
|
+
super("KeybindManager");
|
|
1186
|
+
l(this, "preferencesKeybindToCallbacks", /* @__PURE__ */ new Map());
|
|
1187
|
+
l(this, "pressedKeys", /* @__PURE__ */ new Set());
|
|
1188
|
+
l(this, "activeKeybinds", /* @__PURE__ */ new Set());
|
|
1189
|
+
l(this, "triggeredToggleKeybinds", /* @__PURE__ */ new Set());
|
|
1190
|
+
l(this, "isRecording", !1);
|
|
1191
|
+
l(this, "boundHandleKeyboardFocus", this.handleKeyboardFocus.bind(this));
|
|
1192
|
+
l(this, "boundHandleKeyDown", this.handleKeyDown.bind(this));
|
|
1193
|
+
l(this, "boundHandleKeyUp", this.handleKeyUp.bind(this));
|
|
1194
|
+
l(this, "keybidnsFile");
|
|
1195
|
+
this.keybidnsFile = new nt({
|
|
1196
|
+
path: p.join(F, "keybinds.json"),
|
|
1197
|
+
schema: Xt,
|
|
1198
|
+
default: e
|
|
1199
|
+
});
|
|
1200
|
+
}
|
|
1201
|
+
init() {
|
|
1202
|
+
super.init();
|
|
1203
|
+
const e = ee.getInstance().getInterface("SCC_RAINBOW");
|
|
1204
|
+
e.instance.on("keyboardFocus", this.boundHandleKeyboardFocus), e.instance.on("keyDown", this.boundHandleKeyDown), e.instance.on("keyUp", this.boundHandleKeyUp);
|
|
1205
|
+
}
|
|
1206
|
+
async onHotkeyToggled(e, n) {
|
|
1207
|
+
const s = this.preferencesKeybindToCallbacks.get(e) || {};
|
|
1208
|
+
s.toggle = n, this.preferencesKeybindToCallbacks.set(e, s);
|
|
1209
|
+
}
|
|
1210
|
+
async onHotkeyDown(e, n) {
|
|
1211
|
+
const s = this.preferencesKeybindToCallbacks.get(e) || {};
|
|
1212
|
+
s.down = n, this.preferencesKeybindToCallbacks.set(e, s);
|
|
1213
|
+
}
|
|
1214
|
+
async onHotkeyUp(e, n) {
|
|
1215
|
+
const s = this.preferencesKeybindToCallbacks.get(e) || {};
|
|
1216
|
+
s.up = n, this.preferencesKeybindToCallbacks.set(e, s);
|
|
1217
|
+
}
|
|
1218
|
+
destroy() {
|
|
1219
|
+
const e = ee.getInstance().getInterface("SCC_RAINBOW");
|
|
1220
|
+
e.instance.off("keyboardFocus", this.boundHandleKeyboardFocus), e.instance.off("keyDown", this.boundHandleKeyDown), e.instance.off("keyUp", this.boundHandleKeyUp), super.destroy();
|
|
1221
|
+
}
|
|
1222
|
+
handleKeyDown(e) {
|
|
1223
|
+
if (this.isRecording)
|
|
1224
|
+
return;
|
|
1225
|
+
const n = te.get(e.key);
|
|
1226
|
+
if (!n) {
|
|
1227
|
+
this.logger.error("Unknown key down", e);
|
|
1228
|
+
return;
|
|
1229
|
+
}
|
|
1230
|
+
this.pressedKeys.add(n), this.checkKeybindings();
|
|
1231
|
+
}
|
|
1232
|
+
handleKeyboardFocus() {
|
|
1233
|
+
this.pressedKeys.clear(), this.activeKeybinds.clear(), this.triggeredToggleKeybinds.clear();
|
|
1234
|
+
}
|
|
1235
|
+
async handleKeyUp(e) {
|
|
1236
|
+
if (this.isRecording)
|
|
1237
|
+
return;
|
|
1238
|
+
const n = te.get(e.key);
|
|
1239
|
+
if (!n)
|
|
1240
|
+
return;
|
|
1241
|
+
this.pressedKeys.delete(n);
|
|
1242
|
+
const s = this.keybidnsFile.data;
|
|
1243
|
+
for (const [i] of this.preferencesKeybindToCallbacks.entries())
|
|
1244
|
+
s[i].keys.includes(n) && this.triggeredToggleKeybinds.delete(i);
|
|
1245
|
+
this.checkHotkeyUps();
|
|
1246
|
+
}
|
|
1247
|
+
async checkHotkeyUps() {
|
|
1248
|
+
const e = this.keybidnsFile.data;
|
|
1249
|
+
for (const [n, s] of this.preferencesKeybindToCallbacks.entries()) {
|
|
1250
|
+
if (!s.up) continue;
|
|
1251
|
+
const i = e[n];
|
|
1252
|
+
this.activeKeybinds.has(n) && i.keys.some((o) => !this.pressedKeys.has(o)) && (this.activeKeybinds.delete(n), s.up(), this.logger.log("Hotkey up triggered", this.getHotkeyToString(i)));
|
|
1253
|
+
}
|
|
1254
|
+
}
|
|
1255
|
+
async checkKeybindings() {
|
|
1256
|
+
const e = this.keybidnsFile.data;
|
|
1257
|
+
for (const [n, s] of this.preferencesKeybindToCallbacks.entries()) {
|
|
1258
|
+
const i = e[n];
|
|
1259
|
+
if (i.keys.length === this.pressedKeys.size && i.keys.every((a) => pe.has(a) ? this.pressedKeys.has(a) : !1)) {
|
|
1260
|
+
this.triggerHotkey(i, s, n);
|
|
1261
|
+
return;
|
|
1262
|
+
}
|
|
1263
|
+
}
|
|
1264
|
+
for (const [n, s] of this.preferencesKeybindToCallbacks.entries()) {
|
|
1265
|
+
const i = e[n];
|
|
1266
|
+
i.keys.every((a) => pe.has(a) ? this.pressedKeys.has(a) : (this.logger.error("Unknown key", a, i), !1)) && this.triggerHotkey(i, s, n);
|
|
1267
|
+
}
|
|
1268
|
+
}
|
|
1269
|
+
triggerHotkey(e, n, s) {
|
|
1270
|
+
const i = e.mode;
|
|
1271
|
+
if (i === "toggle" && n.toggle && !this.triggeredToggleKeybinds.has(s)) {
|
|
1272
|
+
const o = n.toggle();
|
|
1273
|
+
this.triggeredToggleKeybinds.add(s), this.logger.log(
|
|
1274
|
+
o ? `Hotkey pressed rejected: ${o}` : "Hotkey pressed accepted",
|
|
1275
|
+
this.getHotkeyToString(e)
|
|
1276
|
+
);
|
|
1277
|
+
}
|
|
1278
|
+
if (i === "hold" && n.down && !this.activeKeybinds.has(s)) {
|
|
1279
|
+
const o = n.down();
|
|
1280
|
+
o ? this.logger.log(`Hotkey down rejected: ${o}`, this.getHotkeyToString(e)) : (this.activeKeybinds.add(s), this.logger.log("Hotkey down accepted", this.getHotkeyToString(e)));
|
|
1281
|
+
}
|
|
1282
|
+
}
|
|
1283
|
+
getHotkeyToString(e) {
|
|
1284
|
+
return `(${e.keys.join("+")}${e.mode ? ` ${e.mode}` : ""})`;
|
|
1285
|
+
}
|
|
1286
|
+
}
|
|
1287
|
+
function pr(r) {
|
|
1288
|
+
const t = /* @__PURE__ */ new Map(), e = Yt(r.modules, t), n = Zt(), s = tr(r.keybinds);
|
|
1289
|
+
return Qt(), er(r, t), {
|
|
1290
|
+
...e,
|
|
1291
|
+
...n,
|
|
1292
|
+
keybinds: s
|
|
1293
|
+
};
|
|
1294
|
+
}
|
|
1295
|
+
function Qt() {
|
|
1296
|
+
qt.getInstance().init(), V.getInstance().init(), S.getInstance().init(), G.getInstance().init();
|
|
1297
|
+
}
|
|
1298
|
+
function Yt(r, t) {
|
|
1299
|
+
return r.reduce((e, n) => {
|
|
1300
|
+
const s = n.key;
|
|
1301
|
+
return e[s] = {
|
|
1302
|
+
// prettier-ignore
|
|
1303
|
+
on(i, o) {
|
|
1304
|
+
const a = z(s, i), c = t.get(a) ?? /* @__PURE__ */ new Set();
|
|
1305
|
+
c.add(o), t.set(a, c);
|
|
1306
|
+
},
|
|
1307
|
+
// prettier-ignore
|
|
1308
|
+
off(i, o) {
|
|
1309
|
+
const a = z(s, i), c = t.get(a) ?? /* @__PURE__ */ new Set();
|
|
1310
|
+
c.delete(o), t.set(a, c);
|
|
1311
|
+
}
|
|
1312
|
+
}, e;
|
|
1313
|
+
}, {});
|
|
1314
|
+
}
|
|
1315
|
+
function Zt() {
|
|
1316
|
+
const r = be.getInstance(), t = V.getInstance();
|
|
1317
|
+
return {
|
|
1318
|
+
on: (e, n) => {
|
|
1319
|
+
switch (e) {
|
|
1320
|
+
case "error":
|
|
1321
|
+
r.on("error", n);
|
|
1322
|
+
break;
|
|
1323
|
+
case "warning":
|
|
1324
|
+
r.on("warning", n);
|
|
1325
|
+
break;
|
|
1326
|
+
case "gameLaunch":
|
|
1327
|
+
t.on("gameLaunch", n);
|
|
1328
|
+
break;
|
|
1329
|
+
case "gameClose":
|
|
1330
|
+
t.on("gameClose", n);
|
|
1331
|
+
break;
|
|
1332
|
+
default:
|
|
1333
|
+
throw new Error("Not implemented", { cause: [e, n] });
|
|
1334
|
+
}
|
|
1335
|
+
}
|
|
1336
|
+
};
|
|
1337
|
+
}
|
|
1338
|
+
function z(r, t) {
|
|
1339
|
+
return `${r}:${t}`;
|
|
1340
|
+
}
|
|
1341
|
+
function er(r, t) {
|
|
1342
|
+
const e = Qe.getInstance();
|
|
1343
|
+
function n(s) {
|
|
1344
|
+
const i = Ye(s);
|
|
1345
|
+
if (i instanceof D.errors)
|
|
1346
|
+
return;
|
|
1347
|
+
const o = r.modules.find((f) => f.key === i.game), a = o == null ? void 0 : o.events.event;
|
|
1348
|
+
if (!a)
|
|
1349
|
+
return;
|
|
1350
|
+
const c = a(s);
|
|
1351
|
+
if (c instanceof D.errors)
|
|
1352
|
+
return;
|
|
1353
|
+
const d = z(o.key, c.type), h = z(o.key, "*"), g = t.get(d), u = t.get(h), y = [...Array.from(g ?? []), ...Array.from(u ?? [])];
|
|
1354
|
+
y.length !== 0 && y.forEach((f) => {
|
|
1355
|
+
f(c);
|
|
1356
|
+
});
|
|
1357
|
+
}
|
|
1358
|
+
return e.on("data", (s) => s.forEach(n)), e;
|
|
1359
|
+
}
|
|
1360
|
+
function tr(r) {
|
|
1361
|
+
const t = {}, e = new Jt(r);
|
|
1362
|
+
for (const n in r)
|
|
1363
|
+
t[n] = {
|
|
1364
|
+
on: (s, i) => {
|
|
1365
|
+
switch (s) {
|
|
1366
|
+
case "down":
|
|
1367
|
+
e.onHotkeyDown(n, i);
|
|
1368
|
+
break;
|
|
1369
|
+
case "up":
|
|
1370
|
+
e.onHotkeyUp(n, i);
|
|
1371
|
+
break;
|
|
1372
|
+
case "toggle":
|
|
1373
|
+
e.onHotkeyToggled(n, i);
|
|
1374
|
+
break;
|
|
1375
|
+
default:
|
|
1376
|
+
throw new Error("Not implemented", { cause: [s, i] });
|
|
1377
|
+
}
|
|
1378
|
+
}
|
|
1379
|
+
};
|
|
1380
|
+
return t;
|
|
1381
|
+
}
|
|
1382
|
+
function yr() {
|
|
1383
|
+
return "test";
|
|
1384
|
+
}
|
|
1385
|
+
export {
|
|
1386
|
+
pr as overlayed,
|
|
1387
|
+
yr as test
|
|
1388
|
+
};
|