Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 'real-wiimote-scanning'
  • Loading branch information
jordan-woyak committed Feb 25, 2013
2 parents e5c53e3 + 6b2804e commit 46adbfa
Show file tree
Hide file tree
Showing 21 changed files with 945 additions and 832 deletions.
1 change: 0 additions & 1 deletion Source/Core/Common/Src/Common.h
Expand Up @@ -155,7 +155,6 @@ enum HOST_COMM
WM_USER_CREATE,
WM_USER_SETCURSOR,
WM_USER_KEYDOWN,
WIIMOTE_DISCONNECT // Disconnect Wiimote
};

// Used for notification on emulation state
Expand Down
24 changes: 5 additions & 19 deletions Source/Core/Core/Src/ConfigManager.cpp
Expand Up @@ -100,9 +100,6 @@ SConfig::SConfig()
{
// Make sure we have log manager
LoadSettings();
//Make sure we load any extra settings
LoadSettingsWii();

}

void SConfig::Init()
Expand Down Expand Up @@ -244,6 +241,8 @@ void SConfig::SaveSettings()
ini.Set("Core", "WiiSDCard", m_WiiSDCard);
ini.Set("Core", "WiiKeyboard", m_WiiKeyboard);
ini.Set("Core", "WiimoteReconnectOnLoad", m_WiimoteReconnectOnLoad);
ini.Set("Core", "WiimoteContinuousScanning", m_WiimoteContinuousScanning);
ini.Set("Core", "WiimoteEnableSpeaker", m_WiimoteEnableSpeaker);
ini.Set("Core", "RunCompareServer", m_LocalCoreStartupParameter.bRunCompareServer);
ini.Set("Core", "RunCompareClient", m_LocalCoreStartupParameter.bRunCompareClient);
ini.Set("Core", "FrameLimit", m_Framelimit);
Expand Down Expand Up @@ -393,7 +392,9 @@ void SConfig::LoadSettings()

ini.Get("Core", "WiiSDCard", &m_WiiSDCard, false);
ini.Get("Core", "WiiKeyboard", &m_WiiKeyboard, false);
ini.Get("Core", "WiimoteReconnectOnLoad", &m_WiimoteReconnectOnLoad, true);
ini.Get("Core", "WiimoteReconnectOnLoad", &m_WiimoteReconnectOnLoad, true);
ini.Get("Core", "WiimoteContinuousScanning", &m_WiimoteContinuousScanning, false);
ini.Get("Core", "WiimoteEnableSpeaker", &m_WiimoteEnableSpeaker, true);
ini.Get("Core", "RunCompareServer", &m_LocalCoreStartupParameter.bRunCompareServer, false);
ini.Get("Core", "RunCompareClient", &m_LocalCoreStartupParameter.bRunCompareClient, false);
ini.Get("Core", "MMU", &m_LocalCoreStartupParameter.bMMU, false);
Expand Down Expand Up @@ -428,18 +429,3 @@ void SConfig::LoadSettings()

m_SYSCONF = new SysConf();
}
void SConfig::LoadSettingsWii()
{
IniFile ini;
//Wiimote configs
ini.Load((File::GetUserPath(D_CONFIG_IDX) + "Dolphin.ini"));
for (int i = 0; i < 4; i++)
{
char SectionName[32];
sprintf(SectionName, "Wiimote%i", i + 1);
ini.Get(SectionName, "AutoReconnectRealWiimote", &m_WiiAutoReconnect[i], false);
}
ini.Load((File::GetUserPath(D_CONFIG_IDX) + "wiimote.ini"));
ini.Get("Real", "Unpair", &m_WiiAutoUnpair, false);

}
7 changes: 2 additions & 5 deletions Source/Core/Core/Src/ConfigManager.h
Expand Up @@ -41,9 +41,9 @@ struct SConfig : NonCopyable
// Wii Devices
bool m_WiiSDCard;
bool m_WiiKeyboard;
bool m_WiiAutoReconnect[4];
bool m_WiiAutoUnpair;
bool m_WiimoteReconnectOnLoad;
bool m_WiimoteContinuousScanning;
bool m_WiimoteEnableSpeaker;

