mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-10 08:09:26 +01:00
Merge pull request #5229 from lioncash/si-id
SI_Devices: Get rid of pointer casts for ID assignment in RunBuffer
This commit is contained in:
commit
394b847b6c
@ -4,6 +4,8 @@
|
|||||||
|
|
||||||
#include "Core/HW/SI/SI_DeviceDanceMat.h"
|
#include "Core/HW/SI/SI_DeviceDanceMat.h"
|
||||||
|
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
#include "InputCommon/GCPadStatus.h"
|
#include "InputCommon/GCPadStatus.h"
|
||||||
|
|
||||||
@ -22,7 +24,9 @@ int CSIDevice_DanceMat::RunBuffer(u8* buffer, int length)
|
|||||||
if (command == CMD_RESET)
|
if (command == CMD_RESET)
|
||||||
{
|
{
|
||||||
ISIDevice::RunBuffer(buffer, length);
|
ISIDevice::RunBuffer(buffer, length);
|
||||||
*(u32*)&buffer[0] = SI_DANCEMAT;
|
|
||||||
|
constexpr u32 id = SI_DANCEMAT;
|
||||||
|
std::memcpy(buffer, &id, sizeof(id));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -4,6 +4,8 @@
|
|||||||
|
|
||||||
#include "Core/HW/SI/SI_DeviceGCController.h"
|
#include "Core/HW/SI/SI_DeviceGCController.h"
|
||||||
|
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
#include "Common/ChunkFile.h"
|
#include "Common/ChunkFile.h"
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
#include "Common/Logging/Log.h"
|
#include "Common/Logging/Log.h"
|
||||||
@ -53,8 +55,11 @@ int CSIDevice_GCController::RunBuffer(u8* buffer, int length)
|
|||||||
{
|
{
|
||||||
case CMD_RESET:
|
case CMD_RESET:
|
||||||
case CMD_ID:
|
case CMD_ID:
|
||||||
*(u32*)&buffer[0] = SI_GC_CONTROLLER;
|
{
|
||||||
|
constexpr u32 id = SI_GC_CONTROLLER;
|
||||||
|
std::memcpy(buffer, &id, sizeof(id));
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case CMD_DIRECT:
|
case CMD_DIRECT:
|
||||||
{
|
{
|
||||||
|
@ -4,6 +4,8 @@
|
|||||||
|
|
||||||
#include "Core/HW/SI/SI_DeviceGCSteeringWheel.h"
|
#include "Core/HW/SI/SI_DeviceGCSteeringWheel.h"
|
||||||
|
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
#include "Common/Logging/Log.h"
|
#include "Common/Logging/Log.h"
|
||||||
#include "Core/HW/GCPad.h"
|
#include "Core/HW/GCPad.h"
|
||||||
@ -28,17 +30,16 @@ int CSIDevice_GCSteeringWheel::RunBuffer(u8* buffer, int length)
|
|||||||
{
|
{
|
||||||
case CMD_RESET:
|
case CMD_RESET:
|
||||||
case CMD_ID:
|
case CMD_ID:
|
||||||
*(u32*)&buffer[0] = SI_GC_STEERING;
|
|
||||||
break;
|
|
||||||
|
|
||||||
// DEFAULT
|
|
||||||
default:
|
|
||||||
{
|
{
|
||||||
return CSIDevice_GCController::RunBuffer(buffer, length);
|
constexpr u32 id = SI_GC_STEERING;
|
||||||
}
|
std::memcpy(buffer, &id, sizeof(id));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
return CSIDevice_GCController::RunBuffer(buffer, length);
|
||||||
|
}
|
||||||
|
|
||||||
return length;
|
return length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,6 +4,8 @@
|
|||||||
|
|
||||||
#include "Core/HW/SI/SI_DeviceKeyboard.h"
|
#include "Core/HW/SI/SI_DeviceKeyboard.h"
|
||||||
|
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
#include "Common/ChunkFile.h"
|
#include "Common/ChunkFile.h"
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
#include "Common/Logging/Log.h"
|
#include "Common/Logging/Log.h"
|
||||||
@ -31,8 +33,11 @@ int CSIDevice_Keyboard::RunBuffer(u8* buffer, int length)
|
|||||||
{
|
{
|
||||||
case CMD_RESET:
|
case CMD_RESET:
|
||||||
case CMD_ID:
|
case CMD_ID:
|
||||||
*(u32*)&buffer[0] = SI_GC_KEYBOARD;
|
{
|
||||||
|
constexpr u32 id = SI_GC_KEYBOARD;
|
||||||
|
std::memcpy(buffer, &id, sizeof(id));
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case CMD_DIRECT:
|
case CMD_DIRECT:
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user