Merge pull request #5091 from lioncash/enum

EXI/SI: Move enum constants into namespaces
This commit is contained in:
Matthew Parlane 2017-03-16 19:36:54 +13:00 committed by GitHub
commit 2cead402b3
7 changed files with 21 additions and 21 deletions

View File

@ -61,8 +61,8 @@ public:
bool bSetEmulationSpeed;
bool bSetVolume;
std::array<bool, MAX_BBMOTES> bSetWiimoteSource;
std::array<bool, MAX_SI_CHANNELS> bSetPads;
std::array<bool, MAX_EXI_CHANNELS> bSetEXIDevice;
std::array<bool, SerialInterface::MAX_SI_CHANNELS> bSetPads;
std::array<bool, ExpansionInterface::MAX_EXI_CHANNELS> bSetEXIDevice;
private:
bool valid;
@ -92,8 +92,8 @@ private:
std::string sBackend;
std::string m_strGPUDeterminismMode;
std::array<int, MAX_BBMOTES> iWiimoteSource;
std::array<SIDevices, MAX_SI_CHANNELS> Pads;
std::array<TEXIDevices, MAX_EXI_CHANNELS> m_EXIDevice;
std::array<SIDevices, SerialInterface::MAX_SI_CHANNELS> Pads;
std::array<TEXIDevices, ExpansionInterface::MAX_EXI_CHANNELS> m_EXIDevice;
};
void ConfigCache::SaveConfig(const SConfig& config)
@ -180,7 +180,7 @@ void ConfigCache::RestoreConfig(SConfig* config)
config->m_wii_language = m_wii_language;
}
for (unsigned int i = 0; i < MAX_SI_CHANNELS; ++i)
for (unsigned int i = 0; i < SerialInterface::MAX_SI_CHANNELS; ++i)
{
if (bSetPads[i])
config->m_SIDevice[i] = Pads[i];
@ -189,7 +189,7 @@ void ConfigCache::RestoreConfig(SConfig* config)
if (bSetEmulationSpeed)
config->m_EmulationSpeed = m_EmulationSpeed;
for (unsigned int i = 0; i < MAX_EXI_CHANNELS; ++i)
for (unsigned int i = 0; i < ExpansionInterface::MAX_EXI_CHANNELS; ++i)
{
if (bSetEXIDevice[i])
config->m_EXIDevice[i] = m_EXIDevice[i];
@ -279,7 +279,7 @@ bool BootCore(const std::string& _rFilename)
core_section->Get("Overclock", &StartUp.m_OCFactor, StartUp.m_OCFactor);
core_section->Get("OverclockEnable", &StartUp.m_OCEnable, StartUp.m_OCEnable);
for (unsigned int i = 0; i < MAX_SI_CHANNELS; ++i)
for (unsigned int i = 0; i < SerialInterface::MAX_SI_CHANNELS; ++i)
{
int source;
controls_section->Get(StringFromFormat("PadType%u", i), &source, -1);

View File

@ -257,7 +257,7 @@ void SConfig::SaveCoreSettings(IniFile& ini)
core->Set("SlotB", m_EXIDevice[1]);
core->Set("SerialPort1", m_EXIDevice[2]);
core->Set("BBA_MAC", m_bba_mac);
for (int i = 0; i < MAX_SI_CHANNELS; ++i)
for (int i = 0; i < SerialInterface::MAX_SI_CHANNELS; ++i)
{
core->Set(StringFromFormat("SIDevice%i", i), m_SIDevice[i]);
core->Set(StringFromFormat("AdapterRumble%i", i), m_AdapterRumble[i]);
@ -577,7 +577,7 @@ void SConfig::LoadCoreSettings(IniFile& ini)
core->Get("BBA_MAC", &m_bba_mac);
core->Get("TimeProfiling", &bJITILTimeProfiling, false);
core->Get("OutputIR", &bJITILOutputIR, false);
for (int i = 0; i < MAX_SI_CHANNELS; ++i)
for (int i = 0; i < SerialInterface::MAX_SI_CHANNELS; ++i)
{
core->Get(StringFromFormat("SIDevice%i", i), (u32*)&m_SIDevice[i],
(i == 0) ? SIDEVICE_GC_CONTROLLER : SIDEVICE_NONE);

View File

@ -19,14 +19,14 @@ namespace MMIO
class Mapping;
}
namespace ExpansionInterface
{
enum
{
MAX_MEMORYCARD_SLOTS = 2,
MAX_EXI_CHANNELS = 3
};
namespace ExpansionInterface
{
void Init();
void Shutdown();
void DoState(PointerWrap& p);

View File

@ -15,14 +15,14 @@ namespace MMIO
class Mapping;
}
namespace SerialInterface
{
// SI number of channels
enum
{
MAX_SI_CHANNELS = 0x04
};
namespace SerialInterface
{
void Init();
void Shutdown();
void DoState(PointerWrap& p);

View File

@ -484,14 +484,14 @@ void ChangePads(bool instantly)
int controllers = 0;
for (int i = 0; i < MAX_SI_CHANNELS; ++i)
for (int i = 0; i < SerialInterface::MAX_SI_CHANNELS; ++i)
if (SIDevice_IsGCController(SConfig::GetInstance().m_SIDevice[i]))
controllers |= (1 << i);
if (instantly && (s_controllers & 0x0F) == controllers)
return;
for (int i = 0; i < MAX_SI_CHANNELS; ++i)
for (int i = 0; i < SerialInterface::MAX_SI_CHANNELS; ++i)
{
SIDevices device = SIDEVICE_NONE;
if (IsUsingPad(i))
@ -563,7 +563,7 @@ bool BeginRecordingInput(int controllers)
s_rerecords = 0;
for (int i = 0; i < MAX_SI_CHANNELS; ++i)
for (int i = 0; i < SerialInterface::MAX_SI_CHANNELS; ++i)
if (SConfig::GetInstance().m_SIDevice[i] == SIDEVICE_GC_TARUKONGA)
s_bongos |= (1 << i);

View File

@ -31,7 +31,7 @@ static void Setup();
static bool s_detected = false;
static libusb_device_handle* s_handle = nullptr;
static u8 s_controller_type[MAX_SI_CHANNELS] = {
static u8 s_controller_type[SerialInterface::MAX_SI_CHANNELS] = {
ControllerTypes::CONTROLLER_NONE, ControllerTypes::CONTROLLER_NONE,
ControllerTypes::CONTROLLER_NONE, ControllerTypes::CONTROLLER_NONE};
static u8 s_controller_rumble[4];
@ -199,7 +199,7 @@ static void Setup()
libusb_device** list;
ssize_t cnt = libusb_get_device_list(s_libusb_context.get(), &list);
for (int i = 0; i < MAX_SI_CHANNELS; i++)
for (int i = 0; i < SerialInterface::MAX_SI_CHANNELS; i++)
{
s_controller_type[i] = ControllerTypes::CONTROLLER_NONE;
s_controller_rumble[i] = 0;
@ -350,7 +350,7 @@ static void Reset()
s_adapter_thread.join();
}
for (int i = 0; i < MAX_SI_CHANNELS; i++)
for (int i = 0; i < SerialInterface::MAX_SI_CHANNELS; i++)
s_controller_type[i] = ControllerTypes::CONTROLLER_NONE;
s_detected = false;

View File

@ -33,7 +33,7 @@ static jclass s_adapter_class;
static bool s_detected = false;
static int s_fd = 0;
static u8 s_controller_type[MAX_SI_CHANNELS] = {
static u8 s_controller_type[SerialInterface::MAX_SI_CHANNELS] = {
ControllerTypes::CONTROLLER_NONE, ControllerTypes::CONTROLLER_NONE,
ControllerTypes::CONTROLLER_NONE, ControllerTypes::CONTROLLER_NONE};
static u8 s_controller_rumble[4];
@ -234,7 +234,7 @@ static void Reset()
if (s_read_adapter_thread_running.TestAndClear())
s_read_adapter_thread.join();
for (int i = 0; i < MAX_SI_CHANNELS; i++)
for (int i = 0; i < SerialInterface::MAX_SI_CHANNELS; i++)
s_controller_type[i] = ControllerTypes::CONTROLLER_NONE;
s_detected = false;