| 349 | } |
| 350 | |
| 351 | static 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 | |
| 369 | static SDL_bool WriteSubcommand(SDL_DriverSwitch_Context *ctx, ESwitchSubcommandIDs ucCommandID, Uint8 *pBuf, Uint8 ucLen, SwitchSubcommandInputPacket_t **ppReply) |
| 370 | { |
no test coverage detected