MCPcopy Create free account
hub / github.com/RavEngine/RavEngine / WritePacket

Function WritePacket

deps/SDL2/src/joystick/hidapi/SDL_hidapi_switch.c:351–367  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

349}
350
351static SDL_bool WritePacket(SDL_DriverSwitch_Context *ctx, void *pBuf, Uint8 ucLen)
352{
353 Uint8 rgucBuf[k_unSwitchMaxOutputPacketLength];
354 const size_t unWriteSize = ctx->m_bUsingBluetooth ? k_unSwitchBluetoothPacketLength : k_unSwitchUSBPacketLength;
355
356 if (ucLen > k_unSwitchOutputPacketDataLength) {
357 return SDL_FALSE;
358 }
359
360 if (ucLen < unWriteSize) {
361 SDL_memcpy(rgucBuf, pBuf, ucLen);
362 SDL_memset(rgucBuf+ucLen, 0, unWriteSize-ucLen);
363 pBuf = rgucBuf;
364 ucLen = (Uint8)unWriteSize;
365 }
366 return (WriteOutput(ctx, (Uint8 *)pBuf, ucLen) >= 0);
367}
368
369static SDL_bool WriteSubcommand(SDL_DriverSwitch_Context *ctx, ESwitchSubcommandIDs ucCommandID, Uint8 *pBuf, Uint8 ucLen, SwitchSubcommandInputPacket_t **ppReply)
370{

Callers 3

WriteSubcommandFunction · 0.85
WriteProprietaryFunction · 0.85
WriteRumbleFunction · 0.85

Calls 3

SDL_memcpyFunction · 0.85
SDL_memsetFunction · 0.85
WriteOutputFunction · 0.85

Tested by

no test coverage detected