Skip to content

Commit

Permalink
Android bonk
Browse files Browse the repository at this point in the history
  • Loading branch information
wheremyfoodat committed Dec 13, 2023
1 parent e6880b1 commit 87326a5
Show file tree
Hide file tree
Showing 10 changed files with 2 additions and 24 deletions.
3 changes: 0 additions & 3 deletions src/jni_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,8 @@ AlberFunction(void, LoadRom)(JNIEnv* env, jobject obj, jstring path) {
}

AlberFunction(void, TouchScreenDown)(JNIEnv* env, jobject obj, jint x, jint y) { hidService->setTouchScreenPress((u16)x, (u16)y); }

AlberFunction(void, TouchScreenUp)(JNIEnv* env, jobject obj) { hidService->releaseTouchScreen(); }

AlberFunction(void, KeyUp)(JNIEnv* env, jobject obj, jint keyCode) { hidService->releaseKey((u32)keyCode); }

AlberFunction(void, KeyDown)(JNIEnv* env, jobject obj, jint keyCode) { hidService->pressKey((u32)keyCode); }

AlberFunction(void, SetCirclepadAxis)(JNIEnv* env, jobject obj, jint x, jint y) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import com.panda3ds.pandroid.view.PandaLayoutController;

public class GameActivity extends BaseActivity {

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Expand All @@ -31,14 +30,12 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
}

PandaGlSurfaceView pandaSurface = new PandaGlSurfaceView(this, intent.getStringExtra(Constants.ACTIVITY_PARAMETER_PATH));

setContentView(R.layout.game_activity);

((FrameLayout) findViewById(R.id.panda_gl_frame))
.addView(pandaSurface, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));

PandaLayoutController controllerLayout = findViewById(R.id.controller_layout);

controllerLayout.initialize();

((CheckBox) findViewById(R.id.hide_screen_controller)).setOnCheckedChangeListener((buttonView, isChecked) -> findViewById(R.id.overlay_controller).setVisibility(isChecked ? View.VISIBLE : View.INVISIBLE));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ protected void onCreate(Bundle savedInstanceState) {
}

setContentView(R.layout.activity_main);

findViewById(R.id.load_rom).setOnClickListener(v -> { openFile(); });
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,7 @@ public static String getDataColumn(Context context, Uri uri, String selection, S
}

public static boolean isExternalStorageDocument(Uri uri) { return "com.android.externalstorage.documents".equals(uri.getAuthority()); }

public static boolean isDownloadsDocument(Uri uri) { return "com.android.providers.downloads.documents".equals(uri.getAuthority()); }

public static boolean isMediaDocument(Uri uri) { return "com.android.providers.media.documents".equals(uri.getAuthority()); }

public static boolean isGooglePhotosUri(Uri uri) { return "com.google.android.apps.photos.content".equals(uri.getAuthority()); }
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@

public class PandaLayoutController extends ControllerLayout {
public PandaLayoutController(Context context) { super(context); }

public PandaLayoutController(Context context, AttributeSet attrs) { super(context, attrs); }

public PandaLayoutController(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); }

public PandaLayoutController(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ public class ControllerLayout extends RelativeLayout {
private final ArrayList<ControllerNode> controllerNodes = new ArrayList<>();

public ControllerLayout(Context context) { this(context, null); }

public ControllerLayout(Context context, AttributeSet attrs) { this(context, attrs, 0); }

public ControllerLayout(Context context, AttributeSet attrs, int defStyleAttr) { this(context, attrs, defStyleAttr, 0); }

public ControllerLayout(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
Expand Down Expand Up @@ -131,7 +129,7 @@ public void onViewRemoved(View child) {
refreshChildren();
}

/*@TODO: Need replace that methods for prevent Android send events directly to children*/
// TODO: Need to replace these methods to prevent Android sending events directly to children

@Override
public ArrayList<View> getTouchables() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,5 @@ default Vector2 getPosition() {
default boolean isVisible() { return ((View) this).isShown(); }

@NonNull Vector2 getSize();

void onTouch(TouchEvent event);
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ public class TouchEvent {
private final float x, y;

public float getX() { return x; }

public float getY() { return y; }

public TouchType getAction() { return action; }

public TouchEvent(float x, float y, TouchType action) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@

public abstract class BasicControllerNode extends AppCompatTextView implements ControllerNode {
public BasicControllerNode(@NonNull Context context) { super(context); }

public BasicControllerNode(@NonNull Context context, @Nullable AttributeSet attrs) { super(context, attrs); }

public BasicControllerNode(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); }
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,11 @@ public class Joystick extends BasicControllerNode implements ControllerNode {

private int width = 0;
private int height = 0;

private JoystickListener joystickListener;

public Joystick(Context context) { this(context, null); }

public Joystick(Context context, AttributeSet attrs) { this(context, attrs, 0); }

public Joystick(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);

Expand Down Expand Up @@ -99,7 +97,6 @@ public void onTouch(TouchEvent event) {
y = Math.max(0, Math.min(middle * 2, y));

axisX = ((x - middle) / middle);

axisY = ((y - middle) / middle);

if (event.getAction() == TouchType.ACTION_UP) {
Expand Down

0 comments on commit 87326a5

Please sign in to comment.