From 8a9fcd3014a4aee23b6fb7008a02679f8bf96200 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sun, 14 Apr 2013 22:53:10 -0400 Subject: Kill off dangling else's in the InputCommon project. Some indentations were also too far for some things. Fixed this. Also update the license header to show Git instead of SVN. Got rid of some trailing spaces/tabs too. --- .../ControllerInterface/ControllerInterface.cpp | 25 ++++++++++++++-------- 1 file changed, 16 insertions(+), 9 deletions(-) (limited to 'Source/Core/InputCommon/Src/ControllerInterface/ControllerInterface.cpp') diff --git a/Source/Core/InputCommon/Src/ControllerInterface/ControllerInterface.cpp b/Source/Core/InputCommon/Src/ControllerInterface/ControllerInterface.cpp index 8e96231674..6a1427406d 100644 --- a/Source/Core/InputCommon/Src/ControllerInterface/ControllerInterface.cpp +++ b/Source/Core/InputCommon/Src/ControllerInterface/ControllerInterface.cpp @@ -157,7 +157,7 @@ bool ControllerInterface::UpdateOutput(const bool force) if (force) lk.lock(); else if (!lk.try_lock()) - return false; + return false; size_t ok_count = 0; @@ -173,7 +173,7 @@ bool ControllerInterface::UpdateOutput(const bool force) // // Device :: ~Device // -// dtor, delete all inputs/outputs on device destruction +// Destructor, delete all inputs/outputs on device destruction // ControllerInterface::Device::~Device() { @@ -209,9 +209,9 @@ void ControllerInterface::Device::AddOutput(Output* const o) // // Device :: ClearInputState // -// device classes should override this func -// ControllerInterface will call this when the device returns failure durring UpdateInput -// used to try to set all buttons and axes to their default state when user unplugs a gamepad durring play +// Device classes should override this function +// ControllerInterface will call this when the device returns failure during UpdateInput +// used to try to set all buttons and axes to their default state when user unplugs a gamepad during play // buttons/axes that were held down at the time of unplugging should be seen as not pressed after unplugging // void ControllerInterface::Device::ClearInputState() @@ -239,8 +239,10 @@ ControlState ControllerInterface::InputReference::State( const ControlState igno // bit of hax for "NOT" to work at start of expression if (ci != ce) + { if (ci->mode == 2) state = 1; + } for (; ci!=ce; ++ci) { @@ -354,7 +356,8 @@ bool ControllerInterface::DeviceQualifier::operator==(const ControllerInterface: if (name == devq.name) if (source == devq.source) return true; - return false; + + return false; } // @@ -421,7 +424,9 @@ void ControllerInterface::UpdateReference(ControllerInterface::ControlReference* break; // no terminating '`' character } else + { ctrl_str += c; + } } } @@ -478,7 +483,9 @@ ControllerInterface::Device::Control* ControllerInterface::InputReference::Detec return *i; } else if ((*i)->GetState() < (1 - INPUT_DETECT_THRESHOLD)) + { *state = false; + } } Common::SleepCurrentThread(10); time += 10; } @@ -490,8 +497,8 @@ ControllerInterface::Device::Control* ControllerInterface::InputReference::Detec // // OutputReference :: Detect // -// totally different from the inputReference detect / i have them combined so it was simplier to make the gui. -// the gui doesnt know the difference between an input and an output / its odd but i was lazy and it was easy +// Totally different from the inputReference detect / I have them combined so it was simpler to make the GUI. +// The GUI doesn't know the difference between an input and an output / it's odd but I was lazy and it was easy // // set all binded outputs to power for x milliseconds return false // @@ -499,7 +506,7 @@ ControllerInterface::Device::Control* ControllerInterface::OutputReference::Dete { // ignore device - // dont hang if we dont even have any controls mapped + // don't hang if we don't even have any controls mapped if (m_controls.size()) { State(1); -- cgit v1.2.3 From 44bbb54a62a58be4ad39caf6ba55ff98244223d5 Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Sun, 14 Apr 2013 23:02:53 -0500 Subject: Add a Androind ControllerInterface class for allowing input in a non-hacky way. Add a default GCPad.ini file so it actually works. --- .../InputCommon/Src/ControllerInterface/ControllerInterface.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'Source/Core/InputCommon/Src/ControllerInterface/ControllerInterface.cpp') diff --git a/Source/Core/InputCommon/Src/ControllerInterface/ControllerInterface.cpp b/Source/Core/InputCommon/Src/ControllerInterface/ControllerInterface.cpp index 8e96231674..dccd622519 100644 --- a/Source/Core/InputCommon/Src/ControllerInterface/ControllerInterface.cpp +++ b/Source/Core/InputCommon/Src/ControllerInterface/ControllerInterface.cpp @@ -15,6 +15,9 @@ #ifdef CIFACE_USE_SDL #include "SDL/SDL.h" #endif +#ifdef CIFACE_USE_ANDROID + #include "Android/Android.h" +#endif #include "Thread.h" @@ -50,6 +53,9 @@ void ControllerInterface::Initialize() #ifdef CIFACE_USE_SDL ciface::SDL::Init(m_devices); #endif +#ifdef CIFACE_USE_ANDROID + ciface::Android::Init(m_devices); +#endif m_is_init = true; } @@ -100,6 +106,9 @@ void ControllerInterface::Shutdown() // TODO: there seems to be some sort of memory leak with SDL, quit isn't freeing everything up SDL_Quit(); #endif +#ifdef CIFACE_USE_ANDROID + // nothing needed +#endif m_is_init = false; } -- cgit v1.2.3