Android bonk

This commit is contained in:
wheremyfoodat 2023-12-13 22:47:32 +02:00
parent e6880b1564
commit 63a09dd51f
10 changed files with 1 additions and 23 deletions

View file

@ -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) {

View file

@ -17,7 +17,6 @@ import com.panda3ds.pandroid.view.PandaGlSurfaceView;
import com.panda3ds.pandroid.view.PandaLayoutController;
public class GameActivity extends BaseActivity {
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@ -31,14 +30,12 @@ public class GameActivity extends BaseActivity {
}
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));

View file

@ -40,7 +40,6 @@ public class MainActivity extends BaseActivity {
}
setContentView(R.layout.activity_main);
findViewById(R.id.load_rom).setOnClickListener(v -> { openFile(); });
}

View file

@ -83,10 +83,7 @@ public class PathUtils {
}
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()); }
}

View file

@ -11,9 +11,7 @@ import com.panda3ds.pandroid.view.controller.nodes.Joystick;
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) {

View file

@ -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) {
@ -131,7 +129,7 @@ public class ControllerLayout extends RelativeLayout {
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() {

View file

@ -17,6 +17,5 @@ public interface ControllerNode {
default boolean isVisible() { return ((View) this).isShown(); }
@NonNull Vector2 getSize();
void onTouch(TouchEvent event);
}

View file

@ -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) {

View file

@ -9,8 +9,6 @@ import com.panda3ds.pandroid.view.controller.ControllerNode;
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); }
}

View file

@ -20,11 +20,9 @@ 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) {
@ -99,7 +97,6 @@ public class Joystick extends BasicControllerNode implements ControllerNode {
y = Math.max(0, Math.min(middle * 2, y));
axisX = ((x - middle) / middle);
axisY = ((y - middle) / middle);
if (event.getAction() == TouchType.ACTION_UP) {