decord/source/modules/game_console/GameConsoleManager.tsx
github-actions e510164e6b chore: update source for alpha 346.2
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4759.js (118.4 MB)
2026-09-10 05:38:07 +00:00

305 lines
12 KiB
TypeScript

// Module ID: 17402
// Function ID: 17403
// Name: GameConsoleManager
// Dependencies: [5, 502, 1908, 4597, 4592, 4593, 4591, 9265, 4599, 3, 38, 9121, 10041, 7132, 4461, 9480, 1369, 4918, 1114, 17403, 9483, 2]
// Module 17402 (GameConsoleManager)
import LoggerDefault from "Logger" /* 3 */;
import _modDef38 from "module_38" /* 38 */;
import util from "util" /* 1114 */;
import GlobalUtils from "GlobalUtils" /* 1369 */;
import Timers from "Timers" /* 4461 */;
import AudioActionCreatorsDefault from "AudioActionCreators" /* 9121 */;
import GameConsoleActionCreators from "GameConsoleActionCreators" /* 9480 */;
import _modDef17403 from "module_17403" /* 17403 */;
import asyncGeneratorStep from "asyncGeneratorStep" /* 5 */;
import AuthenticationStore from "AuthenticationStore" /* 502 */;
import MediaEngineStore from "MediaEngineStore" /* 1908 */;
import RTCConnectionStore from "RTCConnectionStore" /* 4597 */;
import SessionsStore from "SessionsStore" /* 4592 */;
import VoiceStateStore from "VoiceStateStore" /* 4593 */;
import GameConsoleStore from "GameConsoleStore" /* 4591 */;
import AutomaticLifecycleManager from "AutomaticLifecycleManager" /* 7132 */;
require = fn;
function syncLocalState() {
const self = this;
const apply = closure_15.apply;
if (typeof apply === "unknown") {
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
} else {
applyArgumentsResult = apply(self, arguments);
}
return applyArgumentsResult;
}
let closure_15 = async function _syncLocalState(arg0) {
let selfMute = arg0;
c3 = 0;
c4 = 0;
return (async (arg0, value) => {
if (c4 === 2) {
c4 = 3;
throw new TypeError("Generator functions may not be called on executing generators");
} else if (tmp4 === 3) {
if (arg0 === 1) {
throw value;
} else if (arg0 === 2) {
const obj4 = { value, done: true };
return obj4;
} else {
return { value: "HermesInternal", done: null };
}
} else {
try {
c4 = 2;
if (0 === c3) {
if (arg0 === 1) {
c4 = 3;
throw value;
} else if (arg0 === 2) {
c4 = 3;
const obj5 = { value, done: true };
return obj5;
} else {
closure_2 = tmp5;
closure_1 = tmp2;
closure_129_0 = selfMute;
channelId = channelId.getChannelId();
_modDef38(null == channelId, "Syncing to remote while in voice!");
if (selfMute.selfMute !== selfMute.isSelfMute()) {
c3 = 1;
c4 = 1;
const obj6 = { value: AudioActionCreatorsDefault.toggleSelfMute({ syncRemote: false }), done: false };
return obj6;
}
}
} else if (arg0 === 1) {
c4 = 3;
throw value;
} else if (arg0 === 2) {
c4 = 3;
const obj = { value, done: true };
return obj;
}
if (closure_129_0.selfDeaf !== closure_130_5.isSelfDeaf()) {
closure_130_1(closure_130_2[11]).toggleSelfDeaf({ syncRemote: false });
const obj2 = closure_130_1(closure_130_2[11]);
}
c4 = 3;
return { value: "HermesInternal", done: null };
} catch (tmp16) {
c4 = tmp;
throw tmp16;
}
}
})();
};
const GameConsoleConstants = fn(9265);
({ GAME_CONSOLE_SESSIONS: c10, USER_ACTION_REQUIRED_ERROR_CODES: closure_11 } = GameConsoleConstants);
const MediaEngineContextTypes = fn(4599).MediaEngineContextTypes;
let closure_13 = new LoggerDefault("GameConsoleManager");
const prototype = function GameConsoleManager() {
const applyArgumentsResult = HermesBuiltin.applyArguments(new.target, new.target);
require = applyArgumentsResult;
const timeout = new Timers.Timeout();
applyArgumentsResult.rollbackCommandTimeout = timeout;
const timeout1 = new Timers.Timeout();
applyArgumentsResult.awaitRemoteTimeout = timeout1;
applyArgumentsResult.actions = {
WAIT_FOR_REMOTE_SESSION() {
return applyArgumentsResult.handleWaitForRemoteSession();
},
POST_CONNECTION_OPEN() {
return applyArgumentsResult.handleSessionsChanged();
},
SESSIONS_REPLACE() {
return applyArgumentsResult.handleSessionsChanged();
},
AUDIO_TOGGLE_SELF_DEAF(syncRemote) {
return applyArgumentsResult.handleAudioStateToggle(syncRemote);
},
AUDIO_TOGGLE_SELF_MUTE(syncRemote) {
return applyArgumentsResult.handleAudioStateToggle(syncRemote);
},
VOICE_STATE_UPDATES(arg0) {
return applyArgumentsResult.handleVoiceStateUpdates(arg0);
},
CONSOLE_COMMAND_UPDATE(arg0) {
return applyArgumentsResult.handleConsoleCommandUpdate(arg0);
},
PASSIVE_UPDATE_V2(arg0) {
return applyArgumentsResult.handleVoiceStateUpdates(arg0);
},
REMOTE_SESSION_DISCONNECT() {
return applyArgumentsResult.handleRemoteSessionDisconnect();
}
};
applyArgumentsResult.maybeConnect = function maybeConnect(arr) {
const awaitingRemoteSessionInfo = GameConsoleStore.getAwaitingRemoteSessionInfo();
const found = arr.find((clientInfo) => {
let hasItem = set.has(clientInfo.clientInfo.os);
let tmp4 = null == closure_0;
if (!tmp4) {
tmp4 = applyArgumentsResult(dependencyMap[12]).coercePlatformTypeToConsoleType(tmp3.type) === clientInfo.clientInfo.os;
const obj = applyArgumentsResult(dependencyMap[12]);
}
if (hasItem) {
hasItem = tmp4;
}
if (hasItem) {
hasItem = tmp2;
}
return hasItem;
});
if (null == found) {
return null;
} else {
const awaitRemoteTimeout = applyArgumentsResult.awaitRemoteTimeout;
awaitRemoteTimeout.stop();
GameConsoleActionCreators.connectToRemote(found.sessionId);
voiceStateForSession = VoiceStateStore.getVoiceStateForSession(AuthenticationStore.getId(), found.sessionId);
if (null != voiceStateForSession) {
syncLocalState(voiceStateForSession);
}
}
};
applyArgumentsResult.handleAudioStateToggle = function handleAudioStateToggle(syncRemote) {
voiceStateForSession = undefined;
if (syncRemote.syncRemote) {
if (tmp === MediaEngineContextTypes.DEFAULT) {
const isSelfDeafResult = MediaEngineStore.isSelfDeaf();
const isSelfMuteResult = MediaEngineStore.isSelfMute();
id = AuthenticationStore.getId();
const remoteSessionId = GameConsoleStore.getRemoteSessionId();
if (null != remoteSessionId) {
voiceStateForSession = VoiceStateStore.getVoiceStateForSession(id, remoteSessionId);
if (null != voiceStateForSession) {
if (!tmp3) {
const obj2 = { selfDeaf: isSelfDeafResult, selfMute: isSelfMuteResult };
const result = GameConsoleActionCreators.remoteVoiceStateUpdate(remoteSessionId, obj2);
const rollbackCommandTimeout = applyArgumentsResult.rollbackCommandTimeout;
rollbackCommandTimeout.start(3000, () => {
syncLocalState(voiceStateForSession);
});
}
tmp3 = voiceStateForSession.selfDeaf === isSelfDeafResult && voiceStateForSession.selfMute === isSelfMuteResult;
}
}
}
}
};
applyArgumentsResult.handleVoiceStateUpdates = function handleVoiceStateUpdates(voiceStates) {
voiceStates = voiceStates.voiceStates;
const remoteSessionId = GameConsoleStore.getRemoteSessionId();
if (null == remoteSessionId) {
const mapped = voiceStates.map((sessionId) => {
sessionId = sessionId.sessionId;
sessionById = null;
if (null != sessionId) {
sessionById = sessionById.getSessionById(sessionId);
}
return sessionById;
});
return applyArgumentsResult.maybeConnect(mapped.filter(GlobalUtils.isNotNullish));
} else {
const found = voiceStates.find((sessionId) => sessionId.sessionId === remoteSessionId);
if (null != found) {
const rollbackCommandTimeout = applyArgumentsResult.rollbackCommandTimeout;
rollbackCommandTimeout.stop();
syncLocalState(found);
}
}
};
applyArgumentsResult.handleSessionsChanged = function handleSessionsChanged() {
const remoteSessionId = GameConsoleStore.getRemoteSessionId();
let tmp2 = null != remoteSessionId;
if (tmp2) {
tmp2 = null == SessionsStore.getSessionById(remoteSessionId);
}
if (tmp2) {
GameConsoleActionCreators.disconnectRemote();
}
if (null == remoteSessionId) {
const _Object = Object;
applyArgumentsResult.maybeConnect(Object.values(SessionsStore.getSessions()));
}
};
applyArgumentsResult.handleWaitForRemoteSession = function handleWaitForRemoteSession() {
const awaitRemoteTimeout = applyArgumentsResult.awaitRemoteTimeout;
awaitRemoteTimeout.start(60000, () => {
closure_1_0(9480).disconnectRemote();
const obj = closure_1_0(9480);
const obj3 = { title: null, body: null };
const intl = closure_1_0(1114).intl;
obj3.title = intl.string(closure_1_0(1114).t.wGMxr3);
const intl2 = closure_1_0(1114).intl;
obj3.body = intl2.string(closure_1_0(1114).t.i5k8b5);
closure_1_1(4918).show(obj3);
});
};
applyArgumentsResult.handleConsoleCommandUpdate = function handleConsoleCommandUpdate(arg0) {
({ result, error } = arg0);
if ("failed" === result) {
if (null != error) {
logger.info("Console command Error result:", result, error);
const awaitingRemoteSessionInfo = GameConsoleStore.getAwaitingRemoteSessionInfo();
let commandId;
if (awaitingRemoteSessionInfo != null) {
commandId = awaitingRemoteSessionInfo.commandId;
}
if (commandId === tmp) {
let str2 = awaitingRemoteSessionInfo.deviceId;
if (str2 == null) {
str2 = "";
}
let device = obj5.getDevice(awaitingRemoteSessionInfo.type, str2);
if (device == null) {
const obj = { id: "id", platform: null, name: null };
const intl = util.intl;
obj.platform = intl.string(util.t["UQMV/E"]);
const intl2 = util.intl;
obj.name = intl2.string(util.t["UQMV/E"]);
device = obj;
}
const tmp8Result = _modDef17403(device, result, error);
if (null != tmp8Result) {
const obj2 = { title: null, body: null, errorCodeMessage: null, reconnectPlatformType: null };
({ title: obj3.title, body: obj3.body, errorCodeMessage: obj3.errorCodeMessage } = tmp8Result);
let type;
if (tmp8Result.isAccountLinkError) {
type = awaitingRemoteSessionInfo.type;
}
obj2.reconnectPlatformType = type;
const result1 = tmp6(9483).showSelfDismissableAlert(obj2);
const tmp6Result = tmp6(9483);
}
if (set.has(error.code)) {
const awaitRemoteTimeout = applyArgumentsResult.awaitRemoteTimeout;
if (awaitRemoteTimeout.isStarted()) {
const awaitRemoteTimeout2 = tmp14.awaitRemoteTimeout;
awaitRemoteTimeout2.start(180000, () => closure_1_0(closure_1_2[15]).disconnectRemote(), true);
}
tmp14 = applyArgumentsResult;
}
if (tmp2) {
GameConsoleActionCreators.disconnectRemote();
}
tmp6 = importDefault;
}
obj5 = GameConsoleStore;
}
}
};
applyArgumentsResult.handleRemoteSessionDisconnect = function handleRemoteSessionDisconnect() {
const awaitRemoteTimeout = applyArgumentsResult.awaitRemoteTimeout;
awaitRemoteTimeout.stop();
};
return applyArgumentsResult;
}.prototype;
class prototype extends tmp4 {
}
const prototype1 = new prototype();
const size = fn(2);
let result = size.fileFinishedImporting("modules/game_console/GameConsoleManager.tsx");
export default prototype1;