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
+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.