Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #9049 from Ebola16/GCAC
GCAdapter_Android: Minor cleanup
  • Loading branch information
jordan-woyak committed Aug 31, 2020
2 parents 0a63340 + acd717f commit e0b64e0
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions Source/Core/InputCommon/GCAdapter_Android.cpp
Expand Up @@ -33,7 +33,7 @@ static jclass s_adapter_class;

static bool s_detected = false;
static int s_fd = 0;
static u8 s_controller_type[SerialInterface::MAX_SI_CHANNELS] = {
static std::array<u8, SerialInterface::MAX_SI_CHANNELS> s_controller_type = {
ControllerTypes::CONTROLLER_NONE, ControllerTypes::CONTROLLER_NONE,
ControllerTypes::CONTROLLER_NONE, ControllerTypes::CONTROLLER_NONE};
static u8 s_controller_rumble[4];
Expand Down Expand Up @@ -96,7 +96,7 @@ static void Write()
if (write_size)
{
jbyteArray jrumble_array = env->NewByteArray(5);
jbyte* jrumble = env->GetByteArrayElements(jrumble_array, NULL);
jbyte* jrumble = env->GetByteArrayElements(jrumble_array, nullptr);

{
std::lock_guard<std::mutex> lk(s_write_mutex);
Expand Down Expand Up @@ -129,7 +129,7 @@ static void Read()

jfieldID payload_field = env->GetStaticFieldID(s_adapter_class, "controller_payload", "[B");
jobject payload_object = env->GetStaticObjectField(s_adapter_class, payload_field);
jbyteArray* java_controller_payload = reinterpret_cast<jbyteArray*>(&payload_object);
auto* java_controller_payload = reinterpret_cast<jbyteArray*>(&payload_object);

// Get function pointers
jmethodID getfd_func = env->GetStaticMethodID(s_adapter_class, "GetFD", "()I");
Expand Down Expand Up @@ -225,8 +225,7 @@ static void Reset()
if (s_read_adapter_thread_running.TestAndClear())
s_read_adapter_thread.join();

for (int i = 0; i < SerialInterface::MAX_SI_CHANNELS; i++)
s_controller_type[i] = ControllerTypes::CONTROLLER_NONE;
s_controller_type.fill(ControllerTypes::CONTROLLER_NONE);

s_detected = false;
s_fd = 0;
Expand Down Expand Up @@ -260,7 +259,7 @@ GCPadStatus Input(int chan)
return {};

int payload_size = 0;
std::array<u8, 37> controller_payload_copy;
std::array<u8, 37> controller_payload_copy{};

{
std::lock_guard<std::mutex> lk(s_read_mutex);
Expand Down

0 comments on commit e0b64e0

Please sign in to comment.