From 3a9e37832a885d4a0e4f03790439c838ce9c692c Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Thu, 25 Jun 2015 20:10:15 -0700 Subject: [PATCH] Specify signedness behavior of char in the API. Fixes backwards scrolling on Rasbian where char is unsigned by default --- limelight-common/Input.h | 10 +++++----- limelight-common/InputStream.c | 10 +++++----- limelight-common/Limelight.h | 6 +++--- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/limelight-common/Input.h b/limelight-common/Input.h index da36fe0..1951080 100644 --- a/limelight-common/Input.h +++ b/limelight-common/Input.h @@ -42,8 +42,8 @@ typedef struct _NV_CONTROLLER_PACKET { int headerA; short headerB; short buttonFlags; - char leftTrigger; - char rightTrigger; + unsigned char leftTrigger; + unsigned char rightTrigger; short leftStickX; short leftStickY; short rightStickX; @@ -67,8 +67,8 @@ typedef struct _NV_MULTI_CONTROLLER_PACKET { short midA; short midB; short buttonFlags; - char leftTrigger; - char rightTrigger; + unsigned char leftTrigger; + unsigned char rightTrigger; short leftStickX; short leftStickY; short rightStickX; @@ -89,4 +89,4 @@ typedef struct _NV_SCROLL_PACKET { short zero3; } NV_SCROLL_PACKET, *PNV_SCROLL_PACKET; -#pragma pack(pop) \ No newline at end of file +#pragma pack(pop) diff --git a/limelight-common/InputStream.c b/limelight-common/InputStream.c index 7c14ea1..5b67fb5 100644 --- a/limelight-common/InputStream.c +++ b/limelight-common/InputStream.c @@ -387,7 +387,7 @@ int LiSendKeyboardEvent(short keyCode, char keyAction, char modifiers) { return err; } -static int sendControllerEventInternal(short controllerNumber, short buttonFlags, char leftTrigger, char rightTrigger, +static int sendControllerEventInternal(short controllerNumber, short buttonFlags, unsigned char leftTrigger, unsigned char rightTrigger, short leftStickX, short leftStickY, short rightStickX, short rightStickY) { PPACKET_HOLDER holder; @@ -448,7 +448,7 @@ static int sendControllerEventInternal(short controllerNumber, short buttonFlags } /* Send a controller event to the streaming machine */ -int LiSendControllerEvent(short buttonFlags, char leftTrigger, char rightTrigger, +int LiSendControllerEvent(short buttonFlags, unsigned char leftTrigger, unsigned char rightTrigger, short leftStickX, short leftStickY, short rightStickX, short rightStickY) { return sendControllerEventInternal(0, buttonFlags, leftTrigger, rightTrigger, @@ -456,7 +456,7 @@ int LiSendControllerEvent(short buttonFlags, char leftTrigger, char rightTrigger } /* Send a controller event to the streaming machine */ -int LiSendMultiControllerEvent(short controllerNumber, short buttonFlags, char leftTrigger, char rightTrigger, +int LiSendMultiControllerEvent(short controllerNumber, short buttonFlags, unsigned char leftTrigger, unsigned char rightTrigger, short leftStickX, short leftStickY, short rightStickX, short rightStickY) { return sendControllerEventInternal(controllerNumber, buttonFlags, leftTrigger, rightTrigger, @@ -464,7 +464,7 @@ int LiSendMultiControllerEvent(short controllerNumber, short buttonFlags, char l } /* Send a scroll event to the streaming machine */ -int LiSendScrollEvent(char scrollClicks) { +int LiSendScrollEvent(signed char scrollClicks) { PPACKET_HOLDER holder; int err; @@ -492,4 +492,4 @@ int LiSendScrollEvent(char scrollClicks) { } return err; -} \ No newline at end of file +} diff --git a/limelight-common/Limelight.h b/limelight-common/Limelight.h index ab17c18..700e5f0 100644 --- a/limelight-common/Limelight.h +++ b/limelight-common/Limelight.h @@ -206,18 +206,18 @@ int LiSendKeyboardEvent(short keyCode, char keyAction, char modifiers); // This function queues a controller event to be sent to the remote server. It will // be seen by the computer as the first controller. -int LiSendControllerEvent(short buttonFlags, char leftTrigger, char rightTrigger, +int LiSendControllerEvent(short buttonFlags, unsigned char leftTrigger, unsigned char rightTrigger, short leftStickX, short leftStickY, short rightStickX, short rightStickY); // This function queues a controller event to be sent to the remote server. The controllerNumber // parameter is a zero-based index of which controller this event corresponds to. The largest legal // controller number is 3 (for a total of 4 controllers, the Xinput maximum). On generation 3 servers (GFE 2.1.x), // these will be sent as controller 0 regardless of the controllerNumber parameter. -int LiSendMultiControllerEvent(short controllerNumber, short buttonFlags, char leftTrigger, char rightTrigger, +int LiSendMultiControllerEvent(short controllerNumber, short buttonFlags, unsigned char leftTrigger, unsigned char rightTrigger, short leftStickX, short leftStickY, short rightStickX, short rightStickY); // This function queues a vertical scroll event to the remote server. -int LiSendScrollEvent(char scrollClicks); +int LiSendScrollEvent(signed char scrollClicks); #ifdef __cplusplus }