diff --git a/Source/Core/Core/Config/MainSettings.cpp b/Source/Core/Core/Config/MainSettings.cpp index e2b73ce846..c520f06b4a 100644 --- a/Source/Core/Core/Config/MainSettings.cpp +++ b/Source/Core/Core/Config/MainSettings.cpp @@ -55,16 +55,16 @@ const Info MAIN_GCI_FOLDER_A_PATH_OVERRIDE{ const Info MAIN_GCI_FOLDER_B_PATH_OVERRIDE{ {System::Main, "Core", "GCIFolderBPathOverride"}, ""}; -const Info MAIN_SLOT_A{ - {System::Main, "Core", "SlotA"}, ExpansionInterface::EXIDEVICE_MEMORYCARDFOLDER}; -const Info MAIN_SLOT_B{{System::Main, "Core", "SlotB"}, - ExpansionInterface::EXIDEVICE_NONE}; -const Info MAIN_SERIAL_PORT_1{ - {System::Main, "Core", "SerialPort1"}, ExpansionInterface::EXIDEVICE_NONE}; +const Info MAIN_SLOT_A{ + {System::Main, "Core", "SlotA"}, ExpansionInterface::EXIDeviceType::MemoryCardFolder}; +const Info MAIN_SLOT_B{{System::Main, "Core", "SlotB"}, + ExpansionInterface::EXIDeviceType::None}; +const Info MAIN_SERIAL_PORT_1{ + {System::Main, "Core", "SerialPort1"}, ExpansionInterface::EXIDeviceType::None}; -const Info& GetInfoForEXIDevice(int channel) +const Info& GetInfoForEXIDevice(int channel) { - static constexpr std::array*, 3> infos{ + static constexpr std::array*, 3> infos{ &MAIN_SLOT_A, &MAIN_SLOT_B, &MAIN_SERIAL_PORT_1, diff --git a/Source/Core/Core/Config/MainSettings.h b/Source/Core/Core/Config/MainSettings.h index 5ee87fcf72..49e2a98e8d 100644 --- a/Source/Core/Core/Config/MainSettings.h +++ b/Source/Core/Core/Config/MainSettings.h @@ -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 MAIN_AGP_CART_A_PATH; extern const Info MAIN_AGP_CART_B_PATH; extern const Info MAIN_GCI_FOLDER_A_PATH_OVERRIDE; extern const Info MAIN_GCI_FOLDER_B_PATH_OVERRIDE; -extern const Info MAIN_SLOT_A; -extern const Info MAIN_SLOT_B; -extern const Info MAIN_SERIAL_PORT_1; -const Info& GetInfoForEXIDevice(int channel); +extern const Info MAIN_SLOT_A; +extern const Info MAIN_SLOT_B; +extern const Info MAIN_SERIAL_PORT_1; +const Info& GetInfoForEXIDevice(int channel); extern const Info MAIN_BBA_MAC; extern const Info MAIN_BBA_XLINK_IP; extern const Info MAIN_BBA_XLINK_CHAT_OSD; diff --git a/Source/Core/Core/ConfigManager.h b/Source/Core/Core/ConfigManager.h index 9125eabcb3..bb0b165249 100644 --- a/Source/Core/Core/ConfigManager.h +++ b/Source/Core/Core/ConfigManager.h @@ -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 diff --git a/Source/Core/Core/HW/EXI/EXI.cpp b/Source/Core/Core/HW/EXI/EXI.cpp index d7fc90a25e..f40d321bb5 100644 --- a/Source/Core/Core/HW/EXI/EXI.cpp +++ b/Source/Core/Core/HW/EXI/EXI.cpp @@ -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(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) { diff --git a/Source/Core/Core/HW/EXI/EXI.h b/Source/Core/Core/HW/EXI/EXI.h index f902c6e735..d898f7ea02 100644 --- a/Source/Core/Core/HW/EXI/EXI.h +++ b/Source/Core/Core/HW/EXI/EXI.h @@ -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 diff --git a/Source/Core/Core/HW/EXI/EXI_Channel.cpp b/Source/Core/Core/HW/EXI/EXI_Channel.cpp index b8d46133fe..c7a0de6ebb 100644 --- a/Source/Core/Core/HW/EXI/EXI_Channel.cpp +++ b/Source/Core/Core/HW/EXI/EXI_Channel.cpp @@ -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& 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) { diff --git a/Source/Core/Core/HW/EXI/EXI_Channel.h b/Source/Core/Core/HW/EXI/EXI_Channel.h index ce727b3008..11c25ad348 100644 --- a/Source/Core/Core/HW/EXI/EXI_Channel.h +++ b/Source/Core/Core/HW/EXI/EXI_Channel.h @@ -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 device, int device_num, bool notify_presence_changed = true); diff --git a/Source/Core/Core/HW/EXI/EXI_Device.cpp b/Source/Core/Core/HW/EXI/EXI_Device.cpp index 854a549f4f..ce25067934 100644 --- a/Source/Core/Core/HW/EXI/EXI_Device.cpp +++ b/Source/Core/Core/HW/EXI/EXI_Device.cpp @@ -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 EXIDevice_Create(const TEXIDevices device_type, const int channel_num, +std::unique_ptr EXIDevice_Create(const EXIDeviceType device_type, const int channel_num, const Memcard::HeaderData& memcard_header_data) { std::unique_ptr result; switch (device_type) { - case EXIDEVICE_DUMMY: + case EXIDeviceType::Dummy: result = std::make_unique("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(channel_num, gci_folder, memcard_header_data); break; } - case EXIDEVICE_MASKROM: + case EXIDeviceType::MaskROM: result = std::make_unique(); break; - case EXIDEVICE_AD16: + case EXIDeviceType::AD16: result = std::make_unique(); break; - case EXIDEVICE_MIC: + case EXIDeviceType::Microphone: result = std::make_unique(channel_num); break; - case EXIDEVICE_ETH: + case EXIDeviceType::Ethernet: result = std::make_unique(BBADeviceType::TAP); break; #if defined(__APPLE__) - case EXIDEVICE_ETHTAPSERVER: + case EXIDeviceType::EthernetTapServer: result = std::make_unique(BBADeviceType::TAPSERVER); break; #endif - case EXIDEVICE_ETHXLINK: + case EXIDeviceType::EthernetXLink: result = std::make_unique(BBADeviceType::XLINK); break; - case EXIDEVICE_GECKO: + case EXIDeviceType::Gecko: result = std::make_unique(); break; - case EXIDEVICE_AGP: + case EXIDeviceType::AGP: result = std::make_unique(channel_num); break; - case EXIDEVICE_AM_BASEBOARD: - case EXIDEVICE_NONE: + case EXIDeviceType::AMBaseboard: + case EXIDeviceType::None: default: result = std::make_unique(); break; diff --git a/Source/Core/Core/HW/EXI/EXI_Device.h b/Source/Core/Core/HW/EXI/EXI_Device.h index 2f0d831af4..6b105c9be4 100644 --- a/Source/Core/Core/HW/EXI/EXI_Device.h +++ b/Source/Core/Core/HW/EXI/EXI_Device.h @@ -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 EXIDevice_Create(TEXIDevices device_type, int channel_num, +std::unique_ptr EXIDevice_Create(EXIDeviceType device_type, int channel_num, const Memcard::HeaderData& memcard_header_data); } // namespace ExpansionInterface diff --git a/Source/Core/Core/HW/EXI/EXI_DeviceMemoryCard.cpp b/Source/Core/Core/HW/EXI/EXI_DeviceMemoryCard.cpp index f905b8bce4..0a12b36118 100644 --- a/Source/Core/Core/HW/EXI/EXI_DeviceMemoryCard.cpp +++ b/Source/Core/Core/HW/EXI/EXI_DeviceMemoryCard.cpp @@ -58,11 +58,11 @@ void CEXIMemoryCard::EventCompleteFindInstance(u64 userdata, { int card_index = (int)userdata; auto* self = static_cast( - ExpansionInterface::FindDevice(EXIDEVICE_MEMORYCARD, card_index)); + ExpansionInterface::FindDevice(EXIDeviceType::MemoryCard, card_index)); if (self == nullptr) { self = static_cast( - 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; diff --git a/Source/Core/Core/HW/EXI/EXI_DeviceMemoryCard.h b/Source/Core/Core/HW/EXI/EXI_DeviceMemoryCard.h index 01fc30a4eb..7075c00234 100644 --- a/Source/Core/Core/HW/EXI/EXI_DeviceMemoryCard.h +++ b/Source/Core/Core/HW/EXI/EXI_DeviceMemoryCard.h @@ -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; diff --git a/Source/Core/Core/Movie.cpp b/Source/Core/Core/Movie.cpp index 78f36941c9..f6bd914aed 100644 --- a/Source/Core/Core/Movie.cpp +++ b/Source/Core/Core/Movie.cpp @@ -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(); diff --git a/Source/Core/Core/NetPlayProto.h b/Source/Core/Core/NetPlayProto.h index 5c5db0da6b..9c63ed0e6c 100644 --- a/Source/Core/Core/NetPlayProto.h +++ b/Source/Core/Core/NetPlayProto.h @@ -44,7 +44,7 @@ struct NetSettings bool m_CopyWiiSave = false; bool m_OCEnable = false; float m_OCFactor = 0; - std::array m_EXIDevice{}; + std::array m_EXIDevice{}; std::array m_SYSCONFSettings{}; diff --git a/Source/Core/Core/NetPlayServer.cpp b/Source/Core/Core/NetPlayServer.cpp index 6b00929373..8ef91a459b 100644 --- a/Source/Core/Core/NetPlayServer.cpp +++ b/Source/Core/Core/NetPlayServer.cpp @@ -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(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'); diff --git a/Source/Core/DolphinQt/GCMemcardManager.cpp b/Source/Core/DolphinQt/GCMemcardManager.cpp index 56f0c8ec93..c179e1dded 100644 --- a/Source/Core/DolphinQt/GCMemcardManager.cpp +++ b/Source/Core/DolphinQt/GCMemcardManager.cpp @@ -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; } diff --git a/Source/Core/DolphinQt/GameList/GameList.cpp b/Source/Core/DolphinQt/GameList/GameList.cpp index 2fd137055f..40b786261c 100644 --- a/Source/Core/DolphinQt/GameList/GameList.cpp +++ b/Source/Core/DolphinQt/GameList/GameList.cpp @@ -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); diff --git a/Source/Core/DolphinQt/Settings/GameCubePane.cpp b/Source/Core/DolphinQt/Settings/GameCubePane.cpp index 77b3b86b0c..353199f2fc 100644 --- a/Source/Core/DolphinQt/Settings/GameCubePane.cpp +++ b/Source/Core/DolphinQt/Settings/GameCubePane.cpp @@ -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(""), 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(""), 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(entry.second)); + m_slot_combos[1]->addItem(entry.first, static_cast(entry.second)); } // Add SP1 devices - std::vector> sp1Entries{ - std::make_pair(tr(""), 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> sp1Entries{ + std::make_pair(tr(""), 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(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(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(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(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(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(m_slot_combos[i]->currentData().toInt()); + const ExpansionInterface::EXIDeviceType current_exi_device = Config::Get(Config::GetInfoForEXIDevice(i)); if (Core::IsRunning() && current_exi_device != dev)