mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-06-07 08:07:18 +02:00
Check patches one by one to improve performance
This commit is contained in:
parent
1b0b15de76
commit
12d6fbd9c8
@ -4403,6 +4403,7 @@ class Patcher {
|
|||||||
static length() { return Object.keys(Patcher.#PATCHES).length };
|
static length() { return Object.keys(Patcher.#PATCHES).length };
|
||||||
|
|
||||||
static patch(item) {
|
static patch(item) {
|
||||||
|
let patchName;
|
||||||
for (let id in item[1]) {
|
for (let id in item[1]) {
|
||||||
if (Patcher.length() <= 0) {
|
if (Patcher.length() <= 0) {
|
||||||
return;
|
return;
|
||||||
@ -4411,16 +4412,18 @@ class Patcher {
|
|||||||
const func = item[1][id];
|
const func = item[1][id];
|
||||||
const funcStr = func.toString();
|
const funcStr = func.toString();
|
||||||
|
|
||||||
let patchedFuncStr;
|
// Only check the first patch
|
||||||
for (const patchName in Patcher.#PATCHES) {
|
if (!patchName) {
|
||||||
patchedFuncStr = Patcher.#PATCHES[patchName].call(null, funcStr);
|
patchName = Object.keys(Patcher.#PATCHES)[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
const patchedFuncStr = Patcher.#PATCHES[patchName].call(null, funcStr);
|
||||||
if (patchedFuncStr) {
|
if (patchedFuncStr) {
|
||||||
|
console.log(`[Better xCloud] Applied "${patchName}" patch`);
|
||||||
|
|
||||||
item[1][id] = eval(patchedFuncStr);
|
item[1][id] = eval(patchedFuncStr);
|
||||||
delete Patcher.#PATCHES[patchName];
|
delete Patcher.#PATCHES[patchName];
|
||||||
|
patchName = null;
|
||||||
console.log(`[Better xCloud] Applied "${patchName}" patch`);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user