Skip to content

add controller detection support from launcher #101

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

undefined06855
Copy link
Contributor

@undefined06855 undefined06855 commented Jun 4, 2025

requires geode-sdk/android-launcher #47 to get merged first before this would work, but wont break on an unsupported launcher
(marked as draft until launcher pr is merged)

@undefined06855 undefined06855 marked this pull request as draft June 4, 2025 19:51
@dankmeme01 dankmeme01 requested a review from Copilot June 9, 2025 12:56
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds controller detection support for Android by integrating with the launcher utility while keeping the legacy behavior for unsupported launchers intact.

  • Introduces an Android-specific code block using conditional compilation and JniHelper to check for connected controllers.
  • Removes legacy code and a constructor that previously retained the ControllerChecker instance in favor of launcher-based detection.
Comments suppressed due to low confidence (1)

src/main.cpp:276

  • The constructor removal may affect the object's lifetime management. Please confirm that the retention of ControllerChecker instances is now handled elsewhere.
ControllerChecker() { this->retain(); }

bool controllerConnected = GEODE_ANDROID(true || ) PlatformToolbox::isControllerConnected();
#ifdef GEODE_IS_ANDROID
bool controllerConnected = true;
JniMethodInfo info;
Copy link
Preview

Copilot AI Jun 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After calling CallStaticIntMethod, consider releasing the JNI local reference (e.g., info.classID) if needed to avoid potential local reference leaks.

Copilot uses AI. Check for mistakes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant