Skip to content

Commit

Permalink
Merge pull request #1936 from lioncash/kb
Browse files Browse the repository at this point in the history
Minor keyboard-related cleanups.
  • Loading branch information
Sonicadvance1 committed Jan 22, 2015
2 parents bff230f + 52e74a5 commit db690a1
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 34 deletions.
31 changes: 17 additions & 14 deletions Source/Core/Core/Core.vcxproj.filters
Expand Up @@ -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>
Expand Down Expand Up @@ -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" />
Expand All @@ -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" />
Expand Down Expand Up @@ -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>
Expand Down Expand Up @@ -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>
24 changes: 12 additions & 12 deletions Source/Core/Core/HW/GCKeyboardEmu.cpp
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions Source/Core/Core/HW/SI_DeviceKeyboard.cpp
Expand Up @@ -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;
}
Expand Down
12 changes: 6 additions & 6 deletions Source/Core/Core/HW/SI_DeviceKeyboard.h
Expand Up @@ -50,17 +50,17 @@ class CSIDevice_Keyboard : public ISIDevice
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;
};

0 comments on commit db690a1

Please sign in to comment.