mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-24 06:39:46 -06:00
Make the gui more accurately reflect connected wiimotes. Also connect and disconnect wiimotes when settings are changed in the wiimote configuration dialog during emulation.
Fix the number of connected wiimotes in the configuration dialog so it works with translations, and update translations accordingly. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6771 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -9,10 +9,15 @@
|
||||
|
||||
#define WIIMOTE_INI_NAME "WiimoteNew"
|
||||
|
||||
//extern InputPlugin g_plugin;
|
||||
extern unsigned int g_wiimote_sources[MAX_WIIMOTES];
|
||||
enum
|
||||
{
|
||||
WIIMOTE_SRC_NONE = 0,
|
||||
WIIMOTE_SRC_EMU = 1,
|
||||
WIIMOTE_SRC_REAL = 2,
|
||||
WIIMOTE_SRC_HYBRID = 3, // emu + real
|
||||
};
|
||||
|
||||
//extern SWiimoteInitialize g_WiimoteInitialize;
|
||||
extern unsigned int g_wiimote_sources[MAX_WIIMOTES];
|
||||
|
||||
namespace Wiimote
|
||||
{
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "IniFile.h"
|
||||
#include "StringUtil.h"
|
||||
#include "Timer.h"
|
||||
#include "../../Host.h"
|
||||
|
||||
#include "WiimoteReal.h"
|
||||
|
||||
@ -537,6 +538,8 @@ THREAD_RETURN WiimoteThreadFunc(void* arg)
|
||||
// rumble briefly
|
||||
wiimote->Rumble();
|
||||
|
||||
Host_ConnectWiimote(wiimote->index, true);
|
||||
|
||||
// main loop
|
||||
while (g_run_wiimote_thread && wiimote->IsConnected())
|
||||
{
|
||||
@ -550,6 +553,8 @@ THREAD_RETURN WiimoteThreadFunc(void* arg)
|
||||
Common::SleepCurrentThread(1);
|
||||
}
|
||||
|
||||
Host_ConnectWiimote(wiimote->index, false);
|
||||
|
||||
#ifdef __APPLE__
|
||||
[pool release];
|
||||
#endif
|
||||
|
@ -29,14 +29,6 @@
|
||||
|
||||
#include "../../InputCommon/Src/InputConfig.h"
|
||||
|
||||
enum
|
||||
{
|
||||
WIIMOTE_SRC_NONE = 0,
|
||||
WIIMOTE_SRC_EMU = 1,
|
||||
WIIMOTE_SRC_REAL = 2,
|
||||
WIIMOTE_SRC_HYBRID = 3, // emu + real
|
||||
};
|
||||
|
||||
// Pointer to data, and size of data
|
||||
typedef std::pair<u8*,u8> Report;
|
||||
|
||||
|
@ -56,5 +56,6 @@ void Host_UpdateStatusBar(const char* _pText, int Filed = 0);
|
||||
|
||||
void Host_SysMessage(const char *fmt, ...);
|
||||
void Host_SetWiiMoteConnectionState(int _State);
|
||||
void Host_ConnectWiimote(int wm_idx, bool connect);
|
||||
|
||||
#endif
|
||||
|
@ -640,6 +640,7 @@ void CFrame::OnHostMessage(wxCommandEvent& event)
|
||||
if (GetStatusBar() != NULL)
|
||||
{
|
||||
GetStatusBar()->SetStatusText(event.GetString(), event.GetInt());
|
||||
UpdateGUI();
|
||||
}
|
||||
break;
|
||||
|
||||
@ -838,12 +839,8 @@ void CFrame::OnKeyDown(wxKeyEvent& event)
|
||||
// Actually perform the wiimote connection or disconnection
|
||||
if (WiimoteId >= 0)
|
||||
{
|
||||
bNoWiimoteMsg = GetMenuBar()->IsChecked(IDM_CONNECT_WIIMOTE1 + WiimoteId);
|
||||
GetMenuBar()->Check(IDM_CONNECT_WIIMOTE1 + WiimoteId, !bNoWiimoteMsg);
|
||||
GetUsbPointer()->AccessWiiMote(WiimoteId | 0x100)->Activate(!bNoWiimoteMsg);
|
||||
wxString msg(wxString::Format(wxT("Wiimote %i %s"), WiimoteId + 1,
|
||||
bNoWiimoteMsg ? _("Disconnected") : _("Connected")));
|
||||
Core::DisplayMessage(msg.ToAscii(), 3000);
|
||||
bool connect = !GetMenuBar()->IsChecked(IDM_CONNECT_WIIMOTE1 + WiimoteId);
|
||||
ConnectWiimote(WiimoteId, connect);
|
||||
}
|
||||
|
||||
// Send the OSD hotkeys to the video plugin
|
||||
|
@ -131,6 +131,7 @@ class CFrame : public CRenderFrame
|
||||
bool RendererHasFocus();
|
||||
void DoFullscreen(bool bF);
|
||||
void ToggleDisplayMode (bool bFullscreen);
|
||||
static void ConnectWiimote(int wm_idx, bool connect);
|
||||
|
||||
#ifdef __WXGTK__
|
||||
Common::Event panic_event;
|
||||
|
@ -1206,18 +1206,22 @@ void CFrame::OnLoadWiiMenu(wxCommandEvent& event)
|
||||
}
|
||||
}
|
||||
|
||||
void CFrame::OnConnectWiimote(wxCommandEvent& event)
|
||||
void CFrame::ConnectWiimote(int wm_idx, bool connect)
|
||||
{
|
||||
if (Core::isRunning() && SConfig::GetInstance().m_LocalCoreStartupParameter.bWii)
|
||||
{
|
||||
int Id = event.GetId() - IDM_CONNECT_WIIMOTE1;
|
||||
bNoWiimoteMsg = !event.IsChecked();
|
||||
GetUsbPointer()->AccessWiiMote(Id | 0x100)->Activate(event.IsChecked());
|
||||
wxString msg(wxString::Format(wxT("Wiimote %i %s"), Id + 1, (event.IsChecked()) ? _("Connected") : _("Disconnected")));
|
||||
GetUsbPointer()->AccessWiiMote(wm_idx | 0x100)->Activate(connect);
|
||||
wxString msg(wxString::Format(wxT("Wiimote %i %s"), wm_idx + 1,
|
||||
connect ? _("Connected") : _("Disconnected")));
|
||||
Core::DisplayMessage(msg.ToAscii(), 3000);
|
||||
}
|
||||
}
|
||||
|
||||
void CFrame::OnConnectWiimote(wxCommandEvent& event)
|
||||
{
|
||||
ConnectWiimote(event.GetId() - IDM_CONNECT_WIIMOTE1, event.IsChecked());
|
||||
}
|
||||
|
||||
// Toogle fullscreen. In Windows the fullscreen mode is accomplished by expanding the m_Panel to cover
|
||||
// the entire screen (when we render to the main window).
|
||||
void CFrame::OnToggleFullscreen(wxCommandEvent& WXUNUSED (event))
|
||||
|
@ -658,3 +658,8 @@ bool Host_RendererHasFocus()
|
||||
{
|
||||
return main_frame->RendererHasFocus();
|
||||
}
|
||||
|
||||
void Host_ConnectWiimote(int wm_idx, bool connect)
|
||||
{
|
||||
CFrame::ConnectWiimote(wm_idx, connect);
|
||||
}
|
||||
|
@ -1,13 +1,14 @@
|
||||
|
||||
#include "WiimoteConfigDiag.h"
|
||||
#include "HW/Wiimote.h"
|
||||
#include "Frame.h"
|
||||
|
||||
#define _connect_macro_(b, f, c, s) (b)->Connect(wxID_ANY, (c), wxCommandEventHandler( f ), (wxObject*)0, (wxEvtHandler*)s)
|
||||
|
||||
const wxString& ConnectedWiimotesString()
|
||||
{
|
||||
static wxString str = _("Connected to . Wiimotes");
|
||||
str[13] = wxChar(wxT('0') + WiimoteReal::Initialize());
|
||||
static wxString str;
|
||||
str.Printf(_("Connected to %i Wiimotes"), WiimoteReal::Initialize());
|
||||
return str;
|
||||
}
|
||||
|
||||
@ -129,6 +130,9 @@ void WiimoteConfigPage::SelectSource(wxCommandEvent& event)
|
||||
{
|
||||
// should be kinda fine, maybe should just set when user clicks OK, w/e change it later
|
||||
g_wiimote_sources[m_index] = event.GetInt();
|
||||
|
||||
// Connect or disconnect emulated wiimotes (maybe do this in when OK is clicked too?).
|
||||
CFrame::ConnectWiimote(m_index, WIIMOTE_SRC_EMU & g_wiimote_sources[m_index]);
|
||||
}
|
||||
|
||||
void WiimoteConfigDiag::Save(wxCommandEvent&)
|
||||
|
Reference in New Issue
Block a user