Emulated Wiimote: Added game specific Wiimote cursor configuration. The IR pointer settings will be saved for the ISO id of the ISO that is loaded. This is necessary because there is no common way of treating the IR pointer positions. The IR data use a virtual resolution of 1024 x 768, but there is no consistency of where such a point is on the screen.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2314 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
John Peterson 2009-02-20 03:13:22 +00:00
parent 4883727384
commit 59734ddc86
19 changed files with 365 additions and 136 deletions

View file

@ -206,7 +206,7 @@ bool IniFile::DeleteKey(const char* sectionName, const char* key)
return false; //shouldn't happen
}
// Return a list of all keys in a section
bool IniFile::GetKeys(const char* sectionName, std::vector<std::string>& keys) const
{
const Section* section = GetSection(sectionName);
@ -228,7 +228,7 @@ bool IniFile::GetKeys(const char* sectionName, std::vector<std::string>& keys) c
return true;
}
// Return a list of all lines in a section
bool IniFile::GetLines(const char* sectionName, std::vector<std::string>& lines) const
{
const Section* section = GetSection(sectionName);

View file

@ -66,6 +66,40 @@ bool AsciiToHex(const char* _szValue, u32& result)
return (true);
}
//////////////////////////////////////////////////////////////////////////////////////////
// Convert AB to it's ascii table entry numbers 0x4142
// ¯¯¯¯¯¯¯¯¯¯¯¯¯
u32 Ascii2Hex(std::string _Text)
{
// Reset the return value zero
u32 Result = 0;
// Max 32-bit values are supported
int Length = _Text.length(); if (Length > 4) Length = 4;
for (int i = 0; i < Length; i++)
{
// Add up the values, for example RSPE becomes, 0x52000000, then 0x52530000 and so on
Result += _Text.c_str()[i] << (Length - 1 - i)*8;
}
// Return the value
return Result;
}
// Convert it back again
std::string Hex2Ascii(u32 _Text)
{
// Create temporary storate
char Result[4];
// Go through the four characters
sprintf(Result, "%c%c%c%c", _Text >> 24, _Text >> 16, _Text >> 8, _Text);
// Return the string
std::string StrResult = Result;
return StrResult;
}
///////////////////////////
bool CharArrayFromFormatV(char* out, int outsize, const char* format, va_list args)
{
int writtenCount = vsnprintf(out, outsize, format, args);

View file

@ -63,6 +63,8 @@ bool TryParseUInt(const std::string& str, u32* output);
// TODO: kill this
bool AsciiToHex(const char* _szValue, u32& result);
u32 Ascii2Hex(std::string _Text);
std::string Hex2Ascii(u32 _Text);
void SplitString(const std::string& str, const std::string& delim, std::vector<std::string>& output);
int ChooseStringFrom(const char* str, const char* * items);

View file

@ -29,6 +29,7 @@
#include "Timer.h"
#include "Common.h"
#include "ConsoleWindow.h"
#include "StringUtil.h"
#include "Console.h"
#include "Core.h"
@ -389,6 +390,8 @@ THREAD_RETURN EmuThread(void *pArg)
{
SWiimoteInitialize WiimoteInitialize;
WiimoteInitialize.hWnd = g_pWindowHandle;
// Add the ISO Id
WiimoteInitialize.ISOId = Ascii2Hex(_CoreParameter.m_strUniqueID);
WiimoteInitialize.pLog = Callback_WiimoteLog;
WiimoteInitialize.pWiimoteInput = Callback_WiimoteInput;
// Wait for Wiiuse to find the number of connected Wiimotes
@ -684,7 +687,7 @@ const char *Callback_ISOName(void)
else
return (const char *)"";
}
// __________________________________________________________________________________________________
// Called from ANY thread!
void Callback_KeyPress(int key, bool shift, bool control)

View file

@ -452,6 +452,7 @@ void CGameListCtrl::ScanForISOs()
sprintf(tempstring,"Scanning %s", FileName.c_str());
msg = wxString::FromAscii(tempstring);
// Update with the progress (i) and the message (msg)
bool Cont = dialog.Update(i, msg);
if (!Cont)

View file

@ -60,6 +60,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Dolphin", "Core\DolphinWX\D
{CFDCEE0E-FA45-4F72-9FCC-0B88F5A75160} = {CFDCEE0E-FA45-4F72-9FCC-0B88F5A75160}
{D6E56527-BBB9-4EAD-A6EC-49D4BF6AFCD8} = {D6E56527-BBB9-4EAD-A6EC-49D4BF6AFCD8}
{0318BA30-EF48-441A-9E10-DC85EFAE39F0} = {0318BA30-EF48-441A-9E10-DC85EFAE39F0}
{8D612734-FAA5-4B8A-804F-4DEA2367D495} = {8D612734-FAA5-4B8A-804F-4DEA2367D495}
{71B16F46-0B00-4EDA-B253-D6D9D03A215C} = {71B16F46-0B00-4EDA-B253-D6D9D03A215C}
{33546D62-7F34-4EA6-A88E-D538B36E16BF} = {33546D62-7F34-4EA6-A88E-D538B36E16BF}
{3E03C179-8251-46E4-81F4-466F114BAC63} = {3E03C179-8251-46E4-81F4-466F114BAC63}
@ -371,6 +372,7 @@ Global
{8D612734-FAA5-4B8A-804F-4DEA2367D495}.Release JITIL|x64.ActiveCfg = Release|x64
{8D612734-FAA5-4B8A-804F-4DEA2367D495}.Release JITIL|x64.Build.0 = Release|x64
{8D612734-FAA5-4B8A-804F-4DEA2367D495}.Release|Win32.ActiveCfg = Release|Win32
{8D612734-FAA5-4B8A-804F-4DEA2367D495}.Release|Win32.Build.0 = Release|Win32
{8D612734-FAA5-4B8A-804F-4DEA2367D495}.Release|x64.ActiveCfg = Release|x64
{8D612734-FAA5-4B8A-804F-4DEA2367D495}.Release|x64.Build.0 = Release|x64
{ADF64291-57ED-4B7A-AB76-37B4A991504B}.Debug|Win32.ActiveCfg = Debug|Win32

View file

@ -19,6 +19,7 @@ typedef void (*TWiimoteInput)(u16 _channelID, const void* _pData, u32 _Size);
typedef struct
{
HWND hWnd;
u32 ISOId;
TLogv pLog;
TWiimoteInput pWiimoteInput;
} SWiimoteInitialize;

View file

@ -16,11 +16,15 @@
// http://code.google.com/p/dolphin-emu/
#include <iostream>
#include "Common.h"
#include "IniFile.h"
#include "StringUtil.h"
#include "Config.h"
#include "EmuDefinitions.h" // for PadMapping
#include "main.h"
Config g_Config;
@ -38,7 +42,6 @@ void Config::Load(bool ChangePad)
// General
iniFile.Get("Settings", "SidewaysDPad", &bSidewaysDPad, false);
iniFile.Get("Settings", "WideScreen", &bWideScreen, false);
iniFile.Get("Settings", "NunchuckConnected", &bNunchuckConnected, false);
iniFile.Get("Settings", "ClassicControllerConnected", &bClassicControllerConnected, false);
@ -53,6 +56,14 @@ void Config::Load(bool ChangePad)
iniFile.Get("Real", "AccNunNeutralY", &iAccNunNeutralY, 0);
iniFile.Get("Real", "AccNunNeutralZ", &iAccNunNeutralZ, 0);
// Load the IR cursor settings if it's avaliable, if not load the default settings
std::string TmpSection;
if (g_ISOId) TmpSection = Hex2Ascii(g_ISOId); else TmpSection = "Emulated";
iniFile.Get(TmpSection.c_str(), "IRLeft", &iIRLeft, LEFT);
iniFile.Get(TmpSection.c_str(), "IRTop", &iIRTop, TOP);
iniFile.Get(TmpSection.c_str(), "IRWidth", &iIRWidth, RIGHT - LEFT);
iniFile.Get(TmpSection.c_str(), "IRHeight", &iIRHeight, BOTTOM - TOP);
// Default controls
#ifdef _WIN32
int WmA = 65, WmB = 66,
@ -160,7 +171,6 @@ void Config::Save(int Slot)
IniFile iniFile;
iniFile.Load(FULL_CONFIG_DIR "Wiimote.ini");
iniFile.Set("Settings", "SidewaysDPad", bSidewaysDPad);
iniFile.Set("Settings", "WideScreen", bWideScreen);
iniFile.Set("Settings", "NunchuckConnected", bNunchuckConnected);
iniFile.Set("Settings", "ClassicControllerConnected", bClassicControllerConnected);
@ -174,6 +184,13 @@ void Config::Save(int Slot)
iniFile.Set("Real", "AccNunNeutralY", iAccNunNeutralY);
iniFile.Set("Real", "AccNunNeutralZ", iAccNunNeutralZ);
// Save the IR cursor settings if it's avaliable, if not save the default settings
std::string TmpSection;
if (g_ISOId) TmpSection = Hex2Ascii(g_ISOId); else TmpSection = "Emulated";
iniFile.Set(TmpSection.c_str(), "IRLeft", iIRLeft);
iniFile.Set(TmpSection.c_str(), "IRTop", iIRTop);
iniFile.Set(TmpSection.c_str(), "IRWidth", iIRWidth);
iniFile.Set(TmpSection.c_str(), "IRHeight", iIRHeight);
for (int i = 0; i < 1; i++)
{

View file

@ -62,6 +62,7 @@ struct Config
// Real Wiimote
bool bConnectRealWiimote, bUseRealWiimote, bUpdateRealWiimote;
int iIRLeft, iIRTop, iIRWidth, iIRHeight;
int iAccNeutralX, iAccNeutralY, iAccNeutralZ;
int iAccNunNeutralX, iAccNunNeutralY, iAccNunNeutralZ;

View file

@ -58,7 +58,6 @@ BEGIN_EVENT_TABLE(ConfigDialog,wxDialog)
EVT_BUTTON(ID_ABOUTOGL, ConfigDialog::AboutClick)
EVT_CHECKBOX(ID_SIDEWAYSDPAD, ConfigDialog::GeneralSettingsChanged)
EVT_CHECKBOX(ID_WIDESCREEN, ConfigDialog::GeneralSettingsChanged)
EVT_CHECKBOX(ID_NUNCHUCKCONNECTED, ConfigDialog::GeneralSettingsChanged)
EVT_CHECKBOX(ID_CLASSICCONTROLLERCONNECTED, ConfigDialog::GeneralSettingsChanged)
@ -122,6 +121,11 @@ BEGIN_EVENT_TABLE(ConfigDialog,wxDialog)
EVT_BUTTON(IDB_WM_U, ConfigDialog::OnButtonClick) EVT_BUTTON(IDB_WM_D, ConfigDialog::OnButtonClick)
EVT_BUTTON(IDB_WM_SHAKE, ConfigDialog::OnButtonClick)
EVT_BUTTON(IDB_WM_PITCH_L, ConfigDialog::OnButtonClick) EVT_BUTTON(IDB_WM_PITCH_R, ConfigDialog::OnButtonClick)
// IR cursor
EVT_COMMAND_SCROLL(IDS_WIDTH, ConfigDialog::GeneralSettingsChanged)
EVT_COMMAND_SCROLL(IDS_HEIGHT, ConfigDialog::GeneralSettingsChanged)
EVT_COMMAND_SCROLL(IDS_LEFT, ConfigDialog::GeneralSettingsChanged)
EVT_COMMAND_SCROLL(IDS_TOP, ConfigDialog::GeneralSettingsChanged)
// Nunchuck
EVT_BUTTON(IDB_NC_Z, ConfigDialog::OnButtonClick) EVT_BUTTON(IDB_NC_C, ConfigDialog::OnButtonClick)
@ -521,11 +525,29 @@ void ConfigDialog::CreateGUIControls()
wxFont m_SmallFont(7, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
///////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// This can take a few seconds so we show a progress bar for it
// ----------------
wxProgressDialog dialog(_T("Opening Wii Remote Configuration"),
wxT("Loading controls..."),
6, // range
this, // parent
wxPD_APP_MODAL |
// wxPD_AUTO_HIDE | -- try this as well
wxPD_ELAPSED_TIME |
wxPD_ESTIMATED_TIME |
wxPD_REMAINING_TIME |
wxPD_SMOOTH // - makes indeterminate mode bar on WinXP very small
);
// I'm not sure what parent this refers to
dialog.CenterOnParent();
///////////////////////////////////////
/* Populate all four pages. Page 2, 3 and 4 are currently disabled since we can't use more than one
Wiimote at the moment */
for (int i = 0; i < 4; i++)
{
////////////////////////////////////////////////////
// General and basic Settings
// ----------------
@ -537,7 +559,6 @@ void ConfigDialog::CreateGUIControls()
m_WiimoteOnline[i] = new wxCheckBox(m_Controller[i], IDC_WIMOTE_ON, wxT("Wiimote On"), wxDefaultPosition, wxSize(ChW, -1));
// Emulated Wiimote
m_SidewaysDPad[i] = new wxCheckBox(m_Controller[i], ID_SIDEWAYSDPAD, wxT("Sideways D-Pad"), wxDefaultPosition, wxSize(ChW, -1));
m_WideScreen[i] = new wxCheckBox(m_Controller[i], ID_WIDESCREEN, wxT("WideScreen Mode (for correct aiming)"));
// Extension
m_WiiMotionPlusConnected[i] = new wxCheckBox(m_Controller[i], wxID_ANY, wxT("Wii Motion Plus Connected"), wxDefaultPosition, wxSize(ChW, -1), 0, wxDefaultValidator);
m_NunchuckConnected[i] = new wxCheckBox(m_Controller[i], ID_NUNCHUCKCONNECTED, wxT("Nunchuck Connected"));
@ -554,7 +575,6 @@ void ConfigDialog::CreateGUIControls()
m_NunchuckConnected[0]->SetValue(g_Config.bNunchuckConnected);
m_ClassicControllerConnected[0]->SetValue(g_Config.bClassicControllerConnected);
m_SidewaysDPad[0]->SetValue(g_Config.bSidewaysDPad);
m_WideScreen[0]->SetValue(g_Config.bWideScreen);
m_ConnectRealWiimote[0]->SetValue(g_Config.bConnectRealWiimote);
m_UseRealWiimote[0]->SetValue(g_Config.bUseRealWiimote);
@ -564,7 +584,53 @@ void ConfigDialog::CreateGUIControls()
m_GuitarHeroGuitarConnected[0]->Enable(false);
m_GuitarHeroWorldTourDrumsConnected[0]->Enable(false);
// Tooltips
m_WiimoteOnline[i]->SetToolTip(wxString::Format(wxT("Decide if Wiimote %i shall be detected by the game"), i));
m_ConnectRealWiimote[i]->SetToolTip(wxT("Connected to the real wiimote. This can not be changed during gameplay."));
m_UseRealWiimote[i]->SetToolTip(wxT(
"Use the real Wiimote in the game. This can be changed during gameplay. This can not be selected"
" when a recording is to be done. No status in this window will be updated when this is checked."));
// -----------------------------------------------
// Screen size
// ---------------------
// Controls
m_TextScreenWidth[i] = new wxStaticText(m_Controller[i], wxID_ANY, wxT("Width: 000"));
m_TextScreenHeight[i] = new wxStaticText(m_Controller[i], wxID_ANY, wxT("Height: 000"));
m_TextScreenLeft[i] = new wxStaticText(m_Controller[i], wxID_ANY, wxT("Left: 000"));
m_TextScreenTop[i] = new wxStaticText(m_Controller[i], wxID_ANY, wxT("Top: 000"));
m_SliderWidth[i] = new wxSlider(m_Controller[i], IDS_WIDTH, 0, 100, 923, wxDefaultPosition, wxSize(75, -1));
m_SliderHeight[i] = new wxSlider(m_Controller[i], IDS_HEIGHT, 0, 0, 727, wxDefaultPosition, wxSize(75, -1));
m_SliderLeft[i] = new wxSlider(m_Controller[i], IDS_LEFT, 0, 100, 500, wxDefaultPosition, wxSize(75, -1));
m_SliderTop[i] = new wxSlider(m_Controller[i], IDS_TOP, 0, 0, 500, wxDefaultPosition, wxSize(75, -1));
//m_ScreenSize = new wxCheckBox(m_Controller[i], IDC_SCREEN_SIZE, wxT("Adjust screen size and position"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
// Sizers
m_SizerIRPointerWidth[i] = new wxBoxSizer(wxHORIZONTAL);
m_SizerIRPointerWidth[i]->Add(m_TextScreenLeft[i], 0, wxEXPAND | (wxTOP), 3);
m_SizerIRPointerWidth[i]->Add(m_SliderLeft[i], 0, wxEXPAND | (wxRIGHT), 0);
m_SizerIRPointerWidth[i]->Add(m_TextScreenWidth[i], 0, wxEXPAND | (wxTOP), 3);
m_SizerIRPointerWidth[i]->Add(m_SliderWidth[i], 0, wxEXPAND | (wxLEFT), 0);
m_SizerIRPointerHeight[i] = new wxBoxSizer(wxHORIZONTAL);
m_SizerIRPointerHeight[i]->Add(m_TextScreenTop[i], 0, wxEXPAND | (wxTOP), 3);
m_SizerIRPointerHeight[i]->Add(m_SliderTop[i], 0, wxEXPAND | (wxRIGHT), 0);
m_SizerIRPointerHeight[i]->Add(m_TextScreenHeight[i], 0, wxEXPAND | (wxTOP), 3);
m_SizerIRPointerHeight[i]->Add(m_SliderHeight[i], 0, wxEXPAND | (wxLEFT), 0);
m_SizerIRPointer[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("IR pointer"));
//m_SizerIRPointer[i]->Add(m_ScreenSize[i], 0, wxEXPAND | (wxALL), 5);
m_SizerIRPointer[i]->Add(m_SizerIRPointerWidth[i], 0, wxEXPAND | (wxLEFT | wxDOWN | wxRIGHT), 5);
m_SizerIRPointer[i]->Add(m_SizerIRPointerHeight[i], 0, wxEXPAND | (wxLEFT | wxDOWN | wxRIGHT), 5);
// Tool tips
//m_ScreenSize[i]->SetToolTip(wxT("Use the adjusted screen size."));
// -------------------------------
// --------------------------------------------------------------------
// Row 1 Sizers: General settings
// -----------------------------
m_SizeBasic[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("General Settings"));
m_SizeEmu[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("Emulated Wiimote"));
m_SizeExtensions[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("Emulated Extension"));
@ -575,7 +641,6 @@ void ConfigDialog::CreateGUIControls()
m_SizeEmuPadding[i] = new wxBoxSizer(wxVERTICAL); m_SizeEmu[i]->Add(m_SizeEmuPadding[i], 0, wxEXPAND | (wxALL), 5);
m_SizeEmuPadding[i]->Add(m_SidewaysDPad[i], 0, wxEXPAND | (wxUP), 0);
m_SizeEmuPadding[i]->Add(m_WideScreen[i], 0, wxEXPAND | (wxUP), 2);
m_SizeRealPadding[i] = new wxBoxSizer(wxVERTICAL); m_SizeReal[i]->Add(m_SizeRealPadding[i], 0, wxEXPAND | (wxALL), 5);
m_SizeRealPadding[i]->Add(m_ConnectRealWiimote[i], 0, wxEXPAND | (wxUP), 0);
@ -594,20 +659,16 @@ void ConfigDialog::CreateGUIControls()
m_SizeBasicGeneralRight[i] = new wxBoxSizer(wxVERTICAL);
m_SizeBasicGeneralLeft[i]->Add(m_SizeBasic[i], 0, wxEXPAND | (wxUP), 0);
m_SizeBasicGeneralLeft[i]->Add(m_SizeReal[i], 0, wxEXPAND | (wxUP), 5);
m_SizeBasicGeneralLeft[i]->Add(m_SizeEmu[i], 0, wxEXPAND | (wxUP), 5);
m_SizeBasicGeneralLeft[i]->Add(m_SizeExtensions[i], 0, wxEXPAND | (wxUP), 5);
m_SizeBasicGeneralRight[i]->Add(m_SizeExtensions[i], 0, wxEXPAND | (wxUP), 0);
m_SizeBasicGeneralRight[i]->Add(m_SizeReal[i], 0, wxEXPAND | (wxUP), 0);
m_SizeBasicGeneralRight[i]->Add(m_SizeEmu[i], 0, wxEXPAND | (wxUP), 5);
m_SizeBasicGeneralRight[i]->Add(m_SizerIRPointer[i], 0, wxEXPAND | (wxUP), 5);
m_SizeBasicGeneral[i]->Add(m_SizeBasicGeneralLeft[i], 0, wxEXPAND | (wxUP), 0);
m_SizeBasicGeneral[i]->Add(m_SizeBasicGeneralRight[i], 0, wxEXPAND | (wxLEFT), 10);
// ------------------------
// Tooltips
m_WiimoteOnline[i]->SetToolTip(wxString::Format(wxT("Decide if Wiimote %i shall be detected by the game"), i));
m_ConnectRealWiimote[i]->SetToolTip(wxT("Connected to the real wiimote. This can not be changed during gameplay."));
m_UseRealWiimote[i]->SetToolTip(wxT(
"Use the real Wiimote in the game. This can be changed during gameplay. This can not be selected"
" when a recording is to be done. No status in this window will be updated when this is checked."));
///////////////////////////
@ -1128,6 +1189,9 @@ void ConfigDialog::CreateGUIControls()
// Set the main sizer
m_Controller[i]->SetSizer(m_sMain[i]);
/////////////////////////////////
// Update with the progress (i) and the message (msg)
dialog.Update(i + 1, wxT("Loading notebook pages..."));
}
////////////////////////////////////////////
@ -1136,6 +1200,9 @@ void ConfigDialog::CreateGUIControls()
CreateGUIControlsRecording();
/////////////////////////////////
// Update with the progress (i) and the message (msg)
dialog.Update(5, wxT("Loading notebook pages..."));
//dialog.Close();
////////////////////////////////////////////////////////////////////////////////
// Buttons
@ -1285,10 +1352,6 @@ void ConfigDialog::GeneralSettingsChanged(wxCommandEvent& event)
case ID_SIDEWAYSDPAD:
g_Config.bSidewaysDPad = m_SidewaysDPad[Page]->IsChecked();
break;
case ID_WIDESCREEN:
g_Config.bWideScreen = m_WideScreen[Page]->IsChecked();
break;
//////////////////////////
// Extensions
@ -1418,6 +1481,49 @@ void ConfigDialog::GeneralSettingsChanged(wxCommandEvent& event)
UpdateGUI();
}
// =======================================================
// Apparently we need a scroll event version of this for the sliders
// -------------
void ConfigDialog::GeneralSettingsChanged(wxScrollEvent& event)
{
switch (event.GetId())
{
// IR cursor position
case IDS_WIDTH:
g_Config.iIRWidth = m_SliderWidth[Page]->GetValue();
break;
case IDS_HEIGHT:
g_Config.iIRHeight = m_SliderHeight[Page]->GetValue();
break;
case IDS_LEFT:
g_Config.iIRLeft = m_SliderLeft[Page]->GetValue();
break;
case IDS_TOP:
g_Config.iIRTop = m_SliderTop[Page]->GetValue();
break;
}
UpdateGUI();
}
// =======================================================
// Update the IR pointer calibration sliders
// -------------
void ConfigDialog::UpdateControls()
{
// Update the slider position if a configuration has been loaded
m_SliderWidth[Page]->SetValue(g_Config.iIRWidth);
m_SliderHeight[Page]->SetValue(g_Config.iIRHeight);
m_SliderLeft[Page]->SetValue(g_Config.iIRLeft);
m_SliderTop[Page]->SetValue(g_Config.iIRTop);
// Update the labels
m_TextScreenWidth[Page]->SetLabel(wxString::Format("Width: %i", g_Config.iIRWidth));
m_TextScreenHeight[Page]->SetLabel(wxString::Format("Height: %i", g_Config.iIRHeight));
m_TextScreenLeft[Page]->SetLabel(wxString::Format("Left: %i", g_Config.iIRLeft));
m_TextScreenTop[Page]->SetLabel(wxString::Format("Top: %i", g_Config.iIRTop));
}
// ==============================
// =======================================================
@ -1433,6 +1539,9 @@ void ConfigDialog::UpdateGUI(int Slot)
// Update dead zone
DoChangeDeadZone(true); DoChangeDeadZone(false);
// Update the Wiimote IR pointer calibration
UpdateControls();
/* We only allow a change of extension if we are not currently using the real Wiimote, if it's in use the status will be updated
from the data scanning functions in main.cpp */
bool AllowExtensionChange = !(g_RealWiiMotePresent && g_Config.bConnectRealWiimote && g_Config.bUseRealWiimote && g_EmulatorRunning);

View file

@ -32,6 +32,7 @@
#include <wx/panel.h>
#include <wx/filepicker.h>
#include <wx/gbsizer.h>
#include <wx/progdlg.h>
class ConfigDialog : public wxDialog
{
@ -44,7 +45,7 @@ class ConfigDialog : public wxDialog
// General open, close and event functions
void CloseClick(wxCommandEvent& event);
void UpdateGUI(int Slot = 0); void UpdateGUIButtonMapping(int controller);
void UpdateGUI(int Slot = 0); void UpdateGUIButtonMapping(int controller); void UpdateControls();
void OnKeyDown(wxKeyEvent& event);
void LoadFile(); void SaveFile();
@ -85,7 +86,8 @@ class ConfigDialog : public wxDialog
wxBoxSizer *m_MainSizer, *m_sMain[4], *m_SizeParent[4], *m_sRecordingMain;
// Emulated Wiimote key settings
wxBoxSizer *m_SizeBasicPadding[4], *m_SizeEmuPadding[4], *m_SizeRealPadding[4], *m_SizeExtensionsPadding[4],
wxBoxSizer *m_SizerIRPointerWidth[4], *m_SizerIRPointerHeight[4],
*m_SizeBasicPadding[4], *m_SizeEmuPadding[4], *m_SizeRealPadding[4], *m_SizeExtensionsPadding[4],
*m_SizeBasicGeneral[4], *m_SizeBasicGeneralLeft[4], *m_SizeBasicGeneralRight[4],
*m_HorizControllers[4], *m_gC2SDeadZone[4], *m_gCircle2Square[4], *m_gCircle2SquareVert[4], *m_gDeadZone[4], *m_gDeadZoneHoriz[4], *m_HorizControllerTiltParent[4], *m_HorizControllerTilt[4], *m_TiltHoriz[4],
*m_SizeAnalogLeft[4], *m_SizeAnalogLeftHorizX[4], *m_SizeAnalogLeftHorizY[4], *m_SizeAnalogRight[4], *m_SizeAnalogRightHorizX[4], *m_SizeAnalogRightHorizY[4],
@ -97,7 +99,7 @@ class ConfigDialog : public wxDialog
*m_HorizControllerMapping[4], *m_NunchuckStick[4];
wxGridBagSizer *m_SizeAnalogTriggerHorizConfig[4], *m_SizeAnalogTriggerStatusBox[4], *m_TiltGrid[4],
*m_GridLeftStick[4], *m_GridRightStick[4];
wxStaticBoxSizer *m_SizeBasic[4], *m_SizeEmu[4], *m_SizeReal[4], *m_SizeExtensions[4], *m_gTilt[4], *m_gJoyname[4];
wxStaticBoxSizer *m_SizeBasic[4], *m_SizeEmu[4], *m_SizeReal[4], *m_SizeExtensions[4], *m_SizerIRPointer[4], *m_gTilt[4], *m_gJoyname[4];
wxTextCtrl *m_AnalogLeftX[4], *m_AnalogLeftY[4], *m_AnalogRightX[4], *m_AnalogRightY[4],
*m_AnalogTriggerL[4], *m_AnalogTriggerR[4];
wxButton *m_bAnalogLeftX[4], *m_bAnalogLeftY[4], *m_bAnalogRightX[4], *m_bAnalogRightY[4],
@ -106,7 +108,8 @@ class ConfigDialog : public wxDialog
*m_bNcShake[4], *m_bNcZ[4], *m_bNcC[4], *m_bNcL[4], *m_bNcR[4], *m_bNcU[4], *m_bNcD[4],
// Wiimote
*m_bWmShake[4], *m_bWmPitchL[4], *m_bWmPitchR[4], *m_bWmA[4], *m_bWmB[4], *m_bWm1[4], *m_bWm2[4], *m_bWmP[4], *m_bWmM[4], *m_bWmH[4], *m_bWmD[4], *m_bWmU[4], *m_bWmR[4], *m_bWmL[4];
wxStaticText *m_tAnalogX[8], *m_tAnalogY[8], *m_TiltTextRoll[4], *m_TiltTextPitch[4],
wxStaticText *m_TextScreenWidth[4], *m_TextScreenHeight[4], *m_TextScreenLeft[4], *m_TextScreenTop[4],
*m_tAnalogX[8], *m_tAnalogY[8], *m_TiltTextRoll[4], *m_TiltTextPitch[4],
*m_CheckC2SLabel[4], *m_ComboDeadZoneLabel[4], *m_TStatusLeftIn[4], *m_TStatusLeftOut[4], *m_TStatusRightIn[4], *m_TStatusRightOut[4],
*m_TriggerStatusL[4], *m_TriggerStatusR[4], *m_TriggerStatusLx[4], *m_TriggerStatusRx[4],
*m_tAnalogTriggerInput[4], *m_tAnalogTriggerL[4], *m_tAnalogTriggerR[4],
@ -117,9 +120,10 @@ class ConfigDialog : public wxDialog
*m_NunchuckTextStick[5];
wxButton *ClickedButton;
wxString OldLabel;
wxSlider *m_SliderWidth[4], *m_SliderHeight[4], *m_SliderLeft[4], *m_SliderTop[4];
// Emulated Wiimote settings
wxCheckBox *m_SidewaysDPad[4], *m_WiimoteOnline[4], *m_WideScreen[4];
wxCheckBox *m_SidewaysDPad[4], *m_WiimoteOnline[4];
wxCheckBox *m_CheckC2S[4], *m_TiltInvertRoll[4], *m_TiltInvertPitch[4];
wxCheckBox *m_WiiMotionPlusConnected[4], *m_NunchuckConnected[4], *m_ClassicControllerConnected[4], *m_BalanceBoardConnected[4], *m_GuitarHeroGuitarConnected[4], *m_GuitarHeroWorldTourDrumsConnected[4];
wxComboBox *m_TiltComboInput[4], *m_TiltComboRangeRoll[4], *m_TiltComboRangePitch[4], *m_Joyname[4], *m_ComboDiagonal[4], *m_ComboDeadZoneLeft[4], *m_ComboDeadZoneRight[4], *m_TriggerType[4],
@ -168,8 +172,7 @@ class ConfigDialog : public wxDialog
ID_NOTEBOOK, ID_CONTROLLERPAGE1, ID_CONTROLLERPAGE2, ID_CONTROLLERPAGE3, ID_CONTROLLERPAGE4, ID_PAGE_RECORDING,
// Emulated Wiimote
ID_SIDEWAYSDPAD,
ID_WIDESCREEN,
ID_SIDEWAYSDPAD,
ID_NUNCHUCKCONNECTED, ID_CLASSICCONTROLLERCONNECTED,
IDC_WIMOTE_ON,
@ -183,6 +186,7 @@ class ConfigDialog : public wxDialog
ID_TRIGGER_L, ID_TRIGGER_R,
// Wiimote
IDS_WIDTH, IDS_HEIGHT, IDS_LEFT, IDS_TOP,
IDB_WM_A, IDB_WM_B,
IDB_WM_1, IDB_WM_2,
IDB_WM_P, IDB_WM_M, IDB_WM_H,
@ -213,7 +217,7 @@ class ConfigDialog : public wxDialog
void CreateGUIControls();
void CreateGUIControlsRecording();
void AboutClick(wxCommandEvent& event);
void GeneralSettingsChanged(wxCommandEvent& event);
void GeneralSettingsChanged(wxCommandEvent& event); void GeneralSettingsChanged(wxScrollEvent& event);
void DoConnectReal(); // Real
void DoUseReal();

View file

@ -42,20 +42,18 @@ namespace WiiMoteEmu
// Definitions and variable declarations
//******************************************************************************
/* Libogc bounding box, in smoothed IR coordinates: 232,284 792,704, however, it was
possible for me to get a better calibration with these values, if they are not
universal for all PCs we have to make a setting for it. */
/* The Libogc bounding box in smoothed IR coordinates is 232,284 792,704. However, there is no
universal standard that works with all games. They all use their own calibration. Also,
there is no widescreen mode for the calibration, at least not in the games I tried, the
game decides for example that a horizontal value of 500 is 50% from the left of the screen,
and then that's the same regardless if we use the widescreen mode or not.*/
#define LEFT 266
#define TOP 211
#define TOP 215
#define RIGHT 752
#define BOTTOM 728
#define SENSOR_BAR_RADIUS 200
#define wLEFT 332
#define wTOP 348
#define wRIGHT 693
#define wBOTTOM 625
#define wSENSOR_BAR_RADIUS 200
#define BOTTOM 705
/* Since the width of the entire screen is 1024 a reasonable sensor bar width is perhaps 200,
given how small most sensor bars are compared to the total TV width */
#define SENSOR_BAR_RADIUS 100
// Movement recording
extern int g_RecordingPlaying[3];
@ -176,6 +174,18 @@ extern std::vector<InputCommon::CONTROLLER_INFO> joyinfo;
extern InputCommon::CONTROLLER_STATE_NEW PadState[4];
extern InputCommon::CONTROLLER_MAPPING_NEW PadMapping[4];
// Wiimote status
struct SDot
{
int Rx, Ry, X, Y;
bool Visible;
u8 Size; /**< size of the IR dot (0-15) */
};
struct SIR
{
SDot Dot[4];
};
// Keyboard input
struct KeyboardWiimote
{
@ -190,6 +200,9 @@ struct KeyboardWiimote
SHAKE,
LAST_CONSTANT
};
// Raw X and Y coordinate and processed X and Y coordinates
SIR IR;
};
extern KeyboardWiimote g_Wm;
struct KeyboardNunchuck

View file

@ -202,4 +202,39 @@ void PitchAccelerometerToDegree(u8 _x, u8 _y, u8 _z, int &_Roll, int &_Pitch, in
_PitchAdj = (int)Pitch;
}
//////////////////////////////////////////////////////////////////////////////////////////
// Calculate dot positions from the extented 12 byte IR data
// ¯¯¯¯¯¯¯¯¯¯¯¯¯
void IRData2Dots(u8 *Data)
{
struct SDot* Dot = g_Wm.IR.Dot;
//SDot Dot[4];
for (int i = 0; i < 4; ++i)
{
//Console::Print("Rx: %i\n", Dot[i].Rx);
Dot[i].Rx = 1023 - (Data[3*i] | ((Data[(3*i)+2] & 0x30) << 4));
Dot[i].Ry = Data[(3*i)+1] | ((Data[(3*i)+2] & 0xc0) << 2);
Dot[i].Size = Data[(3*i)+2] & 0x0f;
/* if in range set to visible */
if (Dot[i].Ry == 1023)
Dot[i].Visible = false;
else
Dot[i].Visible = true;
// Write to the global IR variable
//g_Wm.IR.Dot[i] = Dot[i];
//Console::Print("Rx: %i\n", Dot[i].Rx);
}
}
////////////////////////////////
} // WiiMoteEmu

View file

@ -53,6 +53,8 @@ void SetDefaultExtensionRegistry();
bool Search_Devices(std::vector<InputCommon::CONTROLLER_INFO> &_joyinfo, int &_NumPads, int &_NumGoodPads);
void GetJoyState(InputCommon::CONTROLLER_STATE_NEW &_PadState, InputCommon::CONTROLLER_MAPPING_NEW _PadMapping, int controller, int NumButtons);
void PadStateAdjustments(int &Lx, int &Ly, int &Rx, int &Ry, int &Tl, int &Tr);
// Accelerometer
void PitchDegreeToAccelerometer(float _Roll, float _Pitch, u8 &_x, u8 &_y, u8 &_z);
void PitchAccelerometerToDegree(u8 _x, u8 _y, u8 _z, int &_Roll, int &_Pitch, int&, int&);
float AccelerometerToG(float Current, float Neutral, float G);
@ -60,6 +62,9 @@ void TiltTest(u8 x, u8 y, u8 z);
void Tilt(u8 &_x, u8 &_y, u8 &_z);
void AdjustAngles(float &Roll, float &Pitch);
// IR data
void IRData2Dots(u8 *Data);
}; // WiiMoteEmu

