1) I fixed the emulated Nunchuck in Zelda - TP, however I chose the minimum workable delay time that worked in my PC, in fact it's so short that the Nunchuck still fails sometimes. If you have a very fast PC or something like that so that the Nunchuck still don't work please let me know.

2) I also made the Wiimote work after Stop and Start

3) I changed /Dev/USB to initialize the emulated Wiimote directly after ScanEnable, not wait for any countdown

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1814 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
John Peterson
2009-01-07 02:59:19 +00:00
parent 6125efabb1
commit fa27a97fbb
30 changed files with 1346 additions and 893 deletions
+1 -1
View File
@@ -123,7 +123,7 @@ int wprintf(char *fmt, ...)
if(__fStdOut)
{
fprintf(__fStdOut, s);
//fflush(__fStdOut); // Write file now, don't wait
fflush(__fStdOut); // Write file now, don't wait
}
return(cnt);
+5 -2
View File
@@ -16,11 +16,14 @@
// http://code.google.com/p/dolphin-emu/
#ifndef MM_COMMON_H
#define MM_COMMON_H
//////////////////////////////////////////////////////////////////////////////////////////
// Declarations and definitions
// ¯¯¯¯¯¯¯¯¯¯
void StartConsoleWin(int width, int height, char* fname);
void StartConsoleWin(int width = 100, int height = 2000, char* fname = "Console");
int wprintf(char *fmt, ...);
//////////////////////////////////
#endif // MM_COMMON_H
+5 -1
View File
@@ -442,7 +442,11 @@ void CFrame::MM_OnLog(wxCommandEvent& event)
MusicMod::bShowConsole = !MusicMod::bShowConsole;
if(MusicMod::bShowConsole)
{ MusicMod::ShowConsole(); Player_Console(true); }
/* What we do here is run StartConsoleWin() in Common directly after each
other first in the exe then in the DLL, sometimes this would give me a rampant memory
usage increase until the exe crashed at 700 MB memory usage or something like that.
For that reason I'm trying to sleep for a moment between them here. */
{ MusicMod::ShowConsole(); Sleep(100); Player_Console(true); }
else
{
#if defined (_WIN32)
+17 -19
View File
@@ -70,6 +70,23 @@ extern int GlobalVolume;
//////////////////////////////////
// =======================================================================================
// Supported music files
// ---------------------------------------------------------------------------------------
bool CheckFileEnding(std::string FileName)
{
if (
(FileName.find(".adp") != std::string::npos) // 1080 Avalanche, Crash Bandicoot etc
|| (FileName.find(".afc") != std::string::npos) // Zelda WW
|| (FileName.find(".ast") != std::string::npos) // Zelda TP, Mario Kart
|| (FileName.find(".dsp") != std::string::npos) // Metroid Prime
|| (FileName.find(".hps") != std::string::npos) // SSB Melee
)
return true;
return false;
}
// =======================================================================================
// =======================================================================================
// A function to sort the filelist table after offset
@@ -187,25 +204,6 @@ void Main(std::string FileName)
}
// =======================================================================================
// Supported music files
// ---------------------------------------------------------------------------------------
bool CheckFileEnding(std::string FileName)
{
if (
(FileName.find(".adp") != std::string::npos) // 1080 Avalanche, Crash Bandicoot etc
|| (FileName.find(".afc") != std::string::npos) // Zelda WW
|| (FileName.find(".ast") != std::string::npos) // Zelda TP, Mario Kart
|| (FileName.find(".dsp") != std::string::npos) // Metroid Prime
|| (FileName.find(".hps") != std::string::npos) // SSB Melee
)
return true;
return false;
}
// =======================================================================================
// =======================================================================================
// Check if we should play this file
// ---------------------------------------------------------------------------------------
+19 -2
View File
@@ -15,6 +15,19 @@
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
//////////////////////////////////////////////////////////////////////////////////////////
// File description
/* ¯¯¯¯¯¯¯¯¯¯¯¯¯
All plugins from Core > Plugins are loaded and unloaded with this class when Dolpin is started
and stopped.
//////////////////////////////////////*/
//////////////////////////////////////////////////////////////////////////////////////////
// Includes
// ¯¯¯¯¯¯¯¯¯¯¯¯¯
#include <string.h>
#ifdef _WIN32
#include <windows.h>
@@ -27,6 +40,9 @@
#include "FileUtil.h"
#include "StringUtil.h"
#include "DynamicLibrary.h"
#include "../../../../Branches/MusicMod/Common/Src/Console.h"
///////////////////////////////////
DynamicLibrary::DynamicLibrary()
{
@@ -138,9 +154,10 @@ void* DynamicLibrary::Get(const char* funcname) const
retval = dlsym(library, funcname);
#endif
if (!retval) {
if (!retval)
{
LOG(MASTER_LOG, "Symbol %s missing in %s (error: %s)\n", funcname, library_file.c_str(), GetLastErrorAsString().c_str());
PanicAlert("Symbol %s missing in %s (error: %s)\n", funcname, library_file.c_str(), GetLastErrorAsString().c_str());
//PanicAlert("Symbol %s missing in %s (error: %s)\n", funcname, library_file.c_str(), GetLastErrorAsString().c_str());
}
return retval;
+11
View File
@@ -121,6 +121,10 @@ bool CBoot::LoadMapFromFilename(const std::string &_rFilename, const char *_game
return success;
}
//////////////////////////////////////////////////////////////////////////////////////////
// Load a GC or Wii BIOS file
// ¯¯¯¯¯¯¯¯¯¯¯¯¯
bool CBoot::Load_BIOS(const std::string& _rBiosFilename)
{
bool bResult = false;
@@ -129,6 +133,7 @@ bool CBoot::Load_BIOS(const std::string& _rBiosFilename)
{
if (pFile->GetSize() >= 1024*1024*2)
{
// Write it to memory
u32 CopySize = (u32)pFile->GetSize() - 0x820;
u8* pData = pFile->Lock(0x820, CopySize);
Memory::WriteBigEData(pData, 0x81300000, CopySize);
@@ -143,7 +148,12 @@ bool CBoot::Load_BIOS(const std::string& _rBiosFilename)
delete pFile;
return bResult;
}
/////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
// Third boot step after BootManager and Core. See Call schedule in BootManager.cpp
// ¯¯¯¯¯¯¯¯¯¯¯¯¯
bool CBoot::BootUp(const SCoreStartupParameter& _StartupPara)
{
const bool bDebugIsoBootup = false;
@@ -188,6 +198,7 @@ bool CBoot::BootUp(const SCoreStartupParameter& _StartupPara)
}
else
{
// If we can't load the BIOS file we use the HLE BIOS instead
if (!Load_BIOS(_StartupPara.m_strBios))
{
// fails to load a BIOS so HLE it
+15 -7
View File
@@ -41,7 +41,9 @@ void CBoot::RunFunction(u32 _iAddr)
PowerPC::SingleStep();
}
// BIOS HLE:
// __________________________________________________________________________________________________
//
// GameCube BIOS HLE:
// copy the apploader to 0x81200000
// execute the apploader, function by function, using the above utility.
void CBoot::EmulatedBIOS(bool _bDebug)
@@ -159,7 +161,7 @@ void CBoot::EmulatedBIOS(bool _bDebug)
// __________________________________________________________________________________________________
//
// BIOS HLE:
// Wii BIOS HLE:
// copy the apploader to 0x81200000
// execute the apploader
//
@@ -167,6 +169,7 @@ bool CBoot::EmulatedBIOS_Wii(bool _bDebug)
{
LOG(BOOT, "Faking Wii BIOS...");
// See if we have a memory dump to boot
FILE* pDump = fopen(FULL_WII_SYS_DIR "dump_0x0000_0x4000.bin", "rb");
if (pDump != NULL)
{
@@ -301,10 +304,11 @@ bool CBoot::EmulatedBIOS_Wii(bool _bDebug)
after this check during booting. */
VolumeHandler::ReadToPtr(Memory::GetPointer(0x3180), 0, 4);
Memory::Write_U8(0x80, 0x00003184);
// ================
}
}
// apploader
// Execute the apploader
if (VolumeHandler::IsValid() && VolumeHandler::IsWii())
{
UReg_MSR& m_MSR = ((UReg_MSR&)PowerPC::ppcState.msr);
@@ -345,12 +349,16 @@ bool CBoot::EmulatedBIOS_Wii(bool _bDebug)
u32 iAppLoaderClose = Memory::ReadUnchecked_U32(iAppLoaderFuncAddr+8);
// iAppLoaderInit
LOG(BOOT, "Call iAppLoaderInit");
LOG(BOOT, "Run iAppLoaderInit");
PowerPC::ppcState.gpr[3] = 0x81300000;
RunFunction(iAppLoaderInit);
// iAppLoaderMain
LOG(BOOT, "Call iAppLoaderMain");
/* Let the apploader load the exe to memory. At this point I get an unknwon IPC command
(command zero) when I load Wii Sports or other games a second time. I don't notice
any side effects however. It's a little disconcerning however that Start after Stop
behaves differently than the first Start after starting Dolphin. It means something
was not reset correctly. */
LOG(BOOT, "Run iAppLoaderMain");
do
{
PowerPC::ppcState.gpr[3] = 0x81300004;
@@ -368,7 +376,7 @@ bool CBoot::EmulatedBIOS_Wii(bool _bDebug)
} while(PowerPC::ppcState.gpr[3] != 0x00);
// iAppLoaderClose
LOG(BOOT, "call iAppLoaderClose");
LOG(BOOT, "Run iAppLoaderClose");
RunFunction(iAppLoaderClose);
// Load patches and run startup patches
+43 -29
View File
@@ -94,7 +94,6 @@ void Callback_WiimoteInput(u16 _channelID, const void* _pData, u32 _Size);
// For keyboard shortcuts.
void Callback_KeyPress(int key, bool shift, bool control);
TPeekMessages Callback_PeekMessages = NULL;
TUpdateFPSDisplay g_pUpdateFPSDisplay = NULL;
@@ -106,6 +105,7 @@ TUpdateFPSDisplay g_pUpdateFPSDisplay = NULL;
void Stop();
bool g_bHwInit = false;
bool g_bRealWiimote = false;
HWND g_pWindowHandle = NULL;
Common::Thread* g_pThread = NULL;
@@ -115,13 +115,50 @@ Common::Event emuThreadGoing;
//////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
// Display messages and return values
// ¯¯¯¯¯¯¯¯¯¯
bool PanicAlertToVideo(const char* text, bool yes_no)
{
DisplayMessage(text, 3000);
return true;
}
// Called from GUI thread
void DisplayMessage(const std::string &message, int time_in_ms)
{
PluginVideo::Video_AddMessage(message.c_str(), time_in_ms);
}
void DisplayMessage(const char *message, int time_in_ms)
{
PluginVideo::Video_AddMessage(message, time_in_ms);
}
void Callback_DebuggerBreak()
{
CCPU::EnableStepping(true);
}
const SCoreStartupParameter& GetStartupParameter()
{
return g_CoreStartupParameter;
}
void* GetWindowHandle()
{
return g_pWindowHandle;
}
bool GetRealWiimote()
{
return g_bRealWiimote;
}
/////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
// This is called from the GUI thread. See the booting call schedule in BootManager.cpp
// ¯¯¯¯¯¯¯¯¯¯
bool Init(const SCoreStartupParameter _CoreParameter)
{
if (g_pThread != NULL) {
@@ -153,6 +190,7 @@ bool Init(const SCoreStartupParameter _CoreParameter)
emuThreadGoing.Init();
// This will execute EmuThread() further down in this file
g_pThread = new Common::Thread(EmuThread, (void*)&g_CoreStartupParameter);
emuThreadGoing.Wait();
@@ -168,16 +206,6 @@ bool Init(const SCoreStartupParameter _CoreParameter)
return true;
}
void DisplayMessage(const std::string &message, int time_in_ms)
{
PluginVideo::Video_AddMessage(message.c_str(), time_in_ms);
}
void DisplayMessage(const char *message, int time_in_ms)
{
PluginVideo::Video_AddMessage(message, time_in_ms);
}
// Called from GUI thread or VI thread
void Stop() // - Hammertime!
@@ -213,21 +241,6 @@ void Stop() // - Hammertime!
Host_SetWaitCursor(false);
}
void Callback_DebuggerBreak()
{
CCPU::EnableStepping(true);
}
const SCoreStartupParameter& GetStartupParameter()
{
return g_CoreStartupParameter;
}
void* GetWindowHandle()
{
return g_pWindowHandle;
}
//////////////////////////////////////////////////////////////////////////////////////////
// Create the CPU thread
@@ -280,7 +293,7 @@ THREAD_RETURN CpuThread(void *pArg)
//////////////////////////////////////////////////////////////////////////////////////////
// Initalize plugins and create emulation thread
// ¯¯¯¯¯¯¯¯¯¯
/* Call browser: Init():g_pThread(). See the BootManager.cpp file description for a completel
/* Call browser: Init():g_pThread(). See the BootManager.cpp file description for a complete
call schedule. */
THREAD_RETURN EmuThread(void *pArg)
{
@@ -348,7 +361,8 @@ THREAD_RETURN EmuThread(void *pArg)
WiimoteInitialize.hWnd = g_pWindowHandle;
WiimoteInitialize.pLog = Callback_WiimoteLog;
WiimoteInitialize.pWiimoteInput = Callback_WiimoteInput;
PluginWiimote::Wiimote_Initialize(WiimoteInitialize);
// Wait for Wiiuse to find the number of connected Wiimotes
g_bRealWiimote = PluginWiimote::Wiimote_Initialize(WiimoteInitialize);
}
// The hardware is initialized.
+3 -2
View File
@@ -51,13 +51,14 @@ namespace Core
void SaveState();
void LoadState();
// get core parameters
// Get core parameters
extern SCoreStartupParameter g_CoreStartupParameter; //uck
const SCoreStartupParameter& GetStartupParameter();
// make a screen shot
// Make a screen shot
bool MakeScreenshot(const std::string& _rFilename);
void* GetWindowHandle();
bool GetRealWiimote();
extern bool bReadTrace;
extern bool bWriteTrace;
+52
View File
@@ -15,6 +15,51 @@
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
/////////////////////////////////////////////////////////////////////////////
// File description: This file control all system timers
/* -------------
"Time" is measured in frames, not time: These update frequencies are determined by the passage
of frames. So if a game runs slow, on a slow computer for example, these updates will occur
less frequently. This makes sense because almost all console games are controlled by frames
rather than time, so if a game can't keep up with the normal framerate all animations and
actions slows down and the game runs to slow. This is different from PC games that are are
often controlled by time instead and may not have maximum framerates.
However, I'm not sure if the Bluetooth communication for the Wiimote is entirely frame
dependent, the timing problems with the ack command in Zelda - TP may be related to
time rather than frames? For now the IPC_HLE_PERIOD is frame dependet, but bcause of
different conditions on the way to PluginWiimote::Wiimote_Update() the updates may actually
be time related after all, or not?
I'm not sure about this but the text below seems to assume that 60 fps means that the game
runs in the normal intended speed. In that case an update time of [GetTicksPerSecond() / 60]
would mean one update per frame and [GetTicksPerSecond() / 60] would mean four updates per
frame.
IPC_HLE_PERIOD: For the Wiimote this is the call scedule:
IPC_HLE_UpdateCallback() // In this file
// This function seems to call all devices' Update() function four times per frame
WII_IPC_HLE_Interface::Update()
// If the AclFrameQue is empty this will call Wiimote_Update() and make it send
the current input status to the game. I'm not sure if this occurs approximately
once every frame or if the frequency is not exactly tied to rendered frames
CWII_IPC_HLE_Device_usb_oh1_57e_305::Update()
PluginWiimote::Wiimote_Update()
// This is also a device updated by WII_IPC_HLE_Interface::Update() but it doesn't
seem to ultimately call PluginWiimote::Wiimote_Update(). However it can be called
by the /dev/usb/oh1 device if the AclFrameQue is empty.
CWII_IPC_HLE_WiiMote::Update()
//////////////////////////*/
/////////////////////////////////////////////////////////////////////////////
// Inlude
// -------------
#include "Common.h"
#include "../PatchEngine.h"
#include "SystemTimers.h"
@@ -32,10 +77,15 @@
#include "../IPC_HLE/WII_IPC_HLE.h"
#include "Thread.h"
#include "Timer.h"
/////////////////////////////
namespace SystemTimers
{
/////////////////////////////////////////////////////////////////////////////
// Declarations and definitions
// -------------
u32 CPU_CORE_CLOCK = 486000000u; // 486 mhz (its not 485, stop bugging me!)
s64 fakeDec;
@@ -85,6 +135,8 @@ int
// Once every 2 frame-period should be enough.
// Assuming game's frame-finish-watchdog wait more than 2 emulated frame-period before starting its mess.
FAKE_GP_WATCHDOG_PERIOD = GetTicksPerSecond() / 30;
///////////////////////////////////
u32 GetTicksPerSecond()
{
+5 -2
View File
@@ -399,8 +399,11 @@ void ExecuteCommand(u32 _Address)
break;
default:
_dbg_assert_msg_(WII_IPC_HLE, 0, "Unknown Command %i (0x%08x)", Command, _Address);
CCPU::Break();
_dbg_assert_msg_(WII_IPC_HLE, 0, "Unknown IPC Command %i (0x%08x)", Command, _Address);
// Break on the same terms as the _dbg_assert_msg_, if LOGGING was defined
#ifdef LOGGING
CCPU::Break();
#endif
break;
}
@@ -15,16 +15,28 @@
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
//////////////////////////////////////////////////////////////////////////////////////////
// Include
// ¯¯¯¯¯¯¯¯¯¯¯¯¯
#include "WII_IPC_HLE_Device_usb.h"
#include "../Plugins/Plugin_Wiimote.h"
#include "../Core.h" // Local core functions
#include "../Debugger/Debugger_SymbolMap.h"
#include "../Host.h"
#include "../../../../Branches/MusicMod/Common/Src/Console.h"
///////////////////////
// ugly hacks for "SendEventNumberOfCompletedPackets"
// Ugly hacks for "SendEventNumberOfCompletedPackets"
int g_HCICount = 0;
int g_GlobalHandle = 0;
//////////////////////////////////////////////////////////////////////////////////////////
// The device class
// ¯¯¯¯¯¯¯¯¯¯¯¯¯
CWII_IPC_HLE_Device_usb_oh1_57e_305::CWII_IPC_HLE_Device_usb_oh1_57e_305(u32 _DeviceID, const std::string& _rDeviceName)
: IWII_IPC_HLE_Device(_DeviceID, _rDeviceName)
, m_PINType(0)
@@ -58,6 +70,7 @@ CWII_IPC_HLE_Device_usb_oh1_57e_305::CWII_IPC_HLE_Device_usb_oh1_57e_305(u32 _De
CWII_IPC_HLE_Device_usb_oh1_57e_305::~CWII_IPC_HLE_Device_usb_oh1_57e_305()
{}
///////////////////////////
// ===================================================
@@ -290,7 +303,7 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::SendACLFrame(u16 _ConnectionHandle, u8
// ===================================================
/* This is called from WII_IPC_HLE_Interface::Update() */
/* See IPC_HLE_PERIOD in SystemTimers.cpp for a documentation of this update. */
// ----------------
u32 CWII_IPC_HLE_Device_usb_oh1_57e_305::Update()
{
@@ -387,19 +400,27 @@ u32 CWII_IPC_HLE_Device_usb_oh1_57e_305::Update()
before we initiate the connection. To avoid doing this for GC games we also
want m_LocalName from CommandWriteLocalName() to be "Wii".
FiRES: TODO find a good solution to do this */
FiRES: TODO find a good solution to do this
JP: Solution to what? When to run SendEventRequestConnection()?
*/
// -------------------------
static bool test = true;
// Why do we need this? 0 worked with the emulated wiimote in all games I tried
static int counter = 1000;
/* I disabled this and disable m_ScanEnable instead to avoid running SendEventRequestConnection()
again. */
//static bool test = true;
if (test && !strcasecmp(m_LocalName, "Wii") && (m_ScanEnable & 0x2))
/* Why do we need this? 0 worked with the emulated wiimote in all games I tried. Do we have to
wait for wiiuse_init() and wiiuse_find() for a real Wiimote here? I'm testing
this new method of not waiting at all if there are no real Wiimotes. Please let me know
if it doesn't work. */
static int counter = (Core::GetRealWiimote() ? 1000 : 0);
if (!strcasecmp(m_LocalName, "Wii") && (m_ScanEnable & 0x2))
{
counter--;
if (counter < 0)
{
test = false;
//test = false;
for (size_t i=0; i < m_WiiMotes.size(); i++)
{
if (m_WiiMotes[i].EventPagingChanged(2))
@@ -564,8 +585,15 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventRemoteNameReq(bdaddr_t _bd)
return true;
}
/////////////////////////////////////////////////////////////
/* This is called from Update() after ScanEnable has been enabled. */
// ¯¯¯¯¯¯¯¯¯
bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventRequestConnection(CWII_IPC_HLE_WiiMote& _rWiiMote)
{
// We have to disable scan now to avoid running this function over and over again
m_ScanEnable = 0;
SQueuedEvent Event(sizeof(SHCIEventRequestConnection), 0);
SHCIEventRequestConnection* pEventRequestConnection = (SHCIEventRequestConnection*)Event.m_buffer;
@@ -601,6 +629,8 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventRequestConnection(CWII_IPC_HL
return true;
};
//////////////////////////////
bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventRequestLinkKey(bdaddr_t _bd)
{
@@ -1377,7 +1407,9 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandWritePageTimeOut(u8* _Input)
}
/////////////////////////////////////////////////////////////
/* This will enable ScanEnable so that Update() can start the Wiimote. */
// ¯¯¯¯¯¯¯¯¯
void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandWriteScanEnable(u8* _Input)
{
// Command parameters
@@ -1404,7 +1436,7 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandWriteScanEnable(u8* _Input)
SendEventCommandComplete(HCI_CMD_WRITE_SCAN_ENABLE, &Reply, sizeof(hci_write_scan_enable_rp));
}
/////////////////////////////
void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandWriteInquiryMode(u8* _Input)
@@ -29,7 +29,7 @@ void UnloadPlugin();
// Function Types
typedef void (__cdecl* TGetDllInfo)(PLUGIN_INFO*);
typedef void (__cdecl* TDllConfig)(HWND);
typedef void (__cdecl* TWiimote_Initialize)(SWiimoteInitialize);
typedef bool (__cdecl* TWiimote_Initialize)(SWiimoteInitialize);
typedef void (__cdecl* TWiimote_Shutdown)();
typedef void (__cdecl* TWiimote_Update)();
typedef void (__cdecl* TWiimote_Output)(u16 _channelID, const void* _pData, u32 _Size);
+3 -1
View File
@@ -30,7 +30,8 @@
BootManager.cpp BootCore
Core Core.cpp Init Thread creation
EmuThread Calls CBoot::BootUp
Boot.cpp
Boot.cpp CBoot::BootUp()
CBoot::EmulatedBIOS_Wii() / GC() or Load_BIOS()
*/
// =============
@@ -54,6 +55,7 @@
#include "ConfigMain.h"
#include "Frame.h"
#include "CodeWindow.h"
#include "../../../../Branches/MusicMod/Common/Src/Console.h"
#ifdef MUSICMOD
#include "../../../Branches/MusicMod/Main/Src/Main.h" // MusicMod
#endif
+3 -3
View File
@@ -56,6 +56,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DolphinWX", "Core\DolphinWX
ProjectSection(ProjectDependencies) = postProject
{48AD7E0A-25B1-4974-A1E3-03F8C438D34F} = {48AD7E0A-25B1-4974-A1E3-03F8C438D34F}
{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}
{DE7C596C-CBC4-4278-8909-146D63990803} = {DE7C596C-CBC4-4278-8909-146D63990803}
@@ -240,7 +241,6 @@ Global
{CFDCEE0E-FA45-4F72-9FCC-0B88F5A75160}.DebugFast|Win32.ActiveCfg = DebugFast|Win32
{CFDCEE0E-FA45-4F72-9FCC-0B88F5A75160}.DebugFast|x64.ActiveCfg = DebugFast|x64
{CFDCEE0E-FA45-4F72-9FCC-0B88F5A75160}.Release|Win32.ActiveCfg = Release|Win32
{CFDCEE0E-FA45-4F72-9FCC-0B88F5A75160}.Release|Win32.Build.0 = Release|Win32
{CFDCEE0E-FA45-4F72-9FCC-0B88F5A75160}.Release|x64.ActiveCfg = Release|x64
{CFDCEE0E-FA45-4F72-9FCC-0B88F5A75160}.Release|x64.Build.0 = Release|x64
{C573CAF7-EE6A-458E-8049-16C0BF34C2E9}.Debug|Win32.ActiveCfg = Debug|Win32
@@ -322,8 +322,10 @@ Global
{8D612734-FAA5-4B8A-804F-4DEA2367D495}.Debug|Win32.ActiveCfg = Debug|Win32
{8D612734-FAA5-4B8A-804F-4DEA2367D495}.Debug|x64.ActiveCfg = Debug|x64
{8D612734-FAA5-4B8A-804F-4DEA2367D495}.DebugFast|Win32.ActiveCfg = DebugFast|Win32
{8D612734-FAA5-4B8A-804F-4DEA2367D495}.DebugFast|Win32.Build.0 = DebugFast|Win32
{8D612734-FAA5-4B8A-804F-4DEA2367D495}.DebugFast|x64.ActiveCfg = DebugFast|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
{C6CC7A52-0FDD-433A-B2CF-9C6F187DA807}.Debug|Win32.ActiveCfg = Debug|Win32
@@ -377,11 +379,9 @@ Global
{0D14F1E9-490B-4A2D-A4EF-0535E8B3C718}.Debug|x64.ActiveCfg = Debug|x64
{0D14F1E9-490B-4A2D-A4EF-0535E8B3C718}.Debug|x64.Build.0 = Debug|x64
{0D14F1E9-490B-4A2D-A4EF-0535E8B3C718}.DebugFast|Win32.ActiveCfg = Debug|Win32
{0D14F1E9-490B-4A2D-A4EF-0535E8B3C718}.DebugFast|Win32.Build.0 = Debug|Win32
{0D14F1E9-490B-4A2D-A4EF-0535E8B3C718}.DebugFast|x64.ActiveCfg = Debug|x64
{0D14F1E9-490B-4A2D-A4EF-0535E8B3C718}.DebugFast|x64.Build.0 = Debug|x64
{0D14F1E9-490B-4A2D-A4EF-0535E8B3C718}.Release|Win32.ActiveCfg = Release|Win32
{0D14F1E9-490B-4A2D-A4EF-0535E8B3C718}.Release|Win32.Build.0 = Release|Win32
{0D14F1E9-490B-4A2D-A4EF-0535E8B3C718}.Release|x64.ActiveCfg = Release|x64
{0D14F1E9-490B-4A2D-A4EF-0535E8B3C718}.Release|x64.Build.0 = Release|x64
{DE7C596C-CBC4-4278-8909-146D63990803}.Debug|Win32.ActiveCfg = Debug|Win32
+23 -3
View File
@@ -1,3 +1,21 @@
// 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/
//__________________________________________________________________________________________________
// Common wiimote plugin spec, unversioned
//
@@ -8,9 +26,10 @@
#include "PluginSpecs.h"
#include "ExportProlog.h"
typedef void (*TLogv)(const char* _pMessage, int _v);
// Called when the Wiimote sends input reports to the Core.
// This is called when the Wiimote sends input reports to the Core.
// Payload: an L2CAP packet.
typedef void (*TWiimoteInput)(u16 _channelID, const void* _pData, u32 _Size);
@@ -22,6 +41,7 @@ typedef struct
TWiimoteInput pWiimoteInput;
} SWiimoteInitialize;
/////////////////////////////////////////////////////////////////////////////////////////////////////
// I N T E R F A C E ////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -57,9 +77,9 @@ EXPORT void CALL DllDebugger(HWND _hParent, bool Show);
// Function:
// Purpose:
// input: WiimoteInitialize
// output: none
// output: If at least one real Wiimote was found or not
//
EXPORT void CALL Wiimote_Initialize(SWiimoteInitialize _WiimoteInitialize);
EXPORT bool CALL Wiimote_Initialize(SWiimoteInitialize _WiimoteInitialize);
// __________________________________________________________________________________________________
// Function: Wiimote_Shutdown
@@ -15,12 +15,20 @@
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
/////////////////////////////////////////////////////////////////////////
// Include
// ------------
//#include "Common.h" // for u16
#include "ConfigDlg.h"
#include "Config.h"
#include "EmuSubroutines.h" // for WmRequestStatus
/////////////////////////////
/////////////////////////////////////////////////////////////////////////
// Event table
// ------------
BEGIN_EVENT_TABLE(ConfigDialog,wxDialog)
EVT_CLOSE(ConfigDialog::OnClose)
EVT_BUTTON(ID_CLOSE, ConfigDialog::CloseClick)
@@ -30,6 +38,8 @@ BEGIN_EVENT_TABLE(ConfigDialog,wxDialog)
EVT_CHECKBOX(ID_NUNCHUCKCONNECTED, ConfigDialog::GeneralSettingsChanged)
EVT_CHECKBOX(ID_CLASSICCONTROLLERCONNECTED, 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)
@@ -42,6 +52,10 @@ ConfigDialog::~ConfigDialog()
{
}
/////////////////////////////////////////////////////////////////////////
// Create GUI
// ------------
void ConfigDialog::CreateGUIControls()
{
// Notebook
@@ -120,6 +134,7 @@ void ConfigDialog::AboutClick(wxCommandEvent& WXUNUSED (event))
{
}
//////////////////////////
// ===================================================
@@ -159,8 +174,12 @@ void ConfigDialog::GeneralSettingsChanged(wxCommandEvent& event)
g_Config.bClassicControllerConnected = false;
// Disconnect the extension so that the game recognize the change
DoExtensionConnectedDisconnected();
/* It doesn't seem to be needed but shouldn't it at least take 25 ms to
reconnect an extension after we disconnected another? */
Sleep(25);
}
// Update status
g_Config.bNunchuckConnected = m_NunchuckConnected->IsChecked();
// Generate connect/disconnect status event
+63 -18
View File
@@ -16,37 +16,75 @@
// http://code.google.com/p/dolphin-emu/
// --------------------
//////////////////////////////////////////////////////////////////////////////////////////
// Includes
// ¯¯¯¯¯¯¯¯¯¯¯¯¯
#include <string>
#include <stdio.h>
#ifdef _WIN32
#include <windows.h>
#include <windows.h>
#endif
#include "StringUtil.h"
#define HAVE_WX 1
#if defined(HAVE_WX) && HAVE_WX // wxWidgets
#include <wx/datetime.h> // for the timestamps
#endif
///////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
// Settings
// ¯¯¯¯¯¯¯¯¯¯¯¯¯
// --------------------
// On and off
bool g_consoleEnable = true;
int gSaveFile = 0;
#define DEBUG_WIIMOTE
bool gSaveFile = true;
#define DEBUG_WIIMOTE // On or off
const int nFiles = 1;
// --------------------
// Settings
int nFiles = 1;
// --------------------
// Create handles
#ifdef DEBUG_WIIMOTE
FILE* __fStdOut[1]; // you have to update this manually, we can't place a nFiles in there
FILE* __fStdOut[nFiles];
#endif
#ifdef _WIN32
HANDLE __hStdOut = NULL;
#endif
//////////////////////////////
// =======================================================================================
/* Get Timestamp */
// -------------
std::string Tm(bool Ms)
{
#if defined(HAVE_WX) && HAVE_WX
std::string Tmp;
if(Ms)
{
wxDateTime datetime = wxDateTime::UNow(); // Get timestamp
Tmp = StringFromFormat("%02i:%02i:%03i",
datetime.GetMinute(), datetime.GetSecond(), datetime.GetMillisecond());
}
else
{
wxDateTime datetime = wxDateTime::Now(); // Get timestamp
Tmp = StringFromFormat("%02i:%02i",
datetime.GetMinute(), datetime.GetSecond());
}
return Tmp;
#else
std::string Tmp = "";
return Tmp;
#endif
}
// ===========================
// =======================================================================================
/* Start console window - width and height is the size of console window, if you specify
@@ -69,7 +107,7 @@ void startConsoleWin(int width, int height, char* fname)
SetConsoleWindowInfo(__hStdOut, TRUE, &coo);
// ---------------------------------------------------------------------------------------
// Write to a file
// Create a file for this
if(fname)
{
for(int i = 0; i < nFiles; i++)
@@ -107,6 +145,7 @@ int aprintf(int a, char *fmt, ...)
if(__fStdOut[a]) // TODO: make this work, we have to set all default values to NULL
//to make it work
fprintf(__fStdOut[a], s);
fflush(__fStdOut[0]); // Write file now, don't wait
// -------------
return(cnt);
@@ -135,14 +174,20 @@ int wprintf(const char *fmt, ...)
cnt = vsnprintf(s, 500, fmt, argptr);
va_end(argptr);
DWORD cCharsWritten;
DWORD cCharsWritten; // We will get a value back here
// ---------------------------------------------------------------------------------------
// ------------------------------------------
// Write to console
// ----------------
if(__hStdOut)
{
WriteConsole(__hStdOut, s, strlen(s), &cCharsWritten, NULL);
}
// -------------
// ----------------------------------------
// Write to file
// ----------------
aprintf(0, s);
return(cnt);
#else
@@ -15,7 +15,19 @@
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef WIIMOTE_CONSOLE_H
#define WIIMOTE_CONSOLE_H
//////////////////////////////////////////////////////////////////////////////////////////
// Includes
// ¯¯¯¯¯¯¯¯¯¯¯¯¯
#include <iostream>
//////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
// Declarations
// ¯¯¯¯¯¯¯¯¯¯¯¯¯
std::string Tm(bool Ms = false);
void startConsoleWin(int width, int height, char* fname);
int wprintf(const char *fmt, ...);
int aprintf(int a, const char *fmt, ...);
@@ -24,3 +36,6 @@ void ClearScreen();
#ifdef _WIN32
HWND GetConsoleHwnd(void);
#endif
///////////////////////////////
#endif // WIIMOTE_CONSOLE_H
@@ -20,14 +20,18 @@
// ===================================================
/* Data reports guide. The different structures location in the Input reports. The ? in
the IR coordinates is the High coordinates that are four in one byte. */
the IR coordinates is the High coordinates that are four in one byte.
0x37: For the data reportingmode 0x37 there are five unused IR bytes in the end (represented)
by "..." below, it seems like they can be set to either 0xff or 0x00 without affecting the
IR emulation. */
// ----------------
/* 0x33
[c.left etc] [c.a etc] acc.x y z ir0.x y ? ir1.x y ? ir2.x y ? ir3.x y ?
0x37
[c.left etc] [c.a etc] acc.x y z ir0.x1 y1 ? x2 y2 ir1.x1 y1 ? x2 y2 ext.jx jy ax ay az bt
[c.left etc] [c.a etc] acc.x y z ir0.x1 y1 ? x2 y2 ir1.x1 y1 ? x2 y2 ... ext.jx jy ax ay az bt
The Data Report's path from here is
@@ -43,23 +47,32 @@
//////////////////////////////////////////////////////////////////////////////////////////
// Includes
// ¯¯¯¯¯¯¯¯¯¯¯¯¯
#include "pluginspecs_wiimote.h"
#include <vector>
#include <string>
#include "Common.h"
#include "wiimote_hid.h"
#include "Common.h" // Common
#include "StringUtil.h" // for ArrayToString
#include "wiimote_hid.h" // Local
#include "EmuMain.h"
#include "EmuSubroutines.h"
#include "EmuDefinitions.h"
#include "Encryption.h" // for extension encryption
#include "Console.h" // for startConsoleWin, wprintf, GetConsoleHwnd
#include "Config.h" // for g_Config
///////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
// Declarations and definitions
// ¯¯¯¯¯¯¯¯¯¯¯¯¯
extern SWiimoteInitialize g_WiimoteInitialize;
//extern void __Log(int log, const char *format, ...);
//extern void __Log(int log, int v, const char *format, ...);
///////////////////////////////
namespace WiiMoteEmu
@@ -78,13 +91,13 @@ void WmDataReporting(u16 _channelID, wm_data_reporting* dr)
LOG(WII_IPC_WIIMOTE, " Continuous: %x", dr->continuous);
LOG(WII_IPC_WIIMOTE, " All The Time: %x (not only on data change)", dr->all_the_time);
LOG(WII_IPC_WIIMOTE, " Mode: 0x%02x", dr->mode);
wprintf("\nData reporting mode: 0x%02x", dr->mode);
wprintf("\nData reporting channel: 0x%04x\n", _channelID);
//wprintf("Data reporting mode: 0x%02x\n", dr->mode);
//wprintf("Data reporting channel: 0x%04x\n", _channelID);
g_ReportingMode = dr->mode;
g_ReportingChannel = _channelID;
switch(dr->mode) { //see Wiimote_Update()
switch(dr->mode) // See Wiimote_Update()
{
case WM_REPORT_CORE:
case WM_REPORT_CORE_ACCEL:
case WM_REPORT_CORE_ACCEL_IR12:
@@ -270,7 +283,7 @@ void SendReportCoreAccelIr10Ext(u16 _channelID)
#ifdef _WIN32
/*if(GetAsyncKeyState('V'))
{
std::string Temp = WiiMoteEmu::ArrayToString(DataFrame, Offset, 0, 30);
std::string Temp = ArrayToString(DataFrame, Offset, 0, 30);
wprintf("DataFrame: %s\n", Temp.c_str());
}*/
#endif

Some files were not shown because too many files have changed in this diff Show More