Skip to content

Commit

Permalink
Merge branch 'JP-wiimote-savestate-fixes'
Browse files Browse the repository at this point in the history
  • Loading branch information
RachelBryk committed Jun 25, 2013
2 parents 748ee50 + e250550 commit a619135
Show file tree
Hide file tree
Showing 16 changed files with 826 additions and 73 deletions.
1 change: 1 addition & 0 deletions Source/Core/Common/Src/CommonFuncs.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ const char* GetLastErrorMsg();
namespace Common
{
inline u8 swap8(u8 _data) {return _data;}
inline u32 swap24(const u8* _data) {return (_data[0] << 16) | (_data[1] << 8) | _data[2];}

#ifdef _WIN32
inline u16 swap16(u16 _data) {return _byteswap_ushort(_data);}
Expand Down
2 changes: 0 additions & 2 deletions Source/Core/Core/Src/ConfigManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,6 @@ void SConfig::SaveSettings()

ini.Set("Core", "WiiSDCard", m_WiiSDCard);
ini.Set("Core", "WiiKeyboard", m_WiiKeyboard);
ini.Set("Core", "WiimoteReconnectOnLoad", m_WiimoteReconnectOnLoad);
ini.Set("Core", "WiimoteContinuousScanning", m_WiimoteContinuousScanning);
ini.Set("Core", "WiimoteEnableSpeaker", m_WiimoteEnableSpeaker);
ini.Set("Core", "RunCompareServer", m_LocalCoreStartupParameter.bRunCompareServer);
Expand Down Expand Up @@ -400,7 +399,6 @@ void SConfig::LoadSettings()

ini.Get("Core", "WiiSDCard", &m_WiiSDCard, false);
ini.Get("Core", "WiiKeyboard", &m_WiiKeyboard, false);
ini.Get("Core", "WiimoteReconnectOnLoad", &m_WiimoteReconnectOnLoad, true);
ini.Get("Core", "WiimoteContinuousScanning", &m_WiimoteContinuousScanning, false);
ini.Get("Core", "WiimoteEnableSpeaker", &m_WiimoteEnableSpeaker, true);
ini.Get("Core", "RunCompareServer", &m_LocalCoreStartupParameter.bRunCompareServer, false);
Expand Down
1 change: 0 additions & 1 deletion Source/Core/Core/Src/ConfigManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ struct SConfig : NonCopyable
// Wii Devices
bool m_WiiSDCard;
bool m_WiiKeyboard;
bool m_WiimoteReconnectOnLoad;
bool m_WiimoteContinuousScanning;
bool m_WiimoteEnableSpeaker;

Expand Down
2 changes: 2 additions & 0 deletions Source/Core/Core/Src/Core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -504,9 +504,11 @@ void SetState(EState _State)
break;
case CORE_PAUSE:
CCPU::EnableStepping(true); // Break
Wiimote::Pause();
break;
case CORE_RUN:
CCPU::EnableStepping(false);
Wiimote::Resume();
break;
default:
PanicAlertT("Invalid state");
Expand Down
23 changes: 14 additions & 9 deletions Source/Core/Core/Src/HW/Wiimote.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ void Shutdown()
delete *i;
g_plugin.controllers.clear();

// WiimoteReal is shutdown on app exit
//WiimoteReal::Shutdown();
WiimoteReal::Shutdown();

g_controller_interface.Shutdown();
}
Expand All @@ -58,6 +57,17 @@ void Initialize(void* const hwnd)
Movie::ChangeWiiPads();
}

void Resume()
{
WiimoteReal::Resume();
}

void Pause()
{
WiimoteReal::Pause();
}


// __________________________________________________________________________________________________
// Function: ControlChannel
// Purpose: An L2CAP packet is passed from the Core to the Wiimote,
Expand All @@ -72,11 +82,8 @@ void Initialize(void* const hwnd)
//
void ControlChannel(int _number, u16 _channelID, const void* _pData, u32 _Size)
{
if (WIIMOTE_SRC_EMU & g_wiimote_sources[_number])
if (WIIMOTE_SRC_HYBRID & g_wiimote_sources[_number])
((WiimoteEmu::Wiimote*)g_plugin.controllers[_number])->ControlChannel(_channelID, _pData, _Size);

if (WIIMOTE_SRC_REAL & g_wiimote_sources[_number])
WiimoteReal::ControlChannel(_number, _channelID, _pData, _Size);
}

// __________________________________________________________________________________________________
Expand All @@ -93,10 +100,8 @@ void ControlChannel(int _number, u16 _channelID, const void* _pData, u32 _Size)
//
void InterruptChannel(int _number, u16 _channelID, const void* _pData, u32 _Size)
{
if (WIIMOTE_SRC_EMU & g_wiimote_sources[_number])
if (WIIMOTE_SRC_HYBRID & g_wiimote_sources[_number])
((WiimoteEmu::Wiimote*)g_plugin.controllers[_number])->InterruptChannel(_channelID, _pData, _Size);
else
WiimoteReal::InterruptChannel(_number, _channelID, _pData, _Size);
}

// __________________________________________________________________________________________________
Expand Down
4 changes: 4 additions & 0 deletions Source/Core/Core/Src/HW/Wiimote.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ namespace Wiimote

void Shutdown();
void Initialize(void* const hwnd);
void Resume();
void Pause();

unsigned int GetAttached();
void DoState(u8 **ptr, PointerWrap::Mode mode);
Expand All @@ -53,6 +55,8 @@ namespace WiimoteReal

void Initialize();
void Shutdown();
void Resume();
void Pause();
void Refresh();

void LoadSettings();
Expand Down
Loading

0 comments on commit a619135

Please sign in to comment.