Add LiGetHostFeatureFlags() API

This commit is contained in:
Cameron Gutman
2023-08-03 22:09:30 -05:00
parent 0f17b4d0c5
commit 325518b47a
4 changed files with 22 additions and 6 deletions

View File

@@ -1226,7 +1226,7 @@ int LiSendTouchEvent(uint8_t eventType, uint32_t pointerId, float x, float y, fl
}
// This is a protocol extension only supported with Sunshine
if (!(SunshineFeatureFlags & SS_FF_PEN_TOUCH_EVENTS)) {
if (!(SunshineFeatureFlags & LI_FF_PEN_TOUCH_EVENTS)) {
return LI_ERR_UNSUPPORTED;
}
@@ -1275,7 +1275,7 @@ int LiSendPenEvent(uint8_t eventType, uint8_t toolType, uint8_t penButtons,
}
// This is a protocol extension only supported with Sunshine
if (!(SunshineFeatureFlags & SS_FF_PEN_TOUCH_EVENTS)) {
if (!(SunshineFeatureFlags & LI_FF_PEN_TOUCH_EVENTS)) {
return LI_ERR_UNSUPPORTED;
}
@@ -1368,7 +1368,7 @@ int LiSendControllerTouchEvent(uint8_t controllerNumber, uint8_t eventType, uint
}
// This is a protocol extension only supported with Sunshine
if (!(SunshineFeatureFlags & SS_FF_CONTROLLER_TOUCH_EVENTS)) {
if (!(SunshineFeatureFlags & LI_FF_CONTROLLER_TOUCH_EVENTS)) {
return LI_ERR_UNSUPPORTED;
}
@@ -1416,7 +1416,7 @@ int LiSendControllerMotionEvent(uint8_t controllerNumber, uint8_t motionType, fl
}
// This is a protocol extension only supported with Sunshine
if (!(SunshineFeatureFlags & SS_FF_CONTROLLER_TOUCH_EVENTS)) {
if (!(SunshineFeatureFlags & LI_FF_CONTROLLER_TOUCH_EVENTS)) {
return LI_ERR_UNSUPPORTED;
}

View File

@@ -41,8 +41,6 @@ extern uint16_t VideoPortNumber;
extern SS_PING AudioPingPayload;
extern SS_PING VideoPingPayload;
#define SS_FF_PEN_TOUCH_EVENTS 0x01
#define SS_FF_CONTROLLER_TOUCH_EVENTS 0x02
extern uint32_t SunshineFeatureFlags;
// ENet channel ID values

View File

@@ -624,6 +624,9 @@ int LiSendMouseMoveAsMousePositionEvent(short deltaX, short deltaY, short refere
//
// If unsupported by the host, this will return LI_ERR_UNSUPPORTED and the caller should consider
// falling back to other functions to send this input (such as LiSendMousePositionEvent()).
//
// To determine if LiSendTouchEvent() is supported without calling it, call LiGetHostFeatureFlags()
// and check for the LI_FF_PEN_TOUCH_EVENTS flag.
#define LI_TOUCH_EVENT_HOVER 0x00
#define LI_TOUCH_EVENT_DOWN 0x01
#define LI_TOUCH_EVENT_UP 0x02
@@ -642,6 +645,9 @@ int LiSendTouchEvent(uint8_t eventType, uint32_t pointerId, float x, float y, fl
//
// x, y, pressure, rotation, contact area, and tilt are ignored for LI_TOUCH_EVENT_BUTTON_ONLY events.
// If one of those changes, send LI_TOUCH_EVENT_MOVE or LI_TOUCH_EVENT_HOVER instead.
//
// To determine if LiSendPenEvent() is supported without calling it, call LiGetHostFeatureFlags()
// and check for the LI_FF_PEN_TOUCH_EVENTS flag.
#define LI_TOOL_TYPE_UNKNOWN 0x00
#define LI_TOOL_TYPE_PEN 0x01
#define LI_TOOL_TYPE_ERASER 0x02
@@ -762,6 +768,9 @@ int LiSendControllerArrivalEvent(uint8_t controllerNumber, uint16_t activeGamepa
//
// If unsupported by the host, this will return LI_ERR_UNSUPPORTED and the caller should consider
// using this touch input to simulate trackpad input.
//
// To determine if LiSendControllerTouchEvent() is supported without calling it, call LiGetHostFeatureFlags()
// and check for the LI_FF_CONTROLLER_TOUCH_EVENTS flag.
int LiSendControllerTouchEvent(uint8_t controllerNumber, uint8_t eventType, uint32_t pointerId, float x, float y, float pressure);
// This function allows clients to send controller-associated motion events to a supported host.
@@ -934,6 +943,11 @@ bool LiGetHdrMetadata(PSS_HDR_METADATA metadata);
// frame, just that an IDR frame will arrive soon.
void LiRequestIdrFrame(void);
// This function returns any extended feature flags supported by the host.
#define LI_FF_PEN_TOUCH_EVENTS 0x01 // LiSendTouchEvent()/LiSendPenEvent() supported
#define LI_FF_CONTROLLER_TOUCH_EVENTS 0x02 // LiSendControllerTouchEvent() supported
uint32_t LiGetHostFeatureFlags(void);
#ifdef __cplusplus
}
#endif

View File

@@ -155,3 +155,7 @@ void LiInitializeServerInformation(PSERVER_INFORMATION serverInfo) {
uint64_t LiGetMillis(void) {
return PltGetMillis();
}
uint32_t LiGetHostFeatureFlags(void) {
return SunshineFeatureFlags;
}