diff --git a/src/ControlStream.c b/src/ControlStream.c index d61f31f..713ba09 100644 --- a/src/ControlStream.c +++ b/src/ControlStream.c @@ -490,27 +490,27 @@ static void controlReceiveThreadFunc(void* context) { if (ctlHdr->type == packetTypes[IDX_RUMBLE_DATA]) { BYTE_BUFFER bb; - BbInitializeWrappedBuffer(&bb, event.packet->data, sizeof(*ctlHdr), event.packet->dataLength - sizeof(*ctlHdr), BYTE_ORDER_LITTLE); + BbInitializeWrappedBuffer(&bb, (char*)event.packet->data, sizeof(*ctlHdr), event.packet->dataLength - sizeof(*ctlHdr), BYTE_ORDER_LITTLE); BbAdvanceBuffer(&bb, 4); unsigned short controllerNumber; unsigned short lowFreqRumble; unsigned short highFreqRumble; - BbGetShort(&bb, &controllerNumber); - BbGetShort(&bb, &lowFreqRumble); - BbGetShort(&bb, &highFreqRumble); + BbGetShort(&bb, (short*)&controllerNumber); + BbGetShort(&bb, (short*)&lowFreqRumble); + BbGetShort(&bb, (short*)&highFreqRumble); ListenerCallbacks.rumble(controllerNumber, lowFreqRumble, highFreqRumble); } else if (ctlHdr->type == packetTypes[IDX_TERMINATION]) { BYTE_BUFFER bb; - BbInitializeWrappedBuffer(&bb, event.packet->data, sizeof(*ctlHdr), event.packet->dataLength - sizeof(*ctlHdr), BYTE_ORDER_LITTLE); + BbInitializeWrappedBuffer(&bb, (char*)event.packet->data, sizeof(*ctlHdr), event.packet->dataLength - sizeof(*ctlHdr), BYTE_ORDER_LITTLE); unsigned short terminationReason; - BbGetShort(&bb, &terminationReason); + BbGetShort(&bb, (short*)&terminationReason); Limelog("Server notified termination reason: 0x%04x\n", terminationReason); diff --git a/src/PlatformSockets.h b/src/PlatformSockets.h index 9792162..39c92f1 100644 --- a/src/PlatformSockets.h +++ b/src/PlatformSockets.h @@ -76,3 +76,6 @@ int setNonFatalRecvTimeoutMs(SOCKET s, int timeoutMs); void setRecvTimeout(SOCKET s, int timeoutSec); void closeSocket(SOCKET s); int isPrivateNetworkAddress(struct sockaddr_storage* address); + +int initializePlatformSockets(void); +void cleanupPlatformSockets(void); \ No newline at end of file