IPC photon logging

This commit is contained in:
Natsumi
2021-12-21 22:36:07 +13:00
parent 43b78425d3
commit 1d6384c47b
5 changed files with 237 additions and 283 deletions
+8
View File
@@ -386,6 +386,14 @@ namespace VRCX
return ""; return "";
} }
public string DeserializeVrcEvent(string base64Data)
{
byte[] bytes = Convert.FromBase64String(base64Data);
var deserialization = new VRCEventDeserialization();
var eventData = deserialization.DeserializeData(bytes);
return System.Text.Json.JsonSerializer.Serialize<VRCEventDeserialization.EventEntry>(eventData);
}
public void SetStartup(bool enabled) public void SetStartup(bool enabled)
{ {
try try
+1 -125
View File
@@ -189,21 +189,6 @@ namespace VRCX
break; break;
} }
if (logContext.incomingJson)
{
logContext.jsonChunk += line;
if (line == "}")
{
var data = logContext.jsonChunk;
ParseLogPhotonEvent(fileInfo, data, logContext.jsonDate, logContext.photonEvent);
logContext.incomingJson = false;
logContext.jsonChunk = String.Empty;
logContext.jsonDate = String.Empty;
logContext.photonEvent = String.Empty;
}
continue;
}
// 2020.10.31 23:36:28 Log - [VRCFlowManagerVRC] Destination fetching: wrld_4432ea9b-729c-46e3-8eaf-846aa0a37fdd // 2020.10.31 23:36:28 Log - [VRCFlowManagerVRC] Destination fetching: wrld_4432ea9b-729c-46e3-8eaf-846aa0a37fdd
// 2021.02.03 10:18:58 Log - [DŽDŽDžDžDžDŽDŽDžDžDŽDžDžDžDžDŽDŽDŽDžDžDŽDŽDžDžDžDžDŽDžDžDžDžDŽDŽDŽDŽDŽDžDŽDžDŽDŽDŽDžDžDŽDžDžDž] Destination fetching: wrld_4432ea9b-729c-46e3-8eaf-846aa0a37fdd // 2021.02.03 10:18:58 Log - [DŽDŽDžDžDžDŽDŽDžDžDŽDžDžDžDžDŽDŽDŽDžDžDŽDŽDžDžDžDžDŽDžDžDžDžDŽDŽDŽDŽDŽDžDŽDžDŽDŽDŽDžDžDŽDžDžDž] Destination fetching: wrld_4432ea9b-729c-46e3-8eaf-846aa0a37fdd
@@ -230,21 +215,7 @@ namespace VRCX
var offset = 34; var offset = 34;
if (line[offset] == '[') if (line[offset] == '[')
{ {
if (string.Compare(line, offset, "[Network Data] OnEvent: PLAYER: ", 0, 34, StringComparison.Ordinal) == 0) if (ParseLogOnPlayerJoinedOrLeft(fileInfo, logContext, line, offset) == true ||
{
logContext.photonEvent = line.Substring(offset + 34);
logContext.incomingJson = true;
logContext.jsonChunk = String.Empty;
logContext.jsonDate = ConvertLogTimeToISO8601(line);
}
else if (string.Compare(line, offset, "[Network Data] OnEvent: SYSTEM ", 0, 31, StringComparison.Ordinal) == 0)
{
logContext.photonEvent = line.Substring(offset + 31);
logContext.incomingJson = true;
logContext.jsonChunk = String.Empty;
logContext.jsonDate = ConvertLogTimeToISO8601(line);
}
else if (ParseLogOnPlayerJoinedOrLeft(fileInfo, logContext, line, offset) == true ||
ParseLogLocation(fileInfo, logContext, line, offset) == true || ParseLogLocation(fileInfo, logContext, line, offset) == true ||
ParseLogLocationDestination(fileInfo, logContext, line, offset) == true || ParseLogLocationDestination(fileInfo, logContext, line, offset) == true ||
ParseLogPortalSpawn(fileInfo, logContext, line, offset) == true || ParseLogPortalSpawn(fileInfo, logContext, line, offset) == true ||
@@ -796,101 +767,6 @@ namespace VRCX
return false; return false;
} }
public class VrcEvent
{
public int Code { get; set; }
public Parameters Parameters { get; set; }
public int SenderKey { get; set; }
public int CustomDataKey { get; set; }
public int Type { get; set; }
public string EventType { get; set; }
public Object Data { get; set; }
}
public class Parameters
{
[JsonPropertyName("245")]
public _245 _245 { get; set; }
[JsonPropertyName("254")]
public int _254 { get; set; }
}
public class _245
{
[JsonPropertyName("$type")]
public string Type { get; set; }
[JsonPropertyName("$value")]
public string Value { get; set; }
}
private void ParseLogPhotonEvent(FileInfo fileInfo, string data, string date, string photonEvent)
{
// 2021.09.30 04:27:11 Log - [Network Data] OnEvent: PLAYER: 253
// 2021.09.30 04:27:40 Log - [Network Data] OnEvent: SYSTEM 255
if (photonEvent == "1" || photonEvent == "8" || photonEvent == "9" || photonEvent == "210")
{
return;
}
if (photonEvent == "7")
{
var json = System.Text.Json.JsonSerializer.Deserialize<VrcEvent>(data);
var photonId = json.Parameters._254;
if (photonEvent7.ContainsKey(photonId))
{
photonEvent7[photonId] = date;
} else
{
photonEvent7.Add(photonId, date);
}
return;
}
if (photonEvent == "254")
{
var json = System.Text.Json.JsonSerializer.Deserialize<VrcEvent>(data);
photonEvent7.Remove(json.Parameters._254);
}
if (photonEvent == "6")
{
var json = System.Text.Json.JsonSerializer.Deserialize<VrcEvent>(data);
byte[] bytes = Convert.FromBase64String(json.Parameters._245.Value);
try
{
var deserialization = new VRCEventDeserialization();
var eventData = deserialization.DeserializeData(bytes);
json.Data = eventData.Data;
json.Type = eventData.Type;
json.EventType = eventData.EventType;
data = System.Text.Json.JsonSerializer.Serialize<VrcEvent>(json);
}
catch(Exception ex)
{
data = ex.ToString();
}
}
AppendLog(new[]
{
fileInfo.Name,
date,
"photon-event",
data
});
}
public IDictionary<int, string> GetEvent7()
{
return photonEvent7;
}
public void ClearEvent7()
{
photonEvent7 = new Dictionary<int, string>();
}
public string[][] Get() public string[][] Get()
{ {
Update(); Update();
+4 -4
View File
@@ -1,4 +1,4 @@
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Numerics; using System.Numerics;
@@ -29,9 +29,9 @@ namespace VRCX
public class EventEntry public class EventEntry
{ {
public int Type; public int Type { get; set; }
public string EventType; public string EventType { get; set; }
public object Data; public object Data { get; set; }
} }
private byte DeserializeByte() private byte DeserializeByte()
+171 -97
View File
@@ -4167,6 +4167,7 @@ speechSynthesis.getVoices();
$app.data.debugWebRequests = false; $app.data.debugWebRequests = false;
$app.data.debugWebSocket = false; $app.data.debugWebSocket = false;
$app.data.debugUserDiff = false; $app.data.debugUserDiff = false;
$app.data.debugPhotonLogging = true;
$app.data.APILastOnline = new Map(); $app.data.APILastOnline = new Map();
@@ -7551,6 +7552,7 @@ speechSynthesis.getVoices();
this.photonLobbyWatcherLoopStop(); this.photonLobbyWatcherLoopStop();
this.photonLobbyAvatars = new Map(); this.photonLobbyAvatars = new Map();
this.photonLobbyJointime = new Map(); this.photonLobbyJointime = new Map();
this.photonEvent7List = new Map();
this.moderationEventQueue = new Map(); this.moderationEventQueue = new Map();
this.lastPortalId = ''; this.lastPortalId = '';
this.lastPortalList = new Map(); this.lastPortalList = new Map();
@@ -7990,18 +7992,6 @@ speechSynthesis.getVoices();
this.addGameLogVRDancing(gameLog, location); this.addGameLogVRDancing(gameLog, location);
} }
return; return;
case 'photon-event':
if (!this.isGameRunning || !this.friendLogInitStatus) {
return;
}
try {
var data = JSON.parse(gameLog.json);
} catch {
console.error('error parsing photon json:', gameLog.json);
return;
}
this.parsePhotonEvent(data, gameLog.dt);
return;
case 'photon-id': case 'photon-id':
if (!this.isGameRunning || !this.friendLogInitStatus) { if (!this.isGameRunning || !this.friendLogInitStatus) {
return; return;
@@ -8062,7 +8052,7 @@ speechSynthesis.getVoices();
$app.data.photonLobbyTimeout = []; $app.data.photonLobbyTimeout = [];
$app.data.photonLobbyJointime = new Map(); $app.data.photonLobbyJointime = new Map();
$app.data.photonLobbyBots = []; $app.data.photonLobbyBots = [];
$app.data.photonLoggingEnabled = false; $app.data.photonEvent7List = new Map();
$app.data.photonEventType = [ $app.data.photonEventType = [
'MeshVisibility', 'MeshVisibility',
@@ -8173,7 +8163,6 @@ speechSynthesis.getVoices();
this.photonLobbyTimeout = []; this.photonLobbyTimeout = [];
this.photonLobbyBots = []; this.photonLobbyBots = [];
AppApi.ExecuteVrOverlayFunction('updateHudTimeout', '[]'); AppApi.ExecuteVrOverlayFunction('updateHudTimeout', '[]');
LogWatcher.ClearEvent7();
this.updatePhotonLobbyBotSize(0); this.updatePhotonLobbyBotSize(0);
}; };
@@ -8196,10 +8185,8 @@ speechSynthesis.getVoices();
workerTimers.setTimeout(() => this.photonLobbyWatcher(), 500); workerTimers.setTimeout(() => this.photonLobbyWatcher(), 500);
return; return;
} }
LogWatcher.GetEvent7().then((event7List) => {
var hudTimeout = []; var hudTimeout = [];
Object.entries(event7List).forEach(([photonId, dt]) => { this.photonEvent7List.forEach((dt, id) => {
var id = parseInt(photonId, 10);
var timeSinceLastEvent = dtNow - Date.parse(dt); var timeSinceLastEvent = dtNow - Date.parse(dt);
if (timeSinceLastEvent > this.photonLobbyTimeoutThreshold) { if (timeSinceLastEvent > this.photonLobbyTimeoutThreshold) {
if (this.photonLobbyJointime.has(id)) { if (this.photonLobbyJointime.has(id)) {
@@ -8255,13 +8242,11 @@ speechSynthesis.getVoices();
this.photonLobbyTimeout = hudTimeout; this.photonLobbyTimeout = hudTimeout;
this.getCurrentInstanceUserList(); this.getCurrentInstanceUserList();
} }
this.photonBotCheck(event7List, dtNow); this.photonBotCheck(dtNow);
});
workerTimers.setTimeout(() => this.photonLobbyWatcher(), 500); workerTimers.setTimeout(() => this.photonLobbyWatcher(), 500);
}; };
$app.methods.photonBotCheck = function (event7List, dtNow) { $app.methods.photonBotCheck = function (dtNow) {
var event7PhotonIds = Object.keys(event7List);
var photonBots = []; var photonBots = [];
this.photonLobbyCurrent.forEach((ref, id) => { this.photonLobbyCurrent.forEach((ref, id) => {
if (this.photonLobbyJointime.has(id)) { if (this.photonLobbyJointime.has(id)) {
@@ -8279,12 +8264,6 @@ speechSynthesis.getVoices();
!hasInstantiated !hasInstantiated
) { ) {
text = 'Photon bot has joined, b'; text = 'Photon bot has joined, b';
} else if (
(!joinTime || joinTime + 3000 < dtNow) &&
typeof ref === 'undefined' &&
!event7PhotonIds.includes(id.toString())
) {
text = 'Photon bot has joined, c';
} }
if (text) { if (text) {
if (!this.photonLobbyBots.includes(id)) { if (!this.photonLobbyBots.includes(id)) {
@@ -8427,8 +8406,9 @@ speechSynthesis.getVoices();
}; };
$app.methods.parsePhotonEvent = function (data, gameLogDate) { $app.methods.parsePhotonEvent = function (data, gameLogDate) {
this.photonLoggingEnabled = true; if (data.Code === 7) {
if (data.Code === 226) { this.photonEvent7List.set(data.Sender, gameLogDate);
} else if (data.Code === 226) {
// nothing // nothing
} else if (data.Code === 253) { } else if (data.Code === 253) {
// SetUserProperties // SetUserProperties
@@ -8474,7 +8454,7 @@ speechSynthesis.getVoices();
data.Parameters[249].inVRMode data.Parameters[249].inVRMode
); );
} }
this.parsePhotonLobbyIds(data.Parameters[252].$values); this.parsePhotonLobbyIds(data.Parameters[252]);
this.photonLobbyJointime.set(data.Parameters[254], { this.photonLobbyJointime.set(data.Parameters[254], {
joinTime: Date.parse(gameLogDate), joinTime: Date.parse(gameLogDate),
hasInstantiated: false, hasInstantiated: false,
@@ -8482,6 +8462,8 @@ speechSynthesis.getVoices();
inVRMode: data.Parameters[249].inVRMode, inVRMode: data.Parameters[249].inVRMode,
avatarEyeHeight: data.Parameters[249].avatarEyeHeight avatarEyeHeight: data.Parameters[249].avatarEyeHeight
}); });
var ref = this.photonLobbyCurrent.get(data.Parameters[254]);
this.photonUserJoin(data.Parameters[254], ref, gameLogDate);
this.startLobbyWatcherLoop(); this.startLobbyWatcherLoop();
} else if (data.Code === 254) { } else if (data.Code === 254) {
// Leave // Leave
@@ -8490,7 +8472,8 @@ speechSynthesis.getVoices();
this.photonLobbyCurrent.delete(data.Parameters[254]); this.photonLobbyCurrent.delete(data.Parameters[254]);
this.photonLobbyJointime.delete(data.Parameters[254]); this.photonLobbyJointime.delete(data.Parameters[254]);
this.photonLobbyInVrMode.delete(data.Parameters[254]); this.photonLobbyInVrMode.delete(data.Parameters[254]);
this.parsePhotonLobbyIds(data.Parameters[252].$values); this.photonEvent7List.delete(data.Parameters[254]);
this.parsePhotonLobbyIds(data.Parameters[252]);
if (typeof data.Parameters[203] !== 'undefined') { if (typeof data.Parameters[203] !== 'undefined') {
this.setPhotonLobbyMaster(data.Parameters[203], gameLogDate); this.setPhotonLobbyMaster(data.Parameters[203], gameLogDate);
} }
@@ -8531,8 +8514,8 @@ speechSynthesis.getVoices();
} }
} }
} else { } else {
var blockArray = data.Parameters[245]['10'].$values; var blockArray = data.Parameters[245]['10'];
var muteArray = data.Parameters[245]['11'].$values; var muteArray = data.Parameters[245]['11'];
var idList = new Map(); var idList = new Map();
blockArray.forEach((photonId1) => { blockArray.forEach((photonId1) => {
if (muteArray.includes(photonId1)) { if (muteArray.includes(photonId1)) {
@@ -8586,37 +8569,51 @@ speechSynthesis.getVoices();
}); });
} }
} else if (data.Code === 6) { } else if (data.Code === 6) {
var senderId = data.Parameters[254];
// VRC Event // VRC Event
if ( var senderId = data.Parameters[254];
data.EventType === 'ReceiveVoiceStatsSyncRPC' || AppApi.DeserializeVrcEvent(data.Parameters[245]).then((json) => {
data.EventType === 'initUSpeakSenderRPC' || try {
data.EventType === 'SanityCheck' || var eventData = JSON.parse(json);
(data.EventType === 'UdonSyncRunProgramAsRPC' && } catch {
data.Data[0] !== 'Beep') || console.error(
data.EventType === 'InformOfBadConnection' || 'error parsing DeserializeVrcEvent json:',
data.EventType === 'SetTimerRPC' || json
data.EventType === 'IncrementPortalPlayerCountRPC' || );
data.EventType === 'PlayEffect' ||
data.EventType === 'PlayEmoteRPC' ||
data.EventType === 'CancelRPC' ||
data.EventType === '_SendOnSpawn' ||
data.EventType === 'RefreshAvatar' ||
data.EventType === 'InternalApplyOverrideRPC'
) {
return; return;
} }
if ( if (
data.EventType === '_InstantiateObject' && eventData.EventType === 'ReceiveVoiceStatsSyncRPC' ||
data.Data[0] === 'Portals/PortalInternalDynamic' eventData.EventType === 'initUSpeakSenderRPC' ||
eventData.EventType === 'SanityCheck' ||
(eventData.EventType === 'UdonSyncRunProgramAsRPC' &&
eventData.Data[0] !== 'Beep') ||
eventData.EventType === 'InformOfBadConnection' ||
eventData.EventType === 'SetTimerRPC' ||
eventData.EventType === 'IncrementPortalPlayerCountRPC' ||
eventData.EventType === 'PlayEffect' ||
eventData.EventType === 'PlayEmoteRPC' ||
eventData.EventType === 'CancelRPC' ||
eventData.EventType === '_SendOnSpawn' ||
eventData.EventType === 'RefreshAvatar' ||
eventData.EventType === 'InternalApplyOverrideRPC'
) { ) {
this.lastPortalId = data.Data[3]; // Trash
return;
}
if (this.debugPhotonLogging) {
console.log('VrcEvent:', eventData);
}
if (
eventData.EventType === '_InstantiateObject' &&
eventData.Data[0] === 'Portals/PortalInternalDynamic'
) {
this.lastPortalId = eventData.Data[3];
return; return;
} else if ( } else if (
data.EventType === '_DestroyObject' && eventData.EventType === '_DestroyObject' &&
this.lastPortalList.has(data.Data[0]) this.lastPortalList.has(eventData.Data[0])
) { ) {
var portalId = data.Data[0]; var portalId = eventData.Data[0];
var date = this.lastPortalList.get(portalId); var date = this.lastPortalList.get(portalId);
var time = timeToText(Date.parse(gameLogDate) - date); var time = timeToText(Date.parse(gameLogDate) - date);
this.addEntryPhotonEvent({ this.addEntryPhotonEvent({
@@ -8625,8 +8622,8 @@ speechSynthesis.getVoices();
created_at: gameLogDate created_at: gameLogDate
}); });
return; return;
} else if (data.EventType === 'ConfigurePortal') { } else if (eventData.EventType === 'ConfigurePortal') {
var instanceId = `${data.Data[0]}:${data.Data[1]}`; var instanceId = `${eventData.Data[0]}:${eventData.Data[1]}`;
if (this.lastPortalId) { if (this.lastPortalId) {
this.lastPortalList.set( this.lastPortalList.set(
this.lastPortalId, this.lastPortalId,
@@ -8641,48 +8638,56 @@ speechSynthesis.getVoices();
displayName displayName
}; };
this.portalQueue = 'skip'; this.portalQueue = 'skip';
this.parsePhotonPortalSpawn(gameLogDate, instanceId, ref1); this.parsePhotonPortalSpawn(
gameLogDate,
instanceId,
ref1
);
} else { } else {
this.portalQueue = instanceId; this.portalQueue = instanceId;
} }
return; return;
} else if (data.Type > 34) { } else if (eventData.Type > 34) {
var entry = { var entry = {
created_at: gameLogDate, created_at: gameLogDate,
type: 'Event', type: 'Event',
data: `${displayName} called non existent RPC ${data.Type}` data: `${displayName} called non existent RPC ${eventData.Type}`
}; };
this.addPhotonEventToGameLog(entry); this.addPhotonEventToGameLog(entry);
} }
if (data.Type === 14) { if (eventData.Type === 14) {
if (data.EventType === 'ChangeVisibility') { if (eventData.EventType === 'ChangeVisibility') {
if (data.Data[0] === true) { if (eventData.Data[0] === true) {
var text = 'EnableCamera'; var text = 'EnableCamera';
} else if (data.Data[0] === false) { } else if (eventData.Data[0] === false) {
var text = 'DisableCamera'; var text = 'DisableCamera';
} }
} else if ( } else if (
data.EventType === 'UdonSyncRunProgramAsRPC' && eventData.EventType === 'UdonSyncRunProgramAsRPC' &&
data.Data[0] === 'Beep' eventData.Data[0] === 'Beep'
) { ) {
if (!this.isDanceWorld(this.lastLocation.location)) { if (!this.isDanceWorld(this.lastLocation.location)) {
return; return;
} }
var text = 'Beep'; var text = 'Beep';
} else if (data.EventType === 'ReloadAvatarNetworkedRPC') { } else if (
eventData.EventType === 'ReloadAvatarNetworkedRPC'
) {
var text = 'AvatarReset'; var text = 'AvatarReset';
} else if (data.EventType === 'SpawnEmojiRPC') { } else if (eventData.EventType === 'SpawnEmojiRPC') {
var text = `SpawnEmoji ${this.photonEmojis[data.Data]}`; var text = `SpawnEmoji ${
this.photonEmojis[eventData.Data]
}`;
} else { } else {
var eventData = ''; var eventVrc = '';
if (data.Data) { if (eventData.Data) {
if (Array.isArray(data.Data)) { if (Array.isArray(eventData.Data)) {
eventData = ` ${data.Data.toString()}`; eventVrc = ` ${eventData.Data.toString()}`;
} else { } else {
eventData = ` ${data.Data}`; eventVrc = ` ${eventData.Data}`;
} }
} }
var text = `${data.EventType}${eventData}`; var text = `${eventData.EventType}${eventVrc}`;
} }
this.addEntryPhotonEvent({ this.addEntryPhotonEvent({
photonId: senderId, photonId: senderId,
@@ -8691,19 +8696,22 @@ speechSynthesis.getVoices();
}); });
} else { } else {
var eventType = ''; var eventType = '';
if (data.EventType) { if (eventData.EventType) {
if (Array.isArray(data.EventType)) { if (Array.isArray(eventData.EventType)) {
eventType = ` ${data.EventType.toString()}`; eventType = ` ${eventData.EventType.toString()}`;
} else { } else {
eventType = ` ${data.EventType}`; eventType = ` ${eventData.EventType}`;
} }
} }
if (this.debugPhotonLogging) {
var feed = `RPC ${displayName} ${ var feed = `RPC ${displayName} ${
this.photonEventType[data.Type] this.photonEventType[eventData.Type]
}${eventType}`; }${eventType}`;
console.log(feed); console.log('VrcRpc:', feed);
} }
} }
});
}
}; };
$app.methods.parsePhotonPortalSpawn = async function ( $app.methods.parsePhotonPortalSpawn = async function (
@@ -8806,13 +8814,9 @@ speechSynthesis.getVoices();
hasInstantiated: true hasInstantiated: true
}); });
} }
var hasJoined = this.photonLobbyCurrent.has(photonId);
var tags = []; var tags = [];
if ( if (typeof user.tags !== 'undefined') {
typeof user.tags !== 'undefined' && tags = user.tags;
typeof user.tags.$values !== 'undefined'
) {
tags = user.tags.$values;
} }
var ref = API.cachedUsers.get(user.id); var ref = API.cachedUsers.get(user.id);
var photonUser = { var photonUser = {
@@ -8833,9 +8837,6 @@ speechSynthesis.getVoices();
}; };
this.photonLobby.set(photonId, photonUser); this.photonLobby.set(photonId, photonUser);
this.photonLobbyCurrent.set(photonId, photonUser); this.photonLobbyCurrent.set(photonId, photonUser);
if (!hasJoined) {
this.photonUserJoin(photonId, photonUser, gameLogDate);
}
var bias = Date.parse(gameLogDate) + 60 * 1000; // 1min var bias = Date.parse(gameLogDate) + 60 * 1000; // 1min
if (bias > Date.now()) { if (bias > Date.now()) {
@@ -9009,11 +9010,8 @@ speechSynthesis.getVoices();
$app.methods.parsePhotonAvatar = function (avatar) { $app.methods.parsePhotonAvatar = function (avatar) {
var tags = []; var tags = [];
if ( if (typeof avatar.tags !== 'undefined') {
typeof avatar.tags !== 'undefined' && tags = avatar.tags;
typeof avatar.tags.$values !== 'undefined'
) {
tags = avatar.tags.$values;
} }
API.applyAvatar({ API.applyAvatar({
id: avatar.id, id: avatar.id,
@@ -10951,6 +10949,9 @@ speechSynthesis.getVoices();
$app.data.photonEventOverlayJoinLeave = configRepository.getBool( $app.data.photonEventOverlayJoinLeave = configRepository.getBool(
'VRCX_PhotonEventOverlayJoinLeave' 'VRCX_PhotonEventOverlayJoinLeave'
); );
$app.data.photonLoggingEnabled = configRepository.getBool(
'VRCX_photonLoggingEnabled'
);
$app.methods.saveEventOverlay = function () { $app.methods.saveEventOverlay = function () {
configRepository.setBool( configRepository.setBool(
'VRCX_PhotonEventOverlay', 'VRCX_PhotonEventOverlay',
@@ -18071,8 +18072,40 @@ speechSynthesis.getVoices();
console.error(`IPC invalid JSON, ${json}`); console.error(`IPC invalid JSON, ${json}`);
} }
switch (data.type) { switch (data.type) {
case 'OnEvent':
if (
this.debugPhotonLogging &&
data.OnEventData.Code !== 6 &&
data.OnEventData.Code !== 7
) {
console.log(
'OnEvent',
data.OnEventData.Code,
data.OnEventData
);
}
this.parsePhotonEvent(data.OnEventData, data.dt);
break;
case 'OnOperationResponse':
if (this.debugPhotonLogging) {
console.log(
'OnOperationResponse',
data.OnOperationResponseData.OperationCode,
data.OnOperationResponseData
);
}
this.parseOperationResponse(
data.OnOperationResponseData,
data.dt
);
break;
case 'Ping': case 'Ping':
this.eventPing(data); if (!this.photonLoggingEnabled) {
this.photonLoggingEnabled = true;
configRepository.setBool('VRCX_photonLoggingEnabled', true);
}
this.ipcEnabled = true;
this.ipcTimeout = 60; // 30secs
break; break;
case 'LaunchCommand': case 'LaunchCommand':
AppApi.FocusWindow(); AppApi.FocusWindow();
@@ -18081,6 +18114,47 @@ speechSynthesis.getVoices();
} }
}; };
$app.methods.parseOperationResponse = function (data, dateTime) {
switch (data.OperationCode) {
case 226:
if (typeof data.Parameters[249] !== 'undefined') {
for (var i in data.Parameters[249]) {
var id = parseInt(i, 10);
var user = data.Parameters[249][i];
this.parsePhotonUser(id, user.user, dateTime);
this.parsePhotonAvatarChange(
id,
user.user,
user.avatarDict,
dateTime
);
this.parsePhotonAvatar(user.avatarDict);
this.parsePhotonAvatar(user.favatarDict);
if (typeof user.inVRMode !== 'undefined') {
this.photonLobbyInVrMode.set(id, user.inVRMode);
}
this.photonLobbyJointime.set(id, {
joinTime: Date.parse(dateTime),
hasInstantiated: true,
isInvisible: user.isInvisible,
inVRMode: user.inVRMode,
avatarEyeHeight: user.avatarEyeHeight
});
}
}
if (typeof data.Parameters[252] !== 'undefined') {
this.parsePhotonLobbyIds(data.Parameters[252]);
}
if (
typeof data.Parameters[248] !== 'undefined' &&
typeof data.Parameters[248][248] !== 'undefined'
) {
this.setPhotonLobbyMaster(data.Parameters[248][248]);
}
break;
}
};
API.$on('LOGIN', async function () { API.$on('LOGIN', async function () {
var command = await AppApi.GetLaunchCommand(); var command = await AppApi.GetLaunchCommand();
if (command) { if (command) {
-4
View File
@@ -50,10 +50,6 @@ class GameLogService {
gameLog.url = args[0]; gameLog.url = args[0];
break; break;
case 'photon-event':
gameLog.json = args[0];
break;
case 'photon-id': case 'photon-id':
gameLog.displayName = args[0]; gameLog.displayName = args[0];
gameLog.photonId = args[1]; gameLog.photonId = args[1];