View file

@ -719,6 +719,13 @@ void FillReportAcc(wm_accel& _acc)
/////////////////////////
/*
int Top = TOP, Left = LEFT, Right = RIGHT,
Bottom = BOTTOM, SensorBarRadius = SENSOR_BAR_RADIUS;
*/
///////////////////////////////////////////////////////////////////
// The extended 12 byte (3 byte per object) reporting
// ---------------
@ -739,25 +746,6 @@ void FillReportIR(wm_ir_extended& _ir0, wm_ir_extended& _ir1)
}
// ---------------------
// --------------------------------------
/* The calibration is controlled by these values, their absolute value and
the relative distance between between them control the calibration. WideScreen mode
has its own settings. */
// ----------
int Top, Left, Right, Bottom, SensorBarRadius;
if(g_Config.bWideScreen)
{
Top = wTOP; Left = wLEFT; Right = wRIGHT;
Bottom = wBOTTOM; SensorBarRadius = wSENSOR_BAR_RADIUS;
}
else
{
Top = TOP; Left = LEFT; Right = RIGHT;
Bottom = BOTTOM; SensorBarRadius = SENSOR_BAR_RADIUS;
}
// ------------------
/* Fill with 0xff if empty. The real Wiimote seems to use 0xff when it doesn't see a certain point,
at least from how WiiMoteReal::SendEvent() works. */
memset(&_ir0, 0xff, sizeof(wm_ir_extended));
@ -770,66 +758,64 @@ void FillReportIR(wm_ir_extended& _ir0, wm_ir_extended& _ir1)
if(MouseX > 1 || MouseX < 0 || MouseY > 1 || MouseY < 0) return;
// --------------------------------------
// Actual position calculation
// Position calculation
// ----------
int y0 = Top + (MouseY * (Bottom - Top));
int y1 = Top + (MouseY * (Bottom - Top));
int x0 = Left + (MouseX * (Right - Left)) - SensorBarRadius;
int x1 = Left + (MouseX * (Right - Left)) + SensorBarRadius;
x0 = 1023 - x0;
_ir0.x = x0 & 0xFF;
_ir0.y = y0 & 0xFF;
_ir0.size = 10;
_ir0.xHi = x0 >> 8;
_ir0.yHi = y0 >> 8;
x1 = 1023 - x1;
_ir1.x = x1 & 0xFF;
_ir1.y = y1 & 0xFF;
_ir1.size = 10;
_ir1.xHi = x1 >> 8;
_ir1.yHi = y1 >> 8;
int y0 = g_Config.iIRTop + (MouseY * g_Config.iIRHeight);
int y1 = y0;
// The distance between the x positions are two sensor bar radii
int x0 = g_Config.iIRLeft + (MouseX * g_Config.iIRWidth) - SENSOR_BAR_RADIUS;
int x1 = g_Config.iIRLeft + (MouseX * g_Config.iIRWidth) + SENSOR_BAR_RADIUS;
// ------------------
// ----------------------------
// Debugging for calibration
// ----------
/*
if(GetAsyncKeyState(VK_NUMPAD1))
if(!GetAsyncKeyState(VK_CONTROL) && GetAsyncKeyState(VK_RIGHT))
Right +=1;
else if(GetAsyncKeyState(VK_NUMPAD2))
else if(GetAsyncKeyState(VK_CONTROL) && GetAsyncKeyState(VK_RIGHT))
Right -=1;
if(GetAsyncKeyState(VK_NUMPAD4))
if(!GetAsyncKeyState(VK_CONTROL) && GetAsyncKeyState(VK_LEFT))
Left +=1;
else if(GetAsyncKeyState(VK_NUMPAD5))
else if(GetAsyncKeyState(VK_CONTROL) && GetAsyncKeyState(VK_LEFT))
Left -=1;
if(GetAsyncKeyState(VK_NUMPAD7))
if(!GetAsyncKeyState(VK_CONTROL) && GetAsyncKeyState(VK_UP))
Top += 1;
else if(GetAsyncKeyState(VK_NUMPAD8))
else if(GetAsyncKeyState(VK_CONTROL) && GetAsyncKeyState(VK_UP))
Top -= 1;
if(GetAsyncKeyState(VK_NUMPAD6))
if(!GetAsyncKeyState(VK_CONTROL) && GetAsyncKeyState(VK_DOWN))
Bottom += 1;
else if(GetAsyncKeyState(VK_NUMPAD3))
else if(GetAsyncKeyState(VK_CONTROL) && GetAsyncKeyState(VK_DOWN))
Bottom -= 1;
if(GetAsyncKeyState(VK_INSERT))
if(!GetAsyncKeyState(VK_CONTROL) && GetAsyncKeyState(VK_NUMPAD0))
SensorBarRadius += 1;
else if(GetAsyncKeyState(VK_DELETE))
else if(GetAsyncKeyState(VK_CONTROL) && GetAsyncKeyState(VK_NUMPAD0))
SensorBarRadius -= 1;
//ClearScreen();
//Console::ClearScreen();
//if(consoleDisplay == 1)
Console::Print("x0:%03i x1:%03i y0:%03i y1:%03i irx0:%03i y0:%03i x1:%03i y1:%03i | T:%i L:%i R:%i B:%i S:%i\n",
x0, x1, y0, y1, _ir0.x, _ir0.y, _ir1.x, _ir1.y, Top, Left, Right, Bottom, SensorBarRadius
);
Console::Print("\n");
Console::Print("ir0.x:%02x xHi:%02x ir1.x:%02x xHi:%02x | ir0.y:%02x yHi:%02x ir1.y:%02x yHi:%02x | 1.s:%02x 2:%02x\n",
_ir0.x, _ir0.xHi, _ir1.x, _ir1.xHi,
_ir0.y, _ir0.yHi, _ir1.y, _ir1.yHi,
_ir0.size, _ir1.size
Console::Print("x0:%03i x1:%03i y0:%03i y1:%03i | T:%i L:%i R:%i B:%i S:%i\n",
x0, x1, y0, y1, Top, Left, Right, Bottom, SensorBarRadius
);*/
// ------------------
// --------------------------------------
// Converted to IR data
// ----------
// The width is 0 to 1023
// The height is 0 to 767
x0 = 1023 - x0;
_ir0.x = x0 & 0xff; _ir0.xHi = x0 >> 8;
_ir0.y = y0 & 0xff; _ir0.yHi = y0 >> 8;
// The size can be between 0 and 15 and is probably not important
_ir0.size = 10;
x1 = 1023 - x1;
_ir1.x = x1 & 0xff; _ir1.xHi = x1 >> 8;
_ir1.y = y1 & 0xff; _ir1.yHi = y1 >> 8;
_ir1.size = 10;
// ------------------
}
///////////////////////////////////////////////////////////////////
@ -837,6 +823,7 @@ void FillReportIR(wm_ir_extended& _ir0, wm_ir_extended& _ir1)
// ---------------
void FillReportIRBasic(wm_ir_basic& _ir0, wm_ir_basic& _ir1)
{
// ------------------------------------
// Recorded movements
// --------------
@ -853,23 +840,6 @@ void FillReportIRBasic(wm_ir_basic& _ir0, wm_ir_basic& _ir1)
}
// ---------------------
// --------------------------------------
/* See calibration description above */
// ----------
int Top, Left, Right, Bottom, SensorBarRadius;
if(g_Config.bWideScreen)
{
Top = wTOP; Left = wLEFT; Right = wRIGHT;
Bottom = wBOTTOM; SensorBarRadius = wSENSOR_BAR_RADIUS;
}
else
{
Top = TOP; Left = LEFT; Right = RIGHT;
Bottom = BOTTOM; SensorBarRadius = SENSOR_BAR_RADIUS;
}
// ------------------
// Fill with 0xff if empty
memset(&_ir0, 0xff, sizeof(wm_ir_basic));
memset(&_ir1, 0xff, sizeof(wm_ir_basic));
@ -880,24 +850,21 @@ void FillReportIRBasic(wm_ir_basic& _ir0, wm_ir_basic& _ir1)
// If we are outside the screen leave the values at 0xff
if(MouseX > 1 || MouseX < 0 || MouseY > 1 || MouseY < 0) return;
int y1 = Top + (MouseY * (Bottom - Top));
int y2 = Top + (MouseY * (Bottom - Top));
int y1 = g_Config.iIRTop + (MouseY * g_Config.iIRHeight);
int y2 = g_Config.iIRTop + (MouseY * g_Config.iIRHeight);
int x1 = Left + (MouseX * (Right - Left)) - SensorBarRadius;
int x2 = Left + (MouseX * (Right - Left)) + SensorBarRadius;
int x1 = g_Config.iIRLeft + (MouseX * g_Config.iIRWidth) - SENSOR_BAR_RADIUS;
int x2 = g_Config.iIRLeft + (MouseX * g_Config.iIRWidth) + SENSOR_BAR_RADIUS;
/* As with the extented report we settle with emulating two out of four possible objects */
/* As with the extented report we settle with emulating two out of four possible objects
the only difference is that we don't report any size of the tracked object here */
x1 = 1023 - x1;
_ir0.x1 = x1 & 0xff;
_ir0.y1 = y1 & 0xff;
_ir0.x1Hi = (x1 >> 8); // we are dealing with 2 bit values here
_ir0.y1Hi = (y1 >> 8);
_ir0.x1 = x1 & 0xff; _ir0.x1Hi = (x1 >> 8); // we are dealing with 2 bit values here
_ir0.y1 = y1 & 0xff; _ir0.y1Hi = (y1 >> 8);
x2 = 1023 - x2;
_ir0.x2 = x2 & 0xff;
_ir0.y2 = y2 & 0xff;
_ir0.x2Hi = (x2 >> 8);
_ir0.y2Hi = (y2 >> 8);
_ir0.x2 = x2 & 0xff; _ir0.x2Hi = (x2 >> 8);
_ir0.y2 = y2 & 0xff; _ir0.y2Hi = (y2 >> 8);
// I don't understand't the & 0x03, should we do that?
//_ir1.x1Hi = (x1 >> 8) & 0x3;

