Merge branch 'master' into alpha-kung

This commit is contained in:
Kung-vr
2019-03-03 00:27:35 +09:00
53 changed files with 978 additions and 764 deletions
+7 -1
View File
@@ -165,7 +165,8 @@ SteamIVRInput::SteamIVRInput()
m_snapTurnLeft( input_strings::k_actionSnapTurnLeft,
ActionType::Digital ),
m_snapTurnRight( input_strings::k_actionSnapTurnRight,
ActionType::Digital )
ActionType::Digital ),
m_pushToTalk( input_strings::k_actionPushToTalk, ActionType::Digital )
{
m_activeActionSet.ulActionSet = m_mainSet.handle();
m_activeActionSet.ulRestrictedToDevice = vr::k_ulInvalidInputValueHandle;
@@ -295,6 +296,11 @@ bool SteamIVRInput::snapTurnRight()
return isDigitalActionActivatedOnce( m_snapTurnRight );
}
bool SteamIVRInput::pushToTalk()
{
return isDigitalActionActivatedConstant( m_pushToTalk );
}
/*!
Updates the active action set(s).
Should be called every frame, or however often you want the input system to
+8
View File
@@ -36,6 +36,7 @@ public:
SteamIVRInput();
void UpdateStates();
bool nextSong();
bool previousSong();
bool pausePlaySong();
@@ -56,6 +57,8 @@ public:
bool snapTurnLeft();
bool snapTurnRight();
bool pushToTalk();
// Destructor. There are no terminating calls for the IVRInput API, so it
// is left blank.
~SteamIVRInput() {}
@@ -101,6 +104,9 @@ private:
Action m_resetOffsets;
Action m_snapTurnLeft;
Action m_snapTurnRight;
// Push To Talk
Action m_pushToTalk;
};
/*!
@@ -141,6 +147,8 @@ namespace input_strings
constexpr auto k_actionSnapTurnLeft = "/actions/main/in/SnapTurnLeft";
constexpr auto k_actionSnapTurnRight = "/actions/main/in/SnapTurnRight";
constexpr auto k_actionPushToTalk = "/actions/main/in/PushToTalk";
constexpr auto k_setMain = "/actions/main";
} // namespace input_strings
+67 -25
View File
@@ -351,17 +351,23 @@ void OverlayController::SetWidget( QQuickItem* quickItem,
QOpenGLFramebufferObject::CombinedDepthStencil );
fboFormat.setTextureTarget( GL_TEXTURE_2D );
m_pFbo.reset( new QOpenGLFramebufferObject(
quickItem->width(), quickItem->height(), fboFormat ) );
static_cast<int>( quickItem->width() ),
static_cast<int>( quickItem->height() ),
fboFormat ) );
m_pRenderControl.reset( new QQuickRenderControl() );
m_pWindow.reset( new QQuickWindow( m_pRenderControl.get() ) );
m_pWindow->setRenderTarget( m_pFbo.get() );
quickItem->setParentItem( m_pWindow->contentItem() );
m_pWindow->setGeometry( 0, 0, quickItem->width(), quickItem->height() );
m_pWindow->setGeometry( 0,
0,
static_cast<int>( quickItem->width() ),
static_cast<int>( quickItem->height() ) );
m_pRenderControl->initialize( m_pOpenGLContext.get() );
vr::HmdVector2_t vecWindowSize
= { ( float ) quickItem->width(), ( float ) quickItem->height() };
= { static_cast<float>( quickItem->width() ),
static_cast<float>( quickItem->height() ) };
vr::VROverlay()->SetOverlayMouseScale( m_ulOverlayHandle,
&vecWindowSize );
@@ -425,11 +431,12 @@ void OverlayController::renderOverlay()
#if defined _WIN64 || defined _LP64
// To avoid any compiler warning because of cast to a larger pointer
// type (warning C4312 on VC)
vr::Texture_t texture = { ( void* ) ( ( uint64_t ) unTexture ),
vr::Texture_t texture = { reinterpret_cast<void*>(
static_cast<uint64_t>( unTexture ) ),
vr::TextureType_OpenGL,
vr::ColorSpace_Auto };
#else
vr::Texture_t texture = { ( void* ) unTexture,
vr::Texture_t texture = { reinterpret_cast<void*>( unTexture ),
vr::TextureType_OpenGL,
vr::ColorSpace_Auto };
#endif
@@ -458,20 +465,13 @@ QPoint OverlayController::getMousePositionForEvent( vr::VREvent_Mouse_t mouse )
{
float y = mouse.y;
#ifdef __linux__
float h = ( float ) m_pWindow->height();
float h = static_cast<float>( m_pWindow->height() );
y = h - y;
#endif
return QPoint( mouse.x, y );
return QPoint( static_cast<int>( mouse.x ), static_cast<int>( y ) );
}
/*!
Checks if an action has been activated and dispatches the related action if it
has been.
This function should probably be split into several functions that are specific
to a binding type as the amount of actions grows.
*/
void OverlayController::processInputBindings()
void OverlayController::processMediaKeyBindings()
{
if ( m_actions.nextSong() )
{
@@ -489,6 +489,10 @@ void OverlayController::processInputBindings()
{
m_utilitiesTabController.sendMediaStopSong();
}
}
void OverlayController::processRoomBindings()
{
// Execution order for moveCenterTabController actions is important. Don't
// reorder these. Override actions must always come after normal because
// active priority is set based on which action is "newest"
@@ -522,6 +526,39 @@ void OverlayController::processInputBindings()
m_actions.swapSpaceDragToRightHandOverride() );
}
void OverlayController::processPushToTalkBindings()
{
const auto pushToTalkCannotChange = !m_audioTabController.pttChangeValid();
if ( pushToTalkCannotChange )
{
return;
}
const auto pushToTalkButtonActivated = m_actions.pushToTalk();
const auto pushToTalkCurrentlyActive = m_audioTabController.pttActive();
if ( pushToTalkButtonActivated && !pushToTalkCurrentlyActive )
{
m_audioTabController.startPtt();
}
else if ( !pushToTalkButtonActivated && pushToTalkCurrentlyActive )
{
m_audioTabController.stopPtt();
}
}
/*!
Checks if an action has been activated and dispatches the related action if it
has been.
*/
void OverlayController::processInputBindings()
{
processMediaKeyBindings();
processRoomBindings();
processPushToTalkBindings();
}
// vsync implementation:
// (this function triggers every 1ms)
void OverlayController::OnTimeoutPumpEvents()
@@ -578,7 +615,7 @@ void OverlayController::mainEventLoop()
m_pWindow->mapToGlobal( ptNewMouse ),
Qt::NoButton,
m_lastMouseButtons,
0 );
nullptr );
m_ptLastMouse = ptNewMouse;
QCoreApplication::sendEvent( m_pWindow.get(), &mouseEvent );
OnRenderRequest();
@@ -599,7 +636,7 @@ void OverlayController::mainEventLoop()
m_pWindow->mapToGlobal( ptNewMouse ),
button,
m_lastMouseButtons,
0 );
nullptr );
QCoreApplication::sendEvent( m_pWindow.get(), &mouseEvent );
}
break;
@@ -617,7 +654,7 @@ void OverlayController::mainEventLoop()
m_pWindow->mapToGlobal( ptNewMouse ),
button,
m_lastMouseButtons,
0 );
nullptr );
QCoreApplication::sendEvent( m_pWindow.get(), &mouseEvent );
}
break;
@@ -629,12 +666,14 @@ void OverlayController::mainEventLoop()
m_ptLastMouse,
m_pWindow->mapToGlobal( m_ptLastMouse ),
QPoint(),
QPoint( vrEvent.data.scroll.xdelta * 360.0f * 8.0f,
vrEvent.data.scroll.ydelta * 360.0f * 8.0f ),
QPoint( static_cast<int>( vrEvent.data.scroll.xdelta
* ( 360.0f * 8.0f ) ),
static_cast<int>( vrEvent.data.scroll.ydelta
* ( 360.0f * 8.0f ) ) ),
0,
Qt::Vertical,
m_lastMouseButtons,
0 );
nullptr );
QCoreApplication::sendEvent( m_pWindow.get(), &wheelEvent );
}
break;
@@ -654,9 +693,11 @@ void OverlayController::mainEventLoop()
m_chaperoneTabController.shutdown();
Shutdown();
QApplication::exit();
return;
LOG( INFO ) << "All systems exited.";
exit( EXIT_SUCCESS );
// Does not fallthrough
}
break;
case vr::VREvent_DashboardActivated:
{
@@ -677,7 +718,8 @@ void OverlayController::mainEventLoop()
char keyboardBuffer[1024];
vr::VROverlay()->GetKeyboardText( keyboardBuffer, 1024 );
emit keyBoardInputSignal( QString( keyboardBuffer ),
vrEvent.data.keyboard.uUserValue );
static_cast<unsigned long>(
vrEvent.data.keyboard.uUserValue ) );
}
break;
@@ -1065,7 +1107,7 @@ void OverlayController::playAlarm01Sound( bool loop )
void OverlayController::setAlarm01SoundVolume( float vol )
{
m_alarm01SoundEffect.setVolume( vol );
m_alarm01SoundEffect.setVolume( static_cast<double>( vol ) );
}
void OverlayController::cancelAlarm01Sound()
+5 -2
View File
@@ -89,7 +89,7 @@ private:
bool m_dashboardVisible = false;
QPoint m_ptLastMouse;
Qt::MouseButtons m_lastMouseButtons = 0;
Qt::MouseButtons m_lastMouseButtons = nullptr;
bool m_desktopMode;
bool m_noSound;
@@ -128,6 +128,9 @@ public: // I know it's an ugly hack to make them public to enable external
private:
QPoint getMousePositionForEvent( vr::VREvent_Mouse_t mouse );
void processInputBindings();
void processMediaKeyBindings();
void processRoomBindings();
void processPushToTalkBindings();
public:
OverlayController( bool desktopMode, bool noSound, QQmlEngine& qmlEngine );
@@ -167,7 +170,7 @@ public:
bool isDesktopMode()
{
return m_desktopMode;
};
}
utils::ChaperoneUtils& chaperoneUtils() noexcept
{
+8 -1
View File
@@ -100,6 +100,11 @@
"name": "/actions/main/in/SnapTurnRight",
"requirement": "optional",
"type": "boolean"
},
{
"name": "/actions/main/in/PushToTalk",
"requirement": "optional",
"type": "boolean"
}
],
"action_sets": [
@@ -132,7 +137,9 @@
"/actions/main/in/HeightToggle" : "Height Toggle",
"/actions/main/in/ResetOffsets" : "Reset Offsets",
"/actions/main/in/SnapTurnLeft" : "Snap-Turn Left",
"/actions/main/in/SnapTurnRight" : "Snap-Turn Right"
"/actions/main/in/SnapTurnRight" : "Snap-Turn Right",
"/actions/main/in/PushToTalk" : "Push To Talk"
}
]
}
-47
View File
@@ -362,39 +362,6 @@ MyStackViewPage {
AudioTabController.pttEnabled = checked
}
}
RowLayout {
spacing: 18
MyComboBox {
Layout.leftMargin: 78
id: summaryPttProfileComboBox
Layout.maximumWidth: 378
Layout.minimumWidth: 378
Layout.preferredWidth: 378
Layout.fillWidth: true
model: [""]
onCurrentIndexChanged: {
if (currentIndex > 0) {
summaryPttProfileApplyButton.enabled = true
} else {
summaryPttProfileApplyButton.enabled = false
}
}
}
MyPushButton {
id: summaryPttProfileApplyButton
enabled: false
Layout.preferredWidth: 150
text: "Apply"
onClicked: {
if (summaryPttProfileComboBox.currentIndex > 0) {
AudioTabController.applyPttProfile(summaryPttProfileComboBox.currentIndex - 1)
summaryPttProfileComboBox.currentIndex = 0
}
}
}
}
}
Item {
@@ -417,7 +384,6 @@ MyStackViewPage {
Component.onCompleted: {
reloadChaperoneProfiles()
reloadSteamVRProfiles()
reloadPttProfiles()
summaryVersionText.text = applicationVersion
@@ -454,9 +420,6 @@ MyStackViewPage {
Connections {
target: AudioTabController
onPttProfilesUpdated: {
reloadPttProfiles()
}
onMicVolumeChanged: {
summaryMicVolumeSlider.value = AudioTabController.micVolume
}
@@ -540,14 +503,4 @@ MyStackViewPage {
summarySteamVRProfileComboBox.currentIndex = 0
summarySteamVRProfileComboBox.model = profiles
}
function reloadPttProfiles() {
var profiles = [""]
var profileCount = AudioTabController.getPttProfileCount()
for (var i = 0; i < profileCount; i++) {
profiles.push(AudioTabController.getPttProfileName(i))
}
summaryPttProfileComboBox.currentIndex = 0
summaryPttProfileComboBox.model = profiles
}
}
@@ -45,7 +45,7 @@ RowLayout {
setShownAudioDevice(index)
}
onPlaybackDeviceListChanged: {
audioPlaybackNameCombo.devices = getAudioDeviceList()
audioMirrorNameCombo.devices = getAudioDeviceList()
setShownAudioDevice(AudioTabController.playbackDeviceIndex)
}
}
@@ -10,18 +10,10 @@ ColumnLayout {
id: audioMessageDialog
}
PttDeleteProfileDialog {
id: pttDeleteProfileDialog
}
AudioDeleteProfileDialog {
id: audioDeleteProfileDialog
}
PttNewProfileDialog {
id: pttNewProfileDialog
}
AudioNewProfileDialog {
id: audioNewProfileDialog
}
@@ -61,38 +53,9 @@ ColumnLayout {
}
}
}
MyText {
text: "PTT Profile:"
Layout.preferredWidth: 150
}
MyComboBox {
id: pttProfileComboBox
Layout.preferredWidth: 250
model: [""]
onCurrentIndexChanged: {
if (currentIndex > 0) {
pttApplyProfileButton.enabled = true
pttDeleteProfileButton.enabled = true
} else {
pttApplyProfileButton.enabled = false
pttDeleteProfileButton.enabled = false
}
}
}
MyPushButton {
id: pttApplyProfileButton
enabled: true
Layout.preferredWidth: 150
text: "Apply"
onClicked: {
if (pttProfileComboBox.currentIndex > 0) {
AudioTabController.applyPttProfile(
pttProfileComboBox.currentIndex - 1)
}
}
// Text continues in next RowLayout.
text: "Change the Push To Talk settings"
}
}
RowLayout {
@@ -117,62 +80,27 @@ ColumnLayout {
audioNewProfileDialog.openPopup()
}
}
Item {
Layout.fillWidth: true
}
MyPushButton {
id: pttDeleteProfileButton
enabled: true
Layout.preferredWidth: 200
text: "Delete Profile"
onClicked: {
if (pttProfileComboBox.currentIndex > 0) {
pttDeleteProfileDialog.profileIndex = pttProfileComboBox.currentIndex - 1
pttDeleteProfileDialog.open()
}
}
}
MyPushButton {
Layout.preferredWidth: 200
text: "New Profile"
onClicked: {
pttNewProfileDialog.openPopup()
}
MyText {
// Text continues from RowLayout above.
text: "\t\tin the SteamVR bindings menu."
}
}
Component.onCompleted: {
reloadPttProfiles()
reloadAudioProfiles()
}
Connections {
target: AudioTabController
onPttProfilesUpdated: {
reloadPttProfiles()
}
onAudioProfilesUpdated: {
reloadAudioProfiles()
}
onAudioProfileAdded: {
audioProfileComboBox.currentIndex = AudioTabController.getAudioProfileCount()
}
onPttProfileAdded: {
pttProfileComboBox.currentIndex = AudioTabController.getPttProfileCount()
}
onDefaultProfileDisplay: {
audioProfileComboBox.currentIndex = AudioTabController.getDefaultAudioProfileIndex(
) + 1
}
}
function reloadPttProfiles() {
var profiles = [""]
var profileCount = AudioTabController.getPttProfileCount()
for (var i = 0; i < profileCount; i++) {
profiles.push(AudioTabController.getPttProfileName(i))
}
pttProfileComboBox.currentIndex = 0
pttProfileComboBox.model = profiles
}
function reloadAudioProfiles() {
var profiles = [""]
var profileCount = AudioTabController.getAudioProfileCount()
@@ -6,54 +6,17 @@ import "../../common"
ColumnLayout {
RowLayout {
PttControllerConfigDialog {
id: pttControllerConfigDialog
pttControllerConfigClass: AudioTabController
}
MyToggleButton {
id: audioPttEnabledToggle
Layout.preferredWidth: 260
Layout.fillWidth: true
text: "Push-to-Talk:"
onClicked: {
AudioTabController.pttEnabled = checked
}
}
MyToggleButton {
id: audioPttLeftControllerToggle
text: "Left Controller"
onClicked: {
AudioTabController.setPttLeftControllerEnabled(checked, false)
}
}
MyPushButton {
text: "Configure"
onClicked: {
pttControllerConfigDialog.openPopup(0)
}
}
Item {
Layout.fillWidth: true
}
MyToggleButton {
id: audioPttRightControllerToggle
text: "Right Controller"
onClicked: {
AudioTabController.setPttRightControllerEnabled(checked, false)
}
}
MyPushButton {
text: "Configure"
onClicked: {
pttControllerConfigDialog.openPopup(1)
}
}
}
RowLayout {
MyToggleButton {
id: audioPttShowNotificationToggle
Layout.leftMargin: 350
Layout.fillWidth: true
text: "Show notification in HMD"
onCheckedChanged: {
AudioTabController.setPttShowNotification(checked, false)
@@ -61,7 +24,7 @@ ColumnLayout {
}
MyToggleButton {
id: audioPttReverseToggle
Layout.leftMargin: 118
Layout.fillWidth: true
text: "Push-to-Mute"
onClicked: {
AudioTabController.setMicReversePtt(checked, false)
@@ -71,8 +34,6 @@ ColumnLayout {
Component.onCompleted: {
audioPttEnabledToggle.checked = AudioTabController.pttEnabled
audioPttLeftControllerToggle.checked = AudioTabController.pttLeftControllerEnabled
audioPttRightControllerToggle.checked = AudioTabController.pttRightControllerEnabled
audioPttShowNotificationToggle.checked = AudioTabController.pttShowNotification
audioPttReverseToggle.checked = AudioTabController.micReversePtt
}
@@ -81,12 +42,6 @@ ColumnLayout {
onPttEnabledChanged: {
audioPttEnabledToggle.checked = AudioTabController.pttEnabled
}
onPttLeftControllerEnabledChanged: {
audioPttLeftControllerToggle.checked = AudioTabController.pttLeftControllerEnabled
}
onPttRightControllerEnabledChanged: {
audioPttRightControllerToggle.checked = AudioTabController.pttRightControllerEnabled
}
onMicReversePttChanged: {
audioPttReverseToggle.checked = AudioTabController.micReversePtt
}
@@ -1,148 +0,0 @@
import QtQuick 2.7
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.3
import matzman666.advsettings 1.0
MyDialogOkCancelPopup {
id: pttControllerConfigDialog
property var pttControllerConfigClass
property int controllerIndex: -1
dialogTitle: "Controller Configuration"
dialogWidth: 600
dialogHeight: 620
dialogContentItem: ColumnLayout {
MyText {
text: "Buttons"
}
Rectangle {
color: "#cccccc"
height: 1
Layout.fillWidth: true
}
MyToggleButton {
id: pttControllerConfigGripButtonToggle
text: "Grip"
}
MyToggleButton {
id: pttControllerConfigMenuButtonToggle
text: "Menu"
}
MyToggleButton {
id: pttControllerConfigTriggerButtonToggle
text: "Trigger"
}
MyText {
Layout.topMargin: 32
text: "Touchpad"
}
Rectangle {
color: "#cccccc"
height: 1
Layout.fillWidth: true
}
RowLayout {
spacing: 64
MyToggleButton {
id: pttControllerConfigPadLeftToggle
text: "Left"
}
MyToggleButton {
id: pttControllerConfigPadRightToggle
text: "Right"
}
}
RowLayout {
spacing: 64
MyToggleButton {
id: pttControllerConfigPadTopToggle
text: "Top"
}
MyToggleButton {
id: pttControllerConfigPadBottomToggle
text: "Bottom"
}
}
RowLayout {
MyText {
text: "Mode:"
}
MyComboBox {
id: pttControllerConfigPadModeCombo
Layout.preferredWidth: 250
model: ["Disabled", "Touched", "Pressed"]
}
}
}
onClosed: {
if (okClicked) {
var buttons = []
if (pttControllerConfigGripButtonToggle.checked) {
buttons.push(2)
}
if (pttControllerConfigMenuButtonToggle.checked) {
buttons.push(1)
}
var triggerMode = 0
if (pttControllerConfigTriggerButtonToggle.checked) {
triggerMode = 1
}
var padAreas = 0
if (pttControllerConfigPadLeftToggle.checked) {
padAreas |= (1 << 0)
}
if (pttControllerConfigPadTopToggle.checked) {
padAreas |= (1 << 1)
}
if (pttControllerConfigPadRightToggle.checked) {
padAreas |= (1 << 2)
}
if (pttControllerConfigPadBottomToggle.checked) {
padAreas |= (1 << 3)
}
pttControllerConfigClass.setPttControllerConfig(controllerIndex, buttons, triggerMode, pttControllerConfigPadModeCombo.currentIndex, padAreas);
}
}
function openPopup(controller) {
if (controller === 0) {
dialogTitle = "Left Controller Configuration"
controllerIndex = 0
} else {
dialogTitle = "Right Controller Configuration"
controllerIndex = 1
}
pttControllerConfigGripButtonToggle.checked = false
pttControllerConfigMenuButtonToggle.checked = false
pttControllerConfigTriggerButtonToggle.checked = false
pttControllerConfigPadLeftToggle.checked = false
pttControllerConfigPadTopToggle.checked = false
pttControllerConfigPadRightToggle.checked = false
pttControllerConfigPadBottomToggle.checked = false
pttControllerConfigPadModeCombo.currentIndex = pttControllerConfigClass.pttTouchpadMode(controllerIndex)
var buttons = pttControllerConfigClass.pttDigitalButtons(controllerIndex)
for (var i = 0; i < buttons.length; i++) {
if (buttons[i] == 1) {
pttControllerConfigMenuButtonToggle.checked = true
} else if (buttons[i] == 2) {
pttControllerConfigGripButtonToggle.checked = true
}
}
if (pttControllerConfigClass.pttTriggerMode(controllerIndex) > 0) {
pttControllerConfigTriggerButtonToggle.checked = true
}
var padAreas = pttControllerConfigClass.pttTouchpadArea(controllerIndex)
if (padAreas & (1 << 0)) {
pttControllerConfigPadLeftToggle.checked = true
}
if (padAreas & (1 << 1)) {
pttControllerConfigPadTopToggle.checked = true
}
if (padAreas & (1 << 2)) {
pttControllerConfigPadRightToggle.checked = true
}
if (padAreas & (1 << 3)) {
pttControllerConfigPadBottomToggle.checked = true
}
open()
}
}
+1 -1
View File
@@ -11,7 +11,7 @@ class AudioTabController;
class AudioManager
{
public:
virtual ~AudioManager(){};
virtual ~AudioManager() {}
virtual void init( AudioTabController* controller ) = 0;
+2 -2
View File
@@ -750,7 +750,7 @@ void AudioTabController::reloadAudioProfiles()
{
settings->setArrayIndex( i );
audioProfiles.emplace_back();
auto& entry = audioProfiles[i];
auto& entry = audioProfiles[static_cast<size_t>( i )];
entry.profileName
= settings->value( "profileName" ).toString().toStdString();
entry.playbackName
@@ -1044,7 +1044,7 @@ void AudioTabController::applyDefaultProfile()
if ( profile.defaultProfile )
{
applyAudioProfile( i );
m_defaultProfileIndex = i;
m_defaultProfileIndex = static_cast<int>( i );
break;
}
}
+3 -1
View File
@@ -87,7 +87,7 @@ private:
void onPttStop() override;
void onPttEnabled() override;
void onPttDisabled() override;
bool pttChangeValid() override;
virtual vr::VROverlayHandle_t getNotificationOverlayHandle() override
{
return m_ulNotificationOverlayHandle;
@@ -114,6 +114,8 @@ public:
void eventLoopTick();
bool pttChangeValid() override;
int playbackDeviceIndex() const;
int mirrorDeviceIndex() const;
+11 -10
View File
@@ -70,7 +70,7 @@ void ChaperoneTabController::reloadChaperoneProfiles()
{
settings->setArrayIndex( i );
chaperoneProfiles.emplace_back();
auto& entry = chaperoneProfiles[i];
auto& entry = chaperoneProfiles[static_cast<size_t>( i )];
entry.profileName
= settings->value( "profileName" ).toString().toStdString();
entry.includesChaperoneGeometry
@@ -229,7 +229,7 @@ void ChaperoneTabController::saveChaperoneProfiles()
unsigned i = 0;
for ( auto& p : chaperoneProfiles )
{
settings->setArrayIndex( i );
settings->setArrayIndex( static_cast<int>( i ) );
settings->setValue( "profileName",
QString::fromStdString( p.profileName ) );
settings->setValue( "includesChaperoneGeometry",
@@ -564,7 +564,7 @@ void ChaperoneTabController::eventLoopTick(
{
float mod = m_chaperoneVelocityModifier
* std::max( { leftSpeed, rightSpeed, hmdSpeed } );
if ( mod > 0.02 )
if ( mod > 0.02f )
{
m_chaperoneVelocityModifierCurrent += mod;
}
@@ -654,10 +654,10 @@ void ChaperoneTabController::eventLoopTick(
if ( parent->isDashboardVisible() )
{
vr::EVRSettingsError vrSettingsError;
float vis = vr::VRSettings()->GetInt32(
float vis = static_cast<float>( vr::VRSettings()->GetInt32(
vr::k_pch_CollisionBounds_Section,
vr::k_pch_CollisionBounds_ColorGammaA_Int32,
&vrSettingsError );
&vrSettingsError ) );
if ( vrSettingsError != vr::VRSettingsError_None )
{
LOG( WARNING )
@@ -733,9 +733,10 @@ void ChaperoneTabController::setBoundsVisibility( float value, bool notify )
if ( m_visibility != value )
{
m_visibility = value;
vr::VRSettings()->SetInt32( vr::k_pch_CollisionBounds_Section,
vr::k_pch_CollisionBounds_ColorGammaA_Int32,
255 * m_visibility );
vr::VRSettings()->SetInt32(
vr::k_pch_CollisionBounds_Section,
vr::k_pch_CollisionBounds_ColorGammaA_Int32,
static_cast<int32_t>( 255 * m_visibility ) );
vr::VRSettings()->Sync();
if ( notify )
{
@@ -928,7 +929,7 @@ float ChaperoneTabController::chaperoneVelocityModifier() const
Q_INVOKABLE unsigned ChaperoneTabController::getChaperoneProfileCount()
{
return ( unsigned ) chaperoneProfiles.size();
return static_cast<unsigned int>( chaperoneProfiles.size() );
}
Q_INVOKABLE QString
@@ -1244,7 +1245,7 @@ void ChaperoneTabController::flipOrientation()
{
parent->m_moveCenterTabController.reset();
parent->RotateUniverseCenter( vr::TrackingUniverseStanding,
( float ) M_PI );
static_cast<float>( M_PI ) );
}
void ChaperoneTabController::reloadFromDisk()
+15 -12
View File
@@ -86,9 +86,9 @@ void FixFloorTabController::eventLoopTick(
auto& m = devicePoses[referenceController]
.mDeviceToAbsoluteTracking.m;
tempOffsetX = ( double ) m[0][3];
tempOffsetY = ( double ) m[1][3];
tempOffsetZ = ( double ) m[2][3];
tempOffsetX = static_cast<double>( m[0][3] );
tempOffsetY = static_cast<double>( m[1][3] );
tempOffsetZ = static_cast<double>( m[2][3] );
/*
| Intrinsic y-x'-z" rotation matrix:
| cr*cy+sp*sr*sy | cr*sp*sy-cy*sr | cp*sy |
@@ -99,7 +99,8 @@ void FixFloorTabController::eventLoopTick(
pitch = -asin(-sp) [pi/2, -pi/2]
roll = atan2(cp*sr, cp*cr) [pi, -pi], CW
*/
tempRoll = std::atan2( ( double ) m[1][0], ( double ) m[1][1] );
tempRoll = std::atan2( static_cast<double>( m[1][0] ),
static_cast<double>( m[1][1] ) );
measurementCount = 1;
}
}
@@ -109,9 +110,9 @@ void FixFloorTabController::eventLoopTick(
auto& m
= devicePoses[referenceController].mDeviceToAbsoluteTracking.m;
double rollDiff
= std::atan2( ( double ) m[1][0], ( double ) m[1][1] )
- tempRoll;
double rollDiff = std::atan2( static_cast<double>( m[1][0] ),
static_cast<double>( m[1][1] ) )
- tempRoll;
if ( rollDiff > M_PI )
{
rollDiff -= 2.0 * M_PI;
@@ -120,7 +121,7 @@ void FixFloorTabController::eventLoopTick(
{
rollDiff += 2.0 * M_PI;
}
tempRoll += rollDiff / ( double ) measurementCount;
tempRoll += rollDiff / static_cast<double>( measurementCount );
if ( tempRoll > M_PI )
{
tempRoll -= 2.0 * M_PI;
@@ -134,15 +135,17 @@ void FixFloorTabController::eventLoopTick(
{
if ( std::abs( tempRoll ) <= M_PI_2 )
{
floorOffsetY = tempOffsetY - controllerUpOffsetCorrection;
floorOffsetY = static_cast<float>( tempOffsetY )
- controllerUpOffsetCorrection;
}
else
{
floorOffsetY = tempOffsetY - controllerDownOffsetCorrection;
floorOffsetY = static_cast<float>( tempOffsetY )
- controllerDownOffsetCorrection;
}
floorOffsetX = tempOffsetX;
floorOffsetZ = tempOffsetZ;
floorOffsetX = static_cast<float>( tempOffsetX );
floorOffsetZ = static_cast<float>( tempOffsetZ );
LOG( INFO )
<< "Fix Floor and adjust space center: Floor Offset = ["
+1 -1
View File
@@ -11,7 +11,7 @@ class AudioTabController;
class KeyboardInput
{
public:
virtual ~KeyboardInput(){};
virtual ~KeyboardInput() {}
virtual void sendKeyboardInput( QString input ) = 0;
virtual void sendKeyboardEnter() = 0;
+1 -1
View File
@@ -60,7 +60,7 @@ private:
OverlayController* parent;
QQuickWindow* widget;
int m_trackingUniverse = ( int ) vr::TrackingUniverseStanding;
int m_trackingUniverse = static_cast<int>( vr::TrackingUniverseStanding );
float m_offsetX = 0.0f;
float m_offsetY = 0.0f;
float m_offsetZ = 0.0f;
+17 -121
View File
@@ -43,7 +43,8 @@ void PttController::setPttControllerConfig( unsigned controller,
uint64_t buttonMask = 0;
for ( auto b : buttons )
{
buttonMask |= vr::ButtonMaskFromId( ( vr::EVRButtonId ) b.toInt() );
buttonMask |= vr::ButtonMaskFromId(
( static_cast<vr::EVRButtonId>( b.toInt() ) ) );
}
m_pttControllerConfigs[controller].digitalButtons = buttons;
m_pttControllerConfigs[controller].digitalButtonMask = buttonMask;
@@ -64,7 +65,7 @@ void PttController::reloadPttProfiles()
{
settings->setArrayIndex( i );
pttProfiles.emplace_back();
auto& entry = pttProfiles[i];
auto& entry = pttProfiles[static_cast<size_t>( i )];
entry.profileName
= settings->value( "profileName" ).toString().toStdString();
entry.showNotification
@@ -78,7 +79,8 @@ void PttController::reloadPttProfiles()
uint64_t buttonMask = 0;
for ( auto b : entry.controllerConfigs[0].digitalButtons )
{
buttonMask |= vr::ButtonMaskFromId( ( vr::EVRButtonId ) b.toInt() );
buttonMask |= vr::ButtonMaskFromId(
static_cast<vr::EVRButtonId>( b.toInt() ) );
}
entry.controllerConfigs[0].digitalButtonMask = buttonMask;
entry.controllerConfigs[0].triggerMode
@@ -92,7 +94,8 @@ void PttController::reloadPttProfiles()
buttonMask = 0;
for ( auto b : entry.controllerConfigs[1].digitalButtons )
{
buttonMask |= vr::ButtonMaskFromId( ( vr::EVRButtonId ) b.toInt() );
buttonMask |= vr::ButtonMaskFromId(
static_cast<vr::EVRButtonId>( b.toInt() ) );
}
entry.controllerConfigs[1].digitalButtonMask = buttonMask;
entry.controllerConfigs[1].triggerMode
@@ -114,7 +117,7 @@ void PttController::savePttProfiles()
unsigned i = 0;
for ( auto& p : pttProfiles )
{
settings->setArrayIndex( i );
settings->setArrayIndex( static_cast<int>( i ) );
settings->setValue( "profileName",
QString::fromStdString( p.profileName ) );
settings->setValue( "showNotification", p.showNotification );
@@ -165,7 +168,8 @@ void PttController::reloadPttConfig()
uint64_t buttonMask = 0;
for ( auto b : m_pttControllerConfigs[0].digitalButtons )
{
buttonMask |= vr::ButtonMaskFromId( ( vr::EVRButtonId ) b.toInt() );
buttonMask |= vr::ButtonMaskFromId(
static_cast<vr::EVRButtonId>( b.toInt() ) );
}
m_pttControllerConfigs[0].digitalButtonMask = buttonMask;
m_pttControllerConfigs[0].triggerMode
@@ -179,7 +183,8 @@ void PttController::reloadPttConfig()
buttonMask = 0;
for ( auto b : m_pttControllerConfigs[0].digitalButtons )
{
buttonMask |= vr::ButtonMaskFromId( ( vr::EVRButtonId ) b.toInt() );
buttonMask |= vr::ButtonMaskFromId(
static_cast<vr::EVRButtonId>( b.toInt() ) );
}
m_pttControllerConfigs[1].digitalButtonMask = buttonMask;
m_pttControllerConfigs[1].triggerMode
@@ -222,118 +227,8 @@ void PttController::savePttConfig()
void PttController::checkPttStatus()
{
static auto handleControllerState
= []( const vr::VRControllerState_t& state,
PttControllerConfig* config ) -> bool {
if ( state.ulButtonPressed & config->digitalButtonMask )
{
return true;
}
if ( config->triggerMode )
{
if ( state.ulButtonPressed
& vr::ButtonMaskFromId( vr::k_EButton_SteamVR_Trigger ) )
{
return true;
}
}
if ( config->touchpadMode )
{
if ( ( ( config->touchpadMode & 1 )
&& ( state.ulButtonTouched
& vr::ButtonMaskFromId(
vr::k_EButton_SteamVR_Touchpad ) ) )
|| ( ( config->touchpadMode & 2 )
&& ( state.ulButtonPressed
& vr::ButtonMaskFromId(
vr::k_EButton_SteamVR_Touchpad ) ) ) )
{
if ( config->touchpadAreas
== ( PAD_AREA_LEFT + PAD_AREA_TOP + PAD_AREA_RIGHT
+ PAD_AREA_BOTTOM ) )
{
return true;
}
else
{
float x = state.rAxis[0].x;
float y = state.rAxis[0].y;
if ( std::abs( x ) >= 0.2 || std::abs( y ) >= 0.2 )
{ // deadzone in the middle
if ( x < 0 && std::abs( y ) < -x
&& ( config->touchpadAreas & PAD_AREA_LEFT ) )
{
return true;
}
else if ( y > 0 && std::abs( x ) < y
&& ( config->touchpadAreas & PAD_AREA_TOP ) )
{
return true;
}
else if ( x > 0 && std::abs( y ) < x
&& ( config->touchpadAreas
& PAD_AREA_RIGHT ) )
{
return true;
}
else if ( y < 0 && std::abs( x ) < -y
&& ( config->touchpadAreas
& PAD_AREA_BOTTOM ) )
{
return true;
}
}
}
}
}
return false;
};
if ( m_pttEnabled )
{
bool newState = false;
if ( m_pttLeftControllerEnabled )
{
auto leftId
= vr::VRSystem()->GetTrackedDeviceIndexForControllerRole(
vr::TrackedControllerRole_LeftHand );
if ( leftId != vr::k_unTrackedDeviceIndexInvalid )
{
vr::VRControllerState_t state;
if ( vr::VRSystem()->GetControllerState(
leftId, &state, sizeof( vr::VRControllerState_t ) ) )
{
// logControllerState(state, "Left ");
newState |= handleControllerState( state,
m_pttControllerConfigs );
}
}
}
if ( m_pttRightControllerEnabled )
{
auto rightId
= vr::VRSystem()->GetTrackedDeviceIndexForControllerRole(
vr::TrackedControllerRole_RightHand );
if ( rightId != vr::k_unTrackedDeviceIndexInvalid )
{
vr::VRControllerState_t state;
if ( vr::VRSystem()->GetControllerState(
rightId, &state, sizeof( vr::VRControllerState_t ) ) )
{
// logControllerState(state, "Right ");
newState |= handleControllerState(
state, m_pttControllerConfigs + 1 );
}
}
}
if ( newState && !m_pttActive && pttChangeValid() )
{
startPtt();
}
else if ( !newState && m_pttActive && pttChangeValid() )
{
stopPtt();
}
}
// PTT Controls are now handled in the overlaycontroller using public
// functions.
}
void PttController::startPtt()
@@ -464,7 +359,8 @@ unsigned long PttController::pttDigitalButtonMask( unsigned controller )
{
if ( controller < 2 )
{
return m_pttControllerConfigs[controller].digitalButtonMask;
return static_cast<unsigned long>(
m_pttControllerConfigs[controller].digitalButtonMask );
}
return 0;
}
@@ -498,7 +394,7 @@ unsigned PttController::pttTouchpadArea( unsigned controller )
unsigned PttController::getPttProfileCount()
{
return ( unsigned ) pttProfiles.size();
return static_cast<unsigned int>( pttProfiles.size() );
}
QString PttController::getPttProfileName( unsigned index )
+10 -8
View File
@@ -71,14 +71,11 @@ protected:
protected:
void checkPttStatus();
virtual QString getSettingsName() = 0;
virtual void onPttStart(){};
virtual void onPttStop(){};
virtual void onPttEnabled(){};
virtual void onPttDisabled(){};
virtual bool pttChangeValid()
{
return true;
}
virtual void onPttStart() {}
virtual void onPttStop() {}
virtual void onPttEnabled() {}
virtual void onPttDisabled() {}
virtual vr::VROverlayHandle_t getNotificationOverlayHandle()
{
return vr::k_ulOverlayHandleInvalid;
@@ -100,6 +97,11 @@ public:
void savePttProfiles();
void savePttConfig();
virtual bool pttChangeValid()
{
return true;
}
Q_INVOKABLE QVariantList pttDigitalButtons( unsigned controller );
Q_INVOKABLE unsigned long pttDigitalButtonMask( unsigned controller );
Q_INVOKABLE unsigned pttTouchpadMode( unsigned controller );
+28 -28
View File
@@ -5,25 +5,25 @@
// application namespace
namespace advsettings
{
const char* appkey_overlay = "revive.dashboard.overlay";
const char* section_revive = "revive";
const char* key_pixelsPerDisplayPixel = "pixelsPerDisplayPixel";
const char* key_toggleGrip = "ToggleGrip";
const char* key_triggerAsGrip = "TriggerAsGrip";
const char* key_toggleDelay = "ToggleDelay";
const char* key_thumbDeadzone = "ThumbDeadzone";
const char* key_thumbSensitivity = "ThumbSensitivity";
const char* key_touchPitch = "TouchPitch";
const char* key_touchYaw = "TouchYaw";
const char* key_touchRoll = "TouchRoll";
const char* key_touchX = "TouchX";
const char* key_touchY = "TouchY";
const char* key_touchZ = "TouchZ";
const char* key_playerHeight = "PlayerHeight";
const char* key_eyeHeight = "EyeHeight";
const char* key_piUser = "User";
const char* key_piName = "Name";
const char* key_piGender = "Gender";
constexpr auto appkey_overlay = "revive.dashboard.overlay";
constexpr auto section_revive = "revive";
constexpr auto key_pixelsPerDisplayPixel = "pixelsPerDisplayPixel";
constexpr auto key_toggleGrip = "ToggleGrip";
constexpr auto key_triggerAsGrip = "TriggerAsGrip";
constexpr auto key_toggleDelay = "ToggleDelay";
constexpr auto key_thumbDeadzone = "ThumbDeadzone";
constexpr auto key_thumbSensitivity = "ThumbSensitivity";
constexpr auto key_touchPitch = "TouchPitch";
constexpr auto key_touchYaw = "TouchYaw";
constexpr auto key_touchRoll = "TouchRoll";
constexpr auto key_touchX = "TouchX";
constexpr auto key_touchY = "TouchY";
constexpr auto key_touchZ = "TouchZ";
constexpr auto key_playerHeight = "PlayerHeight";
constexpr auto key_eyeHeight = "EyeHeight";
constexpr auto key_piUser = "User";
constexpr auto key_piName = "Name";
constexpr auto key_piGender = "Gender";
void ReviveTabController::initStage1( bool forceRevivePage )
{
@@ -44,7 +44,7 @@ void ReviveTabController::initStage1( bool forceRevivePage )
}
else
{
if ( valuef == 0.0 )
if ( valuef == 0.0f )
{
m_pixelsPerDisplayPixelOverrideEnabled = false;
m_pixelsPerDisplayPixelOverride = 1.0;
@@ -321,7 +321,7 @@ void ReviveTabController::eventLoopTick()
&vrSettingsError );
if ( vrSettingsError == vr::VRSettingsError_None )
{
if ( valuef == 0.0 )
if ( valuef == 0.0f )
{
setPixelsPerDisplayPixelOverrideEnabled( false );
}
@@ -1015,17 +1015,17 @@ void ReviveTabController::setPiGender( int value, bool notify )
{
m_piGender = value;
vr::EVRSettingsError vrSettingsError;
char* txt;
const char* txt;
switch ( value )
{
case 1:
txt = ( char* ) "Male";
txt = static_cast<const char*>( "Male" );
break;
case 2:
txt = ( char* ) "Female";
txt = static_cast<const char*>( "Female" );
break;
default:
txt = ( char* ) "Unknown";
txt = static_cast<const char*>( "Unknown" );
break;
}
vr::VRSettings()->SetString(
@@ -1207,7 +1207,7 @@ void ReviveTabController::reloadControllerProfiles()
{
settings->setArrayIndex( i );
controllerProfiles.emplace_back();
auto& entry = controllerProfiles[i];
auto& entry = controllerProfiles[static_cast<size_t>( i )];
entry.profileName
= settings->value( "profileName" ).toString().toStdString();
entry.gripButtonMode = settings->value( "gripButtonMode", 0 ).toInt();
@@ -1234,7 +1234,7 @@ void ReviveTabController::saveControllerProfiles()
unsigned i = 0;
for ( auto& p : controllerProfiles )
{
settings->setArrayIndex( i );
settings->setArrayIndex( static_cast<int>( i ) );
settings->setValue( "profileName",
QString::fromStdString( p.profileName ) );
settings->setValue( "gripButtonMode", p.gripButtonMode );
@@ -1255,7 +1255,7 @@ void ReviveTabController::saveControllerProfiles()
Q_INVOKABLE unsigned ReviveTabController::getControllerProfileCount()
{
return ( unsigned ) controllerProfiles.size();
return static_cast<unsigned int>( controllerProfiles.size() );
}
Q_INVOKABLE QString
+10 -10
View File
@@ -48,13 +48,13 @@ void StatisticsTabController::eventLoopTick(
}
else
{
auto delta = std::sqrt(
float delta = static_cast<float>( std::sqrt(
std::pow( m[0][3] - lastHmdPos[0],
2 ) /*+ std::pow(m[1][3] - lastHmdPos[1], 2)*/
+ std::pow( m[2][3] - lastHmdPos[2], 2 ) );
+ std::pow( m[2][3] - lastHmdPos[2], 2 ) ) );
if ( delta >= 0.01f )
{
m_hmdDistanceMoved += delta;
m_hmdDistanceMoved += static_cast<double>( delta );
}
}
lastHmdPos[0] = m[0][3];
@@ -93,7 +93,7 @@ void StatisticsTabController::eventLoopTick(
float StatisticsTabController::hmdDistanceMoved() const
{
return m_hmdDistanceMoved;
return static_cast<float>( m_hmdDistanceMoved );
}
float StatisticsTabController::hmdRotations() const
@@ -133,10 +133,10 @@ unsigned StatisticsTabController::timedOut() const
float StatisticsTabController::totalReprojectedRatio() const
{
float totalFrames = ( float ) ( m_cumStats.m_nNumFramePresents
- m_totalRatioPresentedOffset );
float reprojectedFrames = ( float ) ( m_cumStats.m_nNumReprojectedFrames
- m_totalRatioReprojectedOffset );
float totalFrames = static_cast<float>(
( m_cumStats.m_nNumFramePresents - m_totalRatioPresentedOffset ) );
float reprojectedFrames = static_cast<float>( (
m_cumStats.m_nNumReprojectedFrames - m_totalRatioReprojectedOffset ) );
if ( totalFrames != 0.0f )
{
return reprojectedFrames / totalFrames;
@@ -164,7 +164,7 @@ void StatisticsTabController::statsRotationResetClicked()
void StatisticsTabController::statsLeftControllerSpeedResetClicked()
{
if ( m_leftControllerMaxSpeed != 0.0 )
if ( m_leftControllerMaxSpeed != 0.0f )
{
m_leftControllerMaxSpeed = 0.0;
}
@@ -172,7 +172,7 @@ void StatisticsTabController::statsLeftControllerSpeedResetClicked()
void StatisticsTabController::statsRightControllerSpeedResetClicked()
{
if ( m_rightControllerMaxSpeed != 0.0 )
if ( m_rightControllerMaxSpeed != 0.0f )
{
m_rightControllerMaxSpeed = 0.0;
}
+3 -3
View File
@@ -56,7 +56,7 @@ void SteamVRTabController::eventLoopTick()
<< "\" setting: "
<< vr::VRSettings()->GetSettingsErrorNameFromEnum(
vrSettingsError );
if ( m_superSampling != 1.0 )
if ( m_superSampling != 1.0f )
{
LOG( DEBUG )
<< "OpenVR returns an error and we have a custom "
@@ -204,7 +204,7 @@ void SteamVRTabController::reloadSteamVRProfiles()
{
settings->setArrayIndex( i );
steamvrProfiles.emplace_back();
auto& entry = steamvrProfiles[i];
auto& entry = steamvrProfiles[static_cast<size_t>( i )];
entry.profileName
= settings->value( "profileName" ).toString().toStdString();
entry.includesSupersampling
@@ -243,7 +243,7 @@ void SteamVRTabController::saveSteamVRProfiles()
unsigned i = 0;
for ( auto& p : steamvrProfiles )
{
settings->setArrayIndex( i );
settings->setArrayIndex( static_cast<int>( i ) );
settings->setValue( "profileName",
QString::fromStdString( p.profileName ) );
settings->setValue( "includesSupersampling", p.includesSupersampling );
+10 -8
View File
@@ -12,7 +12,7 @@
// application namespace
namespace advsettings
{
const char* steamDesktopOverlaykey = "valve.steam.desktop";
constexpr auto steamDesktopOverlaykey = "valve.steam.desktop";
void UtilitiesTabController::initStage1()
{
@@ -64,8 +64,8 @@ void UtilitiesTabController::initStage1()
void UtilitiesTabController::initStage2( OverlayController* var_parent,
QQuickWindow* var_widget )
{
this->parent = var_parent;
this->widget = var_widget;
this->m_parent = var_parent;
this->m_widget = var_widget;
}
void UtilitiesTabController::sendKeyboardInput( QString input )
@@ -422,8 +422,9 @@ void UtilitiesTabController::eventLoopTick()
vr::VRNotificationId notificationId;
vr::EVRInitError eError;
vr::IVRNotifications* vrnotification
= ( vr::IVRNotifications* ) vr::VR_GetGenericInterface(
vr::IVRNotifications_Version, &eError );
= static_cast<vr::IVRNotifications*>(
vr::VR_GetGenericInterface(
vr::IVRNotifications_Version, &eError ) );
if ( eError != vr::VRInitError_None )
{
LOG( ERROR )
@@ -467,7 +468,7 @@ void UtilitiesTabController::eventLoopTick()
}
*/
auto nError = vrnotification->CreateNotification(
parent->overlayHandle(),
m_parent->overlayHandle(),
666,
vr::EVRNotificationType_Transient,
alarmMessageBuffer,
@@ -533,7 +534,8 @@ void UtilitiesTabController::eventLoopTick()
i,
vr::ETrackedDeviceProperty::
Prop_DeviceBatteryPercentage_Float );
int batteryState = ceil( battery * 5 );
int batteryState = static_cast<int>(
ceil( static_cast<double>( battery * 5 ) ) );
if ( batteryState != m_batteryState[i] )
{
@@ -582,7 +584,7 @@ void UtilitiesTabController::setSteamDesktopOverlayWidth( float width,
bool notify,
bool notifyOpenVr )
{
if ( std::abs( m_steamDesktopOverlayWidth - width ) > 0.01 )
if ( std::abs( m_steamDesktopOverlayWidth - width ) > 0.01f )
{
m_steamDesktopOverlayWidth = width;
if ( notifyOpenVr )
+3 -3
View File
@@ -33,8 +33,8 @@ class UtilitiesTabController : public QObject
setSteamDesktopOverlayWidth NOTIFY steamDesktopOverlayWidthChanged )
private:
OverlayController* parent;
QQuickWindow* widget;
OverlayController* m_parent;
QQuickWindow* m_widget;
unsigned settingsUpdateCounter = 0;
@@ -53,7 +53,7 @@ private:
public:
void initStage1();
void initStage2( OverlayController* parent, QQuickWindow* widget );
void initStage2( OverlayController* var_parent, QQuickWindow* var_widget );
void eventLoopTick();
@@ -13,7 +13,7 @@ AudioManagerWindows::~AudioManagerWindows()
{
std::lock_guard<std::recursive_mutex> lock( _mutex );
audioDeviceEnumerator->UnregisterEndpointNotificationCallback(
( IMMNotificationClient* ) this );
static_cast<IMMNotificationClient*>( this ) );
if ( mirrorAudioEndpointVolume )
{
mirrorAudioEndpointVolume->Release();
@@ -61,7 +61,7 @@ void AudioManagerWindows::init( AudioTabController* var_controller )
}
this->controller = var_controller;
audioDeviceEnumerator->RegisterEndpointNotificationCallback(
( IMMNotificationClient* ) this );
static_cast<IMMNotificationClient*>( this ) );
policyConfig = getPolicyConfig();
if ( !policyConfig )
{
@@ -370,10 +370,10 @@ IMMDeviceEnumerator* AudioManagerWindows::getAudioDeviceEnumerator()
{
IMMDeviceEnumerator* pEnumerator;
if ( CoCreateInstance( __uuidof( MMDeviceEnumerator ),
NULL,
nullptr,
CLSCTX_ALL,
__uuidof( IMMDeviceEnumerator ),
( void** ) &pEnumerator )
reinterpret_cast<void**>( &pEnumerator ) )
< 0 )
{
return nullptr;
@@ -385,27 +385,28 @@ IPolicyConfig* AudioManagerWindows::getPolicyConfig()
{
IPolicyConfig* var_policyConfig = nullptr;
// for Win 10
auto hr = CoCreateInstance( __uuidof( CPolicyConfigClient ),
NULL,
CLSCTX_INPROC,
IID_IPolicyConfig2,
( LPVOID* ) &var_policyConfig );
auto hr
= CoCreateInstance( __uuidof( CPolicyConfigClient ),
nullptr,
CLSCTX_INPROC,
IID_IPolicyConfig2,
reinterpret_cast<LPVOID*>( &var_policyConfig ) );
if ( hr != S_OK )
{
hr = CoCreateInstance( __uuidof( CPolicyConfigClient ),
NULL,
nullptr,
CLSCTX_INPROC,
IID_IPolicyConfig1,
( LPVOID* ) &var_policyConfig );
reinterpret_cast<LPVOID*>( &var_policyConfig ) );
}
// for Win Vista, 7, 8, 8.1
if ( hr != S_OK )
{
hr = CoCreateInstance( __uuidof( CPolicyConfigClient ),
NULL,
nullptr,
CLSCTX_INPROC,
IID_IPolicyConfig0,
( LPVOID* ) &var_policyConfig );
reinterpret_cast<LPVOID*>( &var_policyConfig ) );
}
if ( hr != S_OK )
{
@@ -470,8 +471,8 @@ IAudioEndpointVolume*
IAudioEndpointVolume* pEndpointVolume;
if ( device->Activate( __uuidof( IAudioEndpointVolume ),
CLSCTX_INPROC_SERVER,
NULL,
( void** ) &pEndpointVolume )
nullptr,
reinterpret_cast<void**>( &pEndpointVolume ) )
< 0 )
{
return nullptr;
@@ -536,16 +537,16 @@ HRESULT AudioManagerWindows::QueryInterface( REFIID riid, void** ppvObject )
if ( IID_IUnknown == riid )
{
AddRef();
*ppvObject = ( IUnknown* ) this;
*ppvObject = static_cast<IUnknown*>( this );
}
else if ( __uuidof( IMMNotificationClient ) == riid )
{
AddRef();
*ppvObject = ( IMMNotificationClient* ) this;
*ppvObject = static_cast<IMMNotificationClient*>( this );
}
else
{
*ppvObject = NULL;
*ppvObject = nullptr;
return E_NOINTERFACE;
}
return S_OK;
@@ -5,7 +5,7 @@
#include <mmdeviceapi.h>
#include <functiondiscoverykeys_devpkey.h>
#include <endpointvolume.h>
#include "IPolicyConfig.h"
#include <IPolicyConfig.h>
#include <mutex>
// application namespace
@@ -1,133 +0,0 @@
// ----------------------------------------------------------------------------
// PolicyConfig.h
// Undocumented COM-interface IPolicyConfig.
// Use for set default audio render endpoint
// @author EreTIk
// ----------------------------------------------------------------------------
#pragma once
// ca286fc3-91fd-42c3-8e9b-caafa66242e3
static const GUID IID_IPolicyConfig2
= { 0xCA286FC3,
0x91FD,
0x42C3,
{ 0x8E, 0x9B, 0xCA, 0xAF, 0xA6, 0x62, 0x42, 0xE3 } };
// 6be54be8-a068-4875-a49d-0c2966473b11
static const GUID IID_IPolicyConfig1
= { 0x6BE54BE8,
0xA068,
0x4875,
{ 0xA4, 0x9D, 0x0C, 0x29, 0x66, 0x47, 0x3B, 0x11 } };
// f8679f50-850a-41cf-9c72-430f290290c8
static const GUID IID_IPolicyConfig0
= { 0xF8679F50,
0x850A,
0x41CF,
{ 0x9C, 0x72, 0x43, 0x0F, 0x29, 0x02, 0x90, 0xC8 } };
class DECLSPEC_UUID( "870af99c-171d-4f9e-af0d-e63df40c2bc9" )
CPolicyConfigClient;
interface IPolicyConfig : public IUnknown
{
public:
virtual HRESULT GetMixFormat( PCWSTR, WAVEFORMATEX** );
virtual HRESULT STDMETHODCALLTYPE GetDeviceFormat(
PCWSTR, INT, WAVEFORMATEX** );
virtual HRESULT STDMETHODCALLTYPE ResetDeviceFormat( PCWSTR );
virtual HRESULT STDMETHODCALLTYPE SetDeviceFormat(
PCWSTR, WAVEFORMATEX*, WAVEFORMATEX* );
virtual HRESULT STDMETHODCALLTYPE GetProcessingPeriod(
PCWSTR, INT, PINT64, PINT64 );
virtual HRESULT STDMETHODCALLTYPE SetProcessingPeriod( PCWSTR, PINT64 );
virtual HRESULT STDMETHODCALLTYPE GetShareMode( PCWSTR,
struct DeviceShareMode* );
virtual HRESULT STDMETHODCALLTYPE SetShareMode( PCWSTR,
struct DeviceShareMode* );
virtual HRESULT STDMETHODCALLTYPE GetPropertyValue(
PCWSTR, int, const PROPERTYKEY&, const PROPVARIANT* );
virtual HRESULT STDMETHODCALLTYPE SetPropertyValue(
PCWSTR, int, const PROPERTYKEY&, const PROPVARIANT* );
virtual HRESULT STDMETHODCALLTYPE SetDefaultEndpoint(
__in PCWSTR wszDeviceId, __in ERole eRole );
virtual HRESULT STDMETHODCALLTYPE SetEndpointVisibility( PCWSTR, INT );
};
interface DECLSPEC_UUID( "568b9108-44bf-40b4-9006-86afe5b5a620" )
IPolicyConfigVista;
class DECLSPEC_UUID( "294935CE-F637-4E7C-A41B-AB255460B862" )
CPolicyConfigVistaClient;
// ----------------------------------------------------------------------------
// class CPolicyConfigVistaClient
// {294935CE-F637-4E7C-A41B-AB255460B862}
//
// interface IPolicyConfigVista
// {568b9108-44bf-40b4-9006-86afe5b5a620}
//
// Query interface:
// CComPtr<IPolicyConfigVista> PolicyConfig;
// PolicyConfig.CoCreateInstance(__uuidof(CPolicyConfigVistaClient));
//
// @compatible: Windows Vista and Later
// ----------------------------------------------------------------------------
interface IPolicyConfigVista : public IUnknown
{
public:
virtual HRESULT GetMixFormat(
PCWSTR,
WAVEFORMATEX** ); // not available on Windows 7, use method from
// IPolicyConfig
virtual HRESULT STDMETHODCALLTYPE GetDeviceFormat(
PCWSTR, INT, WAVEFORMATEX** );
virtual HRESULT STDMETHODCALLTYPE SetDeviceFormat(
PCWSTR, WAVEFORMATEX*, WAVEFORMATEX* );
virtual HRESULT STDMETHODCALLTYPE GetProcessingPeriod(
PCWSTR,
INT,
PINT64,
PINT64 ); // not available on Windows 7, use method from IPolicyConfig
virtual HRESULT STDMETHODCALLTYPE SetProcessingPeriod(
PCWSTR,
PINT64 ); // not available on Windows 7, use method from IPolicyConfig
virtual HRESULT STDMETHODCALLTYPE GetShareMode(
PCWSTR,
struct DeviceShareMode* ); // not available on Windows 7, use method
// from IPolicyConfig
virtual HRESULT STDMETHODCALLTYPE SetShareMode(
PCWSTR,
struct DeviceShareMode* ); // not available on Windows 7, use method
// from IPolicyConfig
virtual HRESULT STDMETHODCALLTYPE GetPropertyValue(
PCWSTR, int, const PROPERTYKEY&, const PROPVARIANT* );
virtual HRESULT STDMETHODCALLTYPE SetPropertyValue(
PCWSTR, int, const PROPERTYKEY&, const PROPVARIANT* );
virtual HRESULT STDMETHODCALLTYPE SetDefaultEndpoint(
__in PCWSTR wszDeviceId, __in ERole eRole );
virtual HRESULT STDMETHODCALLTYPE SetEndpointVisibility(
PCWSTR,
INT ); // not available on Windows 7, use method from IPolicyConfig
};
@@ -33,7 +33,7 @@ void fillKiStruct( INPUT& ip, WORD scanCode, bool keyup )
ip.ki.wScan = 0;
ip.ki.dwExtraInfo = 0;
ip.ki.time = 0;
};
}
/*!
Calls SendInput on an INPUT struct and has associated error handling.
+11 -4
View File
@@ -29,10 +29,14 @@ float ChaperoneUtils::_getDistanceToChaperone(
{ // projected point outside of segment
float d_x = r0.v[0] - x.v[0];
float d_z = r0.v[2] - x.v[2];
float d1 = sqrt( d_x * d_x + d_z * d_z );
// Crazy casts because clang sees the sqrt call as wanting a double.
float d1 = static_cast<float>(
sqrt( static_cast<double>( d_x * d_x + d_z * d_z ) ) );
d_x = r1.v[0] - x.v[0];
d_z = r1.v[2] - x.v[2];
float d2 = sqrt( d_x * d_x + d_z * d_z );
// Crazy casts because clang sees the sqrt call as wanting a double.
float d2 = static_cast<float>(
sqrt( static_cast<double>( d_x * d_x + d_z * d_z ) ) );
if ( d1 < d2 )
{
d = d1;
@@ -52,7 +56,9 @@ float ChaperoneUtils::_getDistanceToChaperone(
x1_z = r0.v[2] + r * u_z;
float d_x = x1_x - x.v[0];
float d_z = x1_z - x.v[2];
d = sqrt( d_x * d_x + d_z * d_z );
// Crazy casts because clang sees the sqrt call as wanting a double.
d = static_cast<float>(
sqrt( static_cast<double>( d_x * d_x + d_z * d_z ) ) );
}
if ( std::isnan( distance ) || d < distance )
{
@@ -77,7 +83,8 @@ void ChaperoneUtils::loadChaperoneData()
std::unique_ptr<vr::HmdQuad_t> quadsBuffer(
new vr::HmdQuad_t[_quadsCount] );
vr::HmdQuad_t* quadsBufferPtr = quadsBuffer.get();
_corners.reset( ( vr::HmdVector3_t* ) new vr::HmdQuad_t[_quadsCount] );
_corners.reset( reinterpret_cast<vr::HmdVector3_t*>(
new vr::HmdQuad_t[_quadsCount] ) );
vr::HmdVector3_t* _cornersPtr = _corners.get();
vr::VRChaperoneSetup()->GetLiveCollisionBoundsInfo( quadsBufferPtr,
&_quadsCount );