mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-15 05:47:56 -07:00
GCAdapter_Android: Minor cleanup
This commit is contained in:
parent
c36ae84b96
commit
acd717ffae
@ -33,7 +33,7 @@ static jclass s_adapter_class;
|
|||||||
|
|
||||||
static bool s_detected = false;
|
static bool s_detected = false;
|
||||||
static int s_fd = 0;
|
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,
|
||||||
ControllerTypes::CONTROLLER_NONE, ControllerTypes::CONTROLLER_NONE};
|
ControllerTypes::CONTROLLER_NONE, ControllerTypes::CONTROLLER_NONE};
|
||||||
static u8 s_controller_rumble[4];
|
static u8 s_controller_rumble[4];
|
||||||
@ -96,7 +96,7 @@ static void Write()
|
|||||||
if (write_size)
|
if (write_size)
|
||||||
{
|
{
|
||||||
jbyteArray jrumble_array = env->NewByteArray(5);
|
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);
|
std::lock_guard<std::mutex> lk(s_write_mutex);
|
||||||
@ -129,7 +129,7 @@ static void Read()
|
|||||||
|
|
||||||
jfieldID payload_field = env->GetStaticFieldID(s_adapter_class, "controller_payload", "[B");
|
jfieldID payload_field = env->GetStaticFieldID(s_adapter_class, "controller_payload", "[B");
|
||||||
jobject payload_object = env->GetStaticObjectField(s_adapter_class, payload_field);
|
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
|
// Get function pointers
|
||||||
jmethodID getfd_func = env->GetStaticMethodID(s_adapter_class, "GetFD", "()I");
|
jmethodID getfd_func = env->GetStaticMethodID(s_adapter_class, "GetFD", "()I");
|
||||||
@ -225,8 +225,7 @@ static void Reset()
|
|||||||
if (s_read_adapter_thread_running.TestAndClear())
|
if (s_read_adapter_thread_running.TestAndClear())
|
||||||
s_read_adapter_thread.join();
|
s_read_adapter_thread.join();
|
||||||
|
|
||||||
for (int i = 0; i < SerialInterface::MAX_SI_CHANNELS; i++)
|
s_controller_type.fill(ControllerTypes::CONTROLLER_NONE);
|
||||||
s_controller_type[i] = ControllerTypes::CONTROLLER_NONE;
|
|
||||||
|
|
||||||
s_detected = false;
|
s_detected = false;
|
||||||
s_fd = 0;
|
s_fd = 0;
|
||||||
@ -260,7 +259,7 @@ GCPadStatus Input(int chan)
|
|||||||
return {};
|
return {};
|
||||||
|
|
||||||
int payload_size = 0;
|
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);
|
std::lock_guard<std::mutex> lk(s_read_mutex);
|
||||||
|
Loading…
Reference in New Issue
Block a user