Merge pull request #4679 from lioncash/ipc

IPC_HLE: Namespace IPC HLE
This commit is contained in:
Matthew Parlane
2017-01-18 17:33:08 +13:00
committed by GitHub
73 changed files with 449 additions and 128 deletions
+5 -2
View File
@@ -11,6 +11,8 @@
#include "Common/StringUtil.h"
#include "Common/Timer.h"
namespace Common
{
void GenerateMacAddress(const MACConsumer type, u8* mac)
{
memset(mac, 0, MAC_ADDRESS_SIZE);
@@ -20,10 +22,10 @@ void GenerateMacAddress(const MACConsumer type, u8* mac)
switch (type)
{
case BBA:
case MACConsumer::BBA:
memcpy(mac, oui_bba, 3);
break;
case IOS:
case MACConsumer::IOS:
memcpy(mac, oui_ios, 3);
break;
}
@@ -68,3 +70,4 @@ bool StringToMacAddress(const std::string& mac_string, u8* mac)
}
return success;
}
} // namespace Common
+6 -3
View File
@@ -8,10 +8,12 @@
#include "Common/CommonTypes.h"
enum MACConsumer
namespace Common
{
BBA = 0,
IOS = 1
enum class MACConsumer
{
BBA,
IOS
};
enum
@@ -22,3 +24,4 @@ enum
void GenerateMacAddress(const MACConsumer type, u8* mac);
std::string MacAddressToString(const u8* mac);
bool StringToMacAddress(const std::string& mac_string, u8* mac);
} // namespace Common
+1 -1
View File
@@ -282,7 +282,7 @@ bool CBoot::BootUp()
std::vector<u8> tmd_buffer = pVolume.GetTMD();
if (!tmd_buffer.empty())
{
WII_IPC_HLE_Interface::ES_DIVerify(tmd_buffer);
IOS::HLE::ES_DIVerify(tmd_buffer);
}
_StartupPara.bWii = pVolume.GetVolumeType() == DiscIO::Platform::WII_DISC;
+2 -2
View File
@@ -87,7 +87,7 @@ bool CBoot::Boot_WiiWAD(const std::string& _pFilename)
File::CreateFullPath(Common::GetTitleDataPath(titleID, Common::FROM_SESSION_ROOT));
if (titleID == TITLEID_SYSMENU)
HLE_IPC_CreateVirtualFATFilesystem();
IOS::HLE::HLE_IPC_CreateVirtualFATFilesystem();
// setup Wii memory
if (!SetupWiiMemory())
return false;
@@ -97,7 +97,7 @@ bool CBoot::Boot_WiiWAD(const std::string& _pFilename)
if (pContent == nullptr)
return false;
WII_IPC_HLE_Interface::SetDefaultContentFile(_pFilename);
IOS::HLE::SetDefaultContentFile(_pFilename);
std::unique_ptr<CDolLoader> pDolLoader = std::make_unique<CDolLoader>(pContent->m_Data->Get());
if (!pDolLoader->IsValid())
+1 -1
View File
@@ -375,7 +375,7 @@ void SConfig::SaveSettingsToSysconf()
sysconf.SetData<u8>("IPL.IDL", 0x00);
NOTICE_LOG(COMMON, "Disabling WC24 'standby' (shutdown to idle) to avoid hanging on shutdown");
RestoreBTInfoSection(&sysconf);
IOS::HLE::RestoreBTInfoSection(&sysconf);
sysconf.Save();
}
+2 -2
View File
@@ -544,7 +544,7 @@ void EmuThread()
// Activate Wiimotes which don't have source set to "None"
for (unsigned int i = 0; i != MAX_BBMOTES; ++i)
if (g_wiimote_sources[i])
GetUsbPointer()->AccessWiiMote(i | 0x100)->Activate(true);
IOS::HLE::GetUsbPointer()->AccessWiiMote(i | 0x100)->Activate(true);
}
AudioCommon::InitSoundStream();
@@ -985,7 +985,7 @@ void UpdateWantDeterminism(bool initial)
bool was_unpaused = Core::PauseAndLock(true);
g_want_determinism = new_want_determinism;
WiiSockMan::GetInstance().UpdateWantDeterminism(new_want_determinism);
IOS::HLE::WiiSockMan::GetInstance().UpdateWantDeterminism(new_want_determinism);
Fifo::UpdateWantDeterminism(new_want_determinism);
// We need to clear the cache because some parts of the JIT depend on want_determinism, e.g. use
// of FMA.
+2 -2
View File
@@ -1155,9 +1155,9 @@ void FinishExecutingCommand(ReplyType reply_type, DIInterruptType interrupt_type
case ReplyType::IOS_HLE:
{
std::shared_ptr<IWII_IPC_HLE_Device> di = WII_IPC_HLE_Interface::GetDeviceByName("/dev/di");
std::shared_ptr<IOS::HLE::IWII_IPC_HLE_Device> di = IOS::HLE::GetDeviceByName("/dev/di");
if (di)
std::static_pointer_cast<CWII_IPC_HLE_Device_di>(di)->FinishIOCtl(interrupt_type);
std::static_pointer_cast<IOS::HLE::CWII_IPC_HLE_Device_di>(di)->FinishIOCtl(interrupt_type);
break;
}
+5 -5
View File
@@ -31,16 +31,16 @@ CEXIETHERNET::CEXIETHERNET()
// Parse MAC address from config, and generate a new one if it doesn't
// exist or can't be parsed.
std::string& mac_addr_setting = SConfig::GetInstance().m_bba_mac;
u8 mac_addr[MAC_ADDRESS_SIZE] = {0};
u8 mac_addr[Common::MAC_ADDRESS_SIZE] = {0};
if (!StringToMacAddress(mac_addr_setting, mac_addr))
if (!Common::StringToMacAddress(mac_addr_setting, mac_addr))
{
GenerateMacAddress(BBA, mac_addr);
mac_addr_setting = MacAddressToString(mac_addr);
Common::GenerateMacAddress(Common::MACConsumer::BBA, mac_addr);
mac_addr_setting = Common::MacAddressToString(mac_addr);
SConfig::GetInstance().SaveSettings();
}
memcpy(&mBbaMem[BBA_NAFR_PAR0], mac_addr, MAC_ADDRESS_SIZE);
memcpy(&mBbaMem[BBA_NAFR_PAR0], mac_addr, Common::MAC_ADDRESS_SIZE);
// HACK: .. fully established 100BASE-T link
mBbaMem[BBA_NWAYS] = NWAYS_LS100 | NWAYS_LPNWAY | NWAYS_100TXF | NWAYS_ANCLPT;
+8 -8
View File
@@ -53,8 +53,8 @@ void Init()
Core::InitializeWiiRoot(Core::g_want_determinism);
DiscIO::cUIDsys::AccessInstance().UpdateLocation();
DiscIO::CSharedContent::AccessInstance().UpdateLocation();
WII_IPCInterface::Init();
WII_IPC_HLE_Interface::Init(); // Depends on Memory
IOS::Init();
IOS::HLE::Init(); // Depends on Memory
}
}
@@ -62,8 +62,8 @@ void Shutdown()
{
if (SConfig::GetInstance().bWii)
{
WII_IPC_HLE_Interface::Shutdown(); // Depends on Memory
WII_IPCInterface::Shutdown();
IOS::HLE::Shutdown(); // Depends on Memory
IOS::Shutdown();
Core::ShutdownWiiRoot();
}
@@ -103,10 +103,10 @@ void DoState(PointerWrap& p)
if (SConfig::GetInstance().bWii)
{
WII_IPCInterface::DoState(p);
p.DoMarker("WII_IPCInterface");
WII_IPC_HLE_Interface::DoState(p);
p.DoMarker("WII_IPC_HLE_Interface");
IOS::DoState(p);
p.DoMarker("IOS");
IOS::HLE::DoState(p);
p.DoMarker("IOS::HLE");
}
p.DoMarker("WIIHW");
+1 -1
View File
@@ -79,7 +79,7 @@ static std::unique_ptr<MMIO::Mapping> InitMMIOWii()
{
auto mmio = InitMMIO();
WII_IPCInterface::RegisterMMIO(mmio.get(), 0x0D000000);
IOS::RegisterMMIO(mmio.get(), 0x0D000000);
DVDInterface::RegisterMMIO(mmio.get(), 0x0D006000);
SerialInterface::RegisterMMIO(mmio.get(), 0x0D006400);
ExpansionInterface::RegisterMMIO(mmio.get(), 0x0D006800);
+6 -6
View File
@@ -212,10 +212,10 @@ static void IOSNotifyResetButtonCallback(u64 userdata, s64 cyclesLate)
{
if (SConfig::GetInstance().bWii)
{
std::shared_ptr<IWII_IPC_HLE_Device> stm =
WII_IPC_HLE_Interface::GetDeviceByName("/dev/stm/eventhook");
std::shared_ptr<IOS::HLE::IWII_IPC_HLE_Device> stm =
IOS::HLE::GetDeviceByName("/dev/stm/eventhook");
if (stm)
std::static_pointer_cast<CWII_IPC_HLE_Device_stm_eventhook>(stm)->ResetButton();
std::static_pointer_cast<IOS::HLE::CWII_IPC_HLE_Device_stm_eventhook>(stm)->ResetButton();
}
}
@@ -223,10 +223,10 @@ static void IOSNotifyPowerButtonCallback(u64 userdata, s64 cyclesLate)
{
if (SConfig::GetInstance().bWii)
{
std::shared_ptr<IWII_IPC_HLE_Device> stm =
WII_IPC_HLE_Interface::GetDeviceByName("/dev/stm/eventhook");
std::shared_ptr<IOS::HLE::IWII_IPC_HLE_Device> stm =
IOS::HLE::GetDeviceByName("/dev/stm/eventhook");
if (stm)
std::static_pointer_cast<CWII_IPC_HLE_Device_stm_eventhook>(stm)->PowerButton();
std::static_pointer_cast<IOS::HLE::CWII_IPC_HLE_Device_stm_eventhook>(stm)->PowerButton();
}
}
+3 -5
View File
@@ -29,7 +29,7 @@ IPC_HLE_PERIOD: For the Wii Remote this is the call schedule:
IPC_HLE_UpdateCallback() // In this file
// This function seems to call all devices' Update() function four times per frame
WII_IPC_HLE_Interface::Update()
IOS::HLE::Update()
// If the AclFrameQue is empty this will call Wiimote_Update() and make it send
the current input status to the game. I'm not sure if this occurs approximately
@@ -37,7 +37,7 @@ IPC_HLE_PERIOD: For the Wii Remote this is the call schedule:
CWII_IPC_HLE_Device_usb_oh1_57e_305::Update()
PluginWiimote::Wiimote_Update()
// This is also a device updated by WII_IPC_HLE_Interface::Update() but it doesn't
// This is also a device updated by IOS::HLE::Update() but it doesn't
seem to ultimately call PluginWiimote::Wiimote_Update(). However it can be called
by the /dev/usb/oh1 device if the AclFrameQue is empty.
CWII_IPC_HLE_WiiMote::Update()
@@ -112,7 +112,7 @@ static void IPC_HLE_UpdateCallback(u64 userdata, s64 cyclesLate)
{
if (SConfig::GetInstance().bWii)
{
WII_IPC_HLE_Interface::UpdateDevices();
IOS::HLE::UpdateDevices();
CoreTiming::ScheduleEvent(s_ipc_hle_period - cyclesLate, et_IPC_HLE);
}
}
@@ -236,8 +236,6 @@ void Init()
// AyuanX: TO BE TWEAKED
// Now the 1500 is a pure assumption
// We need to figure out the real frequency though
// FYI, WII_IPC_HLE_Interface::Update is also called in WII_IPCInterface::Write32
const int freq = 1500;
s_ipc_hle_period = GetTicksPerSecond() / freq;
}
+7 -7
View File
@@ -21,7 +21,7 @@
// ppc_msg is a pointer to 0x40byte command structure
// arm_msg is, similarly, starlet's response buffer*
namespace WII_IPCInterface
namespace IOS
{
enum
{
@@ -139,7 +139,7 @@ void Reset()
{
INFO_LOG(WII_IPC, "Resetting ...");
InitState();
WII_IPC_HLE_Interface::Reset();
HLE::Reset();
}
void Shutdown()
@@ -154,8 +154,8 @@ void RegisterMMIO(MMIO::Mapping* mmio, u32 base)
MMIO::ComplexWrite<u32>([](u32, u32 val) {
ctrl.ppc(val);
if (ctrl.X1)
WII_IPC_HLE_Interface::EnqueueRequest(ppc_msg);
WII_IPC_HLE_Interface::Update();
HLE::EnqueueRequest(ppc_msg);
HLE::Update();
CoreTiming::ScheduleEvent(0, updateInterrupts, 0);
}));
@@ -164,7 +164,7 @@ void RegisterMMIO(MMIO::Mapping* mmio, u32 base)
mmio->Register(base | PPC_IRQFLAG, MMIO::InvalidRead<u32>(),
MMIO::ComplexWrite<u32>([](u32, u32 val) {
ppc_irq_flags &= ~val;
WII_IPC_HLE_Interface::Update();
HLE::Update();
CoreTiming::ScheduleEvent(0, updateInterrupts, 0);
}));
@@ -173,7 +173,7 @@ void RegisterMMIO(MMIO::Mapping* mmio, u32 base)
ppc_irq_masks = val;
if (ppc_irq_masks & INT_CAUSE_IPC_BROADWAY) // wtf?
Reset();
WII_IPC_HLE_Interface::Update();
HLE::Update();
CoreTiming::ScheduleEvent(0, updateInterrupts, 0);
}));
@@ -229,4 +229,4 @@ bool IsReady()
{
return ((ctrl.Y1 == 0) && (ctrl.Y2 == 0) && ((ppc_irq_flags & INT_CAUSE_IPC_BROADWAY) == 0));
}
}
} // namespace IOS
+2 -2
View File
@@ -12,7 +12,7 @@ namespace MMIO
class Mapping;
}
namespace WII_IPCInterface
namespace IOS
{
enum StarletInterruptCause
{
@@ -46,4 +46,4 @@ void GenerateAck(u32 _Address);
void GenerateReply(u32 _Address);
bool IsReady();
}
} // namespace IOS
+6
View File
@@ -12,6 +12,10 @@
#include "Common/CommonFuncs.h"
#include "Common/CommonTypes.h"
namespace IOS
{
namespace HLE
{
TMDReader::TMDReader(const std::vector<u8>& bytes) : m_bytes(bytes)
{
}
@@ -94,3 +98,5 @@ void TMDReader::DoState(PointerWrap& p)
{
p.Do(m_bytes);
}
} // namespace HLE
} // namespace IOS
+6
View File
@@ -13,6 +13,10 @@
#include "Common/ChunkFile.h"
#include "Common/CommonTypes.h"
namespace IOS
{
namespace HLE
{
class TMDReader final
{
public:
@@ -44,3 +48,5 @@ public:
private:
std::vector<u8> m_bytes;
};
} // namespace HLE
} // namespace IOS
+6
View File
@@ -12,6 +12,10 @@
#include "Common/FileUtil.h"
#include "Common/Logging/Log.h"
namespace IOS
{
namespace HLE
{
namespace NWC24
{
NWC24Config::NWC24Config()
@@ -215,3 +219,5 @@ void NWC24Config::SetEmail(const char* email)
m_data.email[MAX_EMAIL_LENGTH - 1] = '\0';
}
} // namespace NWC24
} // namespace HLE
} // namespace IOS
+6
View File
@@ -7,6 +7,10 @@
#include <string>
#include "Common/CommonTypes.h"
namespace IOS
{
namespace HLE
{
namespace NWC24
{
enum ErrorCode : int
@@ -94,3 +98,5 @@ private:
ConfigData m_data;
};
} // namespace NWC24
} // namespace HLE
} // namespace IOS
+9 -7
View File
@@ -60,7 +60,9 @@ struct EventType;
#include "Core/IPC_HLE/WII_IPC_HLE_Device_hid.h"
#endif
namespace WII_IPC_HLE_Interface
namespace IOS
{
namespace HLE
{
static std::map<u32, std::shared_ptr<IWII_IPC_HLE_Device>> s_device_map;
static std::mutex s_device_map_mutex;
@@ -465,12 +467,12 @@ void EnqueueCommandAcknowledgement(u32 address, int cycles_in_future)
// Takes care of routing ipc <-> ipc HLE
void Update()
{
if (!WII_IPCInterface::IsReady())
if (!IsReady())
return;
if (s_request_queue.size())
{
WII_IPCInterface::GenerateAck(s_request_queue.front());
GenerateAck(s_request_queue.front());
DEBUG_LOG(WII_IPC_HLE, "||-- Acknowledge IPC Request @ 0x%08x", s_request_queue.front());
u32 command = s_request_queue.front();
s_request_queue.pop_front();
@@ -480,7 +482,7 @@ void Update()
if (s_reply_queue.size())
{
WII_IPCInterface::GenerateReply(s_reply_queue.front());
GenerateReply(s_reply_queue.front());
DEBUG_LOG(WII_IPC_HLE, "<<-- Reply to IPC Request @ 0x%08x", s_reply_queue.front());
s_reply_queue.pop_front();
return;
@@ -488,7 +490,7 @@ void Update()
if (s_ack_queue.size())
{
WII_IPCInterface::GenerateAck(s_ack_queue.front());
GenerateAck(s_ack_queue.front());
WARN_LOG(WII_IPC_HLE, "<<-- Double-ack to IPC Request @ 0x%08x", s_ack_queue.front());
s_ack_queue.pop_front();
return;
@@ -506,5 +508,5 @@ void UpdateDevices()
}
}
}
} // end of namespace WII_IPC_HLE_Interface
} // namespace HLE
} // namespace IOS
+9 -6
View File
@@ -12,10 +12,15 @@
#include "Core/CoreTiming.h"
#include "Core/HW/SystemTimers.h"
struct IOSRequest;
class IWII_IPC_HLE_Device;
class PointerWrap;
namespace IOS
{
namespace HLE
{
class IWII_IPC_HLE_Device;
struct IOSRequest;
struct IPCCommandResult
{
s32 return_value;
@@ -36,8 +41,6 @@ enum IPCCommandType : u32
IPC_REPLY = 8,
};
namespace WII_IPC_HLE_Interface
{
// Init
void Init();
@@ -74,5 +77,5 @@ void EnqueueRequest(u32 address);
void EnqueueReply(const IOSRequest& request, s32 return_value, int cycles_in_future = 0,
CoreTiming::FromThread from = CoreTiming::FromThread::CPU);
void EnqueueCommandAcknowledgement(u32 address, int cycles_in_future = 0);
} // end of namespace WII_IPC_HLE_Interface
} // namespace HLE
} // namespace IOS

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