SI: Namespace device classes

Places all of the SI code under the SerialInterface namespace instead of
only the main source file. This keeps all SI code under a common name,
as well as out of the global namespace
This commit is contained in:
Lioncash
2017-03-16 04:41:39 -04:00
parent 2cead402b3
commit f0eeb3c63a
26 changed files with 112 additions and 50 deletions
+3 -3
View File
@@ -92,7 +92,7 @@ private:
std::string sBackend;
std::string m_strGPUDeterminismMode;
std::array<int, MAX_BBMOTES> iWiimoteSource;
std::array<SIDevices, SerialInterface::MAX_SI_CHANNELS> Pads;
std::array<SerialInterface::SIDevices, SerialInterface::MAX_SI_CHANNELS> Pads;
std::array<TEXIDevices, ExpansionInterface::MAX_EXI_CHANNELS> m_EXIDevice;
};
@@ -283,9 +283,9 @@ bool BootCore(const std::string& _rFilename)
{
int source;
controls_section->Get(StringFromFormat("PadType%u", i), &source, -1);
if (source >= SIDEVICE_NONE && source < SIDEVICE_COUNT)
if (source >= SerialInterface::SIDEVICE_NONE && source < SerialInterface::SIDEVICE_COUNT)
{
StartUp.m_SIDevice[i] = static_cast<SIDevices>(source);
StartUp.m_SIDevice[i] = static_cast<SerialInterface::SIDevices>(source);
config_cache.bSetPads[i] = true;
}
}
+1 -1
View File
@@ -580,7 +580,7 @@ void SConfig::LoadCoreSettings(IniFile& ini)
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);
(i == 0) ? SerialInterface::SIDEVICE_GC_CONTROLLER : SerialInterface::SIDEVICE_NONE);
core->Get(StringFromFormat("AdapterRumble%i", i), &m_AdapterRumble[i], true);
core->Get(StringFromFormat("SimulateKonga%i", i), &m_AdapterKonga[i], false);
}
+1 -1
View File
@@ -252,7 +252,7 @@ struct SConfig : NonCopyable
std::string m_strGbaCartA;
std::string m_strGbaCartB;
TEXIDevices m_EXIDevice[3];
SIDevices m_SIDevice[4];
SerialInterface::SIDevices m_SIDevice[4];
std::string m_bba_mac;
// interface language
+4 -2
View File
@@ -8,8 +8,7 @@
#include "Common/CommonTypes.h"
class PointerWrap;
class ISIDevice;
enum SIDevices : int;
namespace MMIO
{
class Mapping;
@@ -17,6 +16,9 @@ class Mapping;
namespace SerialInterface
{
class ISIDevice;
enum SIDevices : int;
// SI number of channels
enum
{
+3
View File
@@ -18,6 +18,8 @@
#include "Core/HW/SI/SI_DeviceKeyboard.h"
#include "Core/HW/SI/SI_DeviceNull.h"
namespace SerialInterface
{
ISIDevice::ISIDevice(SIDevices device_type, int device_number)
: m_device_number(device_number), m_device_type(device_type)
{
@@ -120,3 +122,4 @@ std::unique_ptr<ISIDevice> SIDevice_Create(const SIDevices device, const int por
return std::make_unique<CSIDevice_Null>(device, port_number);
}
}
} // namespace SerialInterface
+3
View File
@@ -9,6 +9,8 @@
class PointerWrap;
namespace SerialInterface
{
// Devices can reply with these
enum
{
@@ -100,3 +102,4 @@ protected:
bool SIDevice_IsGCController(SIDevices type);
std::unique_ptr<ISIDevice> SIDevice_Create(SIDevices device, int port_number);
} // namespace SerialInterface
@@ -7,6 +7,8 @@
#include "Common/CommonTypes.h"
#include "InputCommon/GCPadStatus.h"
namespace SerialInterface
{
CSIDevice_DanceMat::CSIDevice_DanceMat(SIDevices device, int device_number)
: CSIDevice_GCController(device, device_number)
{
@@ -68,3 +70,4 @@ bool CSIDevice_DanceMat::GetData(u32& hi, u32& low)
return true;
}
} // namespace SerialInterface
@@ -9,6 +9,8 @@
struct GCPadStatus;
namespace SerialInterface
{
class CSIDevice_DanceMat : public CSIDevice_GCController
{
public:
@@ -18,3 +20,4 @@ public:
u32 MapPadStatus(const GCPadStatus& pad_status) override;
bool GetData(u32& hi, u32& low) override;
};
} // namespace SerialInterface
+3
View File
@@ -20,6 +20,8 @@
#include "Core/HW/SI/SI_Device.h"
#include "Core/HW/SystemTimers.h"
namespace SerialInterface
{
namespace
{
std::thread s_connection_thread;
@@ -375,3 +377,4 @@ bool CSIDevice_GBA::GetData(u32& hi, u32& low)
void CSIDevice_GBA::SendCommand(u32 command, u8 poll)
{
}
} // namespace SerialInterface
+3
View File
@@ -14,6 +14,8 @@
// GameBoy Advance "Link Cable"
namespace SerialInterface
{
u8 GetNumConnected();
int GetTransferTime(u8 cmd);
void GBAConnectionWaiter_Shutdown();
@@ -61,3 +63,4 @@ private:
u64 m_timestamp_sent = 0;
bool m_waiting_for_response = false;
};
} // namespace SerialInterface
@@ -15,6 +15,8 @@
#include "Core/NetPlayProto.h"
#include "InputCommon/GCAdapter.h"
namespace SerialInterface
{
CSIDevice_GCAdapter::CSIDevice_GCAdapter(SIDevices device, int device_number)
: CSIDevice_GCController(device, device_number)
{
@@ -68,3 +70,4 @@ void CSIDevice_GCController::Rumble(int pad_num, ControlState strength)
else if (SIDevice_IsGCController(device))
Pad::Rumble(pad_num, strength);
}
} // namespace SerialInterface
@@ -8,6 +8,8 @@
#include "Core/HW/SI/SI_DeviceGCController.h"
#include "InputCommon/GCPadStatus.h"
namespace SerialInterface
{
class CSIDevice_GCAdapter : public CSIDevice_GCController
{
public:
@@ -16,3 +18,4 @@ public:
GCPadStatus GetPadStatus() override;
int RunBuffer(u8* buffer, int length) override;
};
} // namespace SerialInterface
@@ -17,6 +17,8 @@
#include "Core/NetPlayProto.h"
#include "InputCommon/GCPadStatus.h"
namespace SerialInterface
{
// --- standard GameCube controller ---
CSIDevice_GCController::CSIDevice_GCController(SIDevices device, int device_number)
: ISIDevice(device, device_number)
@@ -327,3 +329,4 @@ void CSIDevice_GCController::DoState(PointerWrap& p)
p.Do(m_timer_button_combo);
p.Do(m_last_button_combo);
}
} // namespace SerialInterface
@@ -8,6 +8,8 @@
#include "Core/HW/SI/SI_Device.h"
#include "InputCommon/GCPadStatus.h"
namespace SerialInterface
{
class CSIDevice_GCController : public ISIDevice
{
protected:
@@ -126,3 +128,4 @@ public:
m_simulate_konga = true;
}
};
} // namespace SerialInterface
@@ -8,6 +8,8 @@
#include "Common/Logging/Log.h"
#include "Core/HW/GCPad.h"
namespace SerialInterface
{
CSIDevice_GCSteeringWheel::CSIDevice_GCSteeringWheel(SIDevices device, int device_number)
: CSIDevice_GCController(device, device_number)
{
@@ -111,3 +113,4 @@ void CSIDevice_GCSteeringWheel::SendCommand(u32 command, u8 poll)
return CSIDevice_GCController::SendCommand(command, poll);
}
}
} // namespace SerialInterface
@@ -6,6 +6,8 @@
#include "Core/HW/SI/SI_DeviceGCController.h"
namespace SerialInterface
{
class CSIDevice_GCSteeringWheel : public CSIDevice_GCController
{
public:
@@ -31,3 +33,4 @@ private:
CMD_WRITE = 0x40
};
};
} // namespace SerialInterface
@@ -10,6 +10,8 @@
#include "Core/HW/GCKeyboard.h"
#include "InputCommon/KeyboardStatus.h"
namespace SerialInterface
{
// --- GameCube keyboard ---
CSIDevice_Keyboard::CSIDevice_Keyboard(SIDevices device, int device_number)
: ISIDevice(device, device_number)
@@ -617,3 +619,4 @@ void CSIDevice_Keyboard::MapKeys(const KeyboardStatus& key_status, u8* key)
return;
}
}
} // namespace SerialInterface
@@ -9,6 +9,8 @@
class PointerWrap;
struct KeyboardStatus;
namespace SerialInterface
{
class CSIDevice_Keyboard : public ISIDevice
{
public:
@@ -65,3 +67,4 @@ protected:
// Internal counter synchonizing GC and keyboard
u8 m_counter = 0;
};
} // namespace SerialInterface
+3
View File
@@ -6,6 +6,8 @@
#include <cstring>
namespace SerialInterface
{
CSIDevice_Null::CSIDevice_Null(SIDevices device, int device_number)
: ISIDevice{device, device_number}
{
@@ -27,3 +29,4 @@ bool CSIDevice_Null::GetData(u32& hi, u32& low)
void CSIDevice_Null::SendCommand(u32 command, u8 poll)
{
}
} // namespace SerialInterface
+3
View File
@@ -7,6 +7,8 @@
#include "Common/CommonTypes.h"
#include "Core/HW/SI/SI_Device.h"
namespace SerialInterface
{
// Stub class for saying nothing is attached, and not having to deal with null pointers :)
class CSIDevice_Null final : public ISIDevice
{
@@ -17,3 +19,4 @@ public:
bool GetData(u32& hi, u32& low) override;
void SendCommand(u32 command, u8 poll) override;
};
} // namespace SerialInterface

Some files were not shown because too many files have changed in this diff Show More