Wiimote: Added optional status icons for the Wiimote speaker and leds. And a few other small changes.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1455 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
668337eb84
commit
fee145244c
|
@ -297,7 +297,11 @@ std::string GetUserDirectory()
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_COMMON_APPDATA, NULL, 0, path)))
|
if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_COMMON_APPDATA, NULL, 0, path)))
|
||||||
{
|
{
|
||||||
return std::string(path);
|
//return std::string(path);
|
||||||
|
|
||||||
|
/* I dont understand this, I got "E:\Documents and Settings\All Users\Application Data"
|
||||||
|
from this */
|
||||||
|
return std::string("");
|
||||||
}
|
}
|
||||||
return std::string("");
|
return std::string("");
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -123,6 +123,25 @@ std::string StringFromFormat(const char* format, ...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ===================================================
|
||||||
|
/* For Debugging. Read out an u8 array. */
|
||||||
|
// ----------------
|
||||||
|
std::string ArrayToString(const u8 *data, u32 size, u32 offset, int line_len)
|
||||||
|
{
|
||||||
|
//const u8* _data = (const u8*)data;
|
||||||
|
std::string Temp;
|
||||||
|
for (u32 i = 0; i < size; i++)
|
||||||
|
{
|
||||||
|
char Buffer[128];
|
||||||
|
sprintf(Buffer, "%02x ", data[i + offset]);
|
||||||
|
if((i + 1) % line_len == 0) Temp.append("\n"); // break long lines
|
||||||
|
Temp.append(Buffer);
|
||||||
|
}
|
||||||
|
return Temp;
|
||||||
|
}
|
||||||
|
// ================
|
||||||
|
|
||||||
|
|
||||||
void ToStringFromFormat(std::string* out, const char* format, ...)
|
void ToStringFromFormat(std::string* out, const char* format, ...)
|
||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
|
|
|
@ -32,10 +32,12 @@ void ToStringFromFormat(std::string* out, const char* format, ...);
|
||||||
// Expensive!
|
// Expensive!
|
||||||
void StringFromFormatV(std::string* out, const char* format, va_list args);
|
void StringFromFormatV(std::string* out, const char* format, va_list args);
|
||||||
|
|
||||||
|
|
||||||
// Cheap!
|
// Cheap!
|
||||||
bool CharArrayFromFormatV(char* out, int outsize, const char* format, va_list args);
|
bool CharArrayFromFormatV(char* out, int outsize, const char* format, va_list args);
|
||||||
|
|
||||||
|
// Good
|
||||||
|
std::string ArrayToString(const u8 *data, u32 size, u32 offset = 0, int line_len = 20);
|
||||||
|
|
||||||
|
|
||||||
template<size_t Count>
|
template<size_t Count>
|
||||||
inline void CharArrayFromFormat(char (& out)[Count], const char* format, ...)
|
inline void CharArrayFromFormat(char (& out)[Count], const char* format, ...)
|
||||||
|
@ -74,4 +76,3 @@ void BuildCompleteFilename(std::string& _CompleteFilename, const std::string& _P
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,7 @@ struct SCoreStartupParameter
|
||||||
bool bRunCompareClient;
|
bool bRunCompareClient;
|
||||||
int SelectedLanguage;
|
int SelectedLanguage;
|
||||||
|
|
||||||
bool bWii;
|
bool bWii; bool bWiiLeds; bool bWiiSpeakers; // Wii settings
|
||||||
|
|
||||||
enum EBootBios
|
enum EBootBios
|
||||||
{
|
{
|
||||||
|
@ -106,3 +106,6 @@ struct SCoreStartupParameter
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -16,8 +16,10 @@
|
||||||
// http://code.google.com/p/dolphin-emu/
|
// http://code.google.com/p/dolphin-emu/
|
||||||
|
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
|
#include "StringUtil.h"
|
||||||
#include "WII_IPC_HLE_WiiMote.h"
|
#include "WII_IPC_HLE_WiiMote.h"
|
||||||
|
|
||||||
|
#include "../../DolphinWX/Src/Frame.h"
|
||||||
#include "../Plugins/Plugin_Wiimote.h"
|
#include "../Plugins/Plugin_Wiimote.h"
|
||||||
#include "../Host.h"
|
#include "../Host.h"
|
||||||
|
|
||||||
|
@ -26,6 +28,8 @@
|
||||||
#include "l2cap.h"
|
#include "l2cap.h"
|
||||||
#include "WiiMote_HID_Attr.h"
|
#include "WiiMote_HID_Attr.h"
|
||||||
|
|
||||||
|
extern CFrame* main_frame; // for the status report
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
#pragma pack(push, 1)
|
#pragma pack(push, 1)
|
||||||
#endif
|
#endif
|
||||||
|
@ -249,6 +253,8 @@ bool CWII_IPC_HLE_WiiMote::Update()
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UpdateStatus();
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -360,6 +366,7 @@ void CWII_IPC_HLE_WiiMote::SendACLFrame(u8* _pData, u32 _Size)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HID_INTERRUPT_CHANNEL:
|
case HID_INTERRUPT_CHANNEL:
|
||||||
|
ShowStatus(pData);
|
||||||
PluginWiimote::Wiimote_InterruptChannel(rChannel.DCID, pData, DataSize);
|
PluginWiimote::Wiimote_InterruptChannel(rChannel.DCID, pData, DataSize);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -373,6 +380,81 @@ void CWII_IPC_HLE_WiiMote::SendACLFrame(u8* _pData, u32 _Size)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ===================================================
|
||||||
|
/* Send a status report to the status bar. */
|
||||||
|
// ----------------
|
||||||
|
void CWII_IPC_HLE_WiiMote::ShowStatus(const void* _pData)
|
||||||
|
{
|
||||||
|
const u8* data = (const u8*)_pData;
|
||||||
|
|
||||||
|
if(data[1] == 0x11 || data[1] == 0x14 || data[1] == 0x16
|
||||||
|
|| data[1] == 0x19)
|
||||||
|
{
|
||||||
|
//std::string Temp = ArrayToString(data, sizeof(data));
|
||||||
|
//LOGV(CONSOLE, 0, "Data: %s", Temp.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the last four bits with LED info
|
||||||
|
u8 Bits;
|
||||||
|
if(data[1] == 0x11)
|
||||||
|
{
|
||||||
|
Bits = (data[2] >> 4);
|
||||||
|
|
||||||
|
// Convert it to a simpler byte format
|
||||||
|
main_frame->g_Leds[0] = Bits >> 0;
|
||||||
|
main_frame->g_Leds[1] = Bits >> 1;
|
||||||
|
main_frame->g_Leds[2] = Bits >> 2;
|
||||||
|
main_frame->g_Leds[3] = Bits >> 3;
|
||||||
|
|
||||||
|
main_frame->UpdateLeds();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(data[1] == 0x14) // Enable and disable speakers
|
||||||
|
{
|
||||||
|
// Get the value
|
||||||
|
if(data[2] == 0x02) Bits = 0;
|
||||||
|
else if(data[2] == 0x06) Bits = 1;
|
||||||
|
main_frame->g_Speakers[0] = Bits;
|
||||||
|
main_frame->UpdateSpeakers();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(data[1] == 0x19) // Mute and unmute
|
||||||
|
{
|
||||||
|
// Get the value
|
||||||
|
if(data[2] == 0x02) Bits = 0;
|
||||||
|
else if(data[2] == 0x06) Bits = 1;
|
||||||
|
main_frame->g_Speakers[1] = Bits;
|
||||||
|
main_frame->UpdateSpeakers();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(data[1] == 0x16) // Write to speaker registry
|
||||||
|
{
|
||||||
|
// Don't care what it does, call all activity
|
||||||
|
main_frame->g_Speakers[2] = 1;
|
||||||
|
main_frame->UpdateSpeakers();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
// Turn off the activity icon again
|
||||||
|
void CWII_IPC_HLE_WiiMote::UpdateStatus()
|
||||||
|
{
|
||||||
|
std::string Tmp = ArrayToString(main_frame->g_Speakers, sizeof(main_frame->g_Speakers));
|
||||||
|
std::string Tmp2 = ArrayToString(main_frame->g_Speakers_, sizeof(main_frame->g_Speakers_));
|
||||||
|
LOGV(CONSOLE, 0, "Tmp: %s", Tmp.c_str());
|
||||||
|
LOGV(CONSOLE, 0, "Tmp2: %s", Tmp2.c_str());
|
||||||
|
// Don't do a lot of CreateBitmap() if we don't need to
|
||||||
|
if(memcmp(main_frame->g_Speakers_, main_frame->g_Speakers,
|
||||||
|
sizeof(main_frame->g_Speakers)))
|
||||||
|
{
|
||||||
|
main_frame->g_Speakers[2] = 0;
|
||||||
|
main_frame->UpdateSpeakers();
|
||||||
|
memcpy(main_frame->g_Speakers_, main_frame->g_Speakers, sizeof(main_frame->g_Speakers));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// ================
|
||||||
|
|
||||||
|
|
||||||
void CWII_IPC_HLE_WiiMote::SignalChannel(u8* _pData, u32 _Size)
|
void CWII_IPC_HLE_WiiMote::SignalChannel(u8* _pData, u32 _Size)
|
||||||
{
|
{
|
||||||
while (_Size >= sizeof(SL2CAP_Command))
|
while (_Size >= sizeof(SL2CAP_Command))
|
||||||
|
|
|
@ -114,9 +114,11 @@ public:
|
||||||
|
|
||||||
u8 GetManufactorID() const { return 0xF; } // Broadcom Corporation
|
u8 GetManufactorID() const { return 0xF; } // Broadcom Corporation
|
||||||
|
|
||||||
void SendACLFrame(u8* _pData, u32 _Size); //to wiimote
|
void SendACLFrame(u8* _pData, u32 _Size); // To wiimote
|
||||||
|
void ShowStatus(const void* _pData); // Show status
|
||||||
|
void UpdateStatus(); // Update status
|
||||||
|
|
||||||
void SendL2capData(u16 scid, const void* _pData, u32 _Size); //from wiimote
|
void SendL2capData(u16 scid, const void* _pData, u32 _Size); // From wiimote
|
||||||
|
|
||||||
const u8* GetLinkKey() const { return m_LinkKey; }
|
const u8* GetLinkKey() const { return m_LinkKey; }
|
||||||
|
|
||||||
|
@ -203,3 +205,4 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include <wx/listctrl.h>
|
#include <wx/listctrl.h>
|
||||||
#include <wx/thread.h>
|
#include <wx/thread.h>
|
||||||
#include <wx/mstream.h>
|
#include <wx/mstream.h>
|
||||||
|
#include <wx/tipwin.h>
|
||||||
|
|
||||||
// ugly that this lib included code from the main
|
// ugly that this lib included code from the main
|
||||||
#include "../../DolphinWX/Src/Globals.h"
|
#include "../../DolphinWX/Src/Globals.h"
|
||||||
|
@ -83,6 +84,12 @@ BEGIN_EVENT_TABLE(CCodeWindow, wxFrame)
|
||||||
EVT_LISTBOX(IDM_CALLERSLIST, CCodeWindow::OnCallersListChange)
|
EVT_LISTBOX(IDM_CALLERSLIST, CCodeWindow::OnCallersListChange)
|
||||||
EVT_LISTBOX(IDM_CALLSLIST, CCodeWindow::OnCallsListChange)
|
EVT_LISTBOX(IDM_CALLSLIST, CCodeWindow::OnCallsListChange)
|
||||||
EVT_HOST_COMMAND(wxID_ANY, CCodeWindow::OnHostMessage)
|
EVT_HOST_COMMAND(wxID_ANY, CCodeWindow::OnHostMessage)
|
||||||
|
|
||||||
|
EVT_MENU_HIGHLIGHT_ALL( CCodeWindow::OnStatusBar)
|
||||||
|
/* Do this to to avoid that the ToolTips get stuck when only the wxMenu is changed
|
||||||
|
and not any wxMenuItem that is required by EVT_MENU_HIGHLIGHT_ALL */
|
||||||
|
EVT_UPDATE_UI(wxID_ANY, CCodeWindow::OnStatusBar_)
|
||||||
|
|
||||||
EVT_MENU(IDM_LOGWINDOW, CCodeWindow::OnToggleLogWindow)
|
EVT_MENU(IDM_LOGWINDOW, CCodeWindow::OnToggleLogWindow)
|
||||||
EVT_MENU(IDM_REGISTERWINDOW, CCodeWindow::OnToggleRegisterWindow)
|
EVT_MENU(IDM_REGISTERWINDOW, CCodeWindow::OnToggleRegisterWindow)
|
||||||
EVT_MENU(IDM_BREAKPOINTWINDOW, CCodeWindow::OnToggleBreakPointWindow)
|
EVT_MENU(IDM_BREAKPOINTWINDOW, CCodeWindow::OnToggleBreakPointWindow)
|
||||||
|
@ -340,22 +347,37 @@ void CCodeWindow::CreateMenu(const SCoreStartupParameter& _LocalCoreStartupParam
|
||||||
// =======================================================================================
|
// =======================================================================================
|
||||||
// Windowses
|
// Windowses
|
||||||
// ---------------
|
// ---------------
|
||||||
wxMenuBar* pMenuBar = new wxMenuBar(wxMB_DOCKABLE);
|
pMenuBar = new wxMenuBar(wxMB_DOCKABLE);
|
||||||
|
|
||||||
{
|
{
|
||||||
wxMenu* pCoreMenu = new wxMenu;
|
wxMenu* pCoreMenu = new wxMenu;
|
||||||
|
|
||||||
wxMenuItem* interpreter = pCoreMenu->Append(IDM_INTERPRETER, _T("&Interpreter core"), wxEmptyString, wxITEM_CHECK);
|
wxMenuItem* interpreter = pCoreMenu->Append(IDM_INTERPRETER, _T("&Interpreter core")
|
||||||
|
, wxString::FromAscii("This is nessesary to get break points"
|
||||||
|
" and stepping to work as explained in the Developer Documentation. But it can be very"
|
||||||
|
" slow, perhaps slower than 1 fps.")
|
||||||
|
, wxITEM_CHECK);
|
||||||
interpreter->Check(!_LocalCoreStartupParameter.bUseJIT);
|
interpreter->Check(!_LocalCoreStartupParameter.bUseJIT);
|
||||||
pCoreMenu->AppendSeparator();
|
pCoreMenu->AppendSeparator();
|
||||||
wxMenuItem* automaticstart = pCoreMenu->Append(IDM_AUTOMATICSTART, _T("&Automatic start"), wxEmptyString, wxITEM_CHECK);
|
wxMenuItem* automaticstart = pCoreMenu->Append(IDM_AUTOMATICSTART, _T("&Automatic start")
|
||||||
|
, wxString::FromAscii("Start the game directly instead of booting to pause. It also"
|
||||||
|
" automatically loads the Default ISO when Dolphin starts, or the last game you loaded"
|
||||||
|
" , if you have not given it an elf file with the --elf command line. This can be"
|
||||||
|
" convenient if you are bugtesting with a certain game and want to rebuild"
|
||||||
|
" and retry it several times, either with changes to Dolphin or if you are"
|
||||||
|
" developing a homebrew game.")
|
||||||
|
, wxITEM_CHECK);
|
||||||
automaticstart->Check(bAutomaticStart);
|
automaticstart->Check(bAutomaticStart);
|
||||||
pCoreMenu->AppendSeparator();
|
pCoreMenu->AppendSeparator();
|
||||||
|
|
||||||
#ifdef JIT_OFF_OPTIONS
|
#ifdef JIT_OFF_OPTIONS
|
||||||
jitunlimited = pCoreMenu->Append(IDM_JITUNLIMITED, _T("&Unlimited JIT Cache"), wxEmptyString, wxITEM_CHECK);
|
jitunlimited = pCoreMenu->Append(IDM_JITUNLIMITED, _T("&Unlimited JIT Cache"),
|
||||||
|
_T("Avoid any involuntary JIT cache clearing, this may prevent Zelda TP from crashing"),
|
||||||
|
wxITEM_CHECK);
|
||||||
pCoreMenu->AppendSeparator();
|
pCoreMenu->AppendSeparator();
|
||||||
jitoff = pCoreMenu->Append(IDM_JITOFF, _T("&JIT off (JIT core)"), wxEmptyString, wxITEM_CHECK);
|
jitoff = pCoreMenu->Append(IDM_JITOFF, _T("&JIT off (JIT core)"),
|
||||||
|
_T("Turn off all JIT functions, but still use the JIT core from Jit.cpp"),
|
||||||
|
wxITEM_CHECK);
|
||||||
jitlsoff = pCoreMenu->Append(IDM_JITLSOFF, _T("&JIT LoadStore off"), wxEmptyString, wxITEM_CHECK);
|
jitlsoff = pCoreMenu->Append(IDM_JITLSOFF, _T("&JIT LoadStore off"), wxEmptyString, wxITEM_CHECK);
|
||||||
jitlslbzxoff = pCoreMenu->Append(IDM_JITLSLBZXOFF, _T(" &JIT LoadStore lbzx off"), wxEmptyString, wxITEM_CHECK);
|
jitlslbzxoff = pCoreMenu->Append(IDM_JITLSLBZXOFF, _T(" &JIT LoadStore lbzx off"), wxEmptyString, wxITEM_CHECK);
|
||||||
jitlslxzoff = pCoreMenu->Append(IDM_JITLSLXZOFF, _T(" &JIT LoadStore lXz off"), wxEmptyString, wxITEM_CHECK);
|
jitlslxzoff = pCoreMenu->Append(IDM_JITLSLXZOFF, _T(" &JIT LoadStore lXz off"), wxEmptyString, wxITEM_CHECK);
|
||||||
|
@ -416,7 +438,14 @@ void CCodeWindow::CreateMenu(const SCoreStartupParameter& _LocalCoreStartupParam
|
||||||
pSymbolsMenu->Append(IDM_LOADMAPFILE, _T("&Load symbol map"));
|
pSymbolsMenu->Append(IDM_LOADMAPFILE, _T("&Load symbol map"));
|
||||||
pSymbolsMenu->Append(IDM_SAVEMAPFILE, _T("&Save symbol map"));
|
pSymbolsMenu->Append(IDM_SAVEMAPFILE, _T("&Save symbol map"));
|
||||||
pSymbolsMenu->AppendSeparator();
|
pSymbolsMenu->AppendSeparator();
|
||||||
pSymbolsMenu->Append(IDM_SAVEMAPFILEWITHCODES, _T("Save code"));
|
pSymbolsMenu->Append(IDM_SAVEMAPFILEWITHCODES, _T("Save code"),
|
||||||
|
wxString::FromAscii("Save the entire disassembled code. This may take a several seconds"
|
||||||
|
" and may require between 50 and 100 MB of hard drive space. It will only save code"
|
||||||
|
" that are in the first 4 MB of memory, if you are debugging a game that load .rel"
|
||||||
|
" files with code to memory you may want to increase that to perhaps 8 MB, you can do"
|
||||||
|
" that from SymbolDB::SaveMap().")
|
||||||
|
);
|
||||||
|
|
||||||
pSymbolsMenu->AppendSeparator();
|
pSymbolsMenu->AppendSeparator();
|
||||||
pSymbolsMenu->Append(IDM_CREATESIGNATUREFILE, _T("&Create signature file..."));
|
pSymbolsMenu->Append(IDM_CREATESIGNATUREFILE, _T("&Create signature file..."));
|
||||||
pSymbolsMenu->Append(IDM_USESIGNATUREFILE, _T("&Use signature file..."));
|
pSymbolsMenu->Append(IDM_USESIGNATUREFILE, _T("&Use signature file..."));
|
||||||
|
@ -900,6 +929,51 @@ void CCodeWindow::OnSymbolListContextMenu(wxContextMenuEvent& event)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// =======================================================================================
|
||||||
|
// Show Tool Tip for menu items
|
||||||
|
// --------------
|
||||||
|
void CCodeWindow::DoTip(wxString text)
|
||||||
|
{
|
||||||
|
// Create a blank tooltip to clear the eventual old one
|
||||||
|
static wxTipWindow *tw = NULL;
|
||||||
|
if (tw)
|
||||||
|
{
|
||||||
|
tw->SetTipWindowPtr(NULL);
|
||||||
|
tw->Close();
|
||||||
|
}
|
||||||
|
tw = NULL;
|
||||||
|
|
||||||
|
// Don't make a new one for blank text
|
||||||
|
if(text.empty()) return;
|
||||||
|
|
||||||
|
tw = new wxTipWindow(this, text, 175, &tw);
|
||||||
|
|
||||||
|
// Move it to the right
|
||||||
|
#ifdef _WIN32
|
||||||
|
POINT point;
|
||||||
|
GetCursorPos(&point);
|
||||||
|
tw->SetPosition(wxPoint(point.x + 25, point.y));
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CCodeWindow::OnStatusBar(wxMenuEvent& event)
|
||||||
|
{
|
||||||
|
DoTip(pMenuBar->GetHelpString(event.GetId()));
|
||||||
|
}
|
||||||
|
void CCodeWindow::OnStatusBar_(wxUpdateUIEvent& event)
|
||||||
|
{
|
||||||
|
DoTip(pMenuBar->GetHelpString(event.GetId()));
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===========
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Show and hide windowses
|
||||||
|
// -----------------------
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void CCodeWindow::OnToggleLogWindow(wxCommandEvent& event)
|
void CCodeWindow::OnToggleLogWindow(wxCommandEvent& event)
|
||||||
{
|
{
|
||||||
if (IsLoggingActivated())
|
if (IsLoggingActivated())
|
||||||
|
@ -1111,6 +1185,9 @@ void CCodeWindow::OnToggleMemoryWindow(wxCommandEvent& event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void CCodeWindow::OnHostMessage(wxCommandEvent& event)
|
void CCodeWindow::OnHostMessage(wxCommandEvent& event)
|
||||||
{
|
{
|
||||||
|
@ -1146,6 +1223,18 @@ void CCodeWindow::OnHostMessage(wxCommandEvent& event)
|
||||||
m_BreakpointWindow->NotifyUpdate();
|
m_BreakpointWindow->NotifyUpdate();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case IDM_UPDATESTATUSBAR:
|
||||||
|
//if (main_frame->m_pStatusBar != NULL)
|
||||||
|
{
|
||||||
|
PanicAlert("");
|
||||||
|
//this->GetParent()->m_p
|
||||||
|
//this->GetParent()->
|
||||||
|
//parent->m_pStatusBar->SetStatusText(wxT("Hi"), 0);
|
||||||
|
//m_pStatusBar->SetStatusText(event.GetString(), event.GetInt());
|
||||||
|
//this->GetParent()->m_pStatusBar->SetStatusText(event.GetString(), event.GetInt());
|
||||||
|
//main_frame->m_pStatusBar->SetStatusText(event.GetString(), event.GetInt());
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -136,7 +136,8 @@ class CCodeWindow
|
||||||
bool bVideoWindow;
|
bool bVideoWindow;
|
||||||
bool bAutomaticStart;
|
bool bAutomaticStart;
|
||||||
|
|
||||||
// sub dialogs
|
// Sub dialogs
|
||||||
|
wxMenuBar* pMenuBar;
|
||||||
CLogWindow* m_LogWindow;
|
CLogWindow* m_LogWindow;
|
||||||
CRegisterWindow* m_RegisterWindow;
|
CRegisterWindow* m_RegisterWindow;
|
||||||
CBreakPointWindow* m_BreakpointWindow;
|
CBreakPointWindow* m_BreakpointWindow;
|
||||||
|
@ -170,7 +171,8 @@ class CCodeWindow
|
||||||
void OnCallsListChange(wxCommandEvent& event);
|
void OnCallsListChange(wxCommandEvent& event);
|
||||||
void OnCodeStep(wxCommandEvent& event);
|
void OnCodeStep(wxCommandEvent& event);
|
||||||
void OnCodeViewChange(wxCommandEvent &event);
|
void OnCodeViewChange(wxCommandEvent &event);
|
||||||
|
void OnStatusBar(wxMenuEvent &event); void OnStatusBar_(wxUpdateUIEvent &event);
|
||||||
|
void DoTip(wxString text);
|
||||||
void SingleCPUStep();
|
void SingleCPUStep();
|
||||||
|
|
||||||
void OnAddrBoxChange(wxCommandEvent& event);
|
void OnAddrBoxChange(wxCommandEvent& event);
|
||||||
|
|
|
@ -83,6 +83,9 @@ void SConfig::SaveSettings()
|
||||||
ini.Set("Core", "SelectedLanguage", m_LocalCoreStartupParameter.SelectedLanguage);
|
ini.Set("Core", "SelectedLanguage", m_LocalCoreStartupParameter.SelectedLanguage);
|
||||||
ini.Set("Core", "RunCompareServer", m_LocalCoreStartupParameter.bRunCompareServer);
|
ini.Set("Core", "RunCompareServer", m_LocalCoreStartupParameter.bRunCompareServer);
|
||||||
ini.Set("Core", "RunCompareClient", m_LocalCoreStartupParameter.bRunCompareClient);
|
ini.Set("Core", "RunCompareClient", m_LocalCoreStartupParameter.bRunCompareClient);
|
||||||
|
|
||||||
|
ini.Set("Wii", "ShowWiimoteLeds", m_LocalCoreStartupParameter.bWiiLeds);
|
||||||
|
ini.Set("Wii", "ShowWiimoteSpeakers", m_LocalCoreStartupParameter.bWiiSpeakers);
|
||||||
}
|
}
|
||||||
|
|
||||||
ini.Save(CONFIG_FILE);
|
ini.Save(CONFIG_FILE);
|
||||||
|
@ -166,5 +169,9 @@ void SConfig::LoadSettings()
|
||||||
ini.Get("Core", "SelectedLanguage", &m_LocalCoreStartupParameter.SelectedLanguage, 0);
|
ini.Get("Core", "SelectedLanguage", &m_LocalCoreStartupParameter.SelectedLanguage, 0);
|
||||||
ini.Get("Core", "RunCompareServer", &m_LocalCoreStartupParameter.bRunCompareServer, false);
|
ini.Get("Core", "RunCompareServer", &m_LocalCoreStartupParameter.bRunCompareServer, false);
|
||||||
ini.Get("Core", "RunCompareClient", &m_LocalCoreStartupParameter.bRunCompareClient, false);
|
ini.Get("Core", "RunCompareClient", &m_LocalCoreStartupParameter.bRunCompareClient, false);
|
||||||
|
|
||||||
|
ini.Get("Wii", "ShowWiimoteLeds", &m_LocalCoreStartupParameter.bWiiLeds, false);
|
||||||
|
ini.Get("Wii", "ShowWiimoteSpeakers", &m_LocalCoreStartupParameter.bWiiSpeakers, false);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,9 @@
|
||||||
|
|
||||||
#include "ConfigMain.h"
|
#include "ConfigMain.h"
|
||||||
#include "PluginManager.h"
|
#include "PluginManager.h"
|
||||||
|
#include "Frame.h"
|
||||||
|
|
||||||
|
extern CFrame* main_frame;
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(CConfigMain, wxDialog)
|
BEGIN_EVENT_TABLE(CConfigMain, wxDialog)
|
||||||
|
|
||||||
|
@ -35,12 +38,16 @@ EVT_CHECKBOX(ID_OPTIMIZEQUANTIZERS, CConfigMain::CoreSettingsChanged)
|
||||||
EVT_CHECKBOX(ID_IDLESKIP, CConfigMain::CoreSettingsChanged)
|
EVT_CHECKBOX(ID_IDLESKIP, CConfigMain::CoreSettingsChanged)
|
||||||
EVT_CHECKBOX(ID_ENABLECHEATS, CConfigMain::CoreSettingsChanged)
|
EVT_CHECKBOX(ID_ENABLECHEATS, CConfigMain::CoreSettingsChanged)
|
||||||
EVT_CHOICE(ID_GC_SRAM_LNG, CConfigMain::GCSettingsChanged)
|
EVT_CHOICE(ID_GC_SRAM_LNG, CConfigMain::GCSettingsChanged)
|
||||||
|
|
||||||
EVT_CHOICE(ID_WII_BT_BAR, CConfigMain::WiiSettingsChanged)
|
EVT_CHOICE(ID_WII_BT_BAR, CConfigMain::WiiSettingsChanged)
|
||||||
|
EVT_CHECKBOX(ID_WII_BT_LEDS, CConfigMain::WiiSettingsChanged)
|
||||||
|
EVT_CHECKBOX(ID_WII_BT_SPEAKERS, CConfigMain::WiiSettingsChanged)
|
||||||
EVT_CHECKBOX(ID_WII_IPL_SSV, CConfigMain::WiiSettingsChanged)
|
EVT_CHECKBOX(ID_WII_IPL_SSV, CConfigMain::WiiSettingsChanged)
|
||||||
EVT_CHECKBOX(ID_WII_IPL_PGS, CConfigMain::WiiSettingsChanged)
|
EVT_CHECKBOX(ID_WII_IPL_PGS, CConfigMain::WiiSettingsChanged)
|
||||||
EVT_CHECKBOX(ID_WII_IPL_E60, CConfigMain::WiiSettingsChanged)
|
EVT_CHECKBOX(ID_WII_IPL_E60, CConfigMain::WiiSettingsChanged)
|
||||||
EVT_CHOICE(ID_WII_IPL_AR, CConfigMain::WiiSettingsChanged)
|
EVT_CHOICE(ID_WII_IPL_AR, CConfigMain::WiiSettingsChanged)
|
||||||
EVT_CHOICE(ID_WII_IPL_LNG, CConfigMain::WiiSettingsChanged)
|
EVT_CHOICE(ID_WII_IPL_LNG, CConfigMain::WiiSettingsChanged)
|
||||||
|
|
||||||
EVT_LISTBOX(ID_ISOPATHS, CConfigMain::ISOPathsSelectionChanged)
|
EVT_LISTBOX(ID_ISOPATHS, CConfigMain::ISOPathsSelectionChanged)
|
||||||
EVT_BUTTON(ID_ADDISOPATH, CConfigMain::AddRemoveISOPaths)
|
EVT_BUTTON(ID_ADDISOPATH, CConfigMain::AddRemoveISOPaths)
|
||||||
EVT_BUTTON(ID_REMOVEISOPATH, CConfigMain::AddRemoveISOPaths)
|
EVT_BUTTON(ID_REMOVEISOPATH, CConfigMain::AddRemoveISOPaths)
|
||||||
|
@ -174,12 +181,19 @@ void CConfigMain::CreateGUIControls()
|
||||||
GamecubePage->SetSizer(sGamecube);
|
GamecubePage->SetSizer(sGamecube);
|
||||||
sGamecube->Layout();
|
sGamecube->Layout();
|
||||||
|
|
||||||
// Wii SYSCONF page
|
|
||||||
|
//////////////////////////////////
|
||||||
|
// Wii page
|
||||||
|
// --------
|
||||||
sbWiimoteSettings = new wxStaticBoxSizer(wxVERTICAL, WiiPage, wxT("Wiimote Settings"));
|
sbWiimoteSettings = new wxStaticBoxSizer(wxVERTICAL, WiiPage, wxT("Wiimote Settings"));
|
||||||
arrayStringFor_WiiSensBarPos.Add(wxT("Bottom")); arrayStringFor_WiiSensBarPos.Add(wxT("Top"));
|
arrayStringFor_WiiSensBarPos.Add(wxT("Bottom")); arrayStringFor_WiiSensBarPos.Add(wxT("Top"));
|
||||||
WiiSensBarPosText = new wxStaticText(WiiPage, ID_WII_BT_BAR_TEXT, wxT("Sensor Bar Position:"), wxDefaultPosition, wxDefaultSize);
|
WiiSensBarPosText = new wxStaticText(WiiPage, ID_WII_BT_BAR_TEXT, wxT("Sensor Bar Position:"), wxDefaultPosition, wxDefaultSize);
|
||||||
WiiSensBarPos = new wxChoice(WiiPage, ID_WII_BT_BAR, wxDefaultPosition, wxDefaultSize, arrayStringFor_WiiSensBarPos, 0, wxDefaultValidator);
|
WiiSensBarPos = new wxChoice(WiiPage, ID_WII_BT_BAR, wxDefaultPosition, wxDefaultSize, arrayStringFor_WiiSensBarPos, 0, wxDefaultValidator);
|
||||||
WiiSensBarPos->SetSelection(m_SYSCONF[BT_BAR]);
|
WiiSensBarPos->SetSelection(m_SYSCONF[BT_BAR]);
|
||||||
|
WiiLeds = new wxCheckBox(WiiPage, ID_WII_BT_LEDS, wxT("Show Wiimote Leds in status bar"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||||
|
WiiLeds->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bWiiLeds);
|
||||||
|
WiiSpeakers = new wxCheckBox(WiiPage, ID_WII_BT_SPEAKERS, wxT("Show Wiimote Speaker status in status bar"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||||
|
WiiSpeakers->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bWiiSpeakers);
|
||||||
|
|
||||||
sbWiiIPLSettings = new wxStaticBoxSizer(wxVERTICAL, WiiPage, wxT("IPL Settings"));
|
sbWiiIPLSettings = new wxStaticBoxSizer(wxVERTICAL, WiiPage, wxT("IPL Settings"));
|
||||||
WiiScreenSaver = new wxCheckBox(WiiPage, ID_WII_IPL_SSV, wxT("Enable Screen Saver (burn-in reduction)"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
WiiScreenSaver = new wxCheckBox(WiiPage, ID_WII_IPL_SSV, wxT("Enable Screen Saver (burn-in reduction)"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||||
|
@ -198,10 +212,13 @@ void CConfigMain::CreateGUIControls()
|
||||||
WiiSystemLang = new wxChoice(WiiPage, ID_WII_IPL_LNG, wxDefaultPosition, wxDefaultSize, arrayStringFor_WiiSystemLang, 0, wxDefaultValidator);
|
WiiSystemLang = new wxChoice(WiiPage, ID_WII_IPL_LNG, wxDefaultPosition, wxDefaultSize, arrayStringFor_WiiSystemLang, 0, wxDefaultValidator);
|
||||||
WiiSystemLang->SetSelection(m_SYSCONF[IPL_LNG]);
|
WiiSystemLang->SetSelection(m_SYSCONF[IPL_LNG]);
|
||||||
|
|
||||||
|
// Populate sbWiimoteSettings
|
||||||
sWii = new wxBoxSizer(wxVERTICAL);
|
sWii = new wxBoxSizer(wxVERTICAL);
|
||||||
sWiimoteSettings = new wxGridBagSizer(0, 0);
|
sWiimoteSettings = new wxGridBagSizer(0, 0);
|
||||||
sWiimoteSettings->Add(WiiSensBarPosText, wxGBPosition(0, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5);
|
sWiimoteSettings->Add(WiiSensBarPosText, wxGBPosition(0, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5);
|
||||||
sWiimoteSettings->Add(WiiSensBarPos, wxGBPosition(0, 1), wxGBSpan(1, 1), wxALL, 5);
|
sWiimoteSettings->Add(WiiSensBarPos, wxGBPosition(0, 1), wxGBSpan(1, 1), wxALL, 5);
|
||||||
|
sWiimoteSettings->Add(WiiLeds, wxGBPosition(1, 0), wxGBSpan(1, 2), wxALL, 5);
|
||||||
|
sWiimoteSettings->Add(WiiSpeakers, wxGBPosition(2, 0), wxGBSpan(1, 2), wxALL, 5);
|
||||||
sbWiimoteSettings->Add(sWiimoteSettings);
|
sbWiimoteSettings->Add(sWiimoteSettings);
|
||||||
sWii->Add(sbWiimoteSettings, 0, wxEXPAND|wxALL, 5);
|
sWii->Add(sbWiimoteSettings, 0, wxEXPAND|wxALL, 5);
|
||||||
|
|
||||||
|
@ -218,6 +235,7 @@ void CConfigMain::CreateGUIControls()
|
||||||
WiiPage->SetSizer(sWii);
|
WiiPage->SetSizer(sWii);
|
||||||
sWii->Layout();
|
sWii->Layout();
|
||||||
|
|
||||||
|
|
||||||
// Paths page
|
// Paths page
|
||||||
sbISOPaths = new wxStaticBoxSizer(wxVERTICAL, PathsPage, wxT("ISO Directories"));
|
sbISOPaths = new wxStaticBoxSizer(wxVERTICAL, PathsPage, wxT("ISO Directories"));
|
||||||
ISOPaths = new wxListBox(PathsPage, ID_ISOPATHS, wxDefaultPosition, wxDefaultSize, arrayStringFor_ISOPaths, wxLB_SINGLE, wxDefaultValidator);
|
ISOPaths = new wxListBox(PathsPage, ID_ISOPATHS, wxDefaultPosition, wxDefaultSize, arrayStringFor_ISOPaths, wxLB_SINGLE, wxDefaultValidator);
|
||||||
|
@ -323,6 +341,9 @@ void CConfigMain::OnClose(wxCloseEvent& WXUNUSED (event))
|
||||||
|
|
||||||
// save the config... dolphin crashes by far to often to save the settings on closing only
|
// save the config... dolphin crashes by far to often to save the settings on closing only
|
||||||
SConfig::GetInstance().SaveSettings();
|
SConfig::GetInstance().SaveSettings();
|
||||||
|
|
||||||
|
// Update the status bar
|
||||||
|
main_frame->ModifyStatusBar(WiiLeds->IsChecked(), WiiSpeakers->IsChecked());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CConfigMain::CloseClick(wxCommandEvent& WXUNUSED (event))
|
void CConfigMain::CloseClick(wxCommandEvent& WXUNUSED (event))
|
||||||
|
@ -372,10 +393,17 @@ void CConfigMain::WiiSettingsChanged(wxCommandEvent& event)
|
||||||
{
|
{
|
||||||
switch (event.GetId())
|
switch (event.GetId())
|
||||||
{
|
{
|
||||||
case ID_WII_BT_BAR:
|
case ID_WII_BT_BAR: // Wiimote settings
|
||||||
m_SYSCONF[BT_BAR] = WiiSensBarPos->GetSelection();
|
m_SYSCONF[BT_BAR] = WiiSensBarPos->GetSelection();
|
||||||
break;
|
break;
|
||||||
case ID_WII_IPL_AR:
|
case ID_WII_BT_LEDS:
|
||||||
|
SConfig::GetInstance().m_LocalCoreStartupParameter.bWiiLeds = WiiLeds->IsChecked();
|
||||||
|
break;
|
||||||
|
case ID_WII_BT_SPEAKERS:
|
||||||
|
SConfig::GetInstance().m_LocalCoreStartupParameter.bWiiSpeakers = WiiSpeakers->IsChecked();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ID_WII_IPL_AR: // IPL settings
|
||||||
m_SYSCONF[IPL_AR] = WiiAspectRatio->GetSelection();
|
m_SYSCONF[IPL_AR] = WiiAspectRatio->GetSelection();
|
||||||
break;
|
break;
|
||||||
case ID_WII_IPL_SSV:
|
case ID_WII_IPL_SSV:
|
||||||
|
@ -537,3 +565,4 @@ bool CConfigMain::GetFilename(wxChoice* _pChoice, std::string& _rFilename)
|
||||||
|
|
||||||
return(false);
|
return(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -148,10 +148,12 @@ class CConfigMain
|
||||||
0x1576 4 NET.CTPC Net Content Restrictions ("Content Parental Control"?)
|
0x1576 4 NET.CTPC Net Content Restrictions ("Content Parental Control"?)
|
||||||
0x17E7 4 NET.WCFG WC24 Configuration flags
|
0x17E7 4 NET.WCFG WC24 Configuration flags
|
||||||
*/
|
*/
|
||||||
wxArrayString arrayStringFor_WiiSensBarPos;
|
wxArrayString arrayStringFor_WiiSensBarPos; // Wiimote Settings
|
||||||
wxStaticText* WiiSensBarPosText;
|
wxStaticText* WiiSensBarPosText;
|
||||||
wxChoice* WiiSensBarPos;
|
wxChoice* WiiSensBarPos;
|
||||||
wxCheckBox* WiiScreenSaver;
|
wxCheckBox* WiiLeds, * WiiSpeakers;
|
||||||
|
|
||||||
|
wxCheckBox* WiiScreenSaver; // IPL settings
|
||||||
wxCheckBox* WiiProgressiveScan;
|
wxCheckBox* WiiProgressiveScan;
|
||||||
wxCheckBox* WiiEuRGB60;
|
wxCheckBox* WiiEuRGB60;
|
||||||
wxArrayString arrayStringFor_WiiAspectRatio;
|
wxArrayString arrayStringFor_WiiAspectRatio;
|
||||||
|
@ -202,8 +204,11 @@ class CConfigMain
|
||||||
ID_ENABLEISOCACHE,
|
ID_ENABLEISOCACHE,
|
||||||
ID_GC_SRAM_LNG_TEXT,
|
ID_GC_SRAM_LNG_TEXT,
|
||||||
ID_GC_SRAM_LNG,
|
ID_GC_SRAM_LNG,
|
||||||
|
|
||||||
ID_WII_BT_BAR_TEXT,
|
ID_WII_BT_BAR_TEXT,
|
||||||
ID_WII_BT_BAR,
|
ID_WII_BT_BAR,
|
||||||
|
ID_WII_BT_LEDS, ID_WII_BT_SPEAKERS,
|
||||||
|
|
||||||
ID_WII_IPL_SSV,
|
ID_WII_IPL_SSV,
|
||||||
ID_WII_IPL_PGS,
|
ID_WII_IPL_PGS,
|
||||||
ID_WII_IPL_E60,
|
ID_WII_IPL_E60,
|
||||||
|
|
|
@ -120,6 +120,7 @@ EVT_MENU(IDM_SAVESLOT7, CFrame::OnSaveState)
|
||||||
EVT_MENU(IDM_SAVESLOT8, CFrame::OnSaveState)
|
EVT_MENU(IDM_SAVESLOT8, CFrame::OnSaveState)
|
||||||
EVT_MENU(IDM_SAVESLOT9, CFrame::OnSaveState)
|
EVT_MENU(IDM_SAVESLOT9, CFrame::OnSaveState)
|
||||||
EVT_MENU(IDM_SAVESLOT10, CFrame::OnSaveState)
|
EVT_MENU(IDM_SAVESLOT10, CFrame::OnSaveState)
|
||||||
|
EVT_SIZE(CFrame::MoveIcons)
|
||||||
EVT_HOST_COMMAND(wxID_ANY, CFrame::OnHostMessage)
|
EVT_HOST_COMMAND(wxID_ANY, CFrame::OnHostMessage)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
@ -144,6 +145,7 @@ CFrame::CFrame(wxFrame* parent,
|
||||||
, m_pStatusBar(NULL)
|
, m_pStatusBar(NULL)
|
||||||
, m_pMenuBar(NULL)
|
, m_pMenuBar(NULL)
|
||||||
, m_pBootProcessDialog(NULL)
|
, m_pBootProcessDialog(NULL)
|
||||||
|
, HaveLeds(false), HaveSpeakers(false)
|
||||||
{
|
{
|
||||||
InitBitmaps();
|
InitBitmaps();
|
||||||
|
|
||||||
|
@ -153,9 +155,8 @@ CFrame::CFrame(wxFrame* parent,
|
||||||
SetIcon(IconTemp);
|
SetIcon(IconTemp);
|
||||||
|
|
||||||
// Give it a status line
|
// Give it a status line
|
||||||
m_pStatusBar = CreateStatusBar(2);
|
CreateStatusBar_();
|
||||||
int StylesField[] = {wxSB_FLAT, wxSB_FLAT};
|
|
||||||
m_pStatusBar->SetStatusStyles(2, StylesField);
|
|
||||||
CreateMenu();
|
CreateMenu();
|
||||||
|
|
||||||
// This panel is the parent for rendering and it holds the gamelistctrl
|
// This panel is the parent for rendering and it holds the gamelistctrl
|
||||||
|
@ -208,6 +209,13 @@ WXLRESULT CFrame::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// =======================================================
|
||||||
|
// Create menu items
|
||||||
|
// -------------
|
||||||
void CFrame::CreateMenu()
|
void CFrame::CreateMenu()
|
||||||
{
|
{
|
||||||
delete m_pMenuBar;
|
delete m_pMenuBar;
|
||||||
|
|
|
@ -17,6 +17,27 @@ class CFrame : public wxFrame
|
||||||
|
|
||||||
void* GetRenderHandle() {return(m_Panel->GetHandle());}
|
void* GetRenderHandle() {return(m_Panel->GetHandle());}
|
||||||
|
|
||||||
|
wxStatusBar* m_pStatusBar;
|
||||||
|
|
||||||
|
|
||||||
|
// --------------------------------
|
||||||
|
// Wiimote leds
|
||||||
|
// ---------
|
||||||
|
void CreateStatusBar_();
|
||||||
|
void ModifyStatusBar(bool LedsOn, bool SpeakerOn);
|
||||||
|
void CreateDestroy(int Case);
|
||||||
|
void CreateLeds(); void CreateSpeakers();
|
||||||
|
void UpdateLeds(); void UpdateSpeakers();
|
||||||
|
wxBitmap CreateBitmapForLeds(bool On);
|
||||||
|
wxBitmap CreateBitmapForSpeakers(int BitmapType, bool On);
|
||||||
|
void MoveIcons(wxSizeEvent& event); void DoMoveIcons(); void MoveLeds(); void MoveSpeakers();
|
||||||
|
bool HaveLeds; bool HaveSpeakers;
|
||||||
|
|
||||||
|
wxStaticBitmap *m_StatBmp[7];
|
||||||
|
u8 g_Leds[4]; u8 g_Leds_[4];
|
||||||
|
u8 g_Speakers[3]; u8 g_Speakers_[3];
|
||||||
|
// ---------
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@ -38,7 +59,16 @@ class CFrame : public wxFrame
|
||||||
Toolbar_PluginPAD,
|
Toolbar_PluginPAD,
|
||||||
Toolbar_FullScreen,
|
Toolbar_FullScreen,
|
||||||
Toolbar_Help,
|
Toolbar_Help,
|
||||||
Bitmaps_Max
|
Bitmaps_Max,
|
||||||
|
END
|
||||||
|
};
|
||||||
|
|
||||||
|
enum WiimoteBitmaps // Wiimote speaker bitmaps
|
||||||
|
{
|
||||||
|
CREATELEDS = END,
|
||||||
|
DESTROYLEDS,
|
||||||
|
CREATESPEAKERS,
|
||||||
|
DESTROYSPEAKERS
|
||||||
};
|
};
|
||||||
|
|
||||||
wxBitmap m_Bitmaps[Bitmaps_Max];
|
wxBitmap m_Bitmaps[Bitmaps_Max];
|
||||||
|
@ -80,7 +110,6 @@ class CFrame : public wxFrame
|
||||||
void OnSaveState(wxCommandEvent& event);
|
void OnSaveState(wxCommandEvent& event);
|
||||||
void OnClose(wxCloseEvent &event);
|
void OnClose(wxCloseEvent &event);
|
||||||
|
|
||||||
wxStatusBar* m_pStatusBar;
|
|
||||||
wxMenuBar* m_pMenuBar;
|
wxMenuBar* m_pMenuBar;
|
||||||
|
|
||||||
wxMenuItem* m_pMenuItemPlay;
|
wxMenuItem* m_pMenuItemPlay;
|
||||||
|
@ -103,4 +132,3 @@ class CFrame : public wxFrame
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __FRAME_H_
|
#endif // __FRAME_H_
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,368 @@
|
||||||
|
// Copyright (C) 2003-2008 Dolphin Project.
|
||||||
|
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation, version 2.0.
|
||||||
|
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License 2.0 for more details.
|
||||||
|
|
||||||
|
// A copy of the GPL 2.0 should have been included with the program.
|
||||||
|
// If not, see http://www.gnu.org/licenses/
|
||||||
|
|
||||||
|
// Official SVN repository and contact information can be found at
|
||||||
|
// http://code.google.com/p/dolphin-emu/
|
||||||
|
|
||||||
|
|
||||||
|
#include "Globals.h"
|
||||||
|
#include "Frame.h"
|
||||||
|
#include "FileUtil.h"
|
||||||
|
#include "StringUtil.h"
|
||||||
|
|
||||||
|
#include "GameListCtrl.h"
|
||||||
|
#include "BootManager.h"
|
||||||
|
|
||||||
|
#include "Common.h"
|
||||||
|
#include "Config.h"
|
||||||
|
#include "Core.h"
|
||||||
|
#include "State.h"
|
||||||
|
#include "ConfigMain.h"
|
||||||
|
#include "PluginManager.h"
|
||||||
|
#include "MemcardManager.h"
|
||||||
|
#include "CheatsWindow.h"
|
||||||
|
#include "AboutDolphin.h"
|
||||||
|
|
||||||
|
#include <wx/statusbr.h>
|
||||||
|
|
||||||
|
|
||||||
|
namespace WiimoteLeds
|
||||||
|
{
|
||||||
|
int LED_SIZE_X = 8;
|
||||||
|
int LED_SIZE_Y = 8;
|
||||||
|
int SPEAKER_SIZE_X = 8;
|
||||||
|
int SPEAKER_SIZE_Y = 8;
|
||||||
|
|
||||||
|
static const int WidthsOn[] = { -1, 100, 50 + LED_SIZE_X * 4 };
|
||||||
|
static const int StylesFieldOn[] = { wxSB_NORMAL, wxSB_NORMAL, wxSB_NORMAL };
|
||||||
|
|
||||||
|
static const int SpWidthsOn[] = { -1, 100, 40 + SPEAKER_SIZE_X * 3 };
|
||||||
|
static const int SpStylesFieldOn[] = { wxSB_NORMAL, wxSB_NORMAL, wxSB_NORMAL };
|
||||||
|
|
||||||
|
static const int LdSpWidthsOn[] = { -1, 100, 32 + SPEAKER_SIZE_X * 3, 50 + LED_SIZE_X * 4 };
|
||||||
|
static const int LdSpStylesFieldOn[] = { wxSB_NORMAL, wxSB_NORMAL, wxSB_NORMAL };
|
||||||
|
|
||||||
|
static const int WidthsOff[] = { -1, 50 + 100 };
|
||||||
|
static const int StylesFieldOff[] = { wxSB_NORMAL, wxSB_NORMAL };
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// =======================================================
|
||||||
|
// Create status bar
|
||||||
|
// -------------
|
||||||
|
void CFrame::CreateStatusBar_()
|
||||||
|
{
|
||||||
|
// Get settings
|
||||||
|
bool LedsOn = SConfig::GetInstance().m_LocalCoreStartupParameter.bWiiLeds;
|
||||||
|
bool SpeakersOn = SConfig::GetInstance().m_LocalCoreStartupParameter.bWiiSpeakers;
|
||||||
|
m_pStatusBar = CreateStatusBar();
|
||||||
|
ModifyStatusBar(LedsOn, SpeakersOn);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// =======================================================
|
||||||
|
// Modify status bar
|
||||||
|
// -------------
|
||||||
|
void CFrame::ModifyStatusBar(bool LedsOn, bool SpeakersOn)
|
||||||
|
{
|
||||||
|
// Declarations
|
||||||
|
int Fields;
|
||||||
|
int *Widths;
|
||||||
|
int *StylesFields;
|
||||||
|
|
||||||
|
// ---------------------------------------
|
||||||
|
// Leds only
|
||||||
|
// -------------
|
||||||
|
if(LedsOn && !SpeakersOn)
|
||||||
|
{
|
||||||
|
Fields = 3;
|
||||||
|
Widths = (int*)WiimoteLeds::WidthsOn;
|
||||||
|
StylesFields = (int*)WiimoteLeds::StylesFieldOn;
|
||||||
|
}
|
||||||
|
// ---------------------------------------
|
||||||
|
// Speaker only
|
||||||
|
// -------------
|
||||||
|
else if(!LedsOn && SpeakersOn)
|
||||||
|
{
|
||||||
|
Fields = 3;
|
||||||
|
Widths = (int*)WiimoteLeds::SpWidthsOn;
|
||||||
|
StylesFields = (int*)WiimoteLeds::SpStylesFieldOn;
|
||||||
|
}
|
||||||
|
// ---------------------------------------
|
||||||
|
// Both on
|
||||||
|
// -------------
|
||||||
|
else if(LedsOn && SpeakersOn)
|
||||||
|
{
|
||||||
|
Fields = 4;
|
||||||
|
Widths = (int*)WiimoteLeds::LdSpWidthsOn;
|
||||||
|
StylesFields = (int*)WiimoteLeds::LdSpStylesFieldOn;
|
||||||
|
}
|
||||||
|
// ---------------------------------------
|
||||||
|
// Both off
|
||||||
|
// -------------
|
||||||
|
else if(!LedsOn && !SpeakersOn)
|
||||||
|
{
|
||||||
|
Fields = 2;
|
||||||
|
Widths = (int*)WiimoteLeds::WidthsOff;
|
||||||
|
StylesFields = (int*)WiimoteLeds::StylesFieldOff;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Destroy and create all, and check for HaveLeds and HaveSpeakers in case we have
|
||||||
|
gotten a confirmed on or off setting, in which case we don't do anything */
|
||||||
|
if(!LedsOn && HaveLeds) CreateDestroy(DESTROYLEDS);
|
||||||
|
if(!SpeakersOn && HaveSpeakers) CreateDestroy(DESTROYSPEAKERS);
|
||||||
|
if(LedsOn && !HaveLeds) CreateDestroy(CREATELEDS);
|
||||||
|
if(SpeakersOn && !HaveSpeakers) CreateDestroy(CREATESPEAKERS);
|
||||||
|
|
||||||
|
// Update the settings
|
||||||
|
m_pStatusBar->SetFieldsCount(Fields);
|
||||||
|
m_pStatusBar->SetStatusWidths(Fields, Widths);
|
||||||
|
m_pStatusBar->SetStatusStyles(Fields, StylesFields);
|
||||||
|
|
||||||
|
DoMoveIcons();
|
||||||
|
m_pStatusBar->Refresh(); // avoid small glitches that can occur
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// =======================================================
|
||||||
|
// Create and destroy leds and speakers icons
|
||||||
|
// -------------
|
||||||
|
void CFrame::CreateDestroy(int Case)
|
||||||
|
{
|
||||||
|
switch(Case)
|
||||||
|
{
|
||||||
|
case CREATELEDS:
|
||||||
|
{
|
||||||
|
CreateLeds();
|
||||||
|
//UpdateLeds(g_Leds);
|
||||||
|
HaveLeds = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case DESTROYLEDS:
|
||||||
|
{
|
||||||
|
for(int i = 0; i < 4; i++)
|
||||||
|
{
|
||||||
|
m_StatBmp[i]->Destroy();
|
||||||
|
}
|
||||||
|
HaveLeds = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case CREATESPEAKERS:
|
||||||
|
{
|
||||||
|
CreateSpeakers();
|
||||||
|
HaveSpeakers = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case DESTROYSPEAKERS:
|
||||||
|
{
|
||||||
|
for(int i = 4; i < 7; i++)
|
||||||
|
{
|
||||||
|
m_StatBmp[i]->Destroy();
|
||||||
|
}
|
||||||
|
HaveSpeakers = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} // end of switch
|
||||||
|
|
||||||
|
DoMoveIcons();
|
||||||
|
}
|
||||||
|
// =============
|
||||||
|
|
||||||
|
|
||||||
|
// =======================================================
|
||||||
|
// Create and update leds
|
||||||
|
// -------------
|
||||||
|
void CFrame::CreateLeds()
|
||||||
|
{
|
||||||
|
// Begin with blank ones
|
||||||
|
memset(&g_Leds, 0, sizeof(g_Leds));
|
||||||
|
for(int i = 0; i < 4; i++)
|
||||||
|
{
|
||||||
|
m_StatBmp[i] = new wxStaticBitmap(m_pStatusBar, wxID_ANY,
|
||||||
|
CreateBitmapForLeds((bool)g_Leds[i]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Update leds
|
||||||
|
void CFrame::UpdateLeds()
|
||||||
|
{
|
||||||
|
for(int i = 0; i < 4; i++)
|
||||||
|
{
|
||||||
|
m_StatBmp[i]->SetBitmap(CreateBitmapForLeds((bool)g_Leds[i]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// ==============
|
||||||
|
|
||||||
|
|
||||||
|
// =======================================================
|
||||||
|
// Create and speaker icons
|
||||||
|
// -------------
|
||||||
|
void CFrame::CreateSpeakers()
|
||||||
|
{
|
||||||
|
// Begin with blank ones
|
||||||
|
memset(&g_Speakers, 0, sizeof(g_Speakers));
|
||||||
|
memset(&g_Speakers_, 0, sizeof(g_Speakers_));
|
||||||
|
for(int i = 0; i < 3; i++)
|
||||||
|
{
|
||||||
|
m_StatBmp[i+4] = new wxStaticBitmap(m_pStatusBar, wxID_ANY,
|
||||||
|
CreateBitmapForSpeakers(i, (bool)g_Speakers[i]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Update icons
|
||||||
|
void CFrame::UpdateSpeakers()
|
||||||
|
{
|
||||||
|
for(int i = 0; i < 3; i++)
|
||||||
|
{
|
||||||
|
m_StatBmp[i+4]->SetBitmap(CreateBitmapForSpeakers(i, (bool)g_Speakers[i]));
|
||||||
|
}
|
||||||
|
if(g_Leds[0] == 0)
|
||||||
|
{
|
||||||
|
// LOGV(CONSOLE, 0, "Break");
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string Temp = ArrayToString(g_Speakers, sizeof(g_Speakers));
|
||||||
|
LOGV(CONSOLE, 0, "Speakers: %s", Temp.c_str());
|
||||||
|
|
||||||
|
Temp = ArrayToString(g_Leds, sizeof(g_Leds));
|
||||||
|
LOGV(CONSOLE, 0, "Leds: %s", Temp.c_str());
|
||||||
|
}
|
||||||
|
// ==============
|
||||||
|
|
||||||
|
|
||||||
|
// =======================================================
|
||||||
|
// Create the Leds bitmap
|
||||||
|
// -------------
|
||||||
|
wxBitmap CFrame::CreateBitmapForLeds(bool On)
|
||||||
|
{
|
||||||
|
wxBitmap bitmap(WiimoteLeds::LED_SIZE_X, WiimoteLeds::LED_SIZE_Y);
|
||||||
|
wxMemoryDC dc;
|
||||||
|
dc.SelectObject(bitmap);
|
||||||
|
|
||||||
|
// Set outline and fill colors
|
||||||
|
wxBrush LightBlueBrush(_T("#0383f0"));
|
||||||
|
wxPen LightBluePen(_T("#80c5fd"));
|
||||||
|
wxPen LightGrayPen(_T("#909090"));
|
||||||
|
dc.SetPen(On ? LightBluePen : LightGrayPen);
|
||||||
|
dc.SetBrush(On ? LightBlueBrush : *wxWHITE_BRUSH);
|
||||||
|
|
||||||
|
dc.Clear();
|
||||||
|
dc.DrawRectangle(0, 0, WiimoteLeds::LED_SIZE_X, WiimoteLeds::LED_SIZE_Y);
|
||||||
|
dc.SelectObject(wxNullBitmap);
|
||||||
|
return bitmap;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// =======================================================
|
||||||
|
// Create the Speaker bitmap
|
||||||
|
// -------------
|
||||||
|
wxBitmap CFrame::CreateBitmapForSpeakers(int BitmapType, bool On)
|
||||||
|
{
|
||||||
|
wxBitmap bitmap(WiimoteLeds::LED_SIZE_X, WiimoteLeds::LED_SIZE_Y);
|
||||||
|
wxMemoryDC dc;
|
||||||
|
dc.SelectObject(bitmap);
|
||||||
|
wxBrush BackgroundGrayBrush(_T("#ece9d8")); // the right color in windows
|
||||||
|
|
||||||
|
switch(BitmapType)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
{
|
||||||
|
// Set outline and fill colors
|
||||||
|
dc.SetPen(On ? *wxMEDIUM_GREY_PEN : *wxMEDIUM_GREY_PEN);
|
||||||
|
dc.SetBrush(On ? *wxGREEN_BRUSH : *wxWHITE_BRUSH);
|
||||||
|
dc.SetBackground(BackgroundGrayBrush);
|
||||||
|
dc.Clear();
|
||||||
|
dc.DrawEllipse(0, 0, WiimoteLeds::SPEAKER_SIZE_X, WiimoteLeds::SPEAKER_SIZE_Y);
|
||||||
|
dc.SelectObject(wxNullBitmap);
|
||||||
|
return bitmap;
|
||||||
|
}
|
||||||
|
case 1:
|
||||||
|
{
|
||||||
|
// Set outline and fill colors
|
||||||
|
dc.SetPen(On ? *wxMEDIUM_GREY_PEN : *wxMEDIUM_GREY_PEN);
|
||||||
|
dc.SetBrush(On ? *wxBLUE_BRUSH : *wxWHITE_BRUSH);
|
||||||
|
dc.SetBackground(BackgroundGrayBrush);
|
||||||
|
dc.Clear();
|
||||||
|
dc.DrawEllipse(0, 0, WiimoteLeds::SPEAKER_SIZE_X, WiimoteLeds::SPEAKER_SIZE_Y);
|
||||||
|
dc.SelectObject(wxNullBitmap);
|
||||||
|
return bitmap;
|
||||||
|
}
|
||||||
|
case 2:
|
||||||
|
{
|
||||||
|
// Set outline and fill colors
|
||||||
|
dc.SetPen(On ? *wxMEDIUM_GREY_PEN : *wxMEDIUM_GREY_PEN);
|
||||||
|
dc.SetBrush(On ? *wxGREEN_BRUSH : *wxWHITE_BRUSH);
|
||||||
|
dc.SetBackground(BackgroundGrayBrush);
|
||||||
|
dc.Clear();
|
||||||
|
dc.DrawEllipse(0, 0, WiimoteLeds::SPEAKER_SIZE_X, WiimoteLeds::SPEAKER_SIZE_Y);
|
||||||
|
dc.SelectObject(wxNullBitmap);
|
||||||
|
return bitmap;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// =======================================================
|
||||||
|
// Move the bitmaps
|
||||||
|
// -------------
|
||||||
|
void CFrame::MoveIcons(wxSizeEvent& event)
|
||||||
|
{
|
||||||
|
DoMoveIcons();
|
||||||
|
event.Skip();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFrame::DoMoveIcons()
|
||||||
|
{
|
||||||
|
if(HaveLeds) MoveLeds();
|
||||||
|
if(HaveSpeakers) MoveSpeakers();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFrame::MoveLeds()
|
||||||
|
{
|
||||||
|
wxRect Rect;
|
||||||
|
// Get the bitmap field coordinates
|
||||||
|
m_pStatusBar->GetFieldRect((HaveLeds && HaveSpeakers) ? 3 : 2, Rect);
|
||||||
|
wxSize Size = m_StatBmp[0]->GetSize(); // Get the bitmap size
|
||||||
|
|
||||||
|
//wxMessageBox(wxString::Format("%i", Rect.x));
|
||||||
|
int x = Rect.x + 10;
|
||||||
|
int Dist = WiimoteLeds::LED_SIZE_X + 7;
|
||||||
|
int y = Rect.y + (Rect.height - Size.y) / 2;
|
||||||
|
|
||||||
|
for(int i = 0; i < 4; i++)
|
||||||
|
{
|
||||||
|
if(i > 0) x = m_StatBmp[i-1]->GetPosition().x + Dist;
|
||||||
|
m_StatBmp[i]->Move(x, y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFrame::MoveSpeakers()
|
||||||
|
{
|
||||||
|
wxRect Rect;
|
||||||
|
m_pStatusBar->GetFieldRect(2, Rect); // Get the bitmap field coordinates
|
||||||
|
|
||||||
|
// Get the actual bitmap size, currently it's the same as SPEAKER_SIZE_Y
|
||||||
|
wxSize Size = m_StatBmp[4]->GetSize();
|
||||||
|
|
||||||
|
//wxMessageBox(wxString::Format("%i", Rect.x));
|
||||||
|
int x = Rect.x + 9;
|
||||||
|
int Dist = WiimoteLeds::SPEAKER_SIZE_X + 7;
|
||||||
|
int y = Rect.y + (Rect.height - Size.y) / 2;
|
||||||
|
|
||||||
|
for(int i = 0; i < 3; i++)
|
||||||
|
{
|
||||||
|
if(i > 0) x = m_StatBmp[i-1+4]->GetPosition().x + Dist;
|
||||||
|
m_StatBmp[i+4]->Move(x, y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// ==============
|
|
@ -492,8 +492,11 @@ void CGameListCtrl::OnRightClick(wxMouseEvent& event)
|
||||||
popupMenu.AppendSeparator();
|
popupMenu.AppendSeparator();
|
||||||
popupMenu.Append(IDM_OPENCONTAININGFOLDER, _("Open &containing folder"));
|
popupMenu.Append(IDM_OPENCONTAININGFOLDER, _("Open &containing folder"));
|
||||||
popupMenu.AppendCheckItem(IDM_SETDEFAULTGCM, _("Set as &default ISO"));
|
popupMenu.AppendCheckItem(IDM_SETDEFAULTGCM, _("Set as &default ISO"));
|
||||||
if(selected_iso->GetFileName() == SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDefaultGCM)
|
|
||||||
popupMenu.FindItemByPosition(3)->Check();
|
// First we have to decide a starting value when we append it
|
||||||
|
if(selected_iso->GetFileName() == SConfig::GetInstance().
|
||||||
|
m_LocalCoreStartupParameter.m_strDefaultGCM)
|
||||||
|
popupMenu.FindItem(IDM_SETDEFAULTGCM)->Check();
|
||||||
|
|
||||||
popupMenu.AppendSeparator();
|
popupMenu.AppendSeparator();
|
||||||
popupMenu.Append(IDM_DELETEGCM, _("&Delete ISO..."));
|
popupMenu.Append(IDM_DELETEGCM, _("&Delete ISO..."));
|
||||||
|
@ -562,12 +565,21 @@ void CGameListCtrl::OnOpenContainingFolder(wxCommandEvent& WXUNUSED (event))
|
||||||
// =======================================================
|
// =======================================================
|
||||||
// Save this file as the default file
|
// Save this file as the default file
|
||||||
// -------------
|
// -------------
|
||||||
void CGameListCtrl::OnSetDefaultGCM(wxCommandEvent& WXUNUSED (event))
|
void CGameListCtrl::OnSetDefaultGCM(wxCommandEvent& event)
|
||||||
{
|
{
|
||||||
const GameListItem *iso = GetSelectedISO();
|
const GameListItem *iso = GetSelectedISO();
|
||||||
if (!iso) return;
|
if (!iso) return;
|
||||||
|
|
||||||
|
if (event.IsChecked()) // Write the new default value and save it the ini file
|
||||||
|
{
|
||||||
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDefaultGCM = iso->GetFileName();
|
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDefaultGCM = iso->GetFileName();
|
||||||
SConfig::GetInstance().SaveSettings();
|
SConfig::GetInstance().SaveSettings();
|
||||||
|
}
|
||||||
|
else // Othwerise blank the value and save it
|
||||||
|
{
|
||||||
|
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDefaultGCM = "";
|
||||||
|
SConfig::GetInstance().SaveSettings();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// =============
|
// =============
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,9 @@ namespace WiiMoteEmu
|
||||||
// Definitions and variable declarations
|
// Definitions and variable declarations
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
|
|
||||||
u8 g_Leds = 0x1;
|
u8 g_Leds = 0x0; // 4 bits
|
||||||
|
u8 g_Speaker = 0x1; // 1 = on
|
||||||
|
u8 g_SpeakerVoice = 0x1; // 1 = on
|
||||||
u8 g_IR = 0x1; // 1 = on
|
u8 g_IR = 0x1; // 1 = on
|
||||||
|
|
||||||
u8 g_Eeprom[WIIMOTE_EEPROM_SIZE];
|
u8 g_Eeprom[WIIMOTE_EEPROM_SIZE];
|
||||||
|
|
|
@ -20,7 +20,10 @@
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "Common.h"
|
|
||||||
|
#include "Common.h" // Common
|
||||||
|
#include "StringUtil.h" // for ArrayToString
|
||||||
|
|
||||||
#include "wiimote_hid.h"
|
#include "wiimote_hid.h"
|
||||||
#include "EmuSubroutines.h"
|
#include "EmuSubroutines.h"
|
||||||
#include "EmuDefinitions.h"
|
#include "EmuDefinitions.h"
|
||||||
|
@ -53,7 +56,6 @@ namespace WiiMoteEmu
|
||||||
// ----------------
|
// ----------------
|
||||||
void HidOutputReport(u16 _channelID, wm_report* sr) {
|
void HidOutputReport(u16 _channelID, wm_report* sr) {
|
||||||
LOGV(WII_IPC_WIIMOTE, 0, "===========================================================");
|
LOGV(WII_IPC_WIIMOTE, 0, "===========================================================");
|
||||||
|
|
||||||
LOGV(WII_IPC_WIIMOTE, 0, "HidOutputReport (0x%02x)", sr->channel);
|
LOGV(WII_IPC_WIIMOTE, 0, "HidOutputReport (0x%02x)", sr->channel);
|
||||||
|
|
||||||
switch(sr->channel)
|
switch(sr->channel)
|
||||||
|
@ -73,22 +75,31 @@ void HidOutputReport(u16 _channelID, wm_report* sr) {
|
||||||
case WM_READ_DATA: // 0x17
|
case WM_READ_DATA: // 0x17
|
||||||
WmReadData(_channelID, (wm_read_data*)sr->data);
|
WmReadData(_channelID, (wm_read_data*)sr->data);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
/* This enables or disables the IR lights, we update the global variable g_IR
|
||||||
|
so that WmRequestStatus() knows about it */
|
||||||
case WM_IR_PIXEL_CLOCK: // 0x13
|
case WM_IR_PIXEL_CLOCK: // 0x13
|
||||||
case WM_IR_LOGIC: // 0x1a
|
case WM_IR_LOGIC: // 0x1a
|
||||||
LOGV(WII_IPC_WIIMOTE, 0, " IR Enable 0x%02x: 0x%02x", sr->channel, sr->data[0]);
|
LOGV(WII_IPC_WIIMOTE, 0, " IR Enable 0x%02x: 0x%02x", sr->channel, sr->data[0]);
|
||||||
//wprintf("IR Enable/Disable 0x%02x: 0x%02x\n", sr->channel, sr->data[0]);
|
//wprintf("IR Enable/Disable 0x%02x: 0x%02x\n", sr->channel, sr->data[0]);
|
||||||
// Update the global value so that WmRequestStatus() knows it
|
|
||||||
if(sr->data[0] == 0x02) g_IR = 0;
|
if(sr->data[0] == 0x02) g_IR = 0;
|
||||||
else if(sr->data[0] == 0x06) g_IR = 1;
|
else if(sr->data[0] == 0x06) g_IR = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_WRITE_DATA: // 0x16
|
case WM_WRITE_DATA: // 0x16
|
||||||
WmWriteData(_channelID, (wm_write_data*)sr->data);
|
WmWriteData(_channelID, (wm_write_data*)sr->data);
|
||||||
break;
|
break;
|
||||||
case WM_SPEAKER_ENABLE:
|
case WM_SPEAKER_ENABLE: // 0x14
|
||||||
LOGV(WII_IPC_WIIMOTE, 1, " WM Speaker Enable 0x%02x: 0x%02x", sr->channel, sr->data[0]);
|
LOGV(WII_IPC_WIIMOTE, 1, " WM Speaker Enable 0x%02x: 0x%02x", sr->channel, sr->data[0]);
|
||||||
|
//wprintf("Speaker Enable/Disable 0x%02x: 0x%02x\n", sr->channel, sr->data[0]);
|
||||||
|
if(sr->data[0] == 0x02) g_Speaker = 0;
|
||||||
|
else if(sr->data[0] == 0x06) g_Speaker = 1;
|
||||||
break;
|
break;
|
||||||
case WM_SPEAKER_MUTE:
|
case WM_SPEAKER_MUTE:
|
||||||
LOGV(WII_IPC_WIIMOTE, 1, " WM Mute Enable 0x%02x: 0x%02x", sr->channel, sr->data[0]);
|
LOGV(WII_IPC_WIIMOTE, 1, " WM Mute Enable 0x%02x: 0x%02x", sr->channel, sr->data[0]);
|
||||||
|
//wprintf("Speaker Mute/Unmute 0x%02x: 0x%02x\n", sr->channel, sr->data[0]);
|
||||||
|
if(sr->data[0] == 0x02) g_SpeakerVoice = 0;
|
||||||
|
else if(sr->data[0] == 0x06) g_SpeakerVoice = 1;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
PanicAlert("HidOutputReport: Unknown channel 0x%02x", sr->channel);
|
PanicAlert("HidOutputReport: Unknown channel 0x%02x", sr->channel);
|
||||||
|
@ -307,7 +318,7 @@ void WmWriteData(u16 _channelID, wm_write_data* wd)
|
||||||
LOG(WII_IPC_WIIMOTE, " Address: 0x%06x", address);
|
LOG(WII_IPC_WIIMOTE, " Address: 0x%06x", address);
|
||||||
LOG(WII_IPC_WIIMOTE, " Size: 0x%02x", wd->size);
|
LOG(WII_IPC_WIIMOTE, " Size: 0x%02x", wd->size);
|
||||||
LOG(WII_IPC_WIIMOTE, " Rumble: %x", wd->rumble);
|
LOG(WII_IPC_WIIMOTE, " Rumble: %x", wd->rumble);
|
||||||
//std::string Temp = WiiMoteEmu::ArrayToString(wd->data, wd->size);
|
//std::string Temp = ArrayToString(wd->data, wd->size);
|
||||||
//LOGV(WII_IPC_WIIMOTE, 0, " Data: %s", Temp.c_str());
|
//LOGV(WII_IPC_WIIMOTE, 0, " Data: %s", Temp.c_str());
|
||||||
|
|
||||||
// Write to EEPROM
|
// Write to EEPROM
|
||||||
|
@ -329,7 +340,10 @@ void WmWriteData(u16 _channelID, wm_write_data* wd)
|
||||||
case 0xA2:
|
case 0xA2:
|
||||||
block = g_RegSpeaker;
|
block = g_RegSpeaker;
|
||||||
blockSize = WIIMOTE_REG_SPEAKER_SIZE;
|
blockSize = WIIMOTE_REG_SPEAKER_SIZE;
|
||||||
LOGV(WII_IPC_WIIMOTE, 0, " Case 0xa2: g_RegSpeaker");
|
LOGV(WII_IPC_WIIMOTE, 0, " Case 0xa2: RegSpeaker");
|
||||||
|
//wprintf("\n\nWrite to RegSpeaker: Size: %i, Address: %08x, Offset: %08x\n",
|
||||||
|
// wd->size, address, (address & 0xffff));
|
||||||
|
//wprintf("Data: %s\n", Temp.c_str());
|
||||||
break;
|
break;
|
||||||
case 0xA4:
|
case 0xA4:
|
||||||
block = g_RegExt; // Extension Controller register
|
block = g_RegExt; // Extension Controller register
|
||||||
|
@ -337,13 +351,13 @@ void WmWriteData(u16 _channelID, wm_write_data* wd)
|
||||||
//LOGV(WII_IPC_WIIMOTE, 0, " *******************************************************");
|
//LOGV(WII_IPC_WIIMOTE, 0, " *******************************************************");
|
||||||
LOGV(WII_IPC_WIIMOTE, 0, " Case 0xa4: ExtReg");
|
LOGV(WII_IPC_WIIMOTE, 0, " Case 0xa4: ExtReg");
|
||||||
//LOGV(WII_IPC_WIIMOTE, 0, " *******************************************************");
|
//LOGV(WII_IPC_WIIMOTE, 0, " *******************************************************");
|
||||||
wprintf("\n\nWmWriteData Size: %i Address: %08x Offset: %08x \n",
|
//wprintf("\n\nWmWriteData Size: %i Address: %08x Offset: %08x \n",
|
||||||
wd->size, address, (address & 0xffff));
|
// wd->size, address, (address & 0xffff));
|
||||||
break;
|
break;
|
||||||
case 0xB0:
|
case 0xB0:
|
||||||
block = g_RegIr;
|
block = g_RegIr;
|
||||||
blockSize = WIIMOTE_REG_IR_SIZE;
|
blockSize = WIIMOTE_REG_IR_SIZE;
|
||||||
LOGV(WII_IPC_WIIMOTE, 0, " Case 0xb0: g_RegIr");
|
LOGV(WII_IPC_WIIMOTE, 0, " Case 0xb0: RegIr");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
PanicAlert("WmWriteData: bad register block!");
|
PanicAlert("WmWriteData: bad register block!");
|
||||||
|
@ -479,9 +493,9 @@ void WmRequestStatus(u16 _channelID, wm_request_status* rs)
|
||||||
|
|
||||||
// Status values
|
// Status values
|
||||||
pStatus->battery_low = 0; // battery is okay
|
pStatus->battery_low = 0; // battery is okay
|
||||||
pStatus->leds = g_Leds; // current setting
|
pStatus->leds = g_Leds; // leds are 4 bit
|
||||||
pStatus->ir = g_IR; // current setting
|
pStatus->ir = g_IR; // 1 bit
|
||||||
|
pStatus->speaker = g_Speaker; // 1 bit
|
||||||
/* Battery levels in voltage
|
/* Battery levels in voltage
|
||||||
0x00 - 0x32: level 1
|
0x00 - 0x32: level 1
|
||||||
0x33 - 0x43: level 2
|
0x33 - 0x43: level 2
|
||||||
|
@ -500,11 +514,9 @@ void WmRequestStatus(u16 _channelID, wm_request_status* rs)
|
||||||
LOGV(WII_IPC_WIIMOTE, 0, " Flags: 0x%02x", pStatus->padding1[2]);
|
LOGV(WII_IPC_WIIMOTE, 0, " Flags: 0x%02x", pStatus->padding1[2]);
|
||||||
LOGV(WII_IPC_WIIMOTE, 0, " Battery: %d", pStatus->battery);
|
LOGV(WII_IPC_WIIMOTE, 0, " Battery: %d", pStatus->battery);
|
||||||
|
|
||||||
//std::string Temp = WiiMoteEmu::ArrayToString(DataFrame, Offset, 0);
|
|
||||||
//wprintf("Status Report: %s\n", Temp.c_str());
|
|
||||||
|
|
||||||
g_WiimoteInitialize.pWiimoteInput(_channelID, DataFrame, Offset);
|
g_WiimoteInitialize.pWiimoteInput(_channelID, DataFrame, Offset);
|
||||||
LOGV(WII_IPC_WIIMOTE, 0, "=================================================");
|
LOGV(WII_IPC_WIIMOTE, 0, "=================================================");
|
||||||
}
|
}
|
||||||
|
|
||||||
} // end of namespace
|
} // end of namespace
|
||||||
|
|
||||||
|
|
|
@ -31,8 +31,6 @@ void InterruptChannel(u16 _channelID, const void* _pData, u32 _Size);
|
||||||
void ControlChannel(u16 _channelID, const void* _pData, u32 _Size) ;
|
void ControlChannel(u16 _channelID, const void* _pData, u32 _Size) ;
|
||||||
void Update();
|
void Update();
|
||||||
|
|
||||||
std::string ArrayToString(const u8 *data, u32 size, u32 offset = 0, int line_len = 20);
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -41,8 +41,12 @@
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "Common.h"
|
|
||||||
|
#include "Common.h" // Common
|
||||||
|
#include "StringUtil.h"
|
||||||
|
|
||||||
#include "wiimote_hid.h"
|
#include "wiimote_hid.h"
|
||||||
|
#include "EmuMain.h"
|
||||||
#include "EmuSubroutines.h"
|
#include "EmuSubroutines.h"
|
||||||
#include "EmuDefinitions.h"
|
#include "EmuDefinitions.h"
|
||||||
#include "Console.h" // for startConsoleWin, wprintf, GetConsoleHwnd
|
#include "Console.h" // for startConsoleWin, wprintf, GetConsoleHwnd
|
||||||
|
@ -172,17 +176,10 @@ void InterruptChannel(u16 _channelID, const void* _pData, u32 _Size)
|
||||||
const u8* data = (const u8*)_pData;
|
const u8* data = (const u8*)_pData;
|
||||||
|
|
||||||
// Debugging. Dump raw data.
|
// Debugging. Dump raw data.
|
||||||
{
|
|
||||||
LOGV(WII_IPC_WIIMOTE, 3, "Wiimote_Input");
|
LOGV(WII_IPC_WIIMOTE, 3, "Wiimote_Input");
|
||||||
std::string Temp;
|
//std::string Temp = ArrayToString(data, sizeof(data), 0, 30);
|
||||||
for (u32 j=0; j<_Size; j++)
|
//LOGV(WII_IPC_WIIMOTE, 3, " Data: %s", Temp.c_str());
|
||||||
{
|
|
||||||
char Buffer[128];
|
|
||||||
sprintf(Buffer, "%02x ", data[j]);
|
|
||||||
Temp.append(Buffer);
|
|
||||||
}
|
|
||||||
LOGV(WII_IPC_WIIMOTE, 3, " Data: %s", Temp.c_str());
|
|
||||||
}
|
|
||||||
hid_packet* hidp = (hid_packet*) data;
|
hid_packet* hidp = (hid_packet*) data;
|
||||||
|
|
||||||
switch(hidp->type)
|
switch(hidp->type)
|
||||||
|
@ -194,7 +191,6 @@ void InterruptChannel(u16 _channelID, const void* _pData, u32 _Size)
|
||||||
case HID_PARAM_OUTPUT:
|
case HID_PARAM_OUTPUT:
|
||||||
{
|
{
|
||||||
wm_report* sr = (wm_report*)hidp->data;
|
wm_report* sr = (wm_report*)hidp->data;
|
||||||
|
|
||||||
HidOutputReport(_channelID, sr);
|
HidOutputReport(_channelID, sr);
|
||||||
|
|
||||||
/* This is the 0x22 answer to all Inputs. In most games it didn't matter
|
/* This is the 0x22 answer to all Inputs. In most games it didn't matter
|
||||||
|
|
|
@ -41,6 +41,8 @@ namespace WiiMoteEmu
|
||||||
|
|
||||||
|
|
||||||
extern u8 g_Leds;
|
extern u8 g_Leds;
|
||||||
|
extern u8 g_Speaker;
|
||||||
|
extern u8 g_SpeakerVoice;
|
||||||
extern u8 g_IR;
|
extern u8 g_IR;
|
||||||
|
|
||||||
extern u8 g_Eeprom[WIIMOTE_EEPROM_SIZE];
|
extern u8 g_Eeprom[WIIMOTE_EEPROM_SIZE];
|
||||||
|
|
|
@ -40,25 +40,6 @@ namespace WiiMoteEmu
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
|
|
||||||
|
|
||||||
// ===================================================
|
|
||||||
/* Debugging. Read out an u8 array. */
|
|
||||||
// ----------------
|
|
||||||
std::string ArrayToString(const u8 *data, u32 size, u32 offset, int line_len)
|
|
||||||
{
|
|
||||||
//const u8* _data = (const u8*)data;
|
|
||||||
std::string Temp;
|
|
||||||
for (u32 i = 0; i < size; i++)
|
|
||||||
{
|
|
||||||
char Buffer[128];
|
|
||||||
sprintf(Buffer, "%02x ", data[i + offset]);
|
|
||||||
if((i + 1) % line_len == 0) Temp.append("\n"); // break long lines
|
|
||||||
Temp.append(Buffer);
|
|
||||||
}
|
|
||||||
return Temp;
|
|
||||||
}
|
|
||||||
// ================
|
|
||||||
|
|
||||||
|
|
||||||
void FillReportInfo(wm_core& _core)
|
void FillReportInfo(wm_core& _core)
|
||||||
{
|
{
|
||||||
memset(&_core, 0x00, sizeof(wm_core));
|
memset(&_core, 0x00, sizeof(wm_core));
|
||||||
|
|
|
@ -177,7 +177,7 @@ extern "C" void Wiimote_InterruptChannel(u16 _channelID, const void* _pData, u32
|
||||||
{
|
{
|
||||||
LOGV(WII_IPC_WIIMOTE, 3, "Wiimote_Input");
|
LOGV(WII_IPC_WIIMOTE, 3, "Wiimote_Input");
|
||||||
LOGV(WII_IPC_WIIMOTE, 3, " Channel ID: %04x", _channelID);
|
LOGV(WII_IPC_WIIMOTE, 3, " Channel ID: %04x", _channelID);
|
||||||
std::string Temp = WiiMoteEmu::ArrayToString(data, _Size);
|
std::string Temp = ArrayToString(data, _Size);
|
||||||
LOGV(WII_IPC_WIIMOTE, 3, " Data: %s", Temp.c_str());
|
LOGV(WII_IPC_WIIMOTE, 3, " Data: %s", Temp.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -199,7 +199,7 @@ extern "C" void Wiimote_ControlChannel(u16 _channelID, const void* _pData, u32 _
|
||||||
// Debugging
|
// Debugging
|
||||||
{
|
{
|
||||||
LOGV(WII_IPC_WIIMOTE, 3, "Wiimote_ControlChannel");
|
LOGV(WII_IPC_WIIMOTE, 3, "Wiimote_ControlChannel");
|
||||||
std::string Temp = WiiMoteEmu::ArrayToString(data, _Size);
|
std::string Temp = ArrayToString(data, _Size);
|
||||||
LOGV(WII_IPC_WIIMOTE, 3, " Data: %s", Temp.c_str());
|
LOGV(WII_IPC_WIIMOTE, 3, " Data: %s", Temp.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue