Skip to content

Commit

Permalink
Merge pull request #4011 from lioncash/array-exi
Browse files Browse the repository at this point in the history
EXI_Channel: Use std::array
  • Loading branch information
delroth committed Jul 15, 2016
2 parents a9d8a7d + 5b2ddbc commit 7ca32f4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
18 changes: 9 additions & 9 deletions Source/Core/Core/HW/EXI_Channel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ CEXIChannel::CEXIChannel(u32 ChannelId)
if (m_ChannelId == 1)
m_Status.CHIP_SELECT = 1;

for (auto& device : m_pDevices)
for (auto& device : m_devices)
device = EXIDevice_Create(EXIDEVICE_NONE, m_ChannelId);
}

Expand Down Expand Up @@ -161,7 +161,7 @@ void CEXIChannel::SendTransferComplete()

void CEXIChannel::RemoveDevices()
{
for (auto& device : m_pDevices)
for (auto& device : m_devices)
device.reset(nullptr);
}

Expand All @@ -176,7 +176,7 @@ void CEXIChannel::AddDevice(std::unique_ptr<IEXIDevice> device, const int device
_dbg_assert_(EXPANSIONINTERFACE, device_num < NUM_DEVICES);

// Replace it with the new one
m_pDevices[device_num] = std::move(device);
m_devices[device_num] = std::move(device);

if (notify_presence_changed)
{
Expand Down Expand Up @@ -214,11 +214,11 @@ IEXIDevice* CEXIChannel::GetDevice(const u8 chip_select)
switch (chip_select)
{
case 1:
return m_pDevices[0].get();
return m_devices[0].get();
case 2:
return m_pDevices[1].get();
return m_devices[1].get();
case 4:
return m_pDevices[2].get();
return m_devices[2].get();
}
return nullptr;
}
Expand All @@ -233,7 +233,7 @@ void CEXIChannel::DoState(PointerWrap& p)

for (int device_index = 0; device_index < NUM_DEVICES; ++device_index)
{
std::unique_ptr<IEXIDevice>& device = m_pDevices[device_index];
std::unique_ptr<IEXIDevice>& device = m_devices[device_index];
TEXIDevices type = device->m_deviceType;
p.Do(type);

Expand All @@ -252,13 +252,13 @@ void CEXIChannel::DoState(PointerWrap& p)

void CEXIChannel::PauseAndLock(bool doLock, bool unpauseOnUnlock)
{
for (auto& device : m_pDevices)
for (auto& device : m_devices)
device->PauseAndLock(doLock, unpauseOnUnlock);
}

IEXIDevice* CEXIChannel::FindDevice(TEXIDevices device_type, int customIndex)
{
for (auto& sup : m_pDevices)
for (auto& sup : m_devices)
{
IEXIDevice* device = sup->FindDevice(device_type, customIndex);
if (device)
Expand Down
3 changes: 2 additions & 1 deletion Source/Core/Core/HW/EXI_Channel.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#pragma once

#include <array>
#include <memory>
#include "Common/CommonTypes.h"

Expand Down Expand Up @@ -79,7 +80,7 @@ class CEXIChannel
NUM_DEVICES = 3
};

std::unique_ptr<IEXIDevice> m_pDevices[NUM_DEVICES];
std::array<std::unique_ptr<IEXIDevice>, NUM_DEVICES> m_devices;

// Since channels operate a bit differently from each other
u32 m_ChannelId;
Expand Down

0 comments on commit 7ca32f4

Please sign in to comment.