View file

@ -16,7 +16,9 @@
// http://code.google.com/p/dolphin-emu/
//////////////////////////////////////////////////////////////////////////////////////////
// Includes
// ッッッッッッッッッッッッッ
#include <iostream> // System
#include "wiiuse.h" // Externals

View file

@ -64,6 +64,7 @@ SWiimoteInitialize g_WiimoteInitialize;
// General
bool g_EmulatorRunning = false;
u32 g_ISOId = 0;
bool g_FrameOpen = false;
bool g_RealWiiMotePresent = false;
bool g_RealWiiMoteInitialized = false;
@ -208,11 +209,26 @@ extern "C" void Initialize(void *init)
g_EmulatorRunning = true;
// Update the GUI if the configuration window is already open
#if defined(HAVE_WX) && HAVE_WX
if(g_FrameOpen) if(frame) frame->UpdateGUI();
if(g_FrameOpen)
{
// Save the settings
g_Config.Save();
// Save the ISO Id
g_ISOId = g_WiimoteInitialize.ISOId;
// Load the settings
g_Config.Load();
if(frame) frame->UpdateGUI();
}
#endif
// Save the ISO Id, again if we had a window open
g_ISOId = g_WiimoteInitialize.ISOId;
DoInitialize();
Console::Print("ISOId: %08x %s\n", g_WiimoteInitialize.ISOId, Hex2Ascii(g_WiimoteInitialize.ISOId).c_str());
}
// If a game is not running this is called by the Configuration window when it's closed
@ -221,6 +237,9 @@ extern "C" void Shutdown(void)
// Not running
g_EmulatorRunning = false;
// Reset the game ID in all cases
g_ISOId = 0;
// We will only shutdown when both a game and the frame is closed
if (g_FrameOpen)
{
@ -415,14 +434,14 @@ void OpenConsole(bool Open)
}
// Open the console window
Console::Open(130, 1000, "Wiimote"); // give room for 20 rows
Console::Open(140, 1000, "Wiimote"); // give room for 20 rows
Console::Print("\n\nWiimote console opened\n");
// Move window
#ifdef _WIN32
//MoveWindow(Console::GetHwnd(), 0,400, 100*8,10*14, true); // small window
//MoveWindow(Console::GetHwnd(), 400,0, 100*8,70*14, true); // big window
MoveWindow(Console::GetHwnd(), 200,0, 130*8,70*14, true); // big wide window
MoveWindow(Console::GetHwnd(), 200,0, 140*8,70*14, true); // big wide window
#endif
}
// ---------------
@ -678,7 +697,7 @@ void ReadDebugging(bool Emu, const void* _pData, int Size)
"%02x %02x %02x %02x %02x %02x %02x %02x %02x %02x "
"%03i %03i "
"%03i %03i %03i "
"%02x ",
"%02x",
data[0], data[1], data[2], data[3], // Header and core buttons
data[4], data[5], data[6], // Wiimote accelerometer
data[7], data[8], data[9], data[10], data[11], data[12], data[13], data[14], data[15], data[16],
@ -716,7 +735,19 @@ void ReadDebugging(bool Emu, const void* _pData, int Size)
(Gy >= 0) ? StringFromFormat(" %i", (int)Gy).c_str() : StringFromFormat("%i", (int)Gy).c_str(),
(Gz >= 0) ? StringFromFormat(" %i", (int)Gz).c_str() : StringFromFormat("%i", (int)Gz).c_str());
Console::Print("Read[%s]: %s| %s | %s\n", (Emu ? "Emu" : "Real"), TmpData.c_str(), RollPitch.c_str(), GForce.c_str()); // No timestamp
// Show the IR data
WiiMoteEmu::IRData2Dots(&data[7]);
std::string IRData;
for (int i = 0; i < 4; ++i)
{
if(WiiMoteEmu::g_Wm.IR.Dot[i].Visible)
IRData += StringFromFormat("[%i] X:%04i Y:%04i ", i, WiiMoteEmu::g_Wm.IR.Dot[i].Rx, WiiMoteEmu::g_Wm.IR.Dot[i].Ry);
else
IRData += StringFromFormat("[%i]", i);
}
//Console::Print("Read[%s]: %s | %s\n", (Emu ? "Emu" : "Real"), TmpData.c_str(), IRData.c_str()); // IR data
Console::Print("Read[%s]: %s| %s | %s\n", (Emu ? "Emu" : "Real"), TmpData.c_str(), RollPitch.c_str(), GForce.c_str()); // Accelerometer
//Console::Print(" (%s): %s\n", Tm(true).c_str(), Temp.c_str()); // Timestamp
}

View file

@ -68,6 +68,7 @@ struct SRecordingAll
#ifndef EXCLUDEMAIN_H
// General
extern bool g_EmulatorRunning;
extern u32 g_ISOId;
extern bool g_FrameOpen;
extern bool g_RealWiiMotePresent;
extern bool g_RealWiiMoteInitialized;

View file

@ -154,7 +154,7 @@ struct wm_accel {
u8 x, y, z;
};
// Filled with 0xFF if empty
// Four bytes for two objects. Filled with 0xFF if empty
struct wm_ir_basic
{
u8 x1;
@ -167,6 +167,7 @@ struct wm_ir_basic
u8 y2;
};
// Three bytes for one object
struct wm_ir_extended
{
u8 x;