Merge pull request #1936 from lioncash/kb

Minor keyboard-related cleanups.
This commit is contained in:
Ryan Houdek 2015-01-22 16:23:34 -06:00
commit db690a1862
4 changed files with 36 additions and 34 deletions

View File

@ -409,12 +409,6 @@
<ClCompile Include="HW\Sram.cpp">
<Filter>HW %28Flipper/Hollywood%29\EXI - Expansion Interface</Filter>
</ClCompile>
<ClCompile Include="HW\GCKeyboard.cpp">
<Filter>HW %28Flipper/Hollywood%29\GCPad</Filter>
</ClCompile>
<ClCompile Include="HW\GCKeyboardEmu.cpp">
<Filter>HW %28Flipper/Hollywood%29\GCPad</Filter>
</ClCompile>
<ClCompile Include="HW\GCMemcard.cpp">
<Filter>HW %28Flipper/Hollywood%29\GCMemcard</Filter>
</ClCompile>
@ -718,6 +712,14 @@
<ClCompile Include="PowerPC\JitILCommon\IR.cpp">
<Filter>PowerPC\JitILCommon</Filter>
</ClCompile>
<ClCompile Include="HW\SI_GCAdapter.cpp" />
<ClCompile Include="PowerPC\JitCommon\JitBackpatch.cpp" />
<ClCompile Include="HW\GCKeyboardEmu.cpp">
<Filter>HW %28Flipper/Hollywood%29\GCKeyboard</Filter>
</ClCompile>
<ClCompile Include="HW\GCKeyboard.cpp">
<Filter>HW %28Flipper/Hollywood%29\GCKeyboard</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="BootManager.h" />
@ -727,7 +729,6 @@
<ClInclude Include="CoreTiming.h" />
<ClInclude Include="ec_wii.h" />
<ClInclude Include="Host.h" />
<ClCompile Include="MachineContext.h" />
<ClInclude Include="MemTools.h" />
<ClInclude Include="Movie.h" />
<ClInclude Include="NetPlayClient.h" />
@ -937,12 +938,6 @@
<ClInclude Include="HW\Sram.h">
<Filter>HW %28Flipper/Hollywood%29\EXI - Expansion Interface</Filter>
</ClInclude>
<ClInclude Include="HW\GCKeyboard.h">
<Filter>HW %28Flipper/Hollywood%29\GCPad</Filter>
</ClInclude>
<ClInclude Include="HW\GCKeyboardEmu.h">
<Filter>HW %28Flipper/Hollywood%29\GCPad</Filter>
</ClInclude>
<ClInclude Include="HW\GCMemcard.h">
<Filter>HW %28Flipper/Hollywood%29\GCMemcard</Filter>
</ClInclude>
@ -1222,8 +1217,16 @@
<ClInclude Include="PowerPC\JitILCommon\IR.h">
<Filter>PowerPC\JitILCommon</Filter>
</ClInclude>
<ClInclude Include="HW\SI_GCAdapter.h" />
<ClInclude Include="MachineContext.h" />
<ClInclude Include="HW\GCKeyboardEmu.h">
<Filter>HW %28Flipper/Hollywood%29\GCKeyboard</Filter>
</ClInclude>
<ClInclude Include="HW\GCKeyboard.h">
<Filter>HW %28Flipper/Hollywood%29\GCKeyboard</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Text Include="CMakeLists.txt" />
</ItemGroup>
</Project>
</Project>

View File

@ -217,28 +217,28 @@ GCKeyboard::GCKeyboard(const unsigned int index) : m_index(index)
{
// buttons
groups.emplace_back(m_keys0x = new Buttons(_trans("Keys")));
for (unsigned int i = 0; i < sizeof(named_keys0) / sizeof(*named_keys0); ++i)
m_keys0x->controls.emplace_back(new ControlGroup::Input(named_keys0[i]));
for (const char* key : named_keys0)
m_keys0x->controls.emplace_back(new ControlGroup::Input(key));
groups.emplace_back(m_keys1x = new Buttons(_trans("Keys")));
for (unsigned int i = 0; i < sizeof(named_keys1) / sizeof(*named_keys1); ++i)
m_keys1x->controls.emplace_back(new ControlGroup::Input(named_keys1[i]));
for (const char* key : named_keys1)
m_keys1x->controls.emplace_back(new ControlGroup::Input(key));
groups.emplace_back(m_keys2x = new Buttons(_trans("Keys")));
for (unsigned int i = 0; i < sizeof(named_keys2) / sizeof(*named_keys2); ++i)
m_keys2x->controls.emplace_back(new ControlGroup::Input(named_keys2[i]));
for (const char* key : named_keys2)
m_keys2x->controls.emplace_back(new ControlGroup::Input(key));
groups.emplace_back(m_keys3x = new Buttons(_trans("Keys")));
for (unsigned int i = 0; i < sizeof(named_keys3) / sizeof(*named_keys3); ++i)
m_keys3x->controls.emplace_back(new ControlGroup::Input(named_keys3[i]));
for (const char* key : named_keys3)
m_keys3x->controls.emplace_back(new ControlGroup::Input(key));
groups.emplace_back(m_keys4x = new Buttons(_trans("Keys")));
for (unsigned int i = 0; i < sizeof(named_keys4) / sizeof(*named_keys4); ++i)
m_keys4x->controls.emplace_back(new ControlGroup::Input(named_keys4[i]));
for (const char* key : named_keys4)
m_keys4x->controls.emplace_back(new ControlGroup::Input(key));
groups.emplace_back(m_keys5x = new Buttons(_trans("Keys")));
for (unsigned int i = 0; i < sizeof(named_keys5) / sizeof(*named_keys5); ++i)
m_keys5x->controls.emplace_back(new ControlGroup::Input(named_keys5[i]));
for (const char* key : named_keys5)
m_keys5x->controls.emplace_back(new ControlGroup::Input(key));
// options

View File

@ -51,8 +51,7 @@ int CSIDevice_Keyboard::RunBuffer(u8* _pBuffer, int _iLength)
KeyboardStatus CSIDevice_Keyboard::GetKeyboardStatus()
{
KeyboardStatus KeyStatus;
memset(&KeyStatus, 0, sizeof(KeyStatus));
KeyboardStatus KeyStatus = {};
Keyboard::GetStatus(ISIDevice::m_iDeviceNumber, &KeyStatus);
return KeyStatus;
}

View File

@ -50,17 +50,17 @@ public:
CSIDevice_Keyboard(SIDevices device, int _iDeviceNumber);
// Run the SI Buffer
virtual int RunBuffer(u8* _pBuffer, int _iLength) override;
int RunBuffer(u8* _pBuffer, int _iLength) override;
// Return true on new data
virtual bool GetData(u32& _Hi, u32& _Low) override;
bool GetData(u32& _Hi, u32& _Low) override;
virtual KeyboardStatus GetKeyboardStatus();
virtual void MapKeys(KeyboardStatus& KeyStatus, u8* key);
KeyboardStatus GetKeyboardStatus();
void MapKeys(KeyboardStatus& KeyStatus, u8* key);
// Send a command directly
virtual void SendCommand(u32 _Cmd, u8 _Poll) override;
void SendCommand(u32 _Cmd, u8 _Poll) override;
// Savestate support
virtual void DoState(PointerWrap& p) override;
void DoState(PointerWrap& p) override;
};