From 7c0b96f638335d7d0cb96769e8bd6d44952d33f1 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sun, 22 Jan 2017 01:48:29 -0500 Subject: [PATCH] EXI_Device: Move the dummy implementation to its own source files --- Source/Core/Core/CMakeLists.txt | 1 + Source/Core/Core/Core.vcxproj | 2 + Source/Core/Core/Core.vcxproj.filters | 6 +++ Source/Core/Core/HW/EXI/EXI_Device.cpp | 38 +----------------- Source/Core/Core/HW/EXI/EXI_DeviceDummy.cpp | 44 +++++++++++++++++++++ Source/Core/Core/HW/EXI/EXI_DeviceDummy.h | 32 +++++++++++++++ 6 files changed, 86 insertions(+), 37 deletions(-) create mode 100644 Source/Core/Core/HW/EXI/EXI_DeviceDummy.cpp create mode 100644 Source/Core/Core/HW/EXI/EXI_DeviceDummy.h diff --git a/Source/Core/Core/CMakeLists.txt b/Source/Core/Core/CMakeLists.txt index 1fb847e497..4187cb4716 100644 --- a/Source/Core/Core/CMakeLists.txt +++ b/Source/Core/Core/CMakeLists.txt @@ -91,6 +91,7 @@ set(SRCS ActionReplay.cpp HW/EXI/EXI_Device.cpp HW/EXI/EXI_DeviceAD16.cpp HW/EXI/EXI_DeviceAGP.cpp + HW/EXI/EXI_DeviceDummy.cpp HW/EXI/EXI_DeviceEthernet.cpp HW/EXI/EXI_DeviceGecko.cpp HW/EXI/EXI_DeviceIPL.cpp diff --git a/Source/Core/Core/Core.vcxproj b/Source/Core/Core/Core.vcxproj index c3ed4081ad..f6aa9a95b7 100644 --- a/Source/Core/Core/Core.vcxproj +++ b/Source/Core/Core/Core.vcxproj @@ -122,6 +122,7 @@ + @@ -351,6 +352,7 @@ + diff --git a/Source/Core/Core/Core.vcxproj.filters b/Source/Core/Core/Core.vcxproj.filters index c08e6a8d1b..1f052cda1f 100644 --- a/Source/Core/Core/Core.vcxproj.filters +++ b/Source/Core/Core/Core.vcxproj.filters @@ -400,6 +400,9 @@ HW %28Flipper/Hollywood%29\EXI - Expansion Interface + + HW %28Flipper/Hollywood%29\EXI - Expansion Interface + HW %28Flipper/Hollywood%29\EXI - Expansion Interface @@ -997,6 +1000,9 @@ HW %28Flipper/Hollywood%29\EXI - Expansion Interface + + HW %28Flipper/Hollywood%29\EXI - Expansion Interface + HW %28Flipper/Hollywood%29\EXI - Expansion Interface diff --git a/Source/Core/Core/HW/EXI/EXI_Device.cpp b/Source/Core/Core/HW/EXI/EXI_Device.cpp index 1185ef2ab2..bddf057c80 100644 --- a/Source/Core/Core/HW/EXI/EXI_Device.cpp +++ b/Source/Core/Core/HW/EXI/EXI_Device.cpp @@ -6,11 +6,10 @@ #include -#include "Common/ChunkFile.h" #include "Common/CommonTypes.h" -#include "Common/Logging/Log.h" #include "Core/HW/EXI/EXI_DeviceAD16.h" #include "Core/HW/EXI/EXI_DeviceAGP.h" +#include "Core/HW/EXI/EXI_DeviceDummy.h" #include "Core/HW/EXI/EXI_DeviceEthernet.h" #include "Core/HW/EXI/EXI_DeviceGecko.h" #include "Core/HW/EXI/EXI_DeviceIPL.h" @@ -18,7 +17,6 @@ #include "Core/HW/EXI/EXI_DeviceMic.h" #include "Core/HW/Memmap.h" -// --- interface IEXIDevice --- void IEXIDevice::ImmWrite(u32 _uData, u32 _uSize) { while (_uSize--) @@ -63,40 +61,6 @@ void IEXIDevice::DMARead(u32 _uAddr, u32 _uSize) } } -// --- class CEXIDummy --- -// Just a dummy that logs reads and writes -// to be used for EXI devices we haven't emulated -// DOES NOT FUNCTION AS "NO DEVICE INSERTED" -> Appears as unknown device -class CEXIDummy : public IEXIDevice -{ - std::string m_strName; - - void TransferByte(u8& _byte) override {} -public: - CEXIDummy(const std::string& _strName) : m_strName(_strName) {} - virtual ~CEXIDummy() {} - void ImmWrite(u32 data, u32 size) override - { - INFO_LOG(EXPANSIONINTERFACE, "EXI DUMMY %s ImmWrite: %08x", m_strName.c_str(), data); - } - u32 ImmRead(u32 size) override - { - INFO_LOG(EXPANSIONINTERFACE, "EXI DUMMY %s ImmRead", m_strName.c_str()); - return 0; - } - void DMAWrite(u32 addr, u32 size) override - { - INFO_LOG(EXPANSIONINTERFACE, "EXI DUMMY %s DMAWrite: %08x bytes, from %08x to device", - m_strName.c_str(), size, addr); - } - void DMARead(u32 addr, u32 size) override - { - INFO_LOG(EXPANSIONINTERFACE, "EXI DUMMY %s DMARead: %08x bytes, from device to %08x", - m_strName.c_str(), size, addr); - } - bool IsPresent() const override { return true; } -}; - // F A C T O R Y std::unique_ptr EXIDevice_Create(TEXIDevices device_type, const int channel_num) { diff --git a/Source/Core/Core/HW/EXI/EXI_DeviceDummy.cpp b/Source/Core/Core/HW/EXI/EXI_DeviceDummy.cpp new file mode 100644 index 0000000000..c9260d527f --- /dev/null +++ b/Source/Core/Core/HW/EXI/EXI_DeviceDummy.cpp @@ -0,0 +1,44 @@ +// Copyright 2017 Dolphin Emulator Project +// Licensed under GPLv2+ +// Refer to the license.txt file included. + +#include "Core/HW/EXI/EXI_DeviceDummy.h" + +#include "Common/CommonTypes.h" +#include "Common/Logging/Log.h" + +CEXIDummy::CEXIDummy(const std::string& name) : m_name{name} +{ +} + +void CEXIDummy::ImmWrite(u32 data, u32 size) +{ + INFO_LOG(EXPANSIONINTERFACE, "EXI DUMMY %s ImmWrite: %08x", m_name.c_str(), data); +} + +u32 CEXIDummy::ImmRead(u32 size) +{ + INFO_LOG(EXPANSIONINTERFACE, "EXI DUMMY %s ImmRead", m_name.c_str()); + return 0; +} + +void CEXIDummy::DMAWrite(u32 address, u32 size) +{ + INFO_LOG(EXPANSIONINTERFACE, "EXI DUMMY %s DMAWrite: %08x bytes, from %08x to device", + m_name.c_str(), size, address); +} + +void CEXIDummy::DMARead(u32 address, u32 size) +{ + INFO_LOG(EXPANSIONINTERFACE, "EXI DUMMY %s DMARead: %08x bytes, from device to %08x", + m_name.c_str(), size, address); +} + +bool CEXIDummy::IsPresent() const +{ + return true; +} + +void CEXIDummy::TransferByte(u8& byte) +{ +} diff --git a/Source/Core/Core/HW/EXI/EXI_DeviceDummy.h b/Source/Core/Core/HW/EXI/EXI_DeviceDummy.h new file mode 100644 index 0000000000..96081f5a4b --- /dev/null +++ b/Source/Core/Core/HW/EXI/EXI_DeviceDummy.h @@ -0,0 +1,32 @@ +// Copyright 2017 Dolphin Emulator Project +// Licensed under GPLv2+ +// Refer to the license.txt file included. + +#pragma once + +#include + +#include "Common/CommonTypes.h" +#include "Core/HW/EXI/EXI_Device.h" + +// Just a dummy that logs reads and writes +// to be used for EXI devices we haven't emulated +// DOES NOT FUNCTION AS "NO DEVICE INSERTED" -> Appears as unknown device +class CEXIDummy final : public IEXIDevice +{ +public: + explicit CEXIDummy(const std::string& name); + + void ImmWrite(u32 data, u32 size) override; + u32 ImmRead(u32 size) override; + + void DMAWrite(u32 address, u32 size) override; + void DMARead(u32 address, u32 size) override; + + bool IsPresent() const override; + +private: + void TransferByte(u8& byte) override; + + std::string m_name; +};