From 2128a6adfa8304dba6e79d4b02fe99413c8f64f1 Mon Sep 17 00:00:00 2001 From: Natsumi Date: Fri, 29 Jul 2022 20:48:22 +1200 Subject: [PATCH] isGameNoVR, remove steam login, remove copy instance, Fix PortalSpawn --- AppApi.cs | 23 ------------ LogWatcher.cs | 38 +++++++++++-------- VRCX.csproj | 1 - html/src/app.js | 73 ++++++++++++------------------------- html/src/index.pug | 36 ++++++++---------- html/src/service/gamelog.js | 4 +- html/src/vr.js | 9 +---- html/src/vr.pug | 8 +--- 8 files changed, 69 insertions(+), 123 deletions(-) diff --git a/AppApi.cs b/AppApi.cs index 271d4b46..8a326de1 100644 --- a/AppApi.cs +++ b/AppApi.cs @@ -89,34 +89,12 @@ namespace VRCX public bool[] CheckGameRunning() { var isGameRunning = false; - var isGameNoVR = false; var isSteamVRRunning = false; - var hwnd = WinApi.FindWindow("UnityWndClass", "VRChat"); - if (hwnd != IntPtr.Zero) - { - var cmdline = string.Empty; - - try - { - WinApi.GetWindowThreadProcessId(hwnd, out uint pid); - using (var searcher = new ManagementObjectSearcher($"SELECT CommandLine FROM Win32_Process WHERE ProcessId = {pid}")) - using (var objects = searcher.Get()) - { - cmdline = objects.Cast().SingleOrDefault()?["CommandLine"]?.ToString(); - } - isGameNoVR = cmdline.Contains("--no-vr"); - } - catch - { - } - } - if (Process.GetProcessesByName("vrchat").Length > 0) { isGameRunning = true; } - if (Process.GetProcessesByName("vrserver").Length > 0) { isSteamVRRunning = true; @@ -125,7 +103,6 @@ namespace VRCX return new bool[] { isGameRunning, - isGameNoVR, isSteamVRRunning }; } diff --git a/LogWatcher.cs b/LogWatcher.cs index b3a9a0c0..4bdb7580 100644 --- a/LogWatcher.cs +++ b/LogWatcher.cs @@ -236,7 +236,8 @@ namespace VRCX { if (ParseLogShaderKeywordsLimit(fileInfo, logContext, line, offset) == true || ParseLogSDK2VideoPlay(fileInfo, logContext, line, offset) == true || - ParseApplicationQuit(fileInfo, logContext, line, offset) == true) + ParseApplicationQuit(fileInfo, logContext, line, offset) == true || + ParseOpenVRInit(fileInfo, logContext, line, offset) == true) { continue; } @@ -442,26 +443,16 @@ namespace VRCX { // 2021.04.06 11:25:45 Log - [Network Processing] RPC invoked ConfigurePortal on (Clone [1600004] Portals/PortalInternalDynamic) for Natsumi-sama // 2021.07.19 04:24:28 Log - [Behaviour] Will execute SendRPC/AlwaysBufferOne on (Clone [100004] Portals/PortalInternalDynamic) (UnityEngine.GameObject) for Natsumi-sama: S: "ConfigurePortal" I: 7 F: 0 B: 255 (local master owner) + // 2022.07.29 18:40:37 Log - [Behaviour] Instantiated a (Clone [800004] Portals/PortalInternalDynamic) - if (!line.Contains("] Will execute SendRPC/AlwaysBufferOne on (Clone [")) + if (!line.Contains("] Portals/PortalInternalDynamic)")) return false; - var pos = line.LastIndexOf("] Portals/PortalInternalDynamic) (UnityEngine.GameObject) for "); - if (pos < 0) - return false; - - var endPos = line.LastIndexOf(": S: \"ConfigurePortal\""); - if (endPos < 0) - return false; - - var data = line.Substring(pos + 62, endPos - (pos + 62)); - AppendLog(new[] { fileInfo.Name, ConvertLogTimeToISO8601(line), - "portal-spawn", - data + "portal-spawn" }); return true; @@ -856,6 +847,23 @@ namespace VRCX return true; } + private bool ParseOpenVRInit(FileInfo fileInfo, LogContext logContext, string line, int offset) + { + // 2022.07.29 02:52:14 Log - OpenVR initialized! + + if (string.Compare(line, offset, "OpenVR initialized!", 0, 19, StringComparison.Ordinal) != 0) + return false; + + AppendLog(new[] + { + fileInfo.Name, + ConvertLogTimeToISO8601(line), + "openvr-init" + }); + + return true; + } + public string[][] Get() { Update(); @@ -891,4 +899,4 @@ namespace VRCX return new string[][] { }; } } -} +} \ No newline at end of file diff --git a/VRCX.csproj b/VRCX.csproj index 88c99ba9..b2b09169 100644 --- a/VRCX.csproj +++ b/VRCX.csproj @@ -117,7 +117,6 @@ - diff --git a/html/src/app.js b/html/src/app.js index aa42ac0d..a6c5b096 100644 --- a/html/src/app.js +++ b/html/src/app.js @@ -4183,7 +4183,7 @@ speechSynthesis.getVoices(); ipcTimeout: 0, nextClearVRCXCacheCheck: 0, isGameRunning: false, - isGameNoVR: false, + isGameNoVR: configRepository.getBool('isGameNoVR'), isSteamVRRunning: false, appVersion, latestAppVersion: '', @@ -4295,18 +4295,19 @@ speechSynthesis.getVoices(); this.clearVRCXCache(); } AppApi.CheckGameRunning().then( - ([isGameRunning, isGameNoVR, isSteamVRRunning]) => { - this.updateOpenVR( - isGameRunning, - isGameNoVR, - isSteamVRRunning - ); + ([isGameRunning, isSteamVRRunning]) => { + this.updateOpenVR(isGameRunning, isSteamVRRunning); if (isGameRunning !== this.isGameRunning) { this.isGameRunning = isGameRunning; if (isGameRunning) { API.currentUser.$online_for = Date.now(); API.currentUser.$offline_for = ''; } else { + this.isGameNoVR = true; + configRepository.setBool( + 'isGameNoVR', + this.isGameNoVR + ); API.currentUser.$online_for = ''; API.currentUser.$offline_for = Date.now(); Discord.SetActive(false); @@ -4317,10 +4318,6 @@ speechSynthesis.getVoices(); this.clearNowPlaying(); this.updateVRLastLocation(); } - if (isGameNoVR !== this.isGameNoVR) { - this.isGameNoVR = isGameNoVR; - this.updateVRLastLocation(); - } if (isSteamVRRunning !== this.isSteamVRRunning) { this.isSteamVRRunning = isSteamVRRunning; } @@ -5223,16 +5220,7 @@ speechSynthesis.getVoices(); ); break; case 'PortalSpawn': - var locationName = ''; - if (noty.worldName) { - locationName = ` to ${this.displayLocation( - noty.instanceId, - noty.worldName - )}`; - } - this.speak( - `${noty.displayName} has spawned a portal${locationName}` - ); + this.speak('User has spawned a portal'); break; case 'AvatarChange': this.speak( @@ -5419,16 +5407,9 @@ speechSynthesis.getVoices(); ); break; case 'PortalSpawn': - var locationName = ''; - if (noty.worldName) { - locationName = ` to ${this.displayLocation( - noty.instanceId, - noty.worldName - )}`; - } AppApi.XSNotification( 'VRCX', - `${noty.displayName} has spawned a portal${locationName}`, + 'User has spawned a portal', timeout, image ); @@ -5643,16 +5624,9 @@ speechSynthesis.getVoices(); ); break; case 'PortalSpawn': - var locationName = ''; - if (noty.worldName) { - locationName = ` to ${this.displayLocation( - noty.instanceId, - noty.worldName - )}`; - } AppApi.DesktopNotification( noty.displayName, - `has spawned a portal${locationName}`, + 'User has spawned a portal', image ); break; @@ -8215,9 +8189,9 @@ speechSynthesis.getVoices(); var entry = { created_at: gameLog.dt, type: 'PortalSpawn', - displayName: gameLog.userDisplayName, location, - userId, + displayName: '', + userId: '', instanceId: '', worldName: '' }; @@ -8330,6 +8304,10 @@ speechSynthesis.getVoices(); } }); break; + case 'opvenvr-init': + this.isGameNoVR = false; + configRepository.setBool('isGameNoVR', this.isGameNoVR); + break; } if (entry) { this.queueGameLogNoty(entry); @@ -11512,7 +11490,7 @@ speechSynthesis.getVoices(); stripe: true, size: 'mini', defaultSort: { - prop: 'photonId', + prop: 'timer', order: 'descending' } }, @@ -11745,9 +11723,10 @@ speechSynthesis.getVoices(); $app.data.photonEventOverlayJoinLeave = configRepository.getBool( 'VRCX_PhotonEventOverlayJoinLeave' ); - $app.data.photonLoggingEnabled = configRepository.getBool( - 'VRCX_photonLoggingEnabled' - ); + $app.data.photonLoggingEnabled = false; + // $app.data.photonLoggingEnabled = configRepository.getBool( + // 'VRCX_photonLoggingEnabled' + // ); $app.data.gameLogDisabled = configRepository.getBool( 'VRCX_gameLogDisabled' ); @@ -12188,14 +12167,10 @@ speechSynthesis.getVoices(); }); }; - $app.methods.updateOpenVR = function ( - isGameRunning, - isGameNoVR, - isSteamVRRunning - ) { + $app.methods.updateOpenVR = function (isGameRunning, isSteamVRRunning) { if ( this.openVR && - !isGameNoVR && + !this.isGameNoVR && isSteamVRRunning && (isGameRunning || this.openVRAlways) ) { diff --git a/html/src/index.pug b/html/src/index.pug index 6705e4ef..74a33b15 100644 --- a/html/src/index.pug +++ b/html/src/index.pug @@ -131,7 +131,7 @@ html span.extra {{ currentInstanceWorld.ref.created_at | formatDate('long') }} div.current-instance-table data-tables(v-bind="currentInstanceUserList" @row-click="selectCurrentInstanceRow" style="margin-top:10px;cursor:pointer") - el-table-column(label="Avatar" width="60" prop="photo") + el-table-column(label="Avatar" width="70" prop="photo") template(v-once #default="scope") template(v-if="userImage(scope.row.ref)") el-popover(placement="right" height="500px" trigger="hover") @@ -140,7 +140,7 @@ html el-table-column(label="Timer" width="80" prop="timer" sortable) template(v-once #default="scope") timer(:epoch="scope.row.timer") - el-table-column(label="Photon Id" width="100" prop="photonId" sortable) + el-table-column(label="Photon Id" width="110" prop="photonId" sortable) template(v-once #default="scope") span(v-text="scope.row.photonId") el-table-column(label="Icons" prop="isMaster" width="100") @@ -151,7 +151,7 @@ html span 💚 el-tooltip(v-if="scope.row.timeoutTime" placement="left" content="Timeout") span(style="color:red") 🔴{{ scope.row.timeoutTime }}s - el-table-column(label="Platform" prop="inVrMode" width="70") + el-table-column(label="Platform" prop="inVrMode" width="80") template(v-once #default="scope") template(v-if="scope.row.ref.last_platform") span(v-if="scope.row.ref.last_platform === 'standalonewindows'" style="color:#409eff") PC @@ -196,7 +196,7 @@ html el-tabs(type="card") el-tab-pane(label="Current") data-tables(v-bind="photonEventTable" style="margin-bottom:10px") - el-table-column(label="Date" prop="created_at" width="110") + el-table-column(label="Date" prop="created_at" width="120") template(v-once #default="scope") el-tooltip(placement="right") template(#content) @@ -241,7 +241,7 @@ html span(v-else v-text="scope.row.text") el-tab-pane(label="Previous") data-tables(v-bind="photonEventTablePrevious" style="margin-bottom:10px") - el-table-column(label="Date" prop="created_at" width="110") + el-table-column(label="Date" prop="created_at" width="120") template(v-once #default="scope") el-tooltip(placement="right") template(#content) @@ -345,7 +345,7 @@ html span(v-else) Offline i.x-user-status(:class="statusClass(scope.row.status)") span(v-text="scope.row.statusDescription") - el-table-column(label="Date" prop="created_at" sortable="custom" width="110") + el-table-column(label="Date" prop="created_at" sortable="custom" width="120") template(v-once #default="scope") el-tooltip(placement="right") template(#content) @@ -405,7 +405,7 @@ html el-input(v-model="gameLogTable.search" placeholder="Search" @keyup.native.13="gameLogTableLookup" @change="gameLogTableLookup" clearable style="flex:none;width:150px;margin:0 10px") //- el-tooltip(placement="bottom" content="Reload game log" :disabled="hideTooltips") //- el-button(type="default" @click="resetGameLog" icon="el-icon-refresh" circle style="flex:none") - el-table-column(label="Date" prop="created_at" sortable="custom" width="110") + el-table-column(label="Date" prop="created_at" sortable="custom" width="120") template(v-once #default="scope") el-tooltip(placement="right") template(#content) @@ -611,7 +611,7 @@ html el-select(v-model="friendLogTable.filters[0].value" @change="saveTableFilters" multiple clearable collapse-tags style="flex:1" placeholder="Filter") el-option(v-once v-for="type in ['Friend', 'Unfriend', 'FriendRequest', 'CancelFriendRequest', 'DisplayName', 'TrustLevel']" :key="type" :label="type" :value="type") el-input(v-model="friendLogTable.filters[1].value" placeholder="Search" style="flex:none;width:150px;margin-left:10px") - el-table-column(label="Date" prop="created_at" sortable="custom" width="110") + el-table-column(label="Date" prop="created_at" sortable="custom" width="120") template(v-once #default="scope") el-tooltip(placement="right") template(#content) @@ -639,7 +639,7 @@ html el-input(v-model="playerModerationTable.filters[1].value" placeholder="Search" style="flex:none;width:150px;margin:0 10px") el-tooltip(placement="bottom" content="Refresh" :disabled="hideTooltips") el-button(type="default" :loading="API.isPlayerModerationsLoading" @click="API.refreshPlayerModerations()" icon="el-icon-refresh" circle style="flex:none") - el-table-column(label="Date" prop="created" sortable="custom" width="110") + el-table-column(label="Date" prop="created" sortable="custom" width="120") template(v-once #default="scope") el-tooltip(placement="right") template(#content) @@ -666,7 +666,7 @@ html el-input(v-model="notificationTable.filters[1].value" placeholder="Search" style="flex:none;width:150px;margin:0 10px") el-tooltip(placement="bottom" content="Refresh" :disabled="hideTooltips") el-button(type="default" :loading="API.isNotificationsLoading" @click="API.refreshNotifications()" icon="el-icon-refresh" circle style="flex:none") - el-table-column(label="Date" prop="created_at" sortable="custom" width="110") + el-table-column(label="Date" prop="created_at" sortable="custom" width="120") template(v-once #default="scope") el-tooltip(placement="right") template(#content) @@ -888,7 +888,7 @@ html el-popover(placement="right" height="500px" trigger="hover") img.friends-list-avatar(slot="reference" v-lazy="userImage(scope.row)") img.friends-list-avatar(v-lazy="userImageFull(scope.row)" style="height:500px;cursor:pointer" @click="openExternalLink(userImageFull(scope.row))") - el-table-column(label="Display Name" min-width="130" prop="displayName" sortable :sort-method="(a, b) => sortAlphabetically(a, b, 'displayName')") + el-table-column(label="Display Name" min-width="140" prop="displayName" sortable :sort-method="(a, b) => sortAlphabetically(a, b, 'displayName')") template(v-once #default="scope") span.name(v-if="randomUserColours" v-text="scope.row.displayName" :style="{'color':scope.row.$userColour}") span.name(v-else v-text="scope.row.displayName") @@ -902,7 +902,7 @@ html i.x-user-status(v-if="scope.row.status !== 'offline'" :class="statusClass(scope.row.status)") span ‎ span(v-text="scope.row.statusDescription") - el-table-column(label="Language" width="100" prop="$languages" sortable :sort-method="(a, b) => sortLanguages(a, b)") + el-table-column(label="Language" width="110" prop="$languages" sortable :sort-method="(a, b) => sortLanguages(a, b)") template(v-once #default="scope") el-tooltip(v-for="item in scope.row.$languages" :key="item.key" placement="top") template(#content) @@ -928,7 +928,7 @@ html template(v-once #default="scope") span {{ scope.row.last_login | formatDate('long') }} el-table-column(label="Date Joined" width="120" prop="date_joined" sortable :sort-method="(a, b) => sortAlphabetically(a, b, 'date_joined')") - el-table-column(label="Unfriend" width="70" align="right") + el-table-column(label="Unfriend" width="80" align="right") template(v-once #default="scope") el-button(type="text" icon="el-icon-close" size="mini" @click.stop="confirmDeleteFriend(scope.row.id)") @@ -1516,8 +1516,6 @@ html launch(:location="userDialog.ref.$location.tag" style="margin-left:5px") el-tooltip(placement="top" content="Invite yourself" :disabled="hideTooltips") invite-yourself(:location="userDialog.ref.$location.tag" style="margin-left:5px") - el-tooltip(placement="top" content="Copy to clipboard" :disabled="hideTooltips") - el-button(@click="copyLocation(userDialog.ref.$location.tag)" size="mini" icon="el-icon-s-order" style="margin-left:5px" circle) el-tooltip(placement="top" content="Refresh player count" :disabled="hideTooltips") el-button(@click="refreshInstancePlayerCount(userDialog.ref.$location.tag)" size="mini" icon="el-icon-refresh" style="margin-left:5px" circle) span(v-if="userDialog.instance.occupants" style="margin-left:5px") {{ userDialog.instance.occupants }} #[template(v-if="userDialog.instance.friendCount > 0") ({{ userDialog.instance.friendCount }})] @@ -1759,8 +1757,6 @@ html i.el-icon-lock(v-if="room.$location.strict" style="display:inline-block;margin-left:5px") el-tooltip(placement="top" content="Invite yourself" :disabled="hideTooltips") invite-yourself(:location="room.$location.tag" style="margin-left:5px") - el-tooltip(placement="top" content="Copy to clipboard" :disabled="hideTooltips") - el-button(v-if="isRealInstance(room.$location.tag)" @click="copyLocation(room.$location.tag)" size="mini" icon="el-icon-s-order" style="margin-left:5px" circle) el-tooltip(placement="top" content="Refresh player count" :disabled="hideTooltips") el-button(@click="refreshInstancePlayerCount(room.$location.tag)" size="mini" icon="el-icon-refresh" style="margin-left:5px" circle) span(v-if="room.occupants" style="margin-left:5px") {{ room.occupants }} #[template(v-if="room.friendCount > 0") ({{ room.friendCount }})] @@ -2850,7 +2846,7 @@ html span(v-text="previousInstancesUserDialog.userRef.displayName" style="font-size:14px") el-input(v-model="previousInstancesUserDialogTable.filters[0].value" placeholder="Search" style="display:block;width:150px;margin-top:15px") data-tables(v-if="previousInstancesUserDialog.visible" v-bind="previousInstancesUserDialogTable" v-loading="previousInstancesUserDialog.loading" style="margin-top:10px") - el-table-column(label="Date" prop="created_at" sortable width="110") + el-table-column(label="Date" prop="created_at" sortable width="120") template(v-once #default="scope") el-tooltip(placement="left") template(#content) @@ -2876,7 +2872,7 @@ html span(v-text="previousInstancesWorldDialog.worldRef.name" style="font-size:14px") el-input(v-model="previousInstancesWorldDialogTable.filters[0].value" placeholder="Search" style="display:block;width:150px;margin-top:15px") data-tables(v-if="previousInstancesWorldDialog.visible" v-bind="previousInstancesWorldDialogTable" v-loading="previousInstancesWorldDialog.loading" style="margin-top:10px") - el-table-column(label="Date" prop="created_at" sortable width="110") + el-table-column(label="Date" prop="created_at" sortable width="120") template(v-once #default="scope") el-tooltip(placement="left") template(#content) @@ -2907,7 +2903,7 @@ html location(:location="previousInstanceInfoDialog.$location.tag" style="font-size:14px") el-input(v-model="previousInstanceInfoDialogTable.filters[0].value" placeholder="Search" style="display:block;width:150px;margin-top:15px") data-tables(v-if="previousInstanceInfoDialog.visible" v-bind="previousInstanceInfoDialogTable" v-loading="previousInstanceInfoDialog.loading" style="margin-top:10px") - el-table-column(label="Date" prop="created_at" sortable width="110") + el-table-column(label="Date" prop="created_at" sortable width="120") template(v-once #default="scope") el-tooltip(placement="left") template(#content) diff --git a/html/src/service/gamelog.js b/html/src/service/gamelog.js index cf81385d..9030d02e 100644 --- a/html/src/service/gamelog.js +++ b/html/src/service/gamelog.js @@ -30,7 +30,6 @@ class GameLogService { break; case 'portal-spawn': - gameLog.userDisplayName = args[0]; break; case 'event': @@ -62,6 +61,9 @@ class GameLogService { case 'vrc-quit': break; + case 'openvr-init': + break; + default: break; } diff --git a/html/src/vr.js b/html/src/vr.js index b03c7437..7b8b2acd 100644 --- a/html/src/vr.js +++ b/html/src/vr.js @@ -454,14 +454,7 @@ Vue.component('marquee-text', MarqueeText); text = `${noty.previousDisplayName} changed their name to ${noty.displayName}`; break; case 'PortalSpawn': - var locationName = ''; - if (noty.worldName) { - locationName = ` to ${this.displayLocation( - noty.instanceId, - noty.worldName - )}`; - } - text = `${noty.displayName} has spawned a portal${locationName}`; + text = 'User has spawned a portal'; break; case 'AvatarChange': text = `${noty.displayName} changed into avatar ${noty.name}`; diff --git a/html/src/vr.pug b/html/src/vr.pug index db47945d..8bad20fb 100644 --- a/html/src/vr.pug +++ b/html/src/vr.pug @@ -122,9 +122,7 @@ html .detail span.extra span.time {{ feed.created_at | formatDate }} - | ✨ #[span.name(v-text="feed.displayName")] - template(v-if="feed.worldName") - | #[location(:location="feed.instanceId" :hint="feed.worldName")] + | ✨ User has spawned a portal div(v-else-if="feed.type === 'AvatarChange'" class="x-friend-item" :class="{ friend: feed.isFriend, favorite: feed.isFavorite }") .detail span.extra @@ -293,9 +291,7 @@ html .detail span.extra span.time {{ feed.created_at | formatDate }} - | #[span.name(v-text="feed.displayName")] has spawned a portal - template(v-if="feed.worldName") - | to #[location(:location="feed.instanceId" :hint="feed.worldName")] + | User has spawned a portal div(v-else-if="feed.type === 'AvatarChange'" class="x-friend-item" :class="{ friend: feed.isFriend, favorite: feed.isFavorite }") .detail span.extra