mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-05-06 14:46:04 +02:00
IPC photon logging
This commit is contained in:
@@ -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
@@ -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();
|
||||||
|
|||||||
@@ -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()
|
||||||
|
|||||||
+224
-150
@@ -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,13 +8185,11 @@ speechSynthesis.getVoices();
|
|||||||
workerTimers.setTimeout(() => this.photonLobbyWatcher(), 500);
|
workerTimers.setTimeout(() => this.photonLobbyWatcher(), 500);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
LogWatcher.GetEvent7().then((event7List) => {
|
var hudTimeout = [];
|
||||||
var hudTimeout = [];
|
this.photonEvent7List.forEach((dt, id) => {
|
||||||
Object.entries(event7List).forEach(([photonId, dt]) => {
|
var timeSinceLastEvent = dtNow - Date.parse(dt);
|
||||||
var id = parseInt(photonId, 10);
|
if (timeSinceLastEvent > this.photonLobbyTimeoutThreshold) {
|
||||||
var timeSinceLastEvent = dtNow - Date.parse(dt);
|
if (this.photonLobbyJointime.has(id)) {
|
||||||
if (timeSinceLastEvent > this.photonLobbyTimeoutThreshold) {
|
|
||||||
if (this.photonLobbyJointime.has(id)) {
|
|
||||||
var {joinTime} = this.photonLobbyJointime.get(id);
|
var {joinTime} = this.photonLobbyJointime.get(id);
|
||||||
}
|
}
|
||||||
if (!joinTime || joinTime + 120000 < dtNow) {
|
if (!joinTime || joinTime + 120000 < dtNow) {
|
||||||
@@ -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,50 +8569,64 @@ 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' ||
|
return;
|
||||||
data.EventType === 'PlayEmoteRPC' ||
|
}
|
||||||
data.EventType === 'CancelRPC' ||
|
if (
|
||||||
data.EventType === '_SendOnSpawn' ||
|
eventData.EventType === 'ReceiveVoiceStatsSyncRPC' ||
|
||||||
data.EventType === 'RefreshAvatar' ||
|
eventData.EventType === 'initUSpeakSenderRPC' ||
|
||||||
data.EventType === 'InternalApplyOverrideRPC'
|
eventData.EventType === 'SanityCheck' ||
|
||||||
) {
|
(eventData.EventType === 'UdonSyncRunProgramAsRPC' &&
|
||||||
return;
|
eventData.Data[0] !== 'Beep') ||
|
||||||
}
|
eventData.EventType === 'InformOfBadConnection' ||
|
||||||
if (
|
eventData.EventType === 'SetTimerRPC' ||
|
||||||
data.EventType === '_InstantiateObject' &&
|
eventData.EventType === 'IncrementPortalPlayerCountRPC' ||
|
||||||
data.Data[0] === 'Portals/PortalInternalDynamic'
|
eventData.EventType === 'PlayEffect' ||
|
||||||
) {
|
eventData.EventType === 'PlayEmoteRPC' ||
|
||||||
this.lastPortalId = data.Data[3];
|
eventData.EventType === 'CancelRPC' ||
|
||||||
return;
|
eventData.EventType === '_SendOnSpawn' ||
|
||||||
} else if (
|
eventData.EventType === 'RefreshAvatar' ||
|
||||||
data.EventType === '_DestroyObject' &&
|
eventData.EventType === 'InternalApplyOverrideRPC'
|
||||||
this.lastPortalList.has(data.Data[0])
|
) {
|
||||||
) {
|
// Trash
|
||||||
var portalId = data.Data[0];
|
return;
|
||||||
var date = this.lastPortalList.get(portalId);
|
}
|
||||||
var time = timeToText(Date.parse(gameLogDate) - date);
|
if (this.debugPhotonLogging) {
|
||||||
this.addEntryPhotonEvent({
|
console.log('VrcEvent:', eventData);
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
eventData.EventType === '_InstantiateObject' &&
|
||||||
|
eventData.Data[0] === 'Portals/PortalInternalDynamic'
|
||||||
|
) {
|
||||||
|
this.lastPortalId = eventData.Data[3];
|
||||||
|
return;
|
||||||
|
} else if (
|
||||||
|
eventData.EventType === '_DestroyObject' &&
|
||||||
|
this.lastPortalList.has(eventData.Data[0])
|
||||||
|
) {
|
||||||
|
var portalId = eventData.Data[0];
|
||||||
|
var date = this.lastPortalList.get(portalId);
|
||||||
|
var time = timeToText(Date.parse(gameLogDate) - date);
|
||||||
|
this.addEntryPhotonEvent({
|
||||||
photonId: senderId,
|
photonId: senderId,
|
||||||
text: `DeletedPortal ${time}`,
|
text: `DeletedPortal ${time}`,
|
||||||
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,
|
||||||
Date.parse(gameLogDate)
|
Date.parse(gameLogDate)
|
||||||
);
|
);
|
||||||
this.lastPortalId = '';
|
this.lastPortalId = '';
|
||||||
@@ -8638,71 +8635,82 @@ speechSynthesis.getVoices();
|
|||||||
if (displayName) {
|
if (displayName) {
|
||||||
var ref1 = {
|
var ref1 = {
|
||||||
id: this.getUserIdFromPhotonId(senderId),
|
id: this.getUserIdFromPhotonId(senderId),
|
||||||
displayName
|
displayName
|
||||||
|
};
|
||||||
|
this.portalQueue = 'skip';
|
||||||
|
this.parsePhotonPortalSpawn(
|
||||||
|
gameLogDate,
|
||||||
|
instanceId,
|
||||||
|
ref1
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
this.portalQueue = instanceId;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
} else if (eventData.Type > 34) {
|
||||||
|
var entry = {
|
||||||
|
created_at: gameLogDate,
|
||||||
|
type: 'Event',
|
||||||
|
data: `${displayName} called non existent RPC ${eventData.Type}`
|
||||||
};
|
};
|
||||||
this.portalQueue = 'skip';
|
this.addPhotonEventToGameLog(entry);
|
||||||
this.parsePhotonPortalSpawn(gameLogDate, instanceId, ref1);
|
|
||||||
} else {
|
|
||||||
this.portalQueue = instanceId;
|
|
||||||
}
|
}
|
||||||
return;
|
if (eventData.Type === 14) {
|
||||||
} else if (data.Type > 34) {
|
if (eventData.EventType === 'ChangeVisibility') {
|
||||||
var entry = {
|
if (eventData.Data[0] === true) {
|
||||||
created_at: gameLogDate,
|
var text = 'EnableCamera';
|
||||||
type: 'Event',
|
} else if (eventData.Data[0] === false) {
|
||||||
data: `${displayName} called non existent RPC ${data.Type}`
|
var text = 'DisableCamera';
|
||||||
};
|
|
||||||
this.addPhotonEventToGameLog(entry);
|
|
||||||
}
|
|
||||||
if (data.Type === 14) {
|
|
||||||
if (data.EventType === 'ChangeVisibility') {
|
|
||||||
if (data.Data[0] === true) {
|
|
||||||
var text = 'EnableCamera';
|
|
||||||
} else if (data.Data[0] === false) {
|
|
||||||
var text = 'DisableCamera';
|
|
||||||
}
|
|
||||||
} else if (
|
|
||||||
data.EventType === 'UdonSyncRunProgramAsRPC' &&
|
|
||||||
data.Data[0] === 'Beep'
|
|
||||||
) {
|
|
||||||
if (!this.isDanceWorld(this.lastLocation.location)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var text = 'Beep';
|
|
||||||
} else if (data.EventType === 'ReloadAvatarNetworkedRPC') {
|
|
||||||
var text = 'AvatarReset';
|
|
||||||
} else if (data.EventType === 'SpawnEmojiRPC') {
|
|
||||||
var text = `SpawnEmoji ${this.photonEmojis[data.Data]}`;
|
|
||||||
} else {
|
|
||||||
var eventData = '';
|
|
||||||
if (data.Data) {
|
|
||||||
if (Array.isArray(data.Data)) {
|
|
||||||
eventData = ` ${data.Data.toString()}`;
|
|
||||||
} else {
|
|
||||||
eventData = ` ${data.Data}`;
|
|
||||||
}
|
}
|
||||||
|
} else if (
|
||||||
|
eventData.EventType === 'UdonSyncRunProgramAsRPC' &&
|
||||||
|
eventData.Data[0] === 'Beep'
|
||||||
|
) {
|
||||||
|
if (!this.isDanceWorld(this.lastLocation.location)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var text = 'Beep';
|
||||||
|
} else if (
|
||||||
|
eventData.EventType === 'ReloadAvatarNetworkedRPC'
|
||||||
|
) {
|
||||||
|
var text = 'AvatarReset';
|
||||||
|
} else if (eventData.EventType === 'SpawnEmojiRPC') {
|
||||||
|
var text = `SpawnEmoji ${
|
||||||
|
this.photonEmojis[eventData.Data]
|
||||||
|
}`;
|
||||||
|
} else {
|
||||||
|
var eventVrc = '';
|
||||||
|
if (eventData.Data) {
|
||||||
|
if (Array.isArray(eventData.Data)) {
|
||||||
|
eventVrc = ` ${eventData.Data.toString()}`;
|
||||||
|
} else {
|
||||||
|
eventVrc = ` ${eventData.Data}`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var text = `${eventData.EventType}${eventVrc}`;
|
||||||
}
|
}
|
||||||
var text = `${data.EventType}${eventData}`;
|
this.addEntryPhotonEvent({
|
||||||
}
|
photonId: senderId,
|
||||||
this.addEntryPhotonEvent({
|
|
||||||
photonId: senderId,
|
|
||||||
text,
|
text,
|
||||||
created_at: gameLogDate
|
created_at: gameLogDate
|
||||||
});
|
});
|
||||||
} 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} ${
|
||||||
|
this.photonEventType[eventData.Type]
|
||||||
|
}${eventType}`;
|
||||||
|
console.log('VrcRpc:', feed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var feed = `RPC ${displayName} ${
|
});
|
||||||
this.photonEventType[data.Type]
|
|
||||||
}${eventType}`;
|
|
||||||
console.log(feed);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -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) {
|
||||||
|
|||||||
@@ -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];
|
||||||
|
|||||||
Reference in New Issue
Block a user