Fix local co-op not working

This commit is contained in:
redphx 2024-04-28 09:27:02 +07:00
parent ba0abaa2f5
commit e2806fea68
2 changed files with 12 additions and 12 deletions

View File

@ -9258,14 +9258,14 @@ eval(\`this.onGamepadChanged = function \${onGamepadChangedStr}\`);
let onGamepadInputStr = this.onGamepadInput.toString();
match = onGamepadInputStr.match(/(w+.GamepadIndex)/);
match = onGamepadInputStr.match(/(\\w+\\.GamepadIndex)/);
if (match) {
const gamepadIndexVar = match[0];
onGamepadInputStr = onGamepadInputStr.replace('this.gamepadStates.get(', \`this.gamepadStates.get(\${gamepadIndexVar},\`);
eval(\`this.onGamepadInput = function \${onGamepadInputStr}\`);
console.log('[Better xCloud] ✅ Successfully patched local co-op support');
const gamepadIndexVar = match[0];
onGamepadInputStr = onGamepadInputStr.replace('this.gamepadStates.get(', \`this.gamepadStates.get(\${gamepadIndexVar},\`);
eval(\`this.onGamepadInput = function \${onGamepadInputStr}\`);
console.log('[Better xCloud] ✅ Successfully patched local co-op support');
} else {
console.log('[Better xCloud] ❌ Unable to patch local co-op support');
console.log('[Better xCloud] ❌ Unable to patch local co-op support');
}
`;
const newCode = `true; ${patchstr}; true,`;

View File

@ -288,14 +288,14 @@ eval(\`this.onGamepadChanged = function \${onGamepadChangedStr}\`);
let onGamepadInputStr = this.onGamepadInput.toString();
match = onGamepadInputStr.match(/(\w+\.GamepadIndex)/);
match = onGamepadInputStr.match(/(\\w+\\.GamepadIndex)/);
if (match) {
const gamepadIndexVar = match[0];
onGamepadInputStr = onGamepadInputStr.replace('this.gamepadStates.get(', \`this.gamepadStates.get(\${gamepadIndexVar},\`);
eval(\`this.onGamepadInput = function \${onGamepadInputStr}\`);
console.log('[Better xCloud] ✅ Successfully patched local co-op support');
const gamepadIndexVar = match[0];
onGamepadInputStr = onGamepadInputStr.replace('this.gamepadStates.get(', \`this.gamepadStates.get(\${gamepadIndexVar},\`);
eval(\`this.onGamepadInput = function \${onGamepadInputStr}\`);
console.log('[Better xCloud] ✅ Successfully patched local co-op support');
} else {
console.log('[Better xCloud] ❌ Unable to patch local co-op support');
console.log('[Better xCloud] ❌ Unable to patch local co-op support');
}
`;