mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-22 05:40:01 -06:00
Calibrated emulated Wiimote aiming in widescreen mode. Added config menu to Wiimote. Added hide cursor option to OpenGL plugin. Added custom Wii settings and moved SYSCONF to User/Config (it will be copied by the game to Wii/shared2/sys when a game is run). Made the DSP and Video debugging windowses run on the same dll instance as the main instance.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1188 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -577,6 +577,26 @@
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Config"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\Src\Config.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\Config.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\ConfigDlg.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\ConfigDlg.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<File
|
||||
RelativePath=".\Src\main.cpp"
|
||||
>
|
||||
|
50
Source/Plugins/Plugin_Wiimote_Test/Src/Config.cpp
Normal file
50
Source/Plugins/Plugin_Wiimote_Test/Src/Config.cpp
Normal file
@ -0,0 +1,50 @@
|
||||
// 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 "Common.h"
|
||||
#include "IniFile.h"
|
||||
#include "Config.h"
|
||||
|
||||
Config g_Config;
|
||||
|
||||
Config::Config()
|
||||
{
|
||||
memset(this, 0, sizeof(Config));
|
||||
}
|
||||
|
||||
void Config::Load()
|
||||
{
|
||||
std::string temp;
|
||||
IniFile iniFile;
|
||||
iniFile.Load(FULL_CONFIG_DIR "Wiimote.ini");
|
||||
|
||||
// get resolution
|
||||
|
||||
iniFile.Get("Settings", "SidewaysDPad", &bSidewaysDPad, 0); // Hardware
|
||||
iniFile.Get("Settings", "WideScreen", &bWideScreen, 0);
|
||||
}
|
||||
|
||||
void Config::Save()
|
||||
{
|
||||
IniFile iniFile;
|
||||
iniFile.Load(FULL_CONFIG_DIR "Wiimote.ini");
|
||||
iniFile.Set("Settings", "SidewaysDPad", bSidewaysDPad);
|
||||
iniFile.Set("Settings", "WideScreen", bWideScreen);
|
||||
|
||||
iniFile.Save(FULL_CONFIG_DIR "Wiimote.ini");
|
||||
}
|
40
Source/Plugins/Plugin_Wiimote_Test/Src/Config.h
Normal file
40
Source/Plugins/Plugin_Wiimote_Test/Src/Config.h
Normal file
@ -0,0 +1,40 @@
|
||||
// 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/
|
||||
|
||||
#ifndef _CONFIG_H
|
||||
#define _CONFIG_H
|
||||
|
||||
#define CONF_LOG 1
|
||||
#define CONF_PRIMLOG 2
|
||||
#define CONF_SAVETEXTURES 4
|
||||
#define CONF_SAVETARGETS 8
|
||||
#define CONF_SAVESHADERS 16
|
||||
|
||||
struct Config
|
||||
{
|
||||
Config();
|
||||
void Load();
|
||||
void Save();
|
||||
|
||||
// General
|
||||
bool bSidewaysDPad;
|
||||
bool bWideScreen;
|
||||
};
|
||||
|
||||
extern Config g_Config;
|
||||
|
||||
#endif // _CONFIG_H
|
124
Source/Plugins/Plugin_Wiimote_Test/Src/ConfigDlg.cpp
Normal file
124
Source/Plugins/Plugin_Wiimote_Test/Src/ConfigDlg.cpp
Normal file
@ -0,0 +1,124 @@
|
||||
// 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 "ConfigDlg.h"
|
||||
#include "Config.h"
|
||||
|
||||
|
||||
BEGIN_EVENT_TABLE(ConfigDialog,wxDialog)
|
||||
EVT_CLOSE(ConfigDialog::OnClose)
|
||||
EVT_BUTTON(ID_CLOSE, ConfigDialog::CloseClick)
|
||||
EVT_BUTTON(ID_ABOUTOGL, ConfigDialog::AboutClick)
|
||||
EVT_CHECKBOX(ID_SIDEWAYSDPAD, ConfigDialog::GeneralSettingsChanged)
|
||||
EVT_CHECKBOX(ID_WIDESCREEN, ConfigDialog::GeneralSettingsChanged)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
ConfigDialog::ConfigDialog(wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &position, const wxSize& size, long style)
|
||||
: wxDialog(parent, id, title, position, size, style)
|
||||
{
|
||||
g_Config.Load();
|
||||
CreateGUIControls();
|
||||
}
|
||||
|
||||
ConfigDialog::~ConfigDialog()
|
||||
{
|
||||
}
|
||||
|
||||
void ConfigDialog::CreateGUIControls()
|
||||
{
|
||||
// Notebook
|
||||
m_Notebook = new wxNotebook(this, ID_NOTEBOOK, wxDefaultPosition, wxDefaultSize);
|
||||
m_PageGeneral = new wxPanel(m_Notebook, ID_PAGEGENERAL, wxDefaultPosition, wxDefaultSize);
|
||||
m_Notebook->AddPage(m_PageGeneral, wxT("General"));
|
||||
|
||||
// Buttons
|
||||
//m_About = new wxButton(this, ID_ABOUTOGL, wxT("About"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||
m_Close = new wxButton(this, ID_CLOSE, wxT("Close"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||
|
||||
// Put notebook and buttons in sizers
|
||||
wxBoxSizer* sButtons;
|
||||
sButtons = new wxBoxSizer(wxHORIZONTAL);
|
||||
//sButtons->Add(m_About, 0, wxALL, 5); // there is no about
|
||||
sButtons->AddStretchSpacer();
|
||||
sButtons->Add(m_Close, 0, wxALL, 5);
|
||||
|
||||
wxBoxSizer* sMain;
|
||||
sMain = new wxBoxSizer(wxVERTICAL);
|
||||
sMain->Add(m_Notebook, 1, wxEXPAND|wxALL, 5);
|
||||
sMain->Add(sButtons, 0, wxEXPAND, 5);
|
||||
|
||||
|
||||
// General
|
||||
sbBasic = new wxStaticBoxSizer(wxVERTICAL, m_PageGeneral, wxT("Basic Settings"));
|
||||
m_SidewaysDPad = new wxCheckBox(m_PageGeneral, ID_SIDEWAYSDPAD, wxT("Enable Sideways D-Pad"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||
m_SidewaysDPad->SetValue(g_Config.bSidewaysDPad);
|
||||
m_WideScreen = new wxCheckBox(m_PageGeneral, ID_WIDESCREEN, wxT("WideScreen Mode (for correct aiming)"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||
m_WideScreen->SetValue(g_Config.bWideScreen);
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Set up sGeneral and sBasic
|
||||
// Usage: The wxGBPosition() must have a column and row
|
||||
// ----------------
|
||||
sGeneral = new wxBoxSizer(wxVERTICAL);
|
||||
sBasic = new wxGridBagSizer(0, 0);
|
||||
sBasic->Add(m_SidewaysDPad, wxGBPosition(0, 0), wxGBSpan(1, 2), wxALL, 5);
|
||||
sBasic->Add(m_WideScreen, wxGBPosition(1, 0), wxGBSpan(1, 2), wxALL, 5);
|
||||
sbBasic->Add(sBasic);
|
||||
sGeneral->Add(sbBasic, 0, wxEXPAND|wxALL, 5);
|
||||
|
||||
m_PageGeneral->SetSizer(sGeneral);
|
||||
sGeneral->Layout();
|
||||
|
||||
this->SetSizer(sMain);
|
||||
this->Layout();
|
||||
// ----------------
|
||||
|
||||
|
||||
Fit();
|
||||
Center();
|
||||
}
|
||||
|
||||
void ConfigDialog::OnClose(wxCloseEvent& WXUNUSED (event))
|
||||
{
|
||||
g_Config.Save();
|
||||
EndModal(0);
|
||||
}
|
||||
|
||||
void ConfigDialog::CloseClick(wxCommandEvent& WXUNUSED (event))
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
void ConfigDialog::AboutClick(wxCommandEvent& WXUNUSED (event))
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void ConfigDialog::GeneralSettingsChanged(wxCommandEvent& event)
|
||||
{
|
||||
switch (event.GetId())
|
||||
{
|
||||
case ID_SIDEWAYSDPAD:
|
||||
g_Config.bSidewaysDPad = m_SidewaysDPad->IsChecked();
|
||||
break;
|
||||
case ID_WIDESCREEN:
|
||||
g_Config.bWideScreen = m_WideScreen->IsChecked();
|
||||
break;
|
||||
}
|
||||
}
|
84
Source/Plugins/Plugin_Wiimote_Test/Src/ConfigDlg.h
Normal file
84
Source/Plugins/Plugin_Wiimote_Test/Src/ConfigDlg.h
Normal file
@ -0,0 +1,84 @@
|
||||
// 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/
|
||||
|
||||
#ifndef __CONFIGDIALOG_h__
|
||||
#define __CONFIGDIALOG_h__
|
||||
|
||||
#include <wx/wx.h>
|
||||
#include <wx/dialog.h>
|
||||
#include <wx/textctrl.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/stattext.h>
|
||||
#include <wx/combobox.h>
|
||||
#include <wx/checkbox.h>
|
||||
#include <wx/notebook.h>
|
||||
#include <wx/panel.h>
|
||||
#include <wx/filepicker.h>
|
||||
#include <wx/gbsizer.h>
|
||||
|
||||
|
||||
#undef ConfigDialog_STYLE
|
||||
#define ConfigDialog_STYLE wxCAPTION | wxSYSTEM_MENU | wxDIALOG_NO_PARENT | wxCLOSE_BOX
|
||||
|
||||
|
||||
class ConfigDialog : public wxDialog
|
||||
{
|
||||
public:
|
||||
ConfigDialog(wxWindow *parent, wxWindowID id = 1,
|
||||
const wxString &title = wxT("Wii Remote Plugin Configuration"),
|
||||
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
||||
long style = ConfigDialog_STYLE);
|
||||
virtual ~ConfigDialog();
|
||||
void CloseClick(wxCommandEvent& event);
|
||||
|
||||
private:
|
||||
DECLARE_EVENT_TABLE();
|
||||
|
||||
wxBoxSizer* sGeneral;
|
||||
wxStaticBoxSizer* sbBasic;
|
||||
wxGridBagSizer* sBasic;
|
||||
|
||||
wxButton *m_About;
|
||||
wxButton *m_Close;
|
||||
wxNotebook *m_Notebook;
|
||||
wxPanel *m_PageGeneral;
|
||||
wxPanel *m_PageAdvanced;
|
||||
|
||||
wxCheckBox *m_SidewaysDPad; // general settings
|
||||
wxCheckBox *m_WideScreen;
|
||||
|
||||
enum
|
||||
{
|
||||
ID_CLOSE = 1000,
|
||||
ID_ABOUTOGL,
|
||||
|
||||
ID_NOTEBOOK,
|
||||
ID_PAGEGENERAL,
|
||||
ID_PAGEADVANCED,
|
||||
|
||||
ID_SIDEWAYSDPAD,
|
||||
ID_WIDESCREEN
|
||||
};
|
||||
|
||||
void OnClose(wxCloseEvent& event);
|
||||
void CreateGUIControls();
|
||||
|
||||
void AboutClick(wxCommandEvent& event);
|
||||
void GeneralSettingsChanged(wxCommandEvent& event);
|
||||
};
|
||||
|
||||
#endif
|
@ -46,6 +46,12 @@ namespace WiiMoteEmu
|
||||
#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
|
||||
|
||||
// vars
|
||||
#define WIIMOTE_EEPROM_SIZE (16*1024)
|
||||
#define WIIMOTE_REG_SPEAKER_SIZE 10
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "EmuDeclarations.h"
|
||||
#include "EmuDefinitions.h"
|
||||
#include "Console.h" // for startConsoleWin, wprintf, GetConsoleHwnd
|
||||
#include "Config.h" // for g_Config
|
||||
|
||||
extern SWiimoteInitialize g_WiimoteInitialize;
|
||||
//extern void __Log(int log, const char *format, ...);
|
||||
@ -60,17 +61,11 @@ void FillReportInfo(wm_core& _core)
|
||||
_core.minus = GetAsyncKeyState('M') ? 1 : 0;
|
||||
_core.home = GetAsyncKeyState('H') ? 1 : 0;
|
||||
|
||||
if(GetAsyncKeyState('T'))
|
||||
{
|
||||
wxMessageBox(wxString::Format("You turned %s sideways controls",
|
||||
toggleSideWays ? "off" : "on"));
|
||||
toggleSideWays = !toggleSideWays;
|
||||
}
|
||||
|
||||
/* Sideways controls (for example for Wario Land) was not enabled automatically
|
||||
so I have to use this function. I'm not sure how it works on the actual Wii.
|
||||
*/
|
||||
if(toggleSideWays)
|
||||
if(g_Config.bSidewaysDPad)
|
||||
{
|
||||
_core.left = GetAsyncKeyState(VK_DOWN) ? 1 : 0;
|
||||
_core.up = GetAsyncKeyState(VK_LEFT) ? 1 : 0;
|
||||
@ -302,14 +297,29 @@ void FillReportAcc(wm_accel& _acc)
|
||||
*/
|
||||
}
|
||||
|
||||
/* DESCRIPTION: The calibration is controlled by these values, their absolute value and
|
||||
the relative distance between between them control the calibration. These integers is
|
||||
for the debugger so that we can calibrate the best values */
|
||||
int Top = TOP, Left = LEFT, Right = RIGHT,
|
||||
Bottom = BOTTOM, SensorBarRadius = SENSOR_BAR_RADIUS;
|
||||
bool toggleWideScreen = false, toggleCursor = true;
|
||||
|
||||
|
||||
void FillReportIR(wm_ir_extended& _ir0, wm_ir_extended& _ir1)
|
||||
{
|
||||
|
||||
/* DESCRIPTION: 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;
|
||||
}
|
||||
|
||||
|
||||
memset(&_ir0, 0xFF, sizeof(wm_ir_extended));
|
||||
memset(&_ir1, 0xFF, sizeof(wm_ir_extended));
|
||||
|
||||
@ -340,7 +350,7 @@ void FillReportIR(wm_ir_extended& _ir0, wm_ir_extended& _ir1)
|
||||
// ----------------------------
|
||||
// Debugging for calibration
|
||||
// ----------
|
||||
/*
|
||||
/**/
|
||||
if(GetAsyncKeyState(VK_NUMPAD1))
|
||||
Right +=1;
|
||||
else if(GetAsyncKeyState(VK_NUMPAD2))
|
||||
@ -363,11 +373,11 @@ void FillReportIR(wm_ir_extended& _ir0, wm_ir_extended& _ir1)
|
||||
SensorBarRadius -= 1;
|
||||
|
||||
//ClearScreen();
|
||||
if(consoleDisplay == 1)
|
||||
//if(consoleDisplay == 1)
|
||||
wprintf("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
|
||||
);
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -18,9 +18,11 @@
|
||||
|
||||
#if !defined(OSX64)
|
||||
#include <wx/aboutdlg.h>
|
||||
#include "ConfigDlg.h"
|
||||
#endif
|
||||
|
||||
#include "Common.h"
|
||||
#include "Config.h"
|
||||
#include "StringUtil.h"
|
||||
|
||||
#include "pluginspecs_wiimote.h"
|
||||
@ -109,6 +111,17 @@ extern "C" void DllAbout(HWND _hParent)
|
||||
|
||||
extern "C" void DllConfig(HWND _hParent)
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
wxWindow win;
|
||||
win.SetHWND(_hParent);
|
||||
ConfigDialog frame(&win);
|
||||
frame.ShowModal();
|
||||
win.SetHWND(0);
|
||||
#elif defined(__linux__)
|
||||
//TODO
|
||||
#else
|
||||
//TODO
|
||||
#endif
|
||||
}
|
||||
|
||||
extern "C" void Wiimote_Initialize(SWiimoteInitialize _WiimoteInitialize)
|
||||
@ -117,9 +130,10 @@ extern "C" void Wiimote_Initialize(SWiimoteInitialize _WiimoteInitialize)
|
||||
|
||||
g_UseRealWiiMote = WiiMoteReal::Initialize() > 0;
|
||||
|
||||
|
||||
WiiMoteEmu::Initialize();
|
||||
|
||||
g_Config.Load(); // load config settings
|
||||
|
||||
// Debugging window
|
||||
/*startConsoleWin(160, 30, "Wiimote"); // give room for 20 rows
|
||||
wprintf("Wiimote console opened\n");
|
||||
|
Reference in New Issue
Block a user