From 3f2553a7cc6407fa116cd67b80bfafa84654569f Mon Sep 17 00:00:00 2001 From: "j.foucher" Date: Fri, 12 Jun 2026 08:08:43 +0200 Subject: [PATCH] android stub --- .../Source/ViveVBS/Private/Global.cpp | 21 ++++++++++ .../Source/ViveVBS/Private/GunMode.cpp | 11 ++++- .../Source/ViveVBS/Private/MBLS.cpp | 42 +++++++++++++++++++ .../Source/ViveVBS/Private/Passthrough.cpp | 11 ++++- .../Source/ViveVBS/Private/ViveVBS.cpp | 3 ++ .../Plugins/PS_ViveVBS/ViveVBS.uplugin | 3 +- 6 files changed, 88 insertions(+), 3 deletions(-) diff --git a/Unreal/PS_ViveVBS/Plugins/PS_ViveVBS/Source/ViveVBS/Private/Global.cpp b/Unreal/PS_ViveVBS/Plugins/PS_ViveVBS/Source/ViveVBS/Private/Global.cpp index ee063e9..90a86cb 100644 --- a/Unreal/PS_ViveVBS/Plugins/PS_ViveVBS/Source/ViveVBS/Private/Global.cpp +++ b/Unreal/PS_ViveVBS/Plugins/PS_ViveVBS/Source/ViveVBS/Private/Global.cpp @@ -2,7 +2,10 @@ #include "../Public/Global.h" + +#if PLATFORM_WINDOWS #include "VS_PC_SDK.h" +#endif DEFINE_LOG_CATEGORY(PS_ViveVBS); @@ -11,6 +14,7 @@ DEFINE_LOG_CATEGORY(PS_ViveVBS); int UGlobal::markerState = 0; +#if PLATFORM_WINDOWS void OnServerStatusUpdate(wchar_t* strName, wchar_t* strValue) { if (wcscmp(strName, L"3011") == 0) @@ -36,14 +40,26 @@ void OnSDKDebugLog(const wchar_t* log) { UE_LOG(PS_ViveVBS, Display, TEXT("OnSDKDebugLog : strName:%s\n"), log); } +#endif // PLATFORM_WINDOWS int UGlobal::VBS_GetVersion() { +#if !PLATFORM_WINDOWS + // VBS SDK is Windows-only: stub so Blueprint calls resolve without crashing. + return 0; +#else return VS_Version(); +#endif } int UGlobal::VBS_Init() { +#if !PLATFORM_WINDOWS + // VBS SDK is Windows-only: stub reports failure so calibration/menu logic treats VBS as unavailable. + UGlobal::markerState = 0; + UE_LOG(PS_ViveVBS, Display, TEXT("VBS_Init : stub, VBS SDK not available on this platform")); + return -1; +#else int retCode = VS_Init(); UGlobal::markerState = 0; @@ -58,11 +74,16 @@ int UGlobal::VBS_Init() } return retCode; +#endif // PLATFORM_WINDOWS } int UGlobal::VBS_Release() { +#if !PLATFORM_WINDOWS + return -1; +#else return VS_Release(); +#endif } #undef LOCTEXT_NAMESPACE \ No newline at end of file diff --git a/Unreal/PS_ViveVBS/Plugins/PS_ViveVBS/Source/ViveVBS/Private/GunMode.cpp b/Unreal/PS_ViveVBS/Plugins/PS_ViveVBS/Source/ViveVBS/Private/GunMode.cpp index 790bdc3..5468ba4 100644 --- a/Unreal/PS_ViveVBS/Plugins/PS_ViveVBS/Source/ViveVBS/Private/GunMode.cpp +++ b/Unreal/PS_ViveVBS/Plugins/PS_ViveVBS/Source/ViveVBS/Private/GunMode.cpp @@ -2,14 +2,22 @@ #include "../Public/GunMode.h" + +#if PLATFORM_WINDOWS #include "VS_PC_SDK.h" +#endif //DEFINE_LOG_CATEGORY(PS_ViveVBS); #define LOCTEXT_NAMESPACE "VBS" -bool UGunMode::VBS_SetGunMode(const bool active) +bool UGunMode::VBS_SetGunMode(const bool active) { +#if !PLATFORM_WINDOWS + // VBS SDK is Windows-only: stub so Blueprint calls resolve and report failure. + UE_LOG(PS_ViveVBS, Display, TEXT("VBS_SetGunMode(%d) : stub, VBS SDK not available on this platform"), active ? 1 : 0); + return false; +#else bool success = false; if (active) { @@ -36,6 +44,7 @@ bool UGunMode::VBS_SetGunMode(const bool active) } } return success; +#endif // PLATFORM_WINDOWS } diff --git a/Unreal/PS_ViveVBS/Plugins/PS_ViveVBS/Source/ViveVBS/Private/MBLS.cpp b/Unreal/PS_ViveVBS/Plugins/PS_ViveVBS/Source/ViveVBS/Private/MBLS.cpp index 236d530..e961249 100644 --- a/Unreal/PS_ViveVBS/Plugins/PS_ViveVBS/Source/ViveVBS/Private/MBLS.cpp +++ b/Unreal/PS_ViveVBS/Plugins/PS_ViveVBS/Source/ViveVBS/Private/MBLS.cpp @@ -3,7 +3,14 @@ #include "../Public/MBLS.h" #include "../Public/Global.h" + +#if PLATFORM_WINDOWS #include "VS_PC_SDK.h" +#else +// VBS SDK is Windows-only: on other platforms every function below is a stub +// returning failure, so Blueprint calls resolve without crashing. +#define VBS_STUB_LOG(FuncName) UE_LOG(PS_ViveVBS, Display, TEXT(FuncName " : stub, VBS SDK not available on this platform")) +#endif //DEFINE_LOG_CATEGORY(PS_ViveVBS); @@ -11,6 +18,10 @@ bool UMBLS::DefineSingleArcuoMarker(const int32 IDMarker1, const float sizeMarker1, const float height) { +#if !PLATFORM_WINDOWS + VBS_STUB_LOG("DefineSingleArcuoMarker"); + return false; +#else UE_LOG(PS_ViveVBS, Display, TEXT("DefineArcuoMarker ID : %d - Size : %f"), IDMarker1, sizeMarker1); const FString parameters = FString::Printf(TEXT("PLAYER00InitMA{\"marker1\":{\"id\":%d,\"behavior\":3,\"size\":%f,\"pose\":[0,0,0,1,0,%f,0]}}"), IDMarker1, sizeMarker1, height); @@ -25,10 +36,15 @@ bool UMBLS::DefineSingleArcuoMarker(const int32 IDMarker1, const float sizeMarke UE_LOG(PS_ViveVBS, Display, TEXT("Define Single ArcuoMarker : FAILED")); return false; } +#endif // PLATFORM_WINDOWS } bool UMBLS::DefineTwoArcuoMarker(const int32 IDMarker1, const int32 IDMarker2, const float sizeMarker, const float height) { +#if !PLATFORM_WINDOWS + VBS_STUB_LOG("DefineTwoArcuoMarker"); + return false; +#else UE_LOG(PS_ViveVBS, Display, TEXT("DefineTwoArcuoMarker ID : %d - ID2 : %d - Size : %f"), IDMarker1, IDMarker2, sizeMarker); FString parameters = FString::Printf(TEXT("PLAYER00InitMA{\"marker1\":{\"id\":%d,\"behavior\":3,\"size\":%f,\"isMainMarker\":true,\"pairMarkerID\":%d,\"pose\":[0,0,0,1,0,%f,0]},\"marker2\":{\"id\":%d,\"behavior\":3,\"size\":%f,\"isMainMarker\":false,\"pairMarkerID\":%d,\"pose\":[0,0,0,1,0,%f,0]}}"), IDMarker1, sizeMarker, IDMarker2, height, IDMarker2, sizeMarker, IDMarker1, height); @@ -43,6 +59,7 @@ bool UMBLS::DefineTwoArcuoMarker(const int32 IDMarker1, const int32 IDMarker2, c UE_LOG(PS_ViveVBS, Display, TEXT("Define Two ArcuoMarker : FAILED")); return false; } +#endif // PLATFORM_WINDOWS } /* @@ -70,24 +87,32 @@ bool UMBLS::RecenterXForm() { UE_LOG(LogInit, Display, TEXT("RecenterXForm")); +#if !PLATFORM_WINDOWS + return false; +#else bool success = true; success = success && VS_WVRSetParameters(DEVICE_TYPE_HMD, L"ClearRecenterXform"); success = success && VS_WVRSetParameters(DEVICE_TYPE_CONTROLLER_RIGHT, L"ClearRecenterXform"); success = success && VS_WVRSetParameters(DEVICE_TYPE_CONTROLLER_LEFT, L"ClearRecenterXform"); return success; +#endif } bool UMBLS::RecenterXFormTR() { UE_LOG(LogInit, Display, TEXT("RecenterXFormTR")); +#if !PLATFORM_WINDOWS + return false; +#else bool success = true; success = success && VS_WVRSetParameters(DEVICE_TYPE_HMD, L"ClearRecenterXformTR"); success = success && VS_WVRSetParameters(DEVICE_TYPE_CONTROLLER_RIGHT, L"ClearRecenterXformTR"); success = success && VS_WVRSetParameters(DEVICE_TYPE_CONTROLLER_LEFT, L"ClearRecenterXformTR"); return success; +#endif } bool UMBLS::StartMarkerScanning() @@ -95,6 +120,10 @@ bool UMBLS::StartMarkerScanning() UE_LOG(LogInit, Display, TEXT("StartMarkerScanning")); UGlobal::markerState = 0; +#if !PLATFORM_WINDOWS + VBS_STUB_LOG("StartMarkerScanning"); + return false; +#else if (VS_WVRGetParameters(DEVICE_TYPE_HMD, L"PLAYER00StartScan")) { UE_LOG(PS_ViveVBS, Display, TEXT("StartMarkerScanning : SUCCESS")); @@ -105,12 +134,16 @@ bool UMBLS::StartMarkerScanning() UE_LOG(PS_ViveVBS, Display, TEXT("StartMarkerScanning : FAILED")); return false; } +#endif // PLATFORM_WINDOWS } bool UMBLS::StopMarkerScanning() { UE_LOG(LogInit, Display, TEXT("StopMarkerScanning")); +#if !PLATFORM_WINDOWS + return false; +#else if (VS_WVRGetParameters(DEVICE_TYPE_HMD, L"PLAYER00StopScan")) { UE_LOG(PS_ViveVBS, Display, TEXT("StopMarkerScanning : SUCCESS")); @@ -121,12 +154,16 @@ bool UMBLS::StopMarkerScanning() UE_LOG(PS_ViveVBS, Display, TEXT("StopMarkerScanning : FAILED")); return false; } +#endif // PLATFORM_WINDOWS } int32 UMBLS::CheckScanStatus() { UE_LOG(LogInit, Display, TEXT("CheckMarkerScanning")); +#if !PLATFORM_WINDOWS + return 0; +#else if (VS_WVRGetParameters(DEVICE_TYPE_HMD, L"PLAYER00CheckMA")) { UE_LOG(PS_ViveVBS, Display, TEXT("CheckMarkerScanning : SUCCESS - Value is %d"), UGlobal::markerState); @@ -137,6 +174,7 @@ int32 UMBLS::CheckScanStatus() UE_LOG(PS_ViveVBS, Display, TEXT("CheckMarkerScanning : FAILED")); return 0; } +#endif // PLATFORM_WINDOWS } void UMBLS::ResetMarkerState() @@ -147,11 +185,15 @@ void UMBLS::ResetMarkerState() int32 UMBLS::RetrievePreviousScan() { +#if !PLATFORM_WINDOWS + return 0; +#else CheckScanStatus(); VS_WVRSetParameters(DEVICE_TYPE_HMD, L"ClearRecenterXform"); VS_WVRSetParameters(DEVICE_TYPE_CONTROLLER_RIGHT, L"ClearRecenterXform"); VS_WVRSetParameters(DEVICE_TYPE_CONTROLLER_LEFT, L"ClearRecenterXform"); return UGlobal::markerState; +#endif } /* diff --git a/Unreal/PS_ViveVBS/Plugins/PS_ViveVBS/Source/ViveVBS/Private/Passthrough.cpp b/Unreal/PS_ViveVBS/Plugins/PS_ViveVBS/Source/ViveVBS/Private/Passthrough.cpp index 613a9a6..c65eef7 100644 --- a/Unreal/PS_ViveVBS/Plugins/PS_ViveVBS/Source/ViveVBS/Private/Passthrough.cpp +++ b/Unreal/PS_ViveVBS/Plugins/PS_ViveVBS/Source/ViveVBS/Private/Passthrough.cpp @@ -2,14 +2,22 @@ #include "../Public/Passthrough.h" + +#if PLATFORM_WINDOWS #include "VS_PC_SDK.h" +#endif //DEFINE_LOG_CATEGORY(PS_ViveVBS); #define LOCTEXT_NAMESPACE "VBS" -bool UPassthrough::VBS_SetPassthrough(const bool active) +bool UPassthrough::VBS_SetPassthrough(const bool active) { +#if !PLATFORM_WINDOWS + // VBS SDK is Windows-only: stub so Blueprint calls resolve and report failure. + UE_LOG(PS_ViveVBS, Display, TEXT("VBS_SetPassthrough(%d) : stub, VBS SDK not available on this platform"), active ? 1 : 0); + return false; +#else bool success = false; if (active) { @@ -36,6 +44,7 @@ bool UPassthrough::VBS_SetPassthrough(const bool active) } } return success; +#endif // PLATFORM_WINDOWS } diff --git a/Unreal/PS_ViveVBS/Plugins/PS_ViveVBS/Source/ViveVBS/Private/ViveVBS.cpp b/Unreal/PS_ViveVBS/Plugins/PS_ViveVBS/Source/ViveVBS/Private/ViveVBS.cpp index a9a3dfe..32e7264 100644 --- a/Unreal/PS_ViveVBS/Plugins/PS_ViveVBS/Source/ViveVBS/Private/ViveVBS.cpp +++ b/Unreal/PS_ViveVBS/Plugins/PS_ViveVBS/Source/ViveVBS/Private/ViveVBS.cpp @@ -1,7 +1,10 @@ // Copyright Asterion VR. All right reserved #include "ViveVBS.h" + +#if PLATFORM_WINDOWS #include "VS_PC_SDK.h" +#endif #define LOCTEXT_NAMESPACE "FViveVBSModule" diff --git a/Unreal/PS_ViveVBS/Plugins/PS_ViveVBS/ViveVBS.uplugin b/Unreal/PS_ViveVBS/Plugins/PS_ViveVBS/ViveVBS.uplugin index 12bdbaf..a1b58a7 100644 --- a/Unreal/PS_ViveVBS/Plugins/PS_ViveVBS/ViveVBS.uplugin +++ b/Unreal/PS_ViveVBS/Plugins/PS_ViveVBS/ViveVBS.uplugin @@ -20,7 +20,8 @@ "Type": "Runtime", "LoadingPhase": "Default", "PlatformAllowList": [ - "Win64" + "Win64", + "Android" ] } ]