Add overlayHand option, small fixes

This commit is contained in:
Natsumi
2022-11-22 18:33:07 +13:00
parent c1afe3b59b
commit b0c41c6d08
4 changed files with 65 additions and 34 deletions
+4 -3
View File
@@ -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() public void RefreshVR()
@@ -391,6 +391,7 @@ namespace VRCX
} }
private static readonly MD5 _hasher = MD5.Create(); private static readonly MD5 _hasher = MD5.Create();
public int GetColourFromUserID(string userId) public int GetColourFromUserID(string userId)
{ {
var hash = _hasher.ComputeHash(Encoding.UTF8.GetBytes(userId)); var hash = _hasher.ComputeHash(Encoding.UTF8.GetBytes(userId));
@@ -439,4 +440,4 @@ namespace VRCX
} }
} }
} }
} }
+24 -18
View File
@@ -41,6 +41,7 @@ namespace VRCX
private bool _hmdOverlayActive; private bool _hmdOverlayActive;
private bool _wristOverlayActive; private bool _wristOverlayActive;
private bool _menuButton; private bool _menuButton;
private int _overlayHand;
static VRCXVR() 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 // https://stackoverflow.com/questions/38312597/how-to-choose-a-specific-graphics-device-in-sharpdx-directx-11/38596725#38596725
Factory f = new Factory1(); Factory f = new Factory1();
Adapter a = f.GetAdapter(1); Adapter a = f.GetAdapter(1);
DeviceCreationFlags flags = DeviceCreationFlags.BgraSupport; DeviceCreationFlags flags = DeviceCreationFlags.BgraSupport;
_device = Program.GPUFix ? new Device(a, flags) : new Device(DriverType.Hardware, DeviceCreationFlags.SingleThreaded | 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); Thread.Sleep(32);
} }
catch(ThreadInterruptedException) catch (ThreadInterruptedException)
{ {
} }
@@ -245,15 +246,15 @@ namespace VRCX
_texture2.Dispose(); _texture2.Dispose();
_texture1.Dispose(); _texture1.Dispose();
_device.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; _active = active;
_hmdOverlayActive = hmdOverlay; _hmdOverlayActive = hmdOverlay;
_wristOverlayActive = wristOverlay; _wristOverlayActive = wristOverlay;
_menuButton = menuButton; _menuButton = menuButton;
_overlayHand = overlayHand;
} }
public void Refresh() public void Refresh()
@@ -309,23 +310,28 @@ namespace VRCX
// Vive : Menu, Bit 1, Mask 2, // Vive : Menu, Bit 1, Mask 2,
// Vive : Grip, Bit 2, Mask 4 // Vive : Grip, Bit 2, Mask 4
var role = system.GetControllerRoleForTrackedDeviceIndex(i); var role = system.GetControllerRoleForTrackedDeviceIndex(i);
if (role == ETrackedControllerRole.LeftHand || if (role == ETrackedControllerRole.LeftHand || role == ETrackedControllerRole.RightHand)
role == ETrackedControllerRole.RightHand)
{ {
if (system.GetControllerState(i, ref state, (uint)Marshal.SizeOf(state)) && if (_overlayHand == 0 ||
(state.ulButtonPressed & (_menuButton ? 2u : (isOculus ? 128u : 4u))) != 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); if (role == ETrackedControllerRole.LeftHand)
Array.Copy(_rotationLeft, _rotation, 3); {
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; var type = string.Empty;
@@ -642,4 +648,4 @@ namespace VRCX
return err; return err;
} }
} }
} }
+21 -5
View File
@@ -4519,7 +4519,11 @@ speechSynthesis.getVoices();
} }
} }
if (--this.nextAppUpdateCheck <= 0) { 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') { if (this.autoUpdateVRCX !== 'Off') {
this.checkForVRCXUpdate(); 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) => { this.$refs.loginForm.validate((valid) => {
if (valid && !this.loginForm.loading) { if (valid && !this.loginForm.loading) {
this.loginForm.loading = true; this.loginForm.loading = true;
@@ -12252,6 +12257,10 @@ speechSynthesis.getVoices();
$app.data.openVR = configRepository.getBool('openVR'); $app.data.openVR = configRepository.getBool('openVR');
$app.data.openVRAlways = configRepository.getBool('openVRAlways'); $app.data.openVRAlways = configRepository.getBool('openVRAlways');
$app.data.overlaybutton = configRepository.getBool('VRCX_overlaybutton'); $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( $app.data.hidePrivateFromFeed = configRepository.getBool(
'VRCX_hidePrivateFromFeed' 'VRCX_hidePrivateFromFeed'
); );
@@ -12367,6 +12376,11 @@ speechSynthesis.getVoices();
configRepository.setBool('openVR', this.openVR); configRepository.setBool('openVR', this.openVR);
configRepository.setBool('openVRAlways', this.openVRAlways); configRepository.setBool('openVRAlways', this.openVRAlways);
configRepository.setBool('VRCX_overlaybutton', this.overlaybutton); 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( configRepository.setBool(
'VRCX_hidePrivateFromFeed', 'VRCX_hidePrivateFromFeed',
this.hidePrivateFromFeed this.hidePrivateFromFeed
@@ -12426,6 +12440,7 @@ speechSynthesis.getVoices();
this.updateVRConfigVars(); this.updateVRConfigVars();
this.updateVRLastLocation(); this.updateVRLastLocation();
AppApi.ExecuteVrOverlayFunction('notyClear', ''); AppApi.ExecuteVrOverlayFunction('notyClear', '');
this.updateOpenVR(this.isGameRunning, this.isSteamVRRunning);
}; };
$app.methods.saveSortFavoritesOption = function () { $app.methods.saveSortFavoritesOption = function () {
this.getLocalWorldFavorites(); this.getLocalWorldFavorites();
@@ -12991,15 +13006,16 @@ speechSynthesis.getVoices();
) { ) {
hmdOverlay = true; hmdOverlay = true;
} }
// active, hmdOverlay, wristOverlay, menuButton // active, hmdOverlay, wristOverlay, menuButton, overlayHand
AppApi.SetVR( AppApi.SetVR(
true, true,
hmdOverlay, hmdOverlay,
this.overlayWrist, this.overlayWrist,
this.overlaybutton this.overlaybutton,
this.overlayHand
); );
} else { } else {
AppApi.SetVR(false, false, false, false); AppApi.SetVR(false, false, false, false, 0);
} }
}; };
+16 -8
View File
@@ -14,6 +14,8 @@ html
.x-app#x-app(style="display:none") .x-app#x-app(style="display:none")
//- login //- login
.x-login-container(v-show="!API.isLoggedIn") .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="width:300px;margin:auto" v-loading="loginForm.loading")
div(style="margin:15px" v-if="Object.keys(loginForm.savedCredentials).length !== 0") div(style="margin:15px" v-if="Object.keys(loginForm.savedCredentials).length !== 0")
h2(style="font-weight:bold;text-align:center;margin:0") Saved Accounts h2(style="font-weight:bold;text-align:center;margin:0") Saved Accounts
@@ -723,7 +725,7 @@ html
template(#tool) template(#tool)
div(style="margin:0 0 10px;display:flex;align-items:center") 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-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-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-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-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 div.options-container-item
span.name Wrist Feed Overlay span.name Wrist Feed Overlay
el-switch(v-model="overlayWrist" @change="saveOpenVROption" :disabled="!openVR") 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 div.options-container-item
span.name Hide Private Worlds span.name Hide Private Worlds
el-switch(v-model="hidePrivateFromFeed" @change="saveOpenVROption") 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 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") 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 div.options-container-item
span.name Background Colour span.name Background Colour
el-switch(v-model="vrBackgroundEnabled" @change="saveOpenVROption" :disabled="!openVR || !overlayWrist") 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-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-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-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-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-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-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 el-dropdown-item(v-else icon="el-icon-circle-close" command="Disable Avatar Interaction") Disable Avatar Interaction
template(v-if="userDialog.isFriend") template(v-if="userDialog.isFriend")
@@ -3318,7 +3326,7 @@ html
el-button(@click="chatboxBlacklist.push('')" size="mini" style="margin-top:5px") Add Item el-button(@click="chatboxBlacklist.push('')" size="mini" style="margin-top:5px") Add Item
br br
h2 User Blacklist 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]}} span {{user[1]}}
//- dialog: open source software notice //- dialog: open source software notice