Fix reference to deleted object bug. This should fix channels not loading from sysmenu anymore.

This commit is contained in:
Matthew Parlane 2013-01-09 09:22:36 +13:00
parent 815fd197d3
commit 2844708c2d
4 changed files with 11 additions and 4 deletions

View File

@ -795,6 +795,7 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress)
std::string tContentFile(m_ContentFile.c_str());
WII_IPC_HLE_Interface::Reset(true);
WII_IPC_HLE_Interface::Init();
s_Usb = GetUsbPointer();
for (unsigned int i = 0; i < s_Usb->m_WiiMotes.size(); i++)
{
if (wiiMoteConnected[i])

View File

@ -38,7 +38,7 @@ CWII_IPC_HLE_Device_usb_oh1_57e_305::CWII_IPC_HLE_Device_usb_oh1_57e_305(u32 _De
// Activate only first Wiimote by default
_conf_pads BT_DINF;
SetUsbPointer(this);
if (!SConfig::GetInstance().m_SYSCONF->GetArrayData("BT.DINF", (u8*)&BT_DINF, sizeof(_conf_pads)))
{
PanicAlertT("Trying to read from invalid SYSCONF\nWiimote bt ids are not available");
@ -100,6 +100,7 @@ CWII_IPC_HLE_Device_usb_oh1_57e_305::CWII_IPC_HLE_Device_usb_oh1_57e_305(u32 _De
CWII_IPC_HLE_Device_usb_oh1_57e_305::~CWII_IPC_HLE_Device_usb_oh1_57e_305()
{
m_WiiMotes.clear();
SetUsbPointer(NULL);
}
void CWII_IPC_HLE_Device_usb_oh1_57e_305::DoState(PointerWrap &p)

View File

@ -27,13 +27,19 @@
#include "l2cap.h" // Local
#include "WiiMote_HID_Attr.h"
static CWII_IPC_HLE_Device_usb_oh1_57e_305* s_Usb;
static CWII_IPC_HLE_Device_usb_oh1_57e_305* s_Usb = NULL;
CWII_IPC_HLE_Device_usb_oh1_57e_305* GetUsbPointer()
{
return s_Usb;
}
void SetUsbPointer(CWII_IPC_HLE_Device_usb_oh1_57e_305* ptr)
{
s_Usb = ptr;
}
CWII_IPC_HLE_WiiMote::CWII_IPC_HLE_WiiMote(CWII_IPC_HLE_Device_usb_oh1_57e_305* _pHost, int _Number, bdaddr_t _BD, bool ready)
: m_HIDControlChannel_Connected(false)
, m_HIDControlChannel_ConnectedWait(false)
@ -49,8 +55,6 @@ CWII_IPC_HLE_WiiMote::CWII_IPC_HLE_WiiMote(CWII_IPC_HLE_Device_usb_oh1_57e_305*
{
DEBUG_LOG(WII_IPC_WIIMOTE, "Wiimote: #%i Constructed", _Number);
s_Usb = _pHost;
m_ConnectionState = (ready) ? CONN_READY : CONN_INACTIVE;
m_ConnectionHandle = 0x100 + _Number;
memset(m_LinkKey, 0xA0 + _Number, HCI_KEY_SIZE);

View File

@ -25,6 +25,7 @@
class CWII_IPC_HLE_Device_usb_oh1_57e_305;
CWII_IPC_HLE_Device_usb_oh1_57e_305* GetUsbPointer();
void SetUsbPointer(CWII_IPC_HLE_Device_usb_oh1_57e_305* ptr);
class CBigEndianBuffer
{