mirror of
https://github.com/izzy2lost/dolphin.git
synced 2026-06-19 01:16:48 -07:00
Merge pull request #11632 from AdmiralCurtiss/pass-more-system
Pass System to Boot functions, CPUThreadGuard, IEXIDevice.
This commit is contained in:
@@ -321,26 +321,24 @@ static const DiscIO::VolumeDisc* SetDisc(std::unique_ptr<DiscIO::VolumeDisc> dis
|
||||
return pointer;
|
||||
}
|
||||
|
||||
bool CBoot::DVDRead(const DiscIO::VolumeDisc& disc, u64 dvd_offset, u32 output_address, u32 length,
|
||||
const DiscIO::Partition& partition)
|
||||
bool CBoot::DVDRead(Core::System& system, const DiscIO::VolumeDisc& disc, u64 dvd_offset,
|
||||
u32 output_address, u32 length, const DiscIO::Partition& partition)
|
||||
{
|
||||
std::vector<u8> buffer(length);
|
||||
if (!disc.Read(dvd_offset, length, buffer.data(), partition))
|
||||
return false;
|
||||
|
||||
auto& system = Core::System::GetInstance();
|
||||
auto& memory = system.GetMemory();
|
||||
memory.CopyToEmu(output_address, buffer.data(), length);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CBoot::DVDReadDiscID(const DiscIO::VolumeDisc& disc, u32 output_address)
|
||||
bool CBoot::DVDReadDiscID(Core::System& system, const DiscIO::VolumeDisc& disc, u32 output_address)
|
||||
{
|
||||
std::array<u8, 0x20> buffer;
|
||||
if (!disc.Read(0, buffer.size(), buffer.data(), DiscIO::PARTITION_NONE))
|
||||
return false;
|
||||
|
||||
auto& system = Core::System::GetInstance();
|
||||
auto& memory = system.GetMemory();
|
||||
memory.CopyToEmu(output_address, buffer.data(), buffer.size());
|
||||
|
||||
@@ -550,14 +548,14 @@ bool CBoot::BootUp(Core::System& system, const Core::CPUThreadGuard& guard,
|
||||
// Because there is no TMD to get the requested system (IOS) version from,
|
||||
// we default to IOS58, which is the version used by the Homebrew Channel.
|
||||
SetupWiiMemory(system, IOS::HLE::IOSC::ConsoleType::Retail);
|
||||
IOS::HLE::GetIOS()->BootIOS(Titles::IOS(58));
|
||||
IOS::HLE::GetIOS()->BootIOS(system, Titles::IOS(58));
|
||||
}
|
||||
else
|
||||
{
|
||||
SetupGCMemory(system, guard);
|
||||
}
|
||||
|
||||
if (!executable.reader->LoadIntoMemory())
|
||||
if (!executable.reader->LoadIntoMemory(system))
|
||||
{
|
||||
PanicAlertFmtT("Failed to load the executable to memory.");
|
||||
return false;
|
||||
|
||||
@@ -171,9 +171,10 @@ public:
|
||||
static bool LoadMapFromFilename(const Core::CPUThreadGuard& guard);
|
||||
|
||||
private:
|
||||
static bool DVDRead(const DiscIO::VolumeDisc& disc, u64 dvd_offset, u32 output_address,
|
||||
u32 length, const DiscIO::Partition& partition);
|
||||
static bool DVDReadDiscID(const DiscIO::VolumeDisc& disc, u32 output_address);
|
||||
static bool DVDRead(Core::System& system, const DiscIO::VolumeDisc& disc, u64 dvd_offset,
|
||||
u32 output_address, u32 length, const DiscIO::Partition& partition);
|
||||
static bool DVDReadDiscID(Core::System& system, const DiscIO::VolumeDisc& disc,
|
||||
u32 output_address);
|
||||
static void RunFunction(Core::System& system, u32 address);
|
||||
|
||||
static void UpdateDebugger_MapLoaded();
|
||||
@@ -213,7 +214,7 @@ public:
|
||||
virtual u32 GetEntryPoint() const = 0;
|
||||
virtual bool IsValid() const = 0;
|
||||
virtual bool IsWii() const = 0;
|
||||
virtual bool LoadIntoMemory(bool only_in_mem1 = false) const = 0;
|
||||
virtual bool LoadIntoMemory(Core::System& system, bool only_in_mem1 = false) const = 0;
|
||||
virtual bool LoadSymbols(const Core::CPUThreadGuard& guard) const = 0;
|
||||
|
||||
protected:
|
||||
|
||||
@@ -44,10 +44,10 @@
|
||||
|
||||
namespace
|
||||
{
|
||||
void PresetTimeBaseTicks(const Core::CPUThreadGuard& guard)
|
||||
void PresetTimeBaseTicks(Core::System& system, const Core::CPUThreadGuard& guard)
|
||||
{
|
||||
const u64 emulated_time =
|
||||
ExpansionInterface::CEXIIPL::GetEmulatedTime(ExpansionInterface::CEXIIPL::GC_EPOCH);
|
||||
ExpansionInterface::CEXIIPL::GetEmulatedTime(system, ExpansionInterface::CEXIIPL::GC_EPOCH);
|
||||
|
||||
const u64 time_base_ticks = emulated_time * 40500000ULL;
|
||||
|
||||
@@ -148,7 +148,7 @@ bool CBoot::RunApploader(Core::System& system, const Core::CPUThreadGuard& guard
|
||||
INFO_LOG_FMT(BOOT, "Invalid apploader. Your disc image is probably corrupted.");
|
||||
return false;
|
||||
}
|
||||
DVDRead(volume, offset + 0x20, 0x01200000, *size + *trailer, partition);
|
||||
DVDRead(system, volume, offset + 0x20, 0x01200000, *size + *trailer, partition);
|
||||
|
||||
// TODO - Make Apploader(or just RunFunction()) debuggable!!!
|
||||
|
||||
@@ -195,7 +195,7 @@ bool CBoot::RunApploader(Core::System& system, const Core::CPUThreadGuard& guard
|
||||
|
||||
INFO_LOG_FMT(BOOT, "DVDRead: offset: {:08x} memOffset: {:08x} length: {}", dvd_offset,
|
||||
ram_address, length);
|
||||
DVDRead(volume, dvd_offset, ram_address, length, partition);
|
||||
DVDRead(system, volume, dvd_offset, ram_address, length, partition);
|
||||
|
||||
DiscIO::Riivolution::ApplyApploaderMemoryPatches(guard, riivolution_patches, ram_address,
|
||||
length);
|
||||
@@ -248,7 +248,7 @@ void CBoot::SetupGCMemory(Core::System& system, const Core::CPUThreadGuard& guar
|
||||
PowerPC::HostWrite_U32(guard, 0x4c000064, 0x80000800); // Write default FPU Handler: rfi
|
||||
PowerPC::HostWrite_U32(guard, 0x4c000064, 0x80000C00); // Write default Syscall Handler: rfi
|
||||
|
||||
PresetTimeBaseTicks(guard);
|
||||
PresetTimeBaseTicks(system, guard);
|
||||
|
||||
// HIO checks this
|
||||
// PowerPC::HostWrite_U16(0x8200, 0x000030e6); // Console type
|
||||
@@ -284,7 +284,7 @@ bool CBoot::EmulatedBS2_GC(Core::System& system, const Core::CPUThreadGuard& gua
|
||||
auto& vertex_shader_manager = system.GetVertexShaderManager();
|
||||
vertex_shader_manager.InvalidateXFRange(XFMEM_POSTMATRICES + 0x3d * 4, XFMEM_POSTMATRICES_END);
|
||||
|
||||
DVDReadDiscID(volume, 0x00000000);
|
||||
DVDReadDiscID(system, volume, 0x00000000);
|
||||
|
||||
auto& memory = system.GetMemory();
|
||||
bool streaming = memory.Read_U8(0x80000008);
|
||||
@@ -554,7 +554,7 @@ bool CBoot::EmulatedBS2_Wii(Core::System& system, const Core::CPUThreadGuard& gu
|
||||
const u64 ios = ios_override >= 0 ? Titles::IOS(static_cast<u32>(ios_override)) : tmd.GetIOSId();
|
||||
|
||||
const auto console_type = volume.GetTicket(data_partition).GetConsoleType();
|
||||
if (!SetupWiiMemory(system, console_type) || !IOS::HLE::GetIOS()->BootIOS(ios))
|
||||
if (!SetupWiiMemory(system, console_type) || !IOS::HLE::GetIOS()->BootIOS(system, ios))
|
||||
return false;
|
||||
|
||||
auto di =
|
||||
@@ -563,13 +563,13 @@ bool CBoot::EmulatedBS2_Wii(Core::System& system, const Core::CPUThreadGuard& gu
|
||||
di->InitializeIfFirstTime();
|
||||
di->ChangePartition(data_partition);
|
||||
|
||||
DVDReadDiscID(volume, 0x00000000);
|
||||
DVDReadDiscID(system, volume, 0x00000000);
|
||||
|
||||
// This is some kind of consistency check that is compared to the 0x00
|
||||
// values as the game boots. This location keeps the 4 byte ID for as long
|
||||
// as the game is running. The 6 byte ID at 0x00 is overwritten sometime
|
||||
// after this check during booting.
|
||||
DVDRead(volume, 0, 0x3180, 4, partition);
|
||||
DVDRead(system, volume, 0, 0x3180, 4, partition);
|
||||
|
||||
auto& ppc_state = system.GetPPCState();
|
||||
|
||||
|
||||
@@ -110,15 +110,14 @@ bool DolReader::Initialize(const std::vector<u8>& buffer)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DolReader::LoadIntoMemory(bool only_in_mem1) const
|
||||
bool DolReader::LoadIntoMemory(Core::System& system, bool only_in_mem1) const
|
||||
{
|
||||
if (!m_is_valid)
|
||||
return false;
|
||||
|
||||
if (m_is_ancast)
|
||||
return LoadAncastIntoMemory();
|
||||
return LoadAncastIntoMemory(system);
|
||||
|
||||
auto& system = Core::System::GetInstance();
|
||||
auto& memory = system.GetMemory();
|
||||
|
||||
// load all text (code) sections
|
||||
@@ -149,7 +148,7 @@ bool DolReader::LoadIntoMemory(bool only_in_mem1) const
|
||||
}
|
||||
|
||||
// On a real console this would be done in the Espresso bootrom
|
||||
bool DolReader::LoadAncastIntoMemory() const
|
||||
bool DolReader::LoadAncastIntoMemory(Core::System& system) const
|
||||
{
|
||||
// The ancast image will always be in data section 0
|
||||
const auto& section = m_data_sections[0];
|
||||
@@ -227,7 +226,6 @@ bool DolReader::LoadAncastIntoMemory() const
|
||||
body_size))
|
||||
return false;
|
||||
|
||||
auto& system = Core::System::GetInstance();
|
||||
auto& memory = system.GetMemory();
|
||||
|
||||
// Copy the Ancast header to the emu
|
||||
|
||||
@@ -26,7 +26,7 @@ public:
|
||||
bool IsWii() const override { return m_is_wii; }
|
||||
bool IsAncast() const { return m_is_ancast; };
|
||||
u32 GetEntryPoint() const override { return m_dolheader.entryPoint; }
|
||||
bool LoadIntoMemory(bool only_in_mem1 = false) const override;
|
||||
bool LoadIntoMemory(Core::System& system, bool only_in_mem1 = false) const override;
|
||||
bool LoadSymbols(const Core::CPUThreadGuard& guard) const override { return false; }
|
||||
|
||||
private:
|
||||
@@ -63,5 +63,5 @@ private:
|
||||
// Copy sections to internal buffers
|
||||
bool Initialize(const std::vector<u8>& buffer);
|
||||
|
||||
bool LoadAncastIntoMemory() const;
|
||||
bool LoadAncastIntoMemory(Core::System& system) const;
|
||||
};
|
||||
|
||||
@@ -124,7 +124,7 @@ const char* ElfReader::GetSectionName(int section) const
|
||||
}
|
||||
|
||||
// This is just a simple elf loader, good enough to load elfs generated by devkitPPC
|
||||
bool ElfReader::LoadIntoMemory(bool only_in_mem1) const
|
||||
bool ElfReader::LoadIntoMemory(Core::System& system, bool only_in_mem1) const
|
||||
{
|
||||
INFO_LOG_FMT(BOOT, "String section: {}", header->e_shstrndx);
|
||||
|
||||
@@ -136,7 +136,6 @@ bool ElfReader::LoadIntoMemory(bool only_in_mem1) const
|
||||
|
||||
INFO_LOG_FMT(BOOT, "{} segments:", header->e_phnum);
|
||||
|
||||
auto& system = Core::System::GetInstance();
|
||||
auto& memory = system.GetMemory();
|
||||
|
||||
// Copy segments into ram.
|
||||
|
||||
@@ -35,7 +35,7 @@ public:
|
||||
ElfMachine GetMachine() const { return (ElfMachine)(header->e_machine); }
|
||||
u32 GetEntryPoint() const override { return entryPoint; }
|
||||
u32 GetFlags() const { return (u32)(header->e_flags); }
|
||||
bool LoadIntoMemory(bool only_in_mem1 = false) const override;
|
||||
bool LoadIntoMemory(Core::System& system, bool only_in_mem1 = false) const override;
|
||||
bool LoadSymbols(const Core::CPUThreadGuard& guard) const override;
|
||||
// TODO: actually check for validity.
|
||||
bool IsValid() const override { return true; }
|
||||
|
||||
@@ -170,7 +170,7 @@ void OnFrameEnd()
|
||||
if (s_memory_watcher)
|
||||
{
|
||||
ASSERT(IsCPUThread());
|
||||
CPUThreadGuard guard;
|
||||
CPUThreadGuard guard(Core::System::GetInstance());
|
||||
|
||||
s_memory_watcher->Step(guard);
|
||||
}
|
||||
@@ -533,7 +533,7 @@ static void EmuThread(std::unique_ptr<BootParameters> boot, WindowSystemInfo wsi
|
||||
|
||||
HW::Init(NetPlay::IsNetPlayRunning() ? &(boot_session_data.GetNetplaySettings()->sram) : nullptr);
|
||||
|
||||
Common::ScopeGuard hw_guard{[] {
|
||||
Common::ScopeGuard hw_guard{[&system] {
|
||||
// We must set up this flag before executing HW::Shutdown()
|
||||
s_hardware_initialized = false;
|
||||
INFO_LOG_FMT(CONSOLE, "{}", StopMessage(false, "Shutting down HW"));
|
||||
@@ -550,7 +550,7 @@ static void EmuThread(std::unique_ptr<BootParameters> boot, WindowSystemInfo wsi
|
||||
PatchEngine::Shutdown();
|
||||
HLE::Clear();
|
||||
|
||||
CPUThreadGuard guard;
|
||||
CPUThreadGuard guard(system);
|
||||
PowerPC::debug_interface.Clear(guard);
|
||||
}};
|
||||
|
||||
@@ -603,7 +603,7 @@ static void EmuThread(std::unique_ptr<BootParameters> boot, WindowSystemInfo wsi
|
||||
|
||||
{
|
||||
ASSERT(IsCPUThread());
|
||||
CPUThreadGuard guard;
|
||||
CPUThreadGuard guard(system);
|
||||
if (!CBoot::BootUp(system, guard, std::move(boot)))
|
||||
return;
|
||||
}
|
||||
@@ -1058,16 +1058,17 @@ void UpdateInputGate(bool require_focus, bool require_full_focus)
|
||||
ControlReference::SetInputGate(focus_passes && full_focus_passes);
|
||||
}
|
||||
|
||||
CPUThreadGuard::CPUThreadGuard() : m_was_cpu_thread(IsCPUThread())
|
||||
CPUThreadGuard::CPUThreadGuard(Core::System& system)
|
||||
: m_system(system), m_was_cpu_thread(IsCPUThread())
|
||||
{
|
||||
if (!m_was_cpu_thread)
|
||||
m_was_unpaused = PauseAndLock(Core::System::GetInstance(), true, true);
|
||||
m_was_unpaused = PauseAndLock(system, true, true);
|
||||
}
|
||||
|
||||
CPUThreadGuard::~CPUThreadGuard()
|
||||
{
|
||||
if (!m_was_cpu_thread)
|
||||
PauseAndLock(Core::System::GetInstance(), false, m_was_unpaused);
|
||||
PauseAndLock(m_system, false, m_was_unpaused);
|
||||
}
|
||||
|
||||
} // namespace Core
|
||||
|
||||
@@ -108,7 +108,7 @@ enum class ConsoleType : u32
|
||||
class CPUThreadGuard final
|
||||
{
|
||||
public:
|
||||
CPUThreadGuard();
|
||||
explicit CPUThreadGuard(Core::System& system);
|
||||
~CPUThreadGuard();
|
||||
|
||||
CPUThreadGuard(const CPUThreadGuard&) = delete;
|
||||
@@ -117,6 +117,7 @@ public:
|
||||
CPUThreadGuard& operator=(CPUThreadGuard&&) = delete;
|
||||
|
||||
private:
|
||||
Core::System& m_system;
|
||||
const bool m_was_cpu_thread;
|
||||
bool m_was_unpaused = false;
|
||||
};
|
||||
|
||||
@@ -169,7 +169,7 @@ void Execute(const Core::CPUThreadGuard& guard, u32 current_pc, u32 hook_index)
|
||||
void ExecuteFromJIT(u32 current_pc, u32 hook_index)
|
||||
{
|
||||
ASSERT(Core::IsCPUThread());
|
||||
Core::CPUThreadGuard guard;
|
||||
Core::CPUThreadGuard guard(Core::System::GetInstance());
|
||||
Execute(guard, current_pc, hook_index);
|
||||
}
|
||||
|
||||
|
||||
@@ -149,7 +149,7 @@ void Init(const Sram* override_sram)
|
||||
Memcard::HeaderData header_data;
|
||||
Memcard::InitializeHeaderData(&header_data, flash_id, size_mbits, shift_jis, rtc_bias,
|
||||
sram_language, format_time + i);
|
||||
state.channels[i] = std::make_unique<CEXIChannel>(i, header_data);
|
||||
state.channels[i] = std::make_unique<CEXIChannel>(system, i, header_data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,8 +25,9 @@ enum
|
||||
EXI_READWRITE
|
||||
};
|
||||
|
||||
CEXIChannel::CEXIChannel(u32 channel_id, const Memcard::HeaderData& memcard_header_data)
|
||||
: m_channel_id(channel_id), m_memcard_header_data(memcard_header_data)
|
||||
CEXIChannel::CEXIChannel(Core::System& system, u32 channel_id,
|
||||
const Memcard::HeaderData& memcard_header_data)
|
||||
: m_system(system), m_channel_id(channel_id), m_memcard_header_data(memcard_header_data)
|
||||
{
|
||||
if (m_channel_id == 0 || m_channel_id == 1)
|
||||
m_status.EXTINT = 1;
|
||||
@@ -34,7 +35,7 @@ CEXIChannel::CEXIChannel(u32 channel_id, const Memcard::HeaderData& memcard_head
|
||||
m_status.CHIP_SELECT = 1;
|
||||
|
||||
for (auto& device : m_devices)
|
||||
device = EXIDevice_Create(EXIDeviceType::None, m_channel_id, m_memcard_header_data);
|
||||
device = EXIDevice_Create(system, EXIDeviceType::None, m_channel_id, m_memcard_header_data);
|
||||
}
|
||||
|
||||
CEXIChannel::~CEXIChannel()
|
||||
@@ -170,7 +171,8 @@ void CEXIChannel::RemoveDevices()
|
||||
|
||||
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);
|
||||
AddDevice(EXIDevice_Create(m_system, device_type, m_channel_id, m_memcard_header_data),
|
||||
device_num);
|
||||
}
|
||||
|
||||
void CEXIChannel::AddDevice(std::unique_ptr<IEXIDevice> device, const int device_num,
|
||||
@@ -255,7 +257,7 @@ void CEXIChannel::DoState(PointerWrap& p)
|
||||
else
|
||||
{
|
||||
std::unique_ptr<IEXIDevice> save_device =
|
||||
EXIDevice_Create(type, m_channel_id, m_memcard_header_data);
|
||||
EXIDevice_Create(m_system, type, m_channel_id, m_memcard_header_data);
|
||||
save_device->DoState(p);
|
||||
AddDevice(std::move(save_device), device_index, false);
|
||||
}
|
||||
|
||||
@@ -25,7 +25,8 @@ enum class EXIDeviceType : int;
|
||||
class CEXIChannel
|
||||
{
|
||||
public:
|
||||
explicit CEXIChannel(u32 channel_id, const Memcard::HeaderData& memcard_header_data);
|
||||
explicit CEXIChannel(Core::System& system, u32 channel_id,
|
||||
const Memcard::HeaderData& memcard_header_data);
|
||||
~CEXIChannel();
|
||||
|
||||
// get device
|
||||
@@ -100,6 +101,8 @@ private:
|
||||
};
|
||||
};
|
||||
|
||||
Core::System& m_system;
|
||||
|
||||
// STATE_TO_SAVE
|
||||
UEXI_STATUS m_status;
|
||||
u32 m_dma_memory_address = 0;
|
||||
|
||||
@@ -19,6 +19,10 @@
|
||||
|
||||
namespace ExpansionInterface
|
||||
{
|
||||
IEXIDevice::IEXIDevice(Core::System& system) : m_system(system)
|
||||
{
|
||||
}
|
||||
|
||||
void IEXIDevice::ImmWrite(u32 data, u32 size)
|
||||
{
|
||||
while (size--)
|
||||
@@ -48,8 +52,7 @@ void IEXIDevice::ImmReadWrite(u32& data, u32 size)
|
||||
|
||||
void IEXIDevice::DMAWrite(u32 address, u32 size)
|
||||
{
|
||||
auto& system = Core::System::GetInstance();
|
||||
auto& memory = system.GetMemory();
|
||||
auto& memory = m_system.GetMemory();
|
||||
while (size--)
|
||||
{
|
||||
u8 byte = memory.Read_U8(address++);
|
||||
@@ -59,8 +62,7 @@ void IEXIDevice::DMAWrite(u32 address, u32 size)
|
||||
|
||||
void IEXIDevice::DMARead(u32 address, u32 size)
|
||||
{
|
||||
auto& system = Core::System::GetInstance();
|
||||
auto& memory = system.GetMemory();
|
||||
auto& memory = m_system.GetMemory();
|
||||
while (size--)
|
||||
{
|
||||
u8 byte = 0;
|
||||
@@ -101,7 +103,8 @@ void IEXIDevice::TransferByte(u8& byte)
|
||||
}
|
||||
|
||||
// F A C T O R Y
|
||||
std::unique_ptr<IEXIDevice> EXIDevice_Create(const EXIDeviceType device_type, const int channel_num,
|
||||
std::unique_ptr<IEXIDevice> EXIDevice_Create(Core::System& system, const EXIDeviceType device_type,
|
||||
const int channel_num,
|
||||
const Memcard::HeaderData& memcard_header_data)
|
||||
{
|
||||
std::unique_ptr<IEXIDevice> result;
|
||||
@@ -112,58 +115,58 @@ std::unique_ptr<IEXIDevice> EXIDevice_Create(const EXIDeviceType device_type, co
|
||||
switch (device_type)
|
||||
{
|
||||
case EXIDeviceType::Dummy:
|
||||
result = std::make_unique<CEXIDummy>("Dummy");
|
||||
result = std::make_unique<CEXIDummy>(system, "Dummy");
|
||||
break;
|
||||
|
||||
case EXIDeviceType::MemoryCard:
|
||||
case EXIDeviceType::MemoryCardFolder:
|
||||
{
|
||||
bool gci_folder = (device_type == EXIDeviceType::MemoryCardFolder);
|
||||
result = std::make_unique<CEXIMemoryCard>(slot, gci_folder, memcard_header_data);
|
||||
result = std::make_unique<CEXIMemoryCard>(system, slot, gci_folder, memcard_header_data);
|
||||
break;
|
||||
}
|
||||
case EXIDeviceType::MaskROM:
|
||||
result = std::make_unique<CEXIIPL>();
|
||||
result = std::make_unique<CEXIIPL>(system);
|
||||
break;
|
||||
|
||||
case EXIDeviceType::AD16:
|
||||
result = std::make_unique<CEXIAD16>();
|
||||
result = std::make_unique<CEXIAD16>(system);
|
||||
break;
|
||||
|
||||
case EXIDeviceType::Microphone:
|
||||
result = std::make_unique<CEXIMic>(channel_num);
|
||||
result = std::make_unique<CEXIMic>(system, channel_num);
|
||||
break;
|
||||
|
||||
case EXIDeviceType::Ethernet:
|
||||
result = std::make_unique<CEXIETHERNET>(BBADeviceType::TAP);
|
||||
result = std::make_unique<CEXIETHERNET>(system, BBADeviceType::TAP);
|
||||
break;
|
||||
|
||||
#if defined(__APPLE__)
|
||||
case EXIDeviceType::EthernetTapServer:
|
||||
result = std::make_unique<CEXIETHERNET>(BBADeviceType::TAPSERVER);
|
||||
result = std::make_unique<CEXIETHERNET>(system, BBADeviceType::TAPSERVER);
|
||||
break;
|
||||
#endif
|
||||
|
||||
case EXIDeviceType::EthernetXLink:
|
||||
result = std::make_unique<CEXIETHERNET>(BBADeviceType::XLINK);
|
||||
result = std::make_unique<CEXIETHERNET>(system, BBADeviceType::XLINK);
|
||||
break;
|
||||
|
||||
case EXIDeviceType::EthernetBuiltIn:
|
||||
result = std::make_unique<CEXIETHERNET>(BBADeviceType::BuiltIn);
|
||||
result = std::make_unique<CEXIETHERNET>(system, BBADeviceType::BuiltIn);
|
||||
break;
|
||||
|
||||
case EXIDeviceType::Gecko:
|
||||
result = std::make_unique<CEXIGecko>();
|
||||
result = std::make_unique<CEXIGecko>(system);
|
||||
break;
|
||||
|
||||
case EXIDeviceType::AGP:
|
||||
result = std::make_unique<CEXIAgp>(slot);
|
||||
result = std::make_unique<CEXIAgp>(system, slot);
|
||||
break;
|
||||
|
||||
case EXIDeviceType::AMBaseboard:
|
||||
case EXIDeviceType::None:
|
||||
default:
|
||||
result = std::make_unique<IEXIDevice>();
|
||||
result = std::make_unique<IEXIDevice>(system);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,10 @@
|
||||
|
||||
class PointerWrap;
|
||||
|
||||
namespace Core
|
||||
{
|
||||
class System;
|
||||
}
|
||||
namespace Memcard
|
||||
{
|
||||
struct HeaderData;
|
||||
@@ -44,6 +48,7 @@ enum class EXIDeviceType : int
|
||||
class IEXIDevice
|
||||
{
|
||||
public:
|
||||
explicit IEXIDevice(Core::System& system);
|
||||
virtual ~IEXIDevice() = default;
|
||||
|
||||
// Immediate copy functions
|
||||
@@ -69,12 +74,16 @@ public:
|
||||
// such.
|
||||
EXIDeviceType m_device_type = EXIDeviceType::None;
|
||||
|
||||
protected:
|
||||
Core::System& m_system;
|
||||
|
||||
private:
|
||||
// Byte transfer function for this device
|
||||
virtual void TransferByte(u8& byte);
|
||||
};
|
||||
|
||||
std::unique_ptr<IEXIDevice> EXIDevice_Create(EXIDeviceType device_type, int channel_num,
|
||||
std::unique_ptr<IEXIDevice> EXIDevice_Create(Core::System& system, EXIDeviceType device_type,
|
||||
int channel_num,
|
||||
const Memcard::HeaderData& memcard_header_data);
|
||||
} // namespace ExpansionInterface
|
||||
|
||||
|
||||
@@ -9,7 +9,9 @@
|
||||
|
||||
namespace ExpansionInterface
|
||||
{
|
||||
CEXIAD16::CEXIAD16() = default;
|
||||
CEXIAD16::CEXIAD16(Core::System& system) : IEXIDevice(system)
|
||||
{
|
||||
}
|
||||
|
||||
void CEXIAD16::SetCS(int cs)
|
||||
{
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace ExpansionInterface
|
||||
class CEXIAD16 : public IEXIDevice
|
||||
{
|
||||
public:
|
||||
CEXIAD16();
|
||||
explicit CEXIAD16(Core::System& system);
|
||||
void SetCS(int cs) override;
|
||||
bool IsPresent() const override;
|
||||
void DoState(PointerWrap& p) override;
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
namespace ExpansionInterface
|
||||
{
|
||||
CEXIAgp::CEXIAgp(Slot slot)
|
||||
CEXIAgp::CEXIAgp(Core::System& system, Slot slot) : IEXIDevice(system)
|
||||
{
|
||||
ASSERT(IsMemcardSlot(slot));
|
||||
m_slot = slot;
|
||||
|
||||
@@ -17,7 +17,7 @@ enum class Slot : int;
|
||||
class CEXIAgp : public IEXIDevice
|
||||
{
|
||||
public:
|
||||
CEXIAgp(const Slot slot);
|
||||
CEXIAgp(Core::System& system, const Slot slot);
|
||||
virtual ~CEXIAgp() override;
|
||||
bool IsPresent() const override { return true; }
|
||||
void ImmWrite(u32 _uData, u32 _uSize) override;
|
||||
|
||||
@@ -10,7 +10,8 @@
|
||||
|
||||
namespace ExpansionInterface
|
||||
{
|
||||
CEXIDummy::CEXIDummy(const std::string& name) : m_name{name}
|
||||
CEXIDummy::CEXIDummy(Core::System& system, const std::string& name)
|
||||
: IEXIDevice(system), m_name{name}
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user