summaryrefslogtreecommitdiff
path: root/Source/Core/DolphinWX/FrameTools.cpp
diff options
context:
space:
mode:
authorLéo Lam <leolino.lam@gmail.com>2017-04-30 18:03:33 +0200
committerGitHub <noreply@github.com>2017-04-30 18:03:32 +0200
commit8e2028e8da4adc34ee090c6a39cead86780d963c (patch)
tree8113535b63a85eb747733bea83d66c423619ef95 /Source/Core/DolphinWX/FrameTools.cpp
parent50776f347135d627df175ad662efe80f33587bd2 (diff)
parent58fe0f12a49dca3ee13bb7f8a2260156059416fd (diff)
Merge pull request #5340 from leoetlino/ios-reorg
IOS: Convert the IOS kernel HLE code to a class
Diffstat (limited to 'Source/Core/DolphinWX/FrameTools.cpp')
-rw-r--r--Source/Core/DolphinWX/FrameTools.cpp25
1 files changed, 18 insertions, 7 deletions
diff --git a/Source/Core/DolphinWX/FrameTools.cpp b/Source/Core/DolphinWX/FrameTools.cpp
index 9dd9c7a9a2..9822aae148 100644
--- a/Source/Core/DolphinWX/FrameTools.cpp
+++ b/Source/Core/DolphinWX/FrameTools.cpp
@@ -42,7 +42,7 @@
#include "Core/HW/Wiimote.h"
#include "Core/Host.h"
#include "Core/HotkeyManager.h"
-#include "Core/IOS/IPC.h"
+#include "Core/IOS/IOS.h"
#include "Core/IOS/STM/STM.h"
#include "Core/IOS/USB/Bluetooth/BTEmu.h"
#include "Core/IOS/USB/Bluetooth/WiimoteDevice.h"
@@ -880,7 +880,11 @@ void CFrame::DoStop()
bool CFrame::TriggerSTMPowerEvent()
{
- const auto stm = IOS::HLE::GetDeviceByName("/dev/stm/eventhook");
+ const auto ios = IOS::HLE::GetIOS();
+ if (!ios)
+ return false;
+
+ const auto stm = ios->GetDeviceByName("/dev/stm/eventhook");
if (!stm || !std::static_pointer_cast<IOS::HLE::Device::STMEventHook>(stm)->HasHookInstalled())
return false;
@@ -1310,8 +1314,12 @@ void CFrame::ConnectWiimote(int wm_idx, bool connect)
!SConfig::GetInstance().m_bt_passthrough_enabled)
{
bool was_unpaused = Core::PauseAndLock(true);
+ const auto ios = IOS::HLE::GetIOS();
+ if (!ios)
+ return;
+
const auto bt = std::static_pointer_cast<IOS::HLE::Device::BluetoothEmu>(
- IOS::HLE::GetDeviceByName("/dev/usb/oh1/57e/305"));
+ ios->GetDeviceByName("/dev/usb/oh1/57e/305"));
if (bt)
bt->AccessWiiMote(wm_idx | 0x100)->Activate(connect);
const char* message = connect ? "Wii Remote %i connected" : "Wii Remote %i disconnected";
@@ -1323,11 +1331,12 @@ void CFrame::ConnectWiimote(int wm_idx, bool connect)
void CFrame::OnConnectWiimote(wxCommandEvent& event)
{
- if (SConfig::GetInstance().m_bt_passthrough_enabled)
+ const auto ios = IOS::HLE::GetIOS();
+ if (!ios || SConfig::GetInstance().m_bt_passthrough_enabled)
return;
bool was_unpaused = Core::PauseAndLock(true);
const auto bt = std::static_pointer_cast<IOS::HLE::Device::BluetoothEmu>(
- IOS::HLE::GetDeviceByName("/dev/usb/oh1/57e/305"));
+ ios->GetDeviceByName("/dev/usb/oh1/57e/305"));
const bool is_connected =
bt && bt->AccessWiiMote((event.GetId() - IDM_CONNECT_WIIMOTE1) | 0x100)->IsConnected();
ConnectWiimote(event.GetId() - IDM_CONNECT_WIIMOTE1, !is_connected);
@@ -1486,8 +1495,10 @@ void CFrame::UpdateGUI()
// Tools
GetMenuBar()->FindItem(IDM_CHEATS)->Enable(SConfig::GetInstance().bEnableCheats);
- const auto bt = std::static_pointer_cast<IOS::HLE::Device::BluetoothEmu>(
- IOS::HLE::GetDeviceByName("/dev/usb/oh1/57e/305"));
+ const auto ios = IOS::HLE::GetIOS();
+ const auto bt = ios ? std::static_pointer_cast<IOS::HLE::Device::BluetoothEmu>(
+ ios->GetDeviceByName("/dev/usb/oh1/57e/305")) :
+ nullptr;
bool ShouldEnableWiimotes = Running && bt && !SConfig::GetInstance().m_bt_passthrough_enabled;
GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE1)->Enable(ShouldEnableWiimotes);
GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE2)->Enable(ShouldEnableWiimotes);