mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-25 07:21:14 +01:00
Replace TEXIDevices with an enum class
This commit is contained in:
parent
e8bbfc26fe
commit
d354163fbe
@ -55,16 +55,16 @@ const Info<std::string> MAIN_GCI_FOLDER_A_PATH_OVERRIDE{
|
||||
const Info<std::string> MAIN_GCI_FOLDER_B_PATH_OVERRIDE{
|
||||
{System::Main, "Core", "GCIFolderBPathOverride"}, ""};
|
||||
|
||||
const Info<ExpansionInterface::TEXIDevices> MAIN_SLOT_A{
|
||||
{System::Main, "Core", "SlotA"}, ExpansionInterface::EXIDEVICE_MEMORYCARDFOLDER};
|
||||
const Info<ExpansionInterface::TEXIDevices> MAIN_SLOT_B{{System::Main, "Core", "SlotB"},
|
||||
ExpansionInterface::EXIDEVICE_NONE};
|
||||
const Info<ExpansionInterface::TEXIDevices> MAIN_SERIAL_PORT_1{
|
||||
{System::Main, "Core", "SerialPort1"}, ExpansionInterface::EXIDEVICE_NONE};
|
||||
const Info<ExpansionInterface::EXIDeviceType> MAIN_SLOT_A{
|
||||
{System::Main, "Core", "SlotA"}, ExpansionInterface::EXIDeviceType::MemoryCardFolder};
|
||||
const Info<ExpansionInterface::EXIDeviceType> MAIN_SLOT_B{{System::Main, "Core", "SlotB"},
|
||||
ExpansionInterface::EXIDeviceType::None};
|
||||
const Info<ExpansionInterface::EXIDeviceType> MAIN_SERIAL_PORT_1{
|
||||
{System::Main, "Core", "SerialPort1"}, ExpansionInterface::EXIDeviceType::None};
|
||||
|
||||
const Info<ExpansionInterface::TEXIDevices>& GetInfoForEXIDevice(int channel)
|
||||
const Info<ExpansionInterface::EXIDeviceType>& GetInfoForEXIDevice(int channel)
|
||||
{
|
||||
static constexpr std::array<const Info<ExpansionInterface::TEXIDevices>*, 3> infos{
|
||||
static constexpr std::array<const Info<ExpansionInterface::EXIDeviceType>*, 3> infos{
|
||||
&MAIN_SLOT_A,
|
||||
&MAIN_SLOT_B,
|
||||
&MAIN_SERIAL_PORT_1,
|
||||
|
@ -33,7 +33,7 @@ enum class DPL2Quality;
|
||||
|
||||
namespace ExpansionInterface
|
||||
{
|
||||
enum TEXIDevices : int;
|
||||
enum class EXIDeviceType : int;
|
||||
}
|
||||
|
||||
namespace SerialInterface
|
||||
@ -69,10 +69,10 @@ extern const Info<std::string> MAIN_AGP_CART_A_PATH;
|
||||
extern const Info<std::string> MAIN_AGP_CART_B_PATH;
|
||||
extern const Info<std::string> MAIN_GCI_FOLDER_A_PATH_OVERRIDE;
|
||||
extern const Info<std::string> MAIN_GCI_FOLDER_B_PATH_OVERRIDE;
|
||||
extern const Info<ExpansionInterface::TEXIDevices> MAIN_SLOT_A;
|
||||
extern const Info<ExpansionInterface::TEXIDevices> MAIN_SLOT_B;
|
||||
extern const Info<ExpansionInterface::TEXIDevices> MAIN_SERIAL_PORT_1;
|
||||
const Info<ExpansionInterface::TEXIDevices>& GetInfoForEXIDevice(int channel);
|
||||
extern const Info<ExpansionInterface::EXIDeviceType> MAIN_SLOT_A;
|
||||
extern const Info<ExpansionInterface::EXIDeviceType> MAIN_SLOT_B;
|
||||
extern const Info<ExpansionInterface::EXIDeviceType> MAIN_SERIAL_PORT_1;
|
||||
const Info<ExpansionInterface::EXIDeviceType>& GetInfoForEXIDevice(int channel);
|
||||
extern const Info<std::string> MAIN_BBA_MAC;
|
||||
extern const Info<std::string> MAIN_BBA_XLINK_IP;
|
||||
extern const Info<bool> MAIN_BBA_XLINK_CHAT_OSD;
|
||||
|
@ -25,26 +25,11 @@ struct Partition;
|
||||
class Volume;
|
||||
} // namespace DiscIO
|
||||
|
||||
namespace ExpansionInterface
|
||||
{
|
||||
enum TEXIDevices : int;
|
||||
} // namespace ExpansionInterface
|
||||
|
||||
namespace IOS::ES
|
||||
{
|
||||
class TMDReader;
|
||||
} // namespace IOS::ES
|
||||
|
||||
namespace PowerPC
|
||||
{
|
||||
enum class CPUCore;
|
||||
} // namespace PowerPC
|
||||
|
||||
namespace SerialInterface
|
||||
{
|
||||
enum SIDevices : int;
|
||||
} // namespace SerialInterface
|
||||
|
||||
struct BootParameters;
|
||||
|
||||
struct SConfig
|
||||
|
@ -41,19 +41,19 @@ namespace
|
||||
{
|
||||
void AddMemoryCards(int i)
|
||||
{
|
||||
TEXIDevices memorycard_device;
|
||||
EXIDeviceType memorycard_device;
|
||||
if (Movie::IsPlayingInput() && Movie::IsConfigSaved())
|
||||
{
|
||||
if (Movie::IsUsingMemcard(i))
|
||||
{
|
||||
if (Config::Get(Config::GetInfoForEXIDevice(i)) == EXIDEVICE_MEMORYCARDFOLDER)
|
||||
memorycard_device = EXIDEVICE_MEMORYCARDFOLDER;
|
||||
if (Config::Get(Config::GetInfoForEXIDevice(i)) == EXIDeviceType::MemoryCardFolder)
|
||||
memorycard_device = EXIDeviceType::MemoryCardFolder;
|
||||
else
|
||||
memorycard_device = EXIDEVICE_MEMORYCARD;
|
||||
memorycard_device = EXIDeviceType::MemoryCard;
|
||||
}
|
||||
else
|
||||
{
|
||||
memorycard_device = EXIDEVICE_NONE;
|
||||
memorycard_device = EXIDeviceType::None;
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -101,9 +101,9 @@ void Init()
|
||||
for (int i = 0; i < MAX_MEMORYCARD_SLOTS; i++)
|
||||
AddMemoryCards(i);
|
||||
|
||||
g_Channels[0]->AddDevice(EXIDEVICE_MASKROM, 1);
|
||||
g_Channels[0]->AddDevice(EXIDeviceType::MaskROM, 1);
|
||||
g_Channels[0]->AddDevice(Config::Get(Config::MAIN_SERIAL_PORT_1), 2);
|
||||
g_Channels[2]->AddDevice(EXIDEVICE_AD16, 0);
|
||||
g_Channels[2]->AddDevice(EXIDeviceType::AD16, 0);
|
||||
|
||||
changeDevice = CoreTiming::RegisterEvent("ChangeEXIDevice", ChangeDeviceCallback);
|
||||
updateInterrupts = CoreTiming::RegisterEvent("EXIUpdateInterrupts", UpdateInterruptsCallback);
|
||||
@ -149,15 +149,15 @@ static void ChangeDeviceCallback(u64 userdata, s64 cyclesLate)
|
||||
u8 type = (u8)(userdata >> 16);
|
||||
u8 num = (u8)userdata;
|
||||
|
||||
g_Channels.at(channel)->AddDevice((TEXIDevices)type, num);
|
||||
g_Channels.at(channel)->AddDevice(static_cast<EXIDeviceType>(type), num);
|
||||
}
|
||||
|
||||
void ChangeDevice(const u8 channel, const TEXIDevices device_type, const u8 device_num,
|
||||
void ChangeDevice(const u8 channel, const EXIDeviceType device_type, const u8 device_num,
|
||||
CoreTiming::FromThread from_thread)
|
||||
{
|
||||
// Let the hardware see no device for 1 second
|
||||
CoreTiming::ScheduleEvent(0, changeDevice,
|
||||
((u64)channel << 32) | ((u64)EXIDEVICE_NONE << 16) | device_num,
|
||||
((u64)channel << 32) | ((u64)EXIDeviceType::None << 16) | device_num,
|
||||
from_thread);
|
||||
CoreTiming::ScheduleEvent(SystemTimers::GetTicksPerSecond(), changeDevice,
|
||||
((u64)channel << 32) | ((u64)device_type << 16) | device_num,
|
||||
@ -169,7 +169,7 @@ CEXIChannel* GetChannel(u32 index)
|
||||
return g_Channels.at(index).get();
|
||||
}
|
||||
|
||||
IEXIDevice* FindDevice(TEXIDevices device_type, int customIndex)
|
||||
IEXIDevice* FindDevice(EXIDeviceType device_type, int customIndex)
|
||||
{
|
||||
for (auto& channel : g_Channels)
|
||||
{
|
||||
|
@ -21,7 +21,7 @@ namespace ExpansionInterface
|
||||
{
|
||||
class CEXIChannel;
|
||||
class IEXIDevice;
|
||||
enum TEXIDevices : int;
|
||||
enum class EXIDeviceType : int;
|
||||
|
||||
enum
|
||||
{
|
||||
@ -39,11 +39,11 @@ void RegisterMMIO(MMIO::Mapping* mmio, u32 base);
|
||||
void UpdateInterrupts();
|
||||
void ScheduleUpdateInterrupts(CoreTiming::FromThread from, int cycles_late);
|
||||
|
||||
void ChangeDevice(const u8 channel, const TEXIDevices device_type, const u8 device_num,
|
||||
void ChangeDevice(const u8 channel, const EXIDeviceType device_type, const u8 device_num,
|
||||
CoreTiming::FromThread from_thread = CoreTiming::FromThread::NON_CPU);
|
||||
|
||||
CEXIChannel* GetChannel(u32 index);
|
||||
|
||||
IEXIDevice* FindDevice(TEXIDevices device_type, int customIndex = -1);
|
||||
IEXIDevice* FindDevice(EXIDeviceType device_type, int customIndex = -1);
|
||||
|
||||
} // namespace ExpansionInterface
|
||||
|
@ -34,7 +34,7 @@ CEXIChannel::CEXIChannel(u32 channel_id, const Memcard::HeaderData& memcard_head
|
||||
m_status.CHIP_SELECT = 1;
|
||||
|
||||
for (auto& device : m_devices)
|
||||
device = EXIDevice_Create(EXIDEVICE_NONE, m_channel_id, m_memcard_header_data);
|
||||
device = EXIDevice_Create(EXIDeviceType::None, m_channel_id, m_memcard_header_data);
|
||||
}
|
||||
|
||||
CEXIChannel::~CEXIChannel()
|
||||
@ -168,7 +168,7 @@ void CEXIChannel::RemoveDevices()
|
||||
device.reset(nullptr);
|
||||
}
|
||||
|
||||
void CEXIChannel::AddDevice(const TEXIDevices device_type, const int device_num)
|
||||
void CEXIChannel::AddDevice(const EXIDeviceType device_type, const int device_num)
|
||||
{
|
||||
AddDevice(EXIDevice_Create(device_type, m_channel_id, m_memcard_header_data), device_num);
|
||||
}
|
||||
@ -245,7 +245,7 @@ void CEXIChannel::DoState(PointerWrap& p)
|
||||
for (int device_index = 0; device_index < NUM_DEVICES; ++device_index)
|
||||
{
|
||||
std::unique_ptr<IEXIDevice>& device = m_devices[device_index];
|
||||
TEXIDevices type = device->m_device_type;
|
||||
EXIDeviceType type = device->m_device_type;
|
||||
p.Do(type);
|
||||
|
||||
if (type == device->m_device_type)
|
||||
@ -260,7 +260,7 @@ void CEXIChannel::DoState(PointerWrap& p)
|
||||
AddDevice(std::move(save_device), device_index, false);
|
||||
}
|
||||
|
||||
if (type == EXIDEVICE_MEMORYCARDFOLDER && old_header_data != m_memcard_header_data &&
|
||||
if (type == EXIDeviceType::MemoryCardFolder && old_header_data != m_memcard_header_data &&
|
||||
!Movie::IsMovieActive())
|
||||
{
|
||||
// We have loaded a savestate that has a GCI folder memcard that is different to the virtual
|
||||
@ -277,8 +277,8 @@ void CEXIChannel::DoState(PointerWrap& p)
|
||||
// notify_presence_changed flag set to true? Not sure how software behaves if the previous and
|
||||
// the new device type are identical in this case. I assume there is a reason we have this
|
||||
// grace period when switching in the GUI.
|
||||
AddDevice(EXIDEVICE_NONE, device_index);
|
||||
ExpansionInterface::ChangeDevice(m_channel_id, EXIDEVICE_MEMORYCARDFOLDER, device_index,
|
||||
AddDevice(EXIDeviceType::None, device_index);
|
||||
ExpansionInterface::ChangeDevice(m_channel_id, EXIDeviceType::MemoryCardFolder, device_index,
|
||||
CoreTiming::FromThread::CPU);
|
||||
}
|
||||
}
|
||||
@ -295,7 +295,7 @@ void CEXIChannel::SetEXIINT(bool exiint)
|
||||
m_status.EXIINT = !!exiint;
|
||||
}
|
||||
|
||||
IEXIDevice* CEXIChannel::FindDevice(TEXIDevices device_type, int custom_index)
|
||||
IEXIDevice* CEXIChannel::FindDevice(EXIDeviceType device_type, int custom_index)
|
||||
{
|
||||
for (auto& sup : m_devices)
|
||||
{
|
||||
|
@ -20,7 +20,7 @@ class Mapping;
|
||||
namespace ExpansionInterface
|
||||
{
|
||||
class IEXIDevice;
|
||||
enum TEXIDevices : int;
|
||||
enum class EXIDeviceType : int;
|
||||
|
||||
class CEXIChannel
|
||||
{
|
||||
@ -30,13 +30,13 @@ public:
|
||||
|
||||
// get device
|
||||
IEXIDevice* GetDevice(u8 chip_select);
|
||||
IEXIDevice* FindDevice(TEXIDevices device_type, int custom_index = -1);
|
||||
IEXIDevice* FindDevice(EXIDeviceType device_type, int custom_index = -1);
|
||||
|
||||
void RegisterMMIO(MMIO::Mapping* mmio, u32 base);
|
||||
|
||||
void SendTransferComplete();
|
||||
|
||||
void AddDevice(TEXIDevices device_type, int device_num);
|
||||
void AddDevice(EXIDeviceType device_type, int device_num);
|
||||
void AddDevice(std::unique_ptr<IEXIDevice> device, int device_num,
|
||||
bool notify_presence_changed = true);
|
||||
|
||||
|
@ -64,7 +64,7 @@ void IEXIDevice::DMARead(u32 address, u32 size)
|
||||
}
|
||||
}
|
||||
|
||||
IEXIDevice* IEXIDevice::FindDevice(TEXIDevices device_type, int custom_index)
|
||||
IEXIDevice* IEXIDevice::FindDevice(EXIDeviceType device_type, int custom_index)
|
||||
{
|
||||
return (device_type == m_device_type) ? this : nullptr;
|
||||
}
|
||||
@ -101,60 +101,60 @@ void IEXIDevice::TransferByte(u8& byte)
|
||||
}
|
||||
|
||||
// F A C T O R Y
|
||||
std::unique_ptr<IEXIDevice> EXIDevice_Create(const TEXIDevices device_type, const int channel_num,
|
||||
std::unique_ptr<IEXIDevice> EXIDevice_Create(const EXIDeviceType device_type, const int channel_num,
|
||||
const Memcard::HeaderData& memcard_header_data)
|
||||
{
|
||||
std::unique_ptr<IEXIDevice> result;
|
||||
|
||||
switch (device_type)
|
||||
{
|
||||
case EXIDEVICE_DUMMY:
|
||||
case EXIDeviceType::Dummy:
|
||||
result = std::make_unique<CEXIDummy>("Dummy");
|
||||
break;
|
||||
|
||||
case EXIDEVICE_MEMORYCARD:
|
||||
case EXIDEVICE_MEMORYCARDFOLDER:
|
||||
case EXIDeviceType::MemoryCard:
|
||||
case EXIDeviceType::MemoryCardFolder:
|
||||
{
|
||||
bool gci_folder = (device_type == EXIDEVICE_MEMORYCARDFOLDER);
|
||||
bool gci_folder = (device_type == EXIDeviceType::MemoryCardFolder);
|
||||
result = std::make_unique<CEXIMemoryCard>(channel_num, gci_folder, memcard_header_data);
|
||||
break;
|
||||
}
|
||||
case EXIDEVICE_MASKROM:
|
||||
case EXIDeviceType::MaskROM:
|
||||
result = std::make_unique<CEXIIPL>();
|
||||
break;
|
||||
|
||||
case EXIDEVICE_AD16:
|
||||
case EXIDeviceType::AD16:
|
||||
result = std::make_unique<CEXIAD16>();
|
||||
break;
|
||||
|
||||
case EXIDEVICE_MIC:
|
||||
case EXIDeviceType::Microphone:
|
||||
result = std::make_unique<CEXIMic>(channel_num);
|
||||
break;
|
||||
|
||||
case EXIDEVICE_ETH:
|
||||
case EXIDeviceType::Ethernet:
|
||||
result = std::make_unique<CEXIETHERNET>(BBADeviceType::TAP);
|
||||
break;
|
||||
|
||||
#if defined(__APPLE__)
|
||||
case EXIDEVICE_ETHTAPSERVER:
|
||||
case EXIDeviceType::EthernetTapServer:
|
||||
result = std::make_unique<CEXIETHERNET>(BBADeviceType::TAPSERVER);
|
||||
break;
|
||||
#endif
|
||||
|
||||
case EXIDEVICE_ETHXLINK:
|
||||
case EXIDeviceType::EthernetXLink:
|
||||
result = std::make_unique<CEXIETHERNET>(BBADeviceType::XLINK);
|
||||
break;
|
||||
|
||||
case EXIDEVICE_GECKO:
|
||||
case EXIDeviceType::Gecko:
|
||||
result = std::make_unique<CEXIGecko>();
|
||||
break;
|
||||
|
||||
case EXIDEVICE_AGP:
|
||||
case EXIDeviceType::AGP:
|
||||
result = std::make_unique<CEXIAgp>(channel_num);
|
||||
break;
|
||||
|
||||
case EXIDEVICE_AM_BASEBOARD:
|
||||
case EXIDEVICE_NONE:
|
||||
case EXIDeviceType::AMBaseboard:
|
||||
case EXIDeviceType::None:
|
||||
default:
|
||||
result = std::make_unique<IEXIDevice>();
|
||||
break;
|
||||
|
@ -15,26 +15,26 @@ struct HeaderData;
|
||||
|
||||
namespace ExpansionInterface
|
||||
{
|
||||
enum TEXIDevices : int
|
||||
enum class EXIDeviceType : int
|
||||
{
|
||||
EXIDEVICE_DUMMY,
|
||||
EXIDEVICE_MEMORYCARD,
|
||||
EXIDEVICE_MASKROM,
|
||||
EXIDEVICE_AD16,
|
||||
EXIDEVICE_MIC,
|
||||
EXIDEVICE_ETH,
|
||||
Dummy,
|
||||
MemoryCard,
|
||||
MaskROM,
|
||||
AD16,
|
||||
Microphone,
|
||||
Ethernet,
|
||||
// Was used for Triforce in the past, but the implementation is no longer in Dolphin.
|
||||
// It's kept here so that values below will stay constant.
|
||||
EXIDEVICE_AM_BASEBOARD,
|
||||
EXIDEVICE_GECKO,
|
||||
AMBaseboard,
|
||||
Gecko,
|
||||
// Only used when creating a device by EXIDevice_Create.
|
||||
// Converted to EXIDEVICE_MEMORYCARD internally.
|
||||
EXIDEVICE_MEMORYCARDFOLDER,
|
||||
EXIDEVICE_AGP,
|
||||
EXIDEVICE_ETHXLINK,
|
||||
// Converted to MemoryCard internally.
|
||||
MemoryCardFolder,
|
||||
AGP,
|
||||
EthernetXLink,
|
||||
// Only used on Apple devices.
|
||||
EXIDEVICE_ETHTAPSERVER,
|
||||
EXIDEVICE_NONE = 0xFF
|
||||
EthernetTapServer,
|
||||
None = 0xFF
|
||||
};
|
||||
|
||||
class IEXIDevice
|
||||
@ -51,7 +51,7 @@ public:
|
||||
virtual void DMAWrite(u32 address, u32 size);
|
||||
virtual void DMARead(u32 address, u32 size);
|
||||
|
||||
virtual IEXIDevice* FindDevice(TEXIDevices device_type, int custom_index = -1);
|
||||
virtual IEXIDevice* FindDevice(EXIDeviceType device_type, int custom_index = -1);
|
||||
|
||||
virtual bool UseDelayedTransferCompletion() const;
|
||||
virtual bool IsPresent() const;
|
||||
@ -65,13 +65,13 @@ public:
|
||||
// For savestates. storing it here seemed cleaner than requiring each implementation to report its
|
||||
// type. I know this class is set up like an interface, but no code requires it to be strictly
|
||||
// such.
|
||||
TEXIDevices m_device_type = TEXIDevices::EXIDEVICE_NONE;
|
||||
EXIDeviceType m_device_type = EXIDeviceType::None;
|
||||
|
||||
private:
|
||||
// Byte transfer function for this device
|
||||
virtual void TransferByte(u8& byte);
|
||||
};
|
||||
|
||||
std::unique_ptr<IEXIDevice> EXIDevice_Create(TEXIDevices device_type, int channel_num,
|
||||
std::unique_ptr<IEXIDevice> EXIDevice_Create(EXIDeviceType device_type, int channel_num,
|
||||
const Memcard::HeaderData& memcard_header_data);
|
||||
} // namespace ExpansionInterface
|
||||
|
@ -58,11 +58,11 @@ void CEXIMemoryCard::EventCompleteFindInstance(u64 userdata,
|
||||
{
|
||||
int card_index = (int)userdata;
|
||||
auto* self = static_cast<CEXIMemoryCard*>(
|
||||
ExpansionInterface::FindDevice(EXIDEVICE_MEMORYCARD, card_index));
|
||||
ExpansionInterface::FindDevice(EXIDeviceType::MemoryCard, card_index));
|
||||
if (self == nullptr)
|
||||
{
|
||||
self = static_cast<CEXIMemoryCard*>(
|
||||
ExpansionInterface::FindDevice(EXIDEVICE_MEMORYCARDFOLDER, card_index));
|
||||
ExpansionInterface::FindDevice(EXIDeviceType::MemoryCardFolder, card_index));
|
||||
}
|
||||
if (self)
|
||||
{
|
||||
@ -526,7 +526,7 @@ void CEXIMemoryCard::DoState(PointerWrap& p)
|
||||
}
|
||||
}
|
||||
|
||||
IEXIDevice* CEXIMemoryCard::FindDevice(TEXIDevices device_type, int custom_index)
|
||||
IEXIDevice* CEXIMemoryCard::FindDevice(EXIDeviceType device_type, int custom_index)
|
||||
{
|
||||
if (device_type != m_device_type)
|
||||
return nullptr;
|
||||
|
@ -37,7 +37,7 @@ public:
|
||||
bool UseDelayedTransferCompletion() const override;
|
||||
bool IsPresent() const override;
|
||||
void DoState(PointerWrap& p) override;
|
||||
IEXIDevice* FindDevice(TEXIDevices device_type, int custom_index) override;
|
||||
IEXIDevice* FindDevice(EXIDeviceType device_type, int custom_index) override;
|
||||
void DMARead(u32 addr, u32 size) override;
|
||||
void DMAWrite(u32 addr, u32 size) override;
|
||||
|
||||
|
@ -1438,12 +1438,13 @@ void SetGraphicsConfig()
|
||||
// NOTE: EmuThread / Host Thread
|
||||
void GetSettings()
|
||||
{
|
||||
const ExpansionInterface::TEXIDevices slot_a_type = Config::Get(Config::MAIN_SLOT_A);
|
||||
const ExpansionInterface::TEXIDevices slot_b_type = Config::Get(Config::MAIN_SLOT_B);
|
||||
const bool slot_a_has_raw_memcard = slot_a_type == ExpansionInterface::EXIDEVICE_MEMORYCARD;
|
||||
const bool slot_a_has_gci_folder = slot_a_type == ExpansionInterface::EXIDEVICE_MEMORYCARDFOLDER;
|
||||
const bool slot_b_has_raw_memcard = slot_b_type == ExpansionInterface::EXIDEVICE_MEMORYCARD;
|
||||
const bool slot_b_has_gci_folder = slot_b_type == ExpansionInterface::EXIDEVICE_MEMORYCARDFOLDER;
|
||||
using ExpansionInterface::EXIDeviceType;
|
||||
const EXIDeviceType slot_a_type = Config::Get(Config::MAIN_SLOT_A);
|
||||
const EXIDeviceType slot_b_type = Config::Get(Config::MAIN_SLOT_B);
|
||||
const bool slot_a_has_raw_memcard = slot_a_type == EXIDeviceType::MemoryCard;
|
||||
const bool slot_a_has_gci_folder = slot_a_type == EXIDeviceType::MemoryCardFolder;
|
||||
const bool slot_b_has_raw_memcard = slot_b_type == EXIDeviceType::MemoryCard;
|
||||
const bool slot_b_has_gci_folder = slot_b_type == EXIDeviceType::MemoryCardFolder;
|
||||
|
||||
s_bSaveConfig = true;
|
||||
s_bNetPlay = NetPlay::IsNetPlayRunning();
|
||||
|
@ -44,7 +44,7 @@ struct NetSettings
|
||||
bool m_CopyWiiSave = false;
|
||||
bool m_OCEnable = false;
|
||||
float m_OCFactor = 0;
|
||||
std::array<ExpansionInterface::TEXIDevices, 3> m_EXIDevice{};
|
||||
std::array<ExpansionInterface::EXIDeviceType, 3> m_EXIDevice{};
|
||||
|
||||
std::array<u32, Config::SYSCONF_SETTINGS.size()> m_SYSCONFSettings{};
|
||||
|
||||
|
@ -1309,7 +1309,7 @@ bool NetPlayServer::SetupNetSettings()
|
||||
settings.m_EXIDevice[0] = Config::Get(Config::MAIN_SLOT_A);
|
||||
settings.m_EXIDevice[1] = Config::Get(Config::MAIN_SLOT_B);
|
||||
// There's no way the BBA is going to sync, disable it
|
||||
settings.m_EXIDevice[2] = ExpansionInterface::EXIDEVICE_NONE;
|
||||
settings.m_EXIDevice[2] = ExpansionInterface::EXIDeviceType::None;
|
||||
|
||||
for (size_t i = 0; i < Config::SYSCONF_SETTINGS.size(); ++i)
|
||||
{
|
||||
@ -1495,7 +1495,7 @@ bool NetPlayServer::StartGame()
|
||||
spac << m_settings.m_OCFactor;
|
||||
|
||||
for (auto& device : m_settings.m_EXIDevice)
|
||||
spac << device;
|
||||
spac << static_cast<int>(device);
|
||||
|
||||
for (u32 value : m_settings.m_SYSCONFSettings)
|
||||
spac << value;
|
||||
@ -1595,9 +1595,9 @@ bool NetPlayServer::SyncSaveData()
|
||||
constexpr int exi_device_count = 2;
|
||||
for (int i = 0; i < exi_device_count; ++i)
|
||||
{
|
||||
if (m_settings.m_EXIDevice[i] == ExpansionInterface::EXIDEVICE_MEMORYCARD ||
|
||||
if (m_settings.m_EXIDevice[i] == ExpansionInterface::EXIDeviceType::MemoryCard ||
|
||||
Config::Get(Config::GetInfoForEXIDevice(i)) ==
|
||||
ExpansionInterface::EXIDEVICE_MEMORYCARDFOLDER)
|
||||
ExpansionInterface::EXIDeviceType::MemoryCardFolder)
|
||||
{
|
||||
save_count++;
|
||||
}
|
||||
@ -1656,7 +1656,7 @@ bool NetPlayServer::SyncSaveData()
|
||||
{
|
||||
const bool is_slot_a = i == 0;
|
||||
|
||||
if (m_settings.m_EXIDevice[i] == ExpansionInterface::EXIDEVICE_MEMORYCARD)
|
||||
if (m_settings.m_EXIDevice[i] == ExpansionInterface::EXIDeviceType::MemoryCard)
|
||||
{
|
||||
std::string path = is_slot_a ? Config::Get(Config::MAIN_MEMCARD_A_PATH) :
|
||||
Config::Get(Config::MAIN_MEMCARD_B_PATH);
|
||||
@ -1694,7 +1694,7 @@ bool NetPlayServer::SyncSaveData()
|
||||
fmt::format("Memory Card {} Synchronization", is_slot_a ? 'A' : 'B'));
|
||||
}
|
||||
else if (Config::Get(Config::GetInfoForEXIDevice(i)) ==
|
||||
ExpansionInterface::EXIDEVICE_MEMORYCARDFOLDER)
|
||||
ExpansionInterface::EXIDeviceType::MemoryCardFolder)
|
||||
{
|
||||
const std::string path = File::GetUserPath(D_GCUSER_IDX) + region + DIR_SEP +
|
||||
fmt::format("Card {}", is_slot_a ? 'A' : 'B');
|
||||
|
@ -209,7 +209,7 @@ void GCMemcardManager::LoadDefaultMemcards()
|
||||
for (int i = 0; i < SLOT_COUNT; i++)
|
||||
{
|
||||
if (Config::Get(i == 0 ? Config::MAIN_SLOT_A : Config::MAIN_SLOT_B) !=
|
||||
ExpansionInterface::EXIDEVICE_MEMORYCARD)
|
||||
ExpansionInterface::EXIDeviceType::MemoryCard)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
@ -664,11 +664,11 @@ void GameList::OpenGCSaveFolder()
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
QUrl url;
|
||||
const ExpansionInterface::TEXIDevices current_exi_device =
|
||||
const ExpansionInterface::EXIDeviceType current_exi_device =
|
||||
Config::Get(Config::GetInfoForEXIDevice(i));
|
||||
switch (current_exi_device)
|
||||
{
|
||||
case ExpansionInterface::EXIDEVICE_MEMORYCARDFOLDER:
|
||||
case ExpansionInterface::EXIDeviceType::MemoryCardFolder:
|
||||
{
|
||||
std::string path = StringFromFormat("%s/%s/%s", File::GetUserPath(D_GCUSER_IDX).c_str(),
|
||||
SConfig::GetDirectoryForRegion(game->GetRegion()),
|
||||
@ -691,7 +691,7 @@ void GameList::OpenGCSaveFolder()
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ExpansionInterface::EXIDEVICE_MEMORYCARD:
|
||||
case ExpansionInterface::EXIDeviceType::MemoryCard:
|
||||
{
|
||||
std::string memcard_path = i == 0 ? Config::Get(Config::MAIN_MEMCARD_A_PATH) :
|
||||
Config::Get(Config::MAIN_MEMCARD_B_PATH);
|
||||
|
@ -54,6 +54,8 @@ GameCubePane::GameCubePane()
|
||||
|
||||
void GameCubePane::CreateWidgets()
|
||||
{
|
||||
using ExpansionInterface::EXIDeviceType;
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout(this);
|
||||
|
||||
// IPL Settings
|
||||
@ -95,32 +97,31 @@ void GameCubePane::CreateWidgets()
|
||||
}
|
||||
|
||||
// Add slot devices
|
||||
for (const auto& entry :
|
||||
{std::make_pair(tr("<Nothing>"), ExpansionInterface::EXIDEVICE_NONE),
|
||||
std::make_pair(tr("Dummy"), ExpansionInterface::EXIDEVICE_DUMMY),
|
||||
std::make_pair(tr("Memory Card"), ExpansionInterface::EXIDEVICE_MEMORYCARD),
|
||||
std::make_pair(tr("GCI Folder"), ExpansionInterface::EXIDEVICE_MEMORYCARDFOLDER),
|
||||
std::make_pair(tr("USB Gecko"), ExpansionInterface::EXIDEVICE_GECKO),
|
||||
std::make_pair(tr("Advance Game Port"), ExpansionInterface::EXIDEVICE_AGP),
|
||||
std::make_pair(tr("Microphone"), ExpansionInterface::EXIDEVICE_MIC)})
|
||||
for (const auto& entry : {std::make_pair(tr("<Nothing>"), EXIDeviceType::None),
|
||||
std::make_pair(tr("Dummy"), EXIDeviceType::Dummy),
|
||||
std::make_pair(tr("Memory Card"), EXIDeviceType::MemoryCard),
|
||||
std::make_pair(tr("GCI Folder"), EXIDeviceType::MemoryCardFolder),
|
||||
std::make_pair(tr("USB Gecko"), EXIDeviceType::Gecko),
|
||||
std::make_pair(tr("Advance Game Port"), EXIDeviceType::AGP),
|
||||
std::make_pair(tr("Microphone"), EXIDeviceType::Microphone)})
|
||||
{
|
||||
m_slot_combos[0]->addItem(entry.first, entry.second);
|
||||
m_slot_combos[1]->addItem(entry.first, entry.second);
|
||||
m_slot_combos[0]->addItem(entry.first, static_cast<int>(entry.second));
|
||||
m_slot_combos[1]->addItem(entry.first, static_cast<int>(entry.second));
|
||||
}
|
||||
|
||||
// Add SP1 devices
|
||||
std::vector<std::pair<QString, ExpansionInterface::TEXIDevices>> sp1Entries{
|
||||
std::make_pair(tr("<Nothing>"), ExpansionInterface::EXIDEVICE_NONE),
|
||||
std::make_pair(tr("Dummy"), ExpansionInterface::EXIDEVICE_DUMMY),
|
||||
std::make_pair(tr("Broadband Adapter (TAP)"), ExpansionInterface::EXIDEVICE_ETH),
|
||||
std::make_pair(tr("Broadband Adapter (XLink Kai)"), ExpansionInterface::EXIDEVICE_ETHXLINK)};
|
||||
std::vector<std::pair<QString, EXIDeviceType>> sp1Entries{
|
||||
std::make_pair(tr("<Nothing>"), EXIDeviceType::None),
|
||||
std::make_pair(tr("Dummy"), EXIDeviceType::Dummy),
|
||||
std::make_pair(tr("Broadband Adapter (TAP)"), EXIDeviceType::Ethernet),
|
||||
std::make_pair(tr("Broadband Adapter (XLink Kai)"), EXIDeviceType::EthernetXLink)};
|
||||
#if defined(__APPLE__)
|
||||
sp1Entries.emplace_back(std::make_pair(tr("Broadband Adapter (tapserver)"),
|
||||
ExpansionInterface::EXIDEVICE_ETHTAPSERVER));
|
||||
ExpansionInterface::EXIDeviceType::EthernetTapServer));
|
||||
#endif
|
||||
for (const auto& entry : sp1Entries)
|
||||
{
|
||||
m_slot_combos[2]->addItem(entry.first, entry.second);
|
||||
m_slot_combos[2]->addItem(entry.first, static_cast<int>(entry.second));
|
||||
}
|
||||
|
||||
device_layout->addWidget(new QLabel(tr("Slot A:")), 0, 0);
|
||||
@ -242,20 +243,21 @@ void GameCubePane::OnEmulationStateChanged()
|
||||
|
||||
void GameCubePane::UpdateButton(int slot)
|
||||
{
|
||||
const auto value = m_slot_combos[slot]->currentData().toInt();
|
||||
const auto device =
|
||||
static_cast<ExpansionInterface::EXIDeviceType>(m_slot_combos[slot]->currentData().toInt());
|
||||
bool has_config = false;
|
||||
|
||||
switch (slot)
|
||||
{
|
||||
case SLOT_A_INDEX:
|
||||
case SLOT_B_INDEX:
|
||||
has_config =
|
||||
(value == ExpansionInterface::EXIDEVICE_MEMORYCARD ||
|
||||
value == ExpansionInterface::EXIDEVICE_AGP || value == ExpansionInterface::EXIDEVICE_MIC);
|
||||
has_config = (device == ExpansionInterface::EXIDeviceType::MemoryCard ||
|
||||
device == ExpansionInterface::EXIDeviceType::AGP ||
|
||||
device == ExpansionInterface::EXIDeviceType::Microphone);
|
||||
break;
|
||||
case SLOT_SP1_INDEX:
|
||||
has_config = (value == ExpansionInterface::EXIDEVICE_ETH ||
|
||||
value == ExpansionInterface::EXIDEVICE_ETHXLINK);
|
||||
has_config = (device == ExpansionInterface::EXIDeviceType::Ethernet ||
|
||||
device == ExpansionInterface::EXIDeviceType::EthernetXLink);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -267,30 +269,34 @@ void GameCubePane::OnConfigPressed(int slot)
|
||||
QString filter;
|
||||
bool memcard = false;
|
||||
|
||||
switch (m_slot_combos[slot]->currentData().toInt())
|
||||
const ExpansionInterface::EXIDeviceType device =
|
||||
static_cast<ExpansionInterface::EXIDeviceType>(m_slot_combos[slot]->currentData().toInt());
|
||||
|
||||
switch (device)
|
||||
{
|
||||
case ExpansionInterface::EXIDEVICE_MEMORYCARD:
|
||||
case ExpansionInterface::EXIDeviceType::MemoryCard:
|
||||
filter = tr("GameCube Memory Cards (*.raw *.gcp)");
|
||||
memcard = true;
|
||||
break;
|
||||
case ExpansionInterface::EXIDEVICE_AGP:
|
||||
case ExpansionInterface::EXIDeviceType::AGP:
|
||||
filter = tr("Game Boy Advance Carts (*.gba)");
|
||||
break;
|
||||
case ExpansionInterface::EXIDEVICE_MIC:
|
||||
case ExpansionInterface::EXIDeviceType::Microphone:
|
||||
MappingWindow(this, MappingWindow::Type::MAPPING_GC_MICROPHONE, slot).exec();
|
||||
return;
|
||||
case ExpansionInterface::EXIDEVICE_ETH:
|
||||
case ExpansionInterface::EXIDeviceType::Ethernet:
|
||||
{
|
||||
BroadbandAdapterSettingsDialog(this, BroadbandAdapterSettingsDialog::Type::Ethernet).exec();
|
||||
return;
|
||||
}
|
||||
case ExpansionInterface::EXIDEVICE_ETHXLINK:
|
||||
case ExpansionInterface::EXIDeviceType::EthernetXLink:
|
||||
{
|
||||
BroadbandAdapterSettingsDialog(this, BroadbandAdapterSettingsDialog::Type::XLinkKai).exec();
|
||||
return;
|
||||
}
|
||||
default:
|
||||
qFatal("unknown settings pressed");
|
||||
PanicAlertFmt("Unknown settings pressed for {}", device);
|
||||
return;
|
||||
}
|
||||
|
||||
QString filename = DolphinFileDialog::getSaveFileName(
|
||||
@ -322,7 +328,7 @@ void GameCubePane::OnConfigPressed(int slot)
|
||||
|
||||
bool other_slot_memcard =
|
||||
m_slot_combos[slot == SLOT_A_INDEX ? SLOT_B_INDEX : SLOT_A_INDEX]->currentData().toInt() ==
|
||||
ExpansionInterface::EXIDEVICE_MEMORYCARD;
|
||||
static_cast<int>(ExpansionInterface::EXIDeviceType::MemoryCard);
|
||||
if (other_slot_memcard)
|
||||
{
|
||||
QString path_b =
|
||||
@ -384,7 +390,8 @@ void GameCubePane::OnConfigPressed(int slot)
|
||||
// SlotB is on channel 1, slotA and SP1 are on 0
|
||||
slot,
|
||||
// The device enum to change to
|
||||
memcard ? ExpansionInterface::EXIDEVICE_MEMORYCARD : ExpansionInterface::EXIDEVICE_AGP,
|
||||
memcard ? ExpansionInterface::EXIDeviceType::MemoryCard :
|
||||
ExpansionInterface::EXIDeviceType::AGP,
|
||||
// SP1 is device 2, slots are device 0
|
||||
0);
|
||||
}
|
||||
@ -458,8 +465,9 @@ void GameCubePane::LoadSettings()
|
||||
for (int i = 0; i < SLOT_COUNT; i++)
|
||||
{
|
||||
QSignalBlocker blocker(m_slot_combos[i]);
|
||||
const ExpansionInterface::TEXIDevices exi_device = Config::Get(Config::GetInfoForEXIDevice(i));
|
||||
m_slot_combos[i]->setCurrentIndex(m_slot_combos[i]->findData(exi_device));
|
||||
const ExpansionInterface::EXIDeviceType exi_device =
|
||||
Config::Get(Config::GetInfoForEXIDevice(i));
|
||||
m_slot_combos[i]->setCurrentIndex(m_slot_combos[i]->findData(static_cast<int>(exi_device)));
|
||||
UpdateButton(i);
|
||||
}
|
||||
|
||||
@ -485,8 +493,9 @@ void GameCubePane::SaveSettings()
|
||||
// Device Settings
|
||||
for (int i = 0; i < SLOT_COUNT; i++)
|
||||
{
|
||||
const auto dev = ExpansionInterface::TEXIDevices(m_slot_combos[i]->currentData().toInt());
|
||||
const ExpansionInterface::TEXIDevices current_exi_device =
|
||||
const auto dev =
|
||||
static_cast<ExpansionInterface::EXIDeviceType>(m_slot_combos[i]->currentData().toInt());
|
||||
const ExpansionInterface::EXIDeviceType current_exi_device =
|
||||
Config::Get(Config::GetInfoForEXIDevice(i));
|
||||
|
||||
if (Core::IsRunning() && current_exi_device != dev)
|
||||
|
Loading…
x
Reference in New Issue
Block a user