Permalink
Browse files

WiimoteDevice: Move CBigEndianBuffer to the cpp file

This is only used internally, so we don't need to expose it in the
header. This also allows getting rid of inclusion of the byte swapping
utilities in the header as well.
  • Loading branch information...
lioncash committed Jun 2, 2018
1 parent f09f83c commit 13e828fd4d7220cf51e0e3a3ee09e09d89509a45
@@ -15,6 +15,7 @@
#include "Common/Logging/Log.h"
#include "Common/MsgHandler.h"
#include "Common/StringUtil.h"
#include "Common/Swap.h"
#include "Core/Core.h"
#include "Core/HW/Wiimote.h"
#include "Core/Host.h"
@@ -26,6 +27,22 @@ namespace IOS
{
namespace HLE
{
class CBigEndianBuffer
{
public:
CBigEndianBuffer(u8* pBuffer) : m_pBuffer(pBuffer) {}
u8 Read8(u32 offset) const { return m_pBuffer[offset]; }
u16 Read16(u32 offset) const { return Common::swap16(*(u16*)&m_pBuffer[offset]); }
u32 Read32(u32 offset) const { return Common::swap32(*(u32*)&m_pBuffer[offset]); }
void Write8(u32 offset, u8 data) { m_pBuffer[offset] = data; }
void Write16(u32 offset, u16 data) { *(u16*)&m_pBuffer[offset] = Common::swap16(data); }
void Write32(u32 offset, u32 data) { *(u32*)&m_pBuffer[offset] = Common::swap32(data); }
u8* GetPointer(u32 offset) { return &m_pBuffer[offset]; }
private:
u8* m_pBuffer;
};
WiimoteDevice::WiimoteDevice(Device::BluetoothEmu* host, int number, bdaddr_t bd, bool ready)
: m_BD(bd),
m_Name(number == WIIMOTE_BALANCE_BOARD ? "Nintendo RVL-WBC-01" : "Nintendo RVL-CNT-01"),
@@ -9,7 +9,6 @@
#include <string>
#include "Common/CommonTypes.h"
#include "Common/Swap.h"
#include "Core/IOS/USB/Bluetooth/hci.h"
class PointerWrap;
@@ -23,22 +22,6 @@ namespace Device
class BluetoothEmu;
}
class CBigEndianBuffer
{
public:
CBigEndianBuffer(u8* pBuffer) : m_pBuffer(pBuffer) {}
u8 Read8(u32 offset) const { return m_pBuffer[offset]; }
u16 Read16(u32 offset) const { return Common::swap16(*(u16*)&m_pBuffer[offset]); }
u32 Read32(u32 offset) const { return Common::swap32(*(u32*)&m_pBuffer[offset]); }
void Write8(u32 offset, u8 data) { m_pBuffer[offset] = data; }
void Write16(u32 offset, u16 data) { *(u16*)&m_pBuffer[offset] = Common::swap16(data); }
void Write32(u32 offset, u32 data) { *(u32*)&m_pBuffer[offset] = Common::swap32(data); }
u8* GetPointer(u32 offset) { return &m_pBuffer[offset]; }
private:
u8* m_pBuffer;
};
class WiimoteDevice
{
public:

0 comments on commit 13e828f

Please sign in to comment.