diff --git a/AppApi.cs b/AppApi.cs index 951f828b..a4ed4278 100644 --- a/AppApi.cs +++ b/AppApi.cs @@ -203,9 +203,9 @@ namespace VRCX } } - public void SetVR(bool active, bool hmdOverlay, bool wristOverlay, bool menuButton) + public void SetVR(bool active, bool hmdOverlay, bool wristOverlay, bool menuButton, int overlayHand) { - VRCXVR.Instance.SetActive(active, hmdOverlay, wristOverlay, menuButton); + VRCXVR.Instance.SetActive(active, hmdOverlay, wristOverlay, menuButton, overlayHand); } public void RefreshVR() @@ -391,6 +391,7 @@ namespace VRCX } private static readonly MD5 _hasher = MD5.Create(); + public int GetColourFromUserID(string userId) { var hash = _hasher.ComputeHash(Encoding.UTF8.GetBytes(userId)); @@ -439,4 +440,4 @@ namespace VRCX } } } -} +} \ No newline at end of file diff --git a/VRCXVR.cs b/VRCXVR.cs index da98cf36..5ce30d70 100644 --- a/VRCXVR.cs +++ b/VRCXVR.cs @@ -41,6 +41,7 @@ namespace VRCX private bool _hmdOverlayActive; private bool _wristOverlayActive; private bool _menuButton; + private int _overlayHand; static VRCXVR() { @@ -91,7 +92,7 @@ namespace VRCX // https://stackoverflow.com/questions/38312597/how-to-choose-a-specific-graphics-device-in-sharpdx-directx-11/38596725#38596725 Factory f = new Factory1(); Adapter a = f.GetAdapter(1); - + DeviceCreationFlags flags = DeviceCreationFlags.BgraSupport; _device = Program.GPUFix ? new Device(a, flags) : new Device(DriverType.Hardware, DeviceCreationFlags.SingleThreaded | DeviceCreationFlags.BgraSupport); @@ -150,7 +151,7 @@ namespace VRCX { Thread.Sleep(32); } - catch(ThreadInterruptedException) + catch (ThreadInterruptedException) { } @@ -245,15 +246,15 @@ namespace VRCX _texture2.Dispose(); _texture1.Dispose(); _device.Dispose(); - } - public void SetActive(bool active, bool hmdOverlay, bool wristOverlay, bool menuButton) + public void SetActive(bool active, bool hmdOverlay, bool wristOverlay, bool menuButton, int overlayHand) { _active = active; _hmdOverlayActive = hmdOverlay; _wristOverlayActive = wristOverlay; _menuButton = menuButton; + _overlayHand = overlayHand; } public void Refresh() @@ -309,23 +310,28 @@ namespace VRCX // Vive : Menu, Bit 1, Mask 2, // Vive : Grip, Bit 2, Mask 4 var role = system.GetControllerRoleForTrackedDeviceIndex(i); - if (role == ETrackedControllerRole.LeftHand || - role == ETrackedControllerRole.RightHand) + if (role == ETrackedControllerRole.LeftHand || role == ETrackedControllerRole.RightHand) { - if (system.GetControllerState(i, ref state, (uint)Marshal.SizeOf(state)) && - (state.ulButtonPressed & (_menuButton ? 2u : (isOculus ? 128u : 4u))) != 0) + if (_overlayHand == 0 || + _overlayHand == 1 && role == ETrackedControllerRole.LeftHand || + _overlayHand == 2 && role == ETrackedControllerRole.RightHand) { - if (role == ETrackedControllerRole.LeftHand) + if (system.GetControllerState(i, ref state, (uint)Marshal.SizeOf(state)) && + (state.ulButtonPressed & (_menuButton ? 2u : (isOculus ? 128u : 4u))) != 0) { - Array.Copy(_translationLeft, _translation, 3); - Array.Copy(_rotationLeft, _rotation, 3); + if (role == ETrackedControllerRole.LeftHand) + { + Array.Copy(_translationLeft, _translation, 3); + Array.Copy(_rotationLeft, _rotation, 3); + } + else + { + Array.Copy(_translationRight, _translation, 3); + Array.Copy(_rotationRight, _rotation, 3); + } + + overlayIndex = i; } - else - { - Array.Copy(_translationRight, _translation, 3); - Array.Copy(_rotationRight, _rotation, 3); - } - overlayIndex = i; } } var type = string.Empty; @@ -642,4 +648,4 @@ namespace VRCX return err; } } -} +} \ No newline at end of file diff --git a/html/src/app.js b/html/src/app.js index 046954a2..6b59290f 100644 --- a/html/src/app.js +++ b/html/src/app.js @@ -4519,7 +4519,11 @@ speechSynthesis.getVoices(); } } if (--this.nextAppUpdateCheck <= 0) { - this.nextAppUpdateCheck = 1800; // 15mins + if (this.branch === 'Stable') { + this.nextAppUpdateCheck = 14400; // 2hours + } else { + this.nextAppUpdateCheck = 1800; // 15mins + } if (this.autoUpdateVRCX !== 'Off') { this.checkForVRCXUpdate(); } @@ -6517,7 +6521,8 @@ speechSynthesis.getVoices(); } }; - $app.methods.login = function () { + $app.methods.login = async function () { + await webApiService.clearCookies(); this.$refs.loginForm.validate((valid) => { if (valid && !this.loginForm.loading) { this.loginForm.loading = true; @@ -12252,6 +12257,10 @@ speechSynthesis.getVoices(); $app.data.openVR = configRepository.getBool('openVR'); $app.data.openVRAlways = configRepository.getBool('openVRAlways'); $app.data.overlaybutton = configRepository.getBool('VRCX_overlaybutton'); + $app.data.overlayHand = configRepository.getInt('VRCX_overlayHand'); + if (typeof $app.data.overlayHand !== 'number') { + $app.data.overlayHand = 0; + } $app.data.hidePrivateFromFeed = configRepository.getBool( 'VRCX_hidePrivateFromFeed' ); @@ -12367,6 +12376,11 @@ speechSynthesis.getVoices(); configRepository.setBool('openVR', this.openVR); configRepository.setBool('openVRAlways', this.openVRAlways); configRepository.setBool('VRCX_overlaybutton', this.overlaybutton); + this.overlayHand = parseInt(this.overlayHand, 10); + if (isNaN(this.overlayHand)) { + this.overlayHand = 0; + } + configRepository.setInt('VRCX_overlayHand', this.overlayHand); configRepository.setBool( 'VRCX_hidePrivateFromFeed', this.hidePrivateFromFeed @@ -12426,6 +12440,7 @@ speechSynthesis.getVoices(); this.updateVRConfigVars(); this.updateVRLastLocation(); AppApi.ExecuteVrOverlayFunction('notyClear', ''); + this.updateOpenVR(this.isGameRunning, this.isSteamVRRunning); }; $app.methods.saveSortFavoritesOption = function () { this.getLocalWorldFavorites(); @@ -12991,15 +13006,16 @@ speechSynthesis.getVoices(); ) { hmdOverlay = true; } - // active, hmdOverlay, wristOverlay, menuButton + // active, hmdOverlay, wristOverlay, menuButton, overlayHand AppApi.SetVR( true, hmdOverlay, this.overlayWrist, - this.overlaybutton + this.overlaybutton, + this.overlayHand ); } else { - AppApi.SetVR(false, false, false, false); + AppApi.SetVR(false, false, false, false, 0); } }; diff --git a/html/src/index.pug b/html/src/index.pug index 05d65002..981f8631 100644 --- a/html/src/index.pug +++ b/html/src/index.pug @@ -14,6 +14,8 @@ html .x-app#x-app(style="display:none") //- login .x-login-container(v-show="!API.isLoggedIn") + div(style="position:absolute;margin:5px") + el-button(type="default" @click="showVRCXUpdateDialog" size="mini" icon="el-icon-download" circle) div(style="width:300px;margin:auto" v-loading="loginForm.loading") div(style="margin:15px" v-if="Object.keys(loginForm.savedCredentials).length !== 0") h2(style="font-weight:bold;text-align:center;margin:0") Saved Accounts @@ -723,7 +725,7 @@ html template(#tool) div(style="margin:0 0 10px;display:flex;align-items:center") el-select(v-model="playerModerationTable.filters[0].value" @change="saveTableFilters" multiple clearable collapse-tags style="flex:1" placeholder="Filter") - el-option(v-once v-for="type in ['block', 'unblock', 'mute', 'unmute', 'hideAvatar', 'showAvatar', 'interactOn', 'interactOff']" :key="type" :label="type" :value="type") + el-option(v-once v-for="type in ['block', 'unblock', 'mute', 'unmute', 'interactOn', 'interactOff']" :key="type" :label="type" :value="type") 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") @@ -1253,15 +1255,21 @@ html div.options-container-item span.name Wrist Feed Overlay el-switch(v-model="overlayWrist" @change="saveOpenVROption" :disabled="!openVR") - div.options-container-item(style="min-width:118px") - span.name Start overlay with - el-switch(v-model="openVRAlways" @change="saveOpenVROption" inactive-text="VRChat" active-text="SteamVR" :disabled="!openVR") div.options-container-item span.name Hide Private Worlds el-switch(v-model="hidePrivateFromFeed" @change="saveOpenVROption") + div.options-container-item(style="min-width:118px") + span.name Start Overlay With + el-switch(v-model="openVRAlways" @change="saveOpenVROption" inactive-text="VRChat" active-text="SteamVR" :disabled="!openVR") div.options-container-item - span.name(style="min-width:137px") Overlay Button + span.name Overlay Button el-switch(v-model="overlaybutton" @change="saveOpenVROption" inactive-text="Grip" active-text="Menu" :disabled="!openVR || !overlayWrist") + div.options-container-item + span.name Display Overlay On + el-radio-group(v-model="overlayHand" @change="saveOpenVROption" size="mini") + el-radio-button(label="1") Left Hand + el-radio-button(label="2") Right Hand + el-radio-button(label="0") Both Hands div.options-container-item span.name Background Colour el-switch(v-model="vrBackgroundEnabled" @change="saveOpenVROption" :disabled="!openVR || !overlayWrist") @@ -1618,8 +1626,8 @@ html el-dropdown-item(v-else icon="el-icon-circle-close" command="Block" divided :disabled="userDialog.ref.$isModerator") Block el-dropdown-item(v-if="userDialog.isMute" icon="el-icon-microphone" command="Unmute" style="color:#F56C6C") Unmute el-dropdown-item(v-else icon="el-icon-turn-off-microphone" command="Mute" :disabled="userDialog.ref.$isModerator") Mute - el-dropdown-item(v-if="userDialog.isHideAvatar" icon="el-icon-user-solid" command="Show Avatar" style="color:#F56C6C") Show Avatar - el-dropdown-item(v-else icon="el-icon-user" command="Hide Avatar") Hide Avatar + //- el-dropdown-item(v-if="userDialog.isHideAvatar" icon="el-icon-user-solid" command="Show Avatar" style="color:#F56C6C") Show Avatar + //- el-dropdown-item(v-else icon="el-icon-user" command="Hide Avatar") Hide Avatar el-dropdown-item(v-if="userDialog.isInteractOff" icon="el-icon-thumb" command="Enable Avatar Interaction" style="color:#F56C6C") Enable Avatar Interaction el-dropdown-item(v-else icon="el-icon-circle-close" command="Disable Avatar Interaction") Disable Avatar Interaction template(v-if="userDialog.isFriend") @@ -3318,7 +3326,7 @@ html el-button(@click="chatboxBlacklist.push('')" size="mini" style="margin-top:5px") Add Item br h2 User Blacklist - el-tag(v-for="user in chatboxUserBlacklist" type="info" disable-transitions="true" :key="user[0]" style="margin-right:5px" closable @close="deleteChatboxUserBlacklist(user[0])") + el-tag(v-for="user in chatboxUserBlacklist" type="info" disable-transitions="true" :key="user[0]" style="margin-right:5px;margin-top:5px" closable @close="deleteChatboxUserBlacklist(user[0])") span {{user[1]}} //- dialog: open source software notice