// name of the last used filename
std::string m_LastFilename;
Expand Down Expand Up @@ -107,9 +107,6 @@ struct SConfig : NonCopyable
// load settings
void LoadSettings();

//Special load settings
void LoadSettingsWii();

// Return the permanent and somewhat globally used instance of this struct
static SConfig& GetInstance() {return(*m_Instance);}

Expand Down
7 changes: 1 addition & 6 deletions Source/Core/Core/Src/HW/Wiimote.h
Expand Up @@ -38,17 +38,12 @@ void Update(int _number);
namespace WiimoteReal
{

unsigned int Initialize();
void Initialize();
void Shutdown();
void Refresh();

void LoadSettings();

#ifdef _WIN32
int PairUp(bool unpair = false);
int UnPair();
#endif

}

#endif
7 changes: 3 additions & 4 deletions Source/Core/Core/Src/HW/WiimoteEmu/EmuSubroutines.cpp
Expand Up @@ -248,13 +248,12 @@ void Wiimote::RequestStatus(const wm_request_status* const rs)
{
using namespace WiimoteReal;

std::lock_guard<std::mutex> lk(g_refresh_lock);
std::lock_guard<std::recursive_mutex> lk(g_refresh_lock);

if (g_wiimotes[m_index])
{
wm_request_status rpt;
rpt.rumble = 0;
g_wiimotes[m_index]->SendPacket(WM_REQUEST_STATUS, &rpt, sizeof(rpt));
wm_request_status rpt = {};
g_wiimotes[m_index]->QueueReport(WM_REQUEST_STATUS, &rpt, sizeof(rpt));
}

return;
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Core/Src/HW/WiimoteEmu/WiimoteEmu.cpp
Expand Up @@ -704,7 +704,7 @@ void Wiimote::Update()
{
using namespace WiimoteReal;

std::lock_guard<std::mutex> lk(g_refresh_lock);
std::lock_guard<std::recursive_mutex> lk(g_refresh_lock);
if (g_wiimotes[m_index])
{
Report rpt = g_wiimotes[m_index]->ProcessReadQueue();
Expand Down
4 changes: 3 additions & 1 deletion Source/Core/Core/Src/HW/WiimoteEmu/WiimoteHid.h
Expand Up @@ -201,15 +201,17 @@ struct wm_report
#define WM_LEDS 0x11
struct wm_leds {
u8 rumble : 1;
// real wii also sets bit 0x2 (unknown purpose)
u8 : 3;
u8 leds : 4;
};

#define WM_REPORT_MODE 0x12
struct wm_report_mode {
u8 rumble : 1;
u8 continuous : 1; // these 2 seem to be named wrong
// unsure what "all_the_time" actually is, the real wii does set it (bit 0x2)
u8 all_the_time : 1;
u8 continuous : 1;
u8 : 5;
u8 mode;
};
Expand Down
30 changes: 23 additions & 7 deletions Source/Core/Core/Src/HW/WiimoteReal/IODummy.cpp
Expand Up @@ -21,32 +21,48 @@
namespace WiimoteReal
{

int FindWiimotes(Wiimote **wm, int max_wiimotes)
WiimoteScanner::WiimoteScanner()
{
return 0;
return;
}

WiimoteScanner::~WiimoteScanner()
{}

void WiimoteScanner::Update()
{}

std::vector<Wiimote*> WiimoteScanner::FindWiimotes()
{
return std::vector<Wiimote*>();
}

bool WiimoteScanner::IsReady() const
{
return false;
}

bool Wiimote::Connect()
{
return 0;
}

void Wiimote::RealDisconnect()
void Wiimote::Disconnect()
{
return;
}

bool Wiimote::IsOpen() const
bool Wiimote::IsConnected() const
{
return IsConnected();
return false;
}

int Wiimote::IORead(unsigned char* buf)
int Wiimote::IORead(u8* buf)
{
return 0;
}

int Wiimote::IOWrite(unsigned char* buf, int len)
int Wiimote::IOWrite(const u8* buf, int len)
{
return 0;
}
Expand Down

0 comments on commit 46adbfa

Please sign in to comment.