forked from ShuriZma/suyu
1
0
Fork 0

Merge pull request #1573 from wwylele/input_fix

Remove unnecessary const & replace pointer with reference
This commit is contained in:
bunnei 2016-03-26 14:09:26 -04:00
commit e366f60cff
2 changed files with 11 additions and 11 deletions

View File

@ -105,7 +105,7 @@ public:
* @todo Fix this function to be thread-safe. * @todo Fix this function to be thread-safe.
* @return PadState object indicating the current pad state * @return PadState object indicating the current pad state
*/ */
const Service::HID::PadState GetPadState() const { Service::HID::PadState GetPadState() const {
return pad_state; return pad_state;
} }
@ -116,7 +116,7 @@ public:
* @return std::tuple of (x, y, pressed) where `x` and `y` are the touch coordinates and * @return std::tuple of (x, y, pressed) where `x` and `y` are the touch coordinates and
* `pressed` is true if the touch screen is currently being pressed * `pressed` is true if the touch screen is currently being pressed
*/ */
const std::tuple<u16, u16, bool> GetTouchState() const { std::tuple<u16, u16, bool> GetTouchState() const {
return std::make_tuple(touch_x, touch_y, touch_pressed); return std::make_tuple(touch_x, touch_y, touch_pressed);
} }

View File

@ -83,17 +83,17 @@ void Update() {
PadState changed = { { (state.hex ^ old_state.hex) } }; PadState changed = { { (state.hex ^ old_state.hex) } };
// Get the current Pad entry // Get the current Pad entry
PadDataEntry* pad_entry = &mem->pad.entries[mem->pad.index]; PadDataEntry& pad_entry = mem->pad.entries[mem->pad.index];
// Update entry properties // Update entry properties
pad_entry->current_state.hex = state.hex; pad_entry.current_state.hex = state.hex;
pad_entry->delta_additions.hex = changed.hex & state.hex; pad_entry.delta_additions.hex = changed.hex & state.hex;
pad_entry->delta_removals.hex = changed.hex & old_state.hex;; pad_entry.delta_removals.hex = changed.hex & old_state.hex;;
// Set circle Pad // Set circle Pad
pad_entry->circle_pad_x = state.circle_left ? -MAX_CIRCLEPAD_POS : pad_entry.circle_pad_x = state.circle_left ? -MAX_CIRCLEPAD_POS :
state.circle_right ? MAX_CIRCLEPAD_POS : 0x0; state.circle_right ? MAX_CIRCLEPAD_POS : 0x0;
pad_entry->circle_pad_y = state.circle_down ? -MAX_CIRCLEPAD_POS : pad_entry.circle_pad_y = state.circle_down ? -MAX_CIRCLEPAD_POS :
state.circle_up ? MAX_CIRCLEPAD_POS : 0x0; state.circle_up ? MAX_CIRCLEPAD_POS : 0x0;
// If we just updated index 0, provide a new timestamp // If we just updated index 0, provide a new timestamp
@ -106,11 +106,11 @@ void Update() {
next_touch_index = (next_touch_index + 1) % mem->touch.entries.size(); next_touch_index = (next_touch_index + 1) % mem->touch.entries.size();
// Get the current touch entry // Get the current touch entry
TouchDataEntry* touch_entry = &mem->touch.entries[mem->touch.index]; TouchDataEntry& touch_entry = mem->touch.entries[mem->touch.index];
bool pressed = false; bool pressed = false;
std::tie(touch_entry->x, touch_entry->y, pressed) = VideoCore::g_emu_window->GetTouchState(); std::tie(touch_entry.x, touch_entry.y, pressed) = VideoCore::g_emu_window->GetTouchState();
touch_entry->valid.Assign(pressed ? 1 : 0); touch_entry.valid.Assign(pressed ? 1 : 0);
// TODO(bunnei): We're not doing anything with offset 0xA8 + 0x18 of HID SharedMemory, which // TODO(bunnei): We're not doing anything with offset 0xA8 + 0x18 of HID SharedMemory, which
// supposedly is "Touch-screen entry, which contains the raw coordinate data prior to being // supposedly is "Touch-screen entry, which contains the raw coordinate data prior to being