diff options
| author | John Peterson <jpeterson57@gmail.com> | 2009-02-05 00:13:38 +0000 |
|---|---|---|
| committer | John Peterson <jpeterson57@gmail.com> | 2009-02-05 00:13:38 +0000 |
| commit | 3d73d781ec72b4504592a3e4094c25cd1e77ca01 (patch) | |
| tree | 579507179a93bb876e795427015608f1587e790e /Source | |
| parent | c9c95534c838838c1c01e8838c857716f5ae0f5c (diff) | |
Wiimote: Reset variables on Shutdown(). I think this makes DoesChannelExist(scid) in the Core to return false.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2116 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source')
| -rw-r--r-- | Source/Plugins/Plugin_Wiimote/Src/EmuDefinitions.cpp | 8 | ||||
| -rw-r--r-- | Source/Plugins/Plugin_Wiimote/Src/EmuMain.cpp | 24 | ||||
| -rw-r--r-- | Source/Plugins/Plugin_Wiimote/Src/ReadWiimote.cpp | 4 |
3 files changed, 27 insertions, 9 deletions
diff --git a/Source/Plugins/Plugin_Wiimote/Src/EmuDefinitions.cpp b/Source/Plugins/Plugin_Wiimote/Src/EmuDefinitions.cpp index 524624edd9..667af949fd 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/EmuDefinitions.cpp +++ b/Source/Plugins/Plugin_Wiimote/Src/EmuDefinitions.cpp @@ -41,10 +41,10 @@ namespace WiiMoteEmu // Definitions and variable declarations //****************************************************************************** -u8 g_Leds = 0x0; // 4 bits -u8 g_Speaker = 0x0; // 1 = on -u8 g_SpeakerVoice = 0x0; // 1 = on -u8 g_IR = 0x0; // 1 = on +u8 g_Leds; +u8 g_Speaker; +u8 g_SpeakerVoice; +u8 g_IR; u8 g_Eeprom[WIIMOTE_EEPROM_SIZE]; u8 g_RegSpeaker[WIIMOTE_REG_SPEAKER_SIZE]; diff --git a/Source/Plugins/Plugin_Wiimote/Src/EmuMain.cpp b/Source/Plugins/Plugin_Wiimote/Src/EmuMain.cpp index 60f97c3644..7a4e98b5e2 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/EmuMain.cpp +++ b/Source/Plugins/Plugin_Wiimote/Src/EmuMain.cpp @@ -236,6 +236,19 @@ void UpdateEeprom() WiiMoteEmu::g_Eeprom[22], WiiMoteEmu::g_Eeprom[23], WiiMoteEmu::g_Eeprom[27]); } +// Set initial values +void ResetVariables() +{ + u8 g_Leds = 0x0; // 4 bits + u8 g_Speaker = 0x0; // 1 = on + u8 g_SpeakerVoice = 0x0; // 1 = on + u8 g_IR = 0x0; // 1 = on + + g_ReportingMode = 0; + g_ReportingChannel = 0; + + g_EmulatedWiiMoteInitialized = false; +} // =================================================== /* Write initial values to Eeprom and registers. */ @@ -244,6 +257,9 @@ void Initialize() { if (g_EmulatedWiiMoteInitialized) return; + // Reset variables + ResetVariables(); + // Write default Eeprom data memset(g_Eeprom, 0, WIIMOTE_EEPROM_SIZE); memcpy(g_Eeprom, EepromData_0, sizeof(EepromData_0)); @@ -297,10 +313,12 @@ void DoState(void* ptr, int mode) //TODO: implement } -/* We don't need to do anything here. All values will be reset as FreeLibrary() is called - when we stop a game */ +/* This is not needed if we call FreeLibrary() when we stop a game, but if it's not called we need to reset + these variables. */ void Shutdown(void) -{} +{ + ResetVariables(); +} // =================================================== diff --git a/Source/Plugins/Plugin_Wiimote/Src/ReadWiimote.cpp b/Source/Plugins/Plugin_Wiimote/Src/ReadWiimote.cpp index 23502a2568..c414dca671 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/ReadWiimote.cpp +++ b/Source/Plugins/Plugin_Wiimote/Src/ReadWiimote.cpp @@ -249,8 +249,8 @@ void ReadWiimote() std::string Temp;
/* Timeout for data reading. This is used in Initialize() to read the Eeprom, if we have not gotten
- what we wanted in the WIIUSE_READ_DATA case we stop this loop to avoid interference with the regular
- wiiuse_io_read() and wiiuse_io_write() communication. */
+ what we wanted in the WIIUSE_READ_DATA case we stop this loop and enable the regular
+ wiiuse_io_read() and wiiuse_io_write() loop again. */
if (g_RunTemporary)
{
// This holds if the update rate of wiiuse_poll() is kept at the default value of 10 ms
|
