From 34692ab826abc8f8faa61bdb2280b742424528f1 Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Sat, 7 Dec 2013 15:14:29 -0500 Subject: Remove unnecessary Src/ folders --- .../ControllerInterface/Android/Android.cpp | 95 ++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 Source/Core/InputCommon/ControllerInterface/Android/Android.cpp (limited to 'Source/Core/InputCommon/ControllerInterface/Android/Android.cpp') diff --git a/Source/Core/InputCommon/ControllerInterface/Android/Android.cpp b/Source/Core/InputCommon/ControllerInterface/Android/Android.cpp new file mode 100644 index 0000000000..5213b196d1 --- /dev/null +++ b/Source/Core/InputCommon/ControllerInterface/Android/Android.cpp @@ -0,0 +1,95 @@ +// Copyright (C) 2003 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#include "Android.h" + +namespace ciface +{ + +namespace Android +{ + +void Init( std::vector& devices ) +{ + devices.push_back(new Touchscreen(0)); + devices.push_back(new Touchscreen(1)); + devices.push_back(new Touchscreen(2)); + devices.push_back(new Touchscreen(3)); +} + +// Touchscreens and stuff +std::string Touchscreen::GetName() const +{ + return "Touchscreen"; +} + +std::string Touchscreen::GetSource() const +{ + return "Android"; +} + +int Touchscreen::GetId() const +{ + return 0; +} +Touchscreen::Touchscreen(int padID) + : _padID(padID) +{ + AddInput(new Button(_padID, ButtonManager::BUTTON_A)); + AddInput(new Button(_padID, ButtonManager::BUTTON_B)); + AddInput(new Button(_padID, ButtonManager::BUTTON_START)); + AddInput(new Button(_padID, ButtonManager::BUTTON_X)); + AddInput(new Button(_padID, ButtonManager::BUTTON_Y)); + AddInput(new Button(_padID, ButtonManager::BUTTON_Z)); + AddInput(new Button(_padID, ButtonManager::BUTTON_UP)); + AddInput(new Button(_padID, ButtonManager::BUTTON_DOWN)); + AddInput(new Button(_padID, ButtonManager::BUTTON_LEFT)); + AddInput(new Button(_padID, ButtonManager::BUTTON_RIGHT)); + AddAnalogInputs(new Axis(_padID, ButtonManager::STICK_MAIN_LEFT, -1.0f), new Axis(_padID, ButtonManager::STICK_MAIN_RIGHT)); + AddAnalogInputs(new Axis(_padID, ButtonManager::STICK_MAIN_UP, -1.0f), new Axis(_padID, ButtonManager::STICK_MAIN_DOWN)); + AddAnalogInputs(new Axis(_padID, ButtonManager::STICK_C_UP, -1.0f), new Axis(_padID, ButtonManager::STICK_C_DOWN)); + AddAnalogInputs(new Axis(_padID, ButtonManager::STICK_C_LEFT, -1.0f), new Axis(_padID, ButtonManager::STICK_C_RIGHT)); + AddAnalogInputs(new Axis(_padID, ButtonManager::TRIGGER_L), new Axis(_padID, ButtonManager::TRIGGER_L)); + AddAnalogInputs(new Axis(_padID, ButtonManager::TRIGGER_R), new Axis(_padID, ButtonManager::TRIGGER_R)); +} +// Buttons and stuff + +std::string Touchscreen::Button::GetName() const +{ + std::ostringstream ss; + ss << "Button " << (int)_index; + return ss.str(); +} + +ControlState Touchscreen::Button::GetState() const +{ + return ButtonManager::GetButtonPressed(_padID, _index); +} +std::string Touchscreen::Axis::GetName() const +{ + std::ostringstream ss; + ss << "Axis " << (int)_index; + return ss.str(); +} + +ControlState Touchscreen::Axis::GetState() const +{ + return ButtonManager::GetAxisValue(_padID, _index) * _neg; +} + +} +} -- cgit v1.2.3 From d2038049f51192fbb55fbde2fc08128bacfb7707 Mon Sep 17 00:00:00 2001 From: lioncash Date: Mon, 10 Feb 2014 13:54:46 -0500 Subject: Replace all include guard ifdefs with "#pragma once" --- .../ControllerInterface/Android/Android.cpp | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) (limited to 'Source/Core/InputCommon/ControllerInterface/Android/Android.cpp') diff --git a/Source/Core/InputCommon/ControllerInterface/Android/Android.cpp b/Source/Core/InputCommon/ControllerInterface/Android/Android.cpp index 5213b196d1..6ad7b13ad7 100644 --- a/Source/Core/InputCommon/ControllerInterface/Android/Android.cpp +++ b/Source/Core/InputCommon/ControllerInterface/Android/Android.cpp @@ -1,19 +1,6 @@ -// Copyright (C) 2003 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ +// Copyright 2013 Dolphin Emulator Project +// Licensed under GPLv2 +// Refer to the license.txt file included. #include "Android.h" -- cgit v1.2.3 From 2afe2152712981e21d6bda6f029292ed2b1cf91e Mon Sep 17 00:00:00 2001 From: Lioncash Date: Mon, 17 Feb 2014 05:18:15 -0500 Subject: Convert all includes to relative paths. --- Source/Core/InputCommon/ControllerInterface/Android/Android.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Core/InputCommon/ControllerInterface/Android/Android.cpp') diff --git a/Source/Core/InputCommon/ControllerInterface/Android/Android.cpp b/Source/Core/InputCommon/ControllerInterface/Android/Android.cpp index 6ad7b13ad7..fa97e8f222 100644 --- a/Source/Core/InputCommon/ControllerInterface/Android/Android.cpp +++ b/Source/Core/InputCommon/ControllerInterface/Android/Android.cpp @@ -2,7 +2,7 @@ // Licensed under GPLv2 // Refer to the license.txt file included. -#include "Android.h" +#include "InputCommon/ControllerInterface/Android/Android.h" namespace ciface { -- cgit v1.2.3 From e1bbda1e1884665ff52d5250458e40b7227a53bc Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Wed, 23 Apr 2014 03:49:25 -0500 Subject: [Android] Fix a bunch of input bugs. Looking at the old code for the ButtonManager was a brainfsck. This fixes a ton of bugs I kept uncovering as I was moving along. Fixes the gamepad configuration file being incorrect. No longer treats touchscreen in a special way. Ends up as a regular device with a "Touchscreen" device name. Was incorrectly converting a index from integer to ButtonType. Wouldn't work due to the addition of some unused(in JNI) enumerators in ButtonType. Fixes an issue where a map had a key as an axis which was causing its binding to be overwritten for every axis that was used twice (eg main stick left and right); Fixes Triggers not working at all. Fixes DPad not working at all. Fixes C-Stick only half working. Removes touch screen specific nativelibrary types onTouchAxisEvent and onTouchEvent. Adds a configuration version configuration option. Allows easy configuration overwriting if the options need to be changed during updating. Supersedes github PR #291. --- Source/Core/InputCommon/ControllerInterface/Android/Android.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'Source/Core/InputCommon/ControllerInterface/Android/Android.cpp') diff --git a/Source/Core/InputCommon/ControllerInterface/Android/Android.cpp b/Source/Core/InputCommon/ControllerInterface/Android/Android.cpp index fa97e8f222..0f6a6ed0a5 100644 --- a/Source/Core/InputCommon/ControllerInterface/Android/Android.cpp +++ b/Source/Core/InputCommon/ControllerInterface/Android/Android.cpp @@ -46,10 +46,10 @@ Touchscreen::Touchscreen(int padID) AddInput(new Button(_padID, ButtonManager::BUTTON_DOWN)); AddInput(new Button(_padID, ButtonManager::BUTTON_LEFT)); AddInput(new Button(_padID, ButtonManager::BUTTON_RIGHT)); - AddAnalogInputs(new Axis(_padID, ButtonManager::STICK_MAIN_LEFT, -1.0f), new Axis(_padID, ButtonManager::STICK_MAIN_RIGHT)); - AddAnalogInputs(new Axis(_padID, ButtonManager::STICK_MAIN_UP, -1.0f), new Axis(_padID, ButtonManager::STICK_MAIN_DOWN)); - AddAnalogInputs(new Axis(_padID, ButtonManager::STICK_C_UP, -1.0f), new Axis(_padID, ButtonManager::STICK_C_DOWN)); - AddAnalogInputs(new Axis(_padID, ButtonManager::STICK_C_LEFT, -1.0f), new Axis(_padID, ButtonManager::STICK_C_RIGHT)); + AddAnalogInputs(new Axis(_padID, ButtonManager::STICK_MAIN_LEFT), new Axis(_padID, ButtonManager::STICK_MAIN_RIGHT)); + AddAnalogInputs(new Axis(_padID, ButtonManager::STICK_MAIN_UP), new Axis(_padID, ButtonManager::STICK_MAIN_DOWN)); + AddAnalogInputs(new Axis(_padID, ButtonManager::STICK_C_LEFT), new Axis(_padID, ButtonManager::STICK_C_RIGHT)); + AddAnalogInputs(new Axis(_padID, ButtonManager::STICK_C_UP), new Axis(_padID, ButtonManager::STICK_C_DOWN)); AddAnalogInputs(new Axis(_padID, ButtonManager::TRIGGER_L), new Axis(_padID, ButtonManager::TRIGGER_L)); AddAnalogInputs(new Axis(_padID, ButtonManager::TRIGGER_R), new Axis(_padID, ButtonManager::TRIGGER_R)); } -- cgit v1.2.3 From 46057db37d086c47ff6c69f200f66648fa0e6c84 Mon Sep 17 00:00:00 2001 From: Rohit Nirmal Date: Thu, 18 Sep 2014 23:17:41 -0500 Subject: Fix build failing when disabling precompiled headers. --- Source/Core/InputCommon/ControllerInterface/Android/Android.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'Source/Core/InputCommon/ControllerInterface/Android/Android.cpp') diff --git a/Source/Core/InputCommon/ControllerInterface/Android/Android.cpp b/Source/Core/InputCommon/ControllerInterface/Android/Android.cpp index 0f6a6ed0a5..e29cfb0ce7 100644 --- a/Source/Core/InputCommon/ControllerInterface/Android/Android.cpp +++ b/Source/Core/InputCommon/ControllerInterface/Android/Android.cpp @@ -2,6 +2,7 @@ // Licensed under GPLv2 // Refer to the license.txt file included. +#include #include "InputCommon/ControllerInterface/Android/Android.h" namespace ciface -- cgit v1.2.3 From cefcb0ace9d363b3679b4e93bcc9ec05f1e5f4f8 Mon Sep 17 00:00:00 2001 From: Tillmann Karras Date: Mon, 18 May 2015 01:08:10 +0200 Subject: Update license headers to GPLv2+ --- Source/Core/InputCommon/ControllerInterface/Android/Android.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Core/InputCommon/ControllerInterface/Android/Android.cpp') diff --git a/Source/Core/InputCommon/ControllerInterface/Android/Android.cpp b/Source/Core/InputCommon/ControllerInterface/Android/Android.cpp index e29cfb0ce7..b0539b520f 100644 --- a/Source/Core/InputCommon/ControllerInterface/Android/Android.cpp +++ b/Source/Core/InputCommon/ControllerInterface/Android/Android.cpp @@ -1,5 +1,5 @@ // Copyright 2013 Dolphin Emulator Project -// Licensed under GPLv2 +// Licensed under GPLv2+ // Refer to the license.txt file included. #include -- cgit v1.2.3