android stub

This commit is contained in:
2026-06-12 08:08:43 +02:00
parent 47eb7c89e0
commit 3f2553a7cc
6 changed files with 88 additions and 3 deletions

View File

@@ -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

View File

@@ -2,7 +2,10 @@
#include "../Public/GunMode.h"
#if PLATFORM_WINDOWS
#include "VS_PC_SDK.h"
#endif
//DEFINE_LOG_CATEGORY(PS_ViveVBS);
@@ -10,6 +13,11 @@
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
}

View File

@@ -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
}
/*

View File

@@ -2,7 +2,10 @@
#include "../Public/Passthrough.h"
#if PLATFORM_WINDOWS
#include "VS_PC_SDK.h"
#endif
//DEFINE_LOG_CATEGORY(PS_ViveVBS);
@@ -10,6 +13,11 @@
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
}

View File

@@ -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"

View File

@@ -20,7 +20,8 @@
"Type": "Runtime",
"LoadingPhase": "Default",
"PlatformAllowList": [
"Win64"
"Win64",
"Android"
]
}
]