wangyongj 1 år sedan
förälder
incheckning
2209d721d9

+ 3 - 3
app/build.gradle

@@ -27,7 +27,7 @@ android {
 
     sourceSets {
         main {
-            // jniLibs.srcDirs 'src/main/libs'
+             jniLibs.srcDirs 'src/main/libs'
             assets.srcDirs = ['src/main/assets']
             jni.srcDirs = []
             java.srcDirs = ['src/main/java']
@@ -47,8 +47,8 @@ android {
         debug {
             keyAlias 'system'
             keyPassword 'xugame888'
-            storeFile file('../s905_system.jks')
-//            storeFile file('../android_4.4_haisi_zou_system.jks')//android4.4
+//            storeFile file('../s905_system.jks')
+            storeFile file('../android_4.4_haisi_zou_system.jks')//android4.4
 //            storeFile file('../q5_t509_system.jks')
 //            storeFile file('../q5_t509_system.jks')
 //            storeFile file('../3399_systemkey.jks')

BIN
app/release/app-release.apk


+ 20 - 0
app/release/output-metadata.json

@@ -0,0 +1,20 @@
+{
+  "version": 3,
+  "artifactType": {
+    "type": "APK",
+    "kind": "Directory"
+  },
+  "applicationId": "com.xugame.gameconsole",
+  "variantName": "release",
+  "elements": [
+    {
+      "type": "SINGLE",
+      "filters": [],
+      "attributes": [],
+      "versionCode": 1,
+      "versionName": "1.0",
+      "outputFile": "app-release.apk"
+    }
+  ],
+  "elementType": "File"
+}

+ 33 - 0
app/src/main/assets/autoconfig/android/sunxi_gpadc.cfg

@@ -0,0 +1,33 @@
+input_driver = "android"
+input_device = "sunxi-gpadc"
+input_device_display_name = "sunxi-gpadc"
+input_vendor_id = "1"
+input_product_id = "1"
+input_b_btn = "97"
+input_b_btn_label = "B"
+input_a_btn = "96"
+input_a_btn_label = "A"
+input_select_btn = "109"
+input_select_btn_label = "Select"
+input_start_btn = "108"
+input_start_btn_label = "Start"
+input_up_btn = "19"
+input_up_btn_label = "Up"
+input_down_btn = "20"
+input_down_btn_label = "Down"
+input_left_btn = "21"
+input_left_btn_label = "Left"
+input_right_btn = "22"
+input_right_btn_label = "Right"
+input_x_btn = "99"
+input_x_btn_label = "X"
+input_y_btn = "100"
+input_y_btn_label = "Y"
+input_l_x_plus_axis = "+0"
+input_l_x_minus_axis = "-0"
+input_l_y_plus_axis = "+1"
+input_l_y_minus_axis = "-1"
+input_r_x_plus_axis = "+2"
+input_r_x_minus_axis = "-2"
+input_r_y_plus_axis = "+3"
+input_r_y_minus_axis = "-3"

+ 2 - 1
app/src/main/java/com/xugame/app/JoypadManager.java

@@ -34,7 +34,8 @@ public class JoypadManager {
         if ((device == null) || (deviceId < 0)) {
             return false;
         }
-
+        if(device.getName().equals("sunxi-gpadc"))
+            return true;
         if(device.getName().equals("robot"))
             return true;
 

+ 6 - 4
app/src/main/java/com/xugame/gameconsole/MainActivity.java

@@ -177,6 +177,7 @@ public class MainActivity extends PreferenceActivity implements View.OnClickList
 
     private String baseUsbPath, corePath, romPath, coreName;
     private static int screenMode = 0;
+    private String romName;
 
     @Override
     protected void onCreate(Bundle savedInstanceState) {
@@ -193,10 +194,11 @@ public class MainActivity extends PreferenceActivity implements View.OnClickList
         checkCores();
 //        checkRobot();
     }
-    private void checkRobot(){
+
+    private void checkRobot() {
         File file = new File(this.getFilesDir().getParent() + File.separator + "autoconfig/android/robot.cfg");
-        if(!file.exists()){
-            DebugUtil.i("","复制robot"+file.getAbsolutePath());
+        if (!file.exists()) {
+            DebugUtil.i("", "复制robot" + file.getAbsolutePath());
             try {
                 InputStream in = getResources().openRawResource(R.raw.robot);
 //            in = this.getResources().getAssets().open("xucores/"+fileName);
@@ -294,7 +296,7 @@ public class MainActivity extends PreferenceActivity implements View.OnClickList
         // Bind audio stream to hardware controls.
         setVolumeControlStream(AudioManager.STREAM_MUSIC);
 
-        UserPreferences.updateConfigFile(this,baseUsbPath+File.separator+"/system");
+        UserPreferences.updateConfigFile(this, baseUsbPath + File.separator + "/system");
 
         checkRuntimePermissions();
     }

+ 63 - 18
app/src/main/java/com/xugame/gameconsole/emulator/RetroArchEmulatorActivity.java

@@ -20,6 +20,8 @@ import com.xugame.bean.SystemAVInfo;
 import com.xugame.gameconsole.dialog.LoadingDialog;
 import com.xugame.gameconsole.dialog.gamemenu.GameMenuDialog;
 import com.xugame.gameconsole.dialog.gamemenu.GameMenuDialogListener;
+import com.xugame.gameconsole.monitor.EmulatorMonitor;
+import com.xugame.gameconsole.monitor.EmulatorMonitorListener;
 import com.xugame.gameconsole.preferences.ConfigFile;
 import com.xugame.gameconsole.preferences.UserPreferences;
 import com.xugame.gameconsole.util.DebugUtil;
@@ -36,7 +38,8 @@ import java.lang.reflect.Method;
 //        libsPath = intent.getStringExtra("lib_path");
 //        configPath = intent.getStringExtra("config_path");
 //        }
-public class RetroArchEmulatorActivity extends RetroActivityCamera {
+public class RetroArchEmulatorActivity extends RetroActivityCamera
+        implements EmulatorMonitorListener {
     private static final String TAG = "RetroArchEmulatorActivityTAG";
     private ScreenType mScreenType = ScreenType.NORMAL;
     private boolean mUpdateScreen = false;
@@ -46,13 +49,15 @@ public class RetroArchEmulatorActivity extends RetroActivityCamera {
     private AppSystem system = null;
     private boolean isBusy = false;
     private LoadingDialog mLoadingDialog;
+    private EmulatorMonitor mEmulatorMonitor;
+    private String mRomPath;
 
     @Override
     public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
 
         system = new AppSystem();
-
+        mRomPath=getIntent().getStringExtra("ROM");
         callback = new EnvironmentCallback() {
             @Override
             public void setInputDescriptors(InputDescriptorBean[] descriptors) {
@@ -127,6 +132,7 @@ public class RetroArchEmulatorActivity extends RetroActivityCamera {
                 Log.i("EnvironmentCallback", geometry.toString());
             }
         };
+        mEmulatorMonitor = new EmulatorMonitor(this, this);
     }
 
 
@@ -159,6 +165,7 @@ public class RetroArchEmulatorActivity extends RetroActivityCamera {
                     }
                     ComponentName componentName = new ComponentName("com.xugame.gameconsoleMenu",
                             "com.xugame.gameconsole.dialog.localgamesetting.LocalGameSettingDialog");
+                    intent.putExtra("rompath",mRomPath);
                     intent.setComponent(componentName);
                     startActivityForResult(intent, 200);
                     DebugUtil.i(TAG, "showLocalExitDialog");
@@ -249,6 +256,14 @@ public class RetroArchEmulatorActivity extends RetroActivityCamera {
                 Log.w("Key doesn't exist yet.", e.getMessage());
             }
         }
+
+    }
+
+    @Override
+    public void onDestroy() {
+        super.onDestroy();
+        if (mEmulatorMonitor != null)
+            mEmulatorMonitor.unregister();
     }
 
     public void hideMouseCursor() {
@@ -420,26 +435,30 @@ public class RetroArchEmulatorActivity extends RetroActivityCamera {
                         int scanLine = data.getIntExtra("scanLine", 0);
                         int screen = data.getIntExtra("screen", 0);
                         DebugUtil.i(TAG, "scanline=" + scanLine + "screen=" + screen);
-                        if (mScreen != screen) {
-                            mScreen = screen;
-                            if (screen >= 0 && screen < 3) {
-                                switch (screen) {
-                                    case 0:
-                                        setAspectRatio(AspectRatio.ASPECT_RATIO_CUSTOM.getValue());
-                                        setCustomViewPort(Util.getSize(420), Util.getSize(87), Util.getSize(1080), Util.getSize(810));
-                                        break;
-                                    case 1:
-                                        setAspectRatio(AspectRatio.ASPECT_RATIO_CORE.getValue());
-                                        break;
-                                    case 2:
-                                        setAspectRatio(AspectRatio.ASPECT_RATIO_FULL.getValue());
-                                        break;
+//                        if (mScreen != screen) {
+                        mScreen = screen;
+                        if (screen >= 0 && screen < 3) {
+                            DebugUtil.i(TAG, "设置screen" + screen);
+                            switch (screen) {
+
+                                case 0:
+                                    setAspectRatio(AspectRatio.ASPECT_RATIO_CORE.getValue());
+//                                        setCustomViewPort(Util.getSize(420), Util.getSize(87), Util.getSize(1080), Util.getSize(810));
+                                    break;
+                                case 1:
+                                    setAspectRatio(AspectRatio.ASPECT_RATIO_4_3.getValue());
+                                    break;
+                                case 2:
+                                    setAspectRatio(AspectRatio.ASPECT_RATIO_FULL.getValue());
+                                    break;
 
-                                }
                             }
                         }
+//                        }
                         if (mScanline != scanLine) {
                             if (scanLine >= 0 && scanLine < 4) {
+                                DebugUtil.i(TAG, "设置scanLine" + scanLine + ScreenType.values()[scanLine]);
+
                                 switch (ScreenType.values()[scanLine]) {
                                     case NORMAL:
                                         switchFilter(null);
@@ -458,7 +477,7 @@ public class RetroArchEmulatorActivity extends RetroActivityCamera {
                         }
                     } else {
                         int multiple = data.getIntExtra("multiple", -1);
-                        DebugUtil.i(TAG,"multiple="+multiple);
+                        DebugUtil.i(TAG, "multiple=" + multiple);
                         if (multiple >= 2 && multiple <= 5) {
                             resetScreenForPerfect(multiple);
                         }
@@ -554,4 +573,30 @@ public class RetroArchEmulatorActivity extends RetroActivityCamera {
 //
 //        }
     }
+
+    @Override
+    public void onHomeClick() {
+        DebugUtil.i(TAG, "onHomeClick");
+    }
+
+    @Override
+    public void onRecentClick() {
+        DebugUtil.i(TAG, "onRecentClick");
+    }
+
+    @Override
+    public void onMenuSaveState(int index) {
+        DebugUtil.i(TAG, "saveState" + index);
+        if (index >= 0 && index < 10) {
+            saveState(index);
+        }
+    }
+
+    @Override
+    public void onMenuLoadState(int index) {
+        DebugUtil.i(TAG, "loadState" + index);
+        if (index >= 0 && index < 10) {
+            loadState(index);
+        }
+    }
 }

+ 3 - 0
app/src/main/java/com/xugame/gameconsole/preferences/UserPreferences.java

@@ -123,6 +123,9 @@ public class UserPreferences {
         config.setString("system_directory", systemDir);//20230829添加system路径设置
         DebugUtil.i(TAG,"write system dir:"+systemDir);
         config.setInt("input_player1_analog_dpad_mode", 1);
+        config.setInt("input_player2_analog_dpad_mode", 1);//设置2p摇杆
+        config.setInt("input_player3_analog_dpad_mode", 1);//
+        config.setInt("input_player4_analog_dpad_mode", 1);//
 
         config.setInt("frontend_log_level", 1);
         config.setInt("libretro_log_level", 1);

+ 1 - 1
app/src/main/java/com/xugame/gameconsole/util/DebugUtil.java

@@ -4,7 +4,7 @@ import android.util.Log;
 
 
 public class DebugUtil {
-    static private boolean DEBUG = true;
+    static private boolean DEBUG = false;
 
     public static void d(String tag, String msg) {
         if (DEBUG)