Skip to content

Commit

Permalink
Merge pull request #11545 from Florin9doi/MOGA_STUB
Browse files Browse the repository at this point in the history
F-droid lite version - create stubs for Moga Controller
  • Loading branch information
hrydgard committed Nov 8, 2018
2 parents 99867ad + 8694c33 commit 3166029
Show file tree
Hide file tree
Showing 9 changed files with 123 additions and 4 deletions.
10 changes: 8 additions & 2 deletions android/build.gradle
Expand Up @@ -144,6 +144,12 @@ android {
afterEvaluate {
android.sourceSets.main.assets.getSrcDirs().each { println it }
}
dependencies {
implementation files('libs/com.bda.controller.jar')

// F-Droid lite version can be created with : ./gradlew assembleOptimized -Pf_droid
if (project.hasProperty("f_droid")) {
project.android.sourceSets.main.java.srcDirs += 'libs/MogaStubs'
} else {
project.dependencies {
implementation files('libs/com.bda.controller.jar')
}
}
39 changes: 39 additions & 0 deletions android/libs/MogaStubs/com/bda/controller/Controller.java
@@ -0,0 +1,39 @@
package com.bda.controller;

import android.app.Activity;
import android.os.Handler;
import android.view.SurfaceView;

public class Controller {
public static final int ACTION_VERSION_MOGA = 0;
public static final int STATE_CURRENT_PRODUCT_VERSION = 1;

static Controller sInstance;

private Controller() {}

public static Controller getInstance(Activity activity) {
if (sInstance == null) {
sInstance = new Controller();
}
return sInstance;
}
public int getState(int val) {
return 0;
}
public int setListener(SurfaceView view, Handler handler) {
return 0;
}
public int init() {
return 0;
}
public int onPause() {
return 0;
}
public int onResume() {
return 0;
}
public int exit() {
return 0;
}
}
@@ -0,0 +1,9 @@
package com.bda.controller;

public interface ControllerListener {
public abstract void onKeyEvent(KeyEvent event);

public abstract void onMotionEvent(MotionEvent event);

public abstract void onStateEvent(StateEvent state);
}
@@ -0,0 +1,4 @@
package com.bda.controller;

public class IControllerService {
}
20 changes: 20 additions & 0 deletions android/libs/MogaStubs/com/bda/controller/KeyEvent.java
@@ -0,0 +1,20 @@
package com.bda.controller;

public class KeyEvent {
public static final int ACTION_DOWN = 0;
public static final int ACTION_UP = 1;
public static final int KEYCODE_DPAD_UP = 2;
public static final int KEYCODE_DPAD_DOWN = 3;
public static final int KEYCODE_DPAD_LEFT = 4;
public static final int KEYCODE_DPAD_RIGHT = 5;

public int getAction() {
return 0;
}
public int getState(int val) {
return 0;
}
public int getKeyCode() {
return 0;
}
}
14 changes: 14 additions & 0 deletions android/libs/MogaStubs/com/bda/controller/MotionEvent.java
@@ -0,0 +1,14 @@
package com.bda.controller;

public class MotionEvent {
public static final int AXIS_X = 0;
public static final int AXIS_Y = 1;
public static final int AXIS_Z = 2;
public static final int AXIS_RZ = 3;
public static final int AXIS_LTRIGGER = 4;
public static final int AXIS_RTRIGGER = 5;

public int getAxisValue(int val) {
return 0;
}
}
19 changes: 19 additions & 0 deletions android/libs/MogaStubs/com/bda/controller/StateEvent.java
@@ -0,0 +1,19 @@
package com.bda.controller;

public class StateEvent {
public static final int STATE_POWER_LOW = 0;
public static final int STATE_CONNECTION = 1;

public static final int ACTION_FALSE = 0;
public static final int ACTION_TRUE = 1;
public static final int ACTION_DISCONNECTED = 2;
public static final int ACTION_CONNECTING = 3;
public static final int ACTION_CONNECTED = 4;

public int getAction() {
return 0;
}
public int getState() {
return 0;
}
}
6 changes: 5 additions & 1 deletion android/src/org/ppsspp/ppsspp/NativeGLView.java
Expand Up @@ -18,7 +18,11 @@
import android.os.Handler;
import android.util.Log;
import android.view.MotionEvent;
import com.bda.controller.*;

import com.bda.controller.Controller;
import com.bda.controller.ControllerListener;
import com.bda.controller.KeyEvent;
import com.bda.controller.StateEvent;

public class NativeGLView extends GLSurfaceView implements SensorEventListener, ControllerListener {
private static String TAG = "NativeGLView";
Expand Down
6 changes: 5 additions & 1 deletion android/src/org/ppsspp/ppsspp/NativeSurfaceView.java
Expand Up @@ -16,7 +16,11 @@
import android.util.Log;
import android.view.MotionEvent;
import android.view.SurfaceView;
import com.bda.controller.*;

import com.bda.controller.Controller;
import com.bda.controller.ControllerListener;
import com.bda.controller.KeyEvent;
import com.bda.controller.StateEvent;

public class NativeSurfaceView extends SurfaceView implements SensorEventListener, ControllerListener {
private static String TAG = "NativeSurfaceView";
Expand Down

0 comments on commit 3166029

Please sign in to comment.