wangyongj 1 anno fa
parent
commit
54bbd6bd10

BIN
android_4.4_haisi_zou_system.jks


+ 6 - 2
app/build.gradle

@@ -41,7 +41,10 @@ android {
         debug {
             keyAlias 'system'
             keyPassword 'xugame888'
-            storeFile file('../s905_system.jks')
+//            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')
 //            storeFile file('../android_10_system.jks')
             storePassword 'xugame888'
@@ -49,7 +52,8 @@ android {
         release {
             keyAlias 'system'
             keyPassword 'xugame888'
-            storeFile file('../s905_system.jks')
+//            storeFile file('../s905_system.jks')
+            storeFile file('../android_4.4_haisi_zou_system.jks')//android4.4
             storePassword 'xugame888'
         }
     }

BIN
app/release/Mt6572_Emulator_20230915.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"
+}

+ 8 - 0
app/src/main/java/com/xugame/app/JoypadManager.java

@@ -3,6 +3,8 @@ package com.xugame.app;
 import android.view.InputDevice;
 import android.view.MotionEvent;
 
+import com.xugame.gameconsole.util.DebugUtil;
+
 import java.util.ArrayList;
 import java.util.HashSet;
 
@@ -33,6 +35,9 @@ public class JoypadManager {
             return false;
         }
 
+        if(device.getName().equals("robot"))
+            return true;
+
         if (device.isVirtual()) {
             return false;
         }
@@ -92,8 +97,11 @@ class JoypadHandler_API extends JoypadHandler {
         int[] deviceIds = InputDevice.getDeviceIds();
 
         for (int deviceId : deviceIds) {
+//            DebugUtil.i("JOYPAD:",""+InputDevice.getDevice(deviceId).toString());
             if (!mJoypadIds.contains(deviceId)) {
                 if (JoypadManager.isDeviceJoystick(deviceId)) {
+//                    DebugUtil.i("JOYPAD has:",""+InputDevice.getDevice(deviceId).toString());
+
                     InputDevice joypadDevice = InputDevice.getDevice(deviceId);
                     mJoypadIds.add(deviceId);
                     JoypadManager.addJoystickNative(

+ 25 - 0
app/src/main/java/com/xugame/gameconsole/MainActivity.java

@@ -191,7 +191,32 @@ public class MainActivity extends PreferenceActivity implements View.OnClickList
         coreName = getIntent().getStringExtra("coreName");
         screenMode = getIntent().getIntExtra("screenMode", 0);
         checkCores();
+//        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());
+            try {
+                InputStream in = getResources().openRawResource(R.raw.robot);
+//            in = this.getResources().getAssets().open("xucores/"+fileName);
+//                in = new FileInputStream(file);
+                BufferedOutputStream outStream
+                        = new BufferedOutputStream(new FileOutputStream(getFilesDir().getParent() + File.separator + "autoconfig/android/robot.cfg", false));
+                byte[] buffer = new byte[1024];
+                int size;
+                while ((size = in.read(buffer)) > 0) {
+                    outStream.write(buffer, 0, size);
+                }
+                in.close();
+                outStream.flush();
+                outStream.close();
 
+
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
     }
 
     private void checkCores() {

+ 76 - 44
app/src/main/java/com/xugame/gameconsole/emulator/RetroArchEmulatorActivity.java

@@ -41,6 +41,7 @@ public class RetroArchEmulatorActivity extends RetroActivityCamera {
     private boolean quitfocus = false;
 
     private AppSystem system = null;
+    private boolean isBusy=false;
 
     @Override
     public void onCreate(Bundle savedInstanceState) {
@@ -112,6 +113,7 @@ public class RetroArchEmulatorActivity extends RetroActivityCamera {
         };
     }
 
+
     @Override
     public void showLocalExitDialog() {
 //        runOnUiThread(new Runnable() {
@@ -120,14 +122,26 @@ public class RetroArchEmulatorActivity extends RetroActivityCamera {
 //                showDialog();
 //            }
 //        });
-        Intent intent=new Intent();//调出主菜单UI
-        ComponentName componentName=new ComponentName("com.xugame.gameconsoleMenu",
-                "com.xugame.gameconsole.dialog.localgamesetting.LocalGameSettingDialog");
-        intent.setComponent(componentName);
-        startActivityForResult(intent,200);
-        DebugUtil.i(TAG,"showLocalExitDialog");
+        if(!isBusy){
+            isBusy=true;
+            Intent intent = new Intent();//调出主菜单UI
+            ComponentName componentName = new ComponentName("com.xugame.gameconsoleMenu",
+                    "com.xugame.gameconsole.dialog.localgamesetting.LocalGameSettingDialog");
+            intent.setComponent(componentName);
+            startActivityForResult(intent, 200);
+            DebugUtil.i(TAG, "showLocalExitDialog");
+        }
+    }
+
+    @Override
+    public void onPause() {
+        super.onPause();
+        isBusy=false;
+        DebugUtil.i(TAG,"onPause");
     }
 
+
+
     @Override
     public void onResume() {
         super.onResume();
@@ -173,21 +187,21 @@ public class RetroArchEmulatorActivity extends RetroActivityCamera {
             // This requires NVIDIA Android extensions (available on NVIDIA Shield), if they are not
             // available then nothing will be done
             if (retro.hasExtra("HIDEMOUSE")) hideMouseCursor();
-            int screenMode=retro.getIntExtra("screenMode",0);
-            if(screenMode>=0&&screenMode<3){
-                switch (screenMode) {
-                    case 0:
-                        setAspectRatio(AspectRatio.ASPECT_RATIO_CORE.getValue());
-                        break;
-                    case 1:
-                        setAspectRatio(AspectRatio.ASPECT_RATIO_FULL.getValue());
-                        break;
-                    case 2:
-                        setAspectRatio(AspectRatio.ASPECT_RATIO_CUSTOM.getValue());
-                        setCustomViewPort(Util.getSize(420), Util.getSize(87), Util.getSize(1080), Util.getSize(810));
-                        break;
-                }
-            }
+            int screenMode = retro.getIntExtra("screenMode", 0);
+//            if(screenMode>=0&&screenMode<3){
+//                switch (screenMode) {
+//                    case 0:
+//                        setAspectRatio(AspectRatio.ASPECT_RATIO_CORE.getValue());
+//                        break;
+//                    case 1:
+//                        setAspectRatio(AspectRatio.ASPECT_RATIO_FULL.getValue());
+//                        break;
+//                    case 2:
+//                        setAspectRatio(AspectRatio.ASPECT_RATIO_CUSTOM.getValue());
+//                        setCustomViewPort(Util.getSize(420), Util.getSize(87), Util.getSize(1080), Util.getSize(810));
+//                        break;
+//                }
+//            }
         }
 
         //Checks if Android versions is above 9.0 (28) and enable the screen to write over notch if the user desires
@@ -228,7 +242,7 @@ public class RetroArchEmulatorActivity extends RetroActivityCamera {
     @Override
     public void onStop() {
         super.onStop();
-
+        DebugUtil.i(TAG,"onStop");
         // If QUITFOCUS parameter was set then completely exit Retroarch when focus is lost
         if (quitfocus) System.exit(0);
     }
@@ -244,12 +258,30 @@ public class RetroArchEmulatorActivity extends RetroActivityCamera {
                     "com.xugame.gameconsole.dialog.localgamesetting.LocalGameSettingDialog");
            intent.setComponent(componentName);
             startActivityForResult(intent,200);
+//            setScan();
             return super.dispatchKeyEvent(event);
         }
 
         return super.dispatchKeyEvent(event);
     }
 
+    private int tempIndex = 0;
+
+    private void setScan() {
+        tempIndex++;
+        if (tempIndex >= 4)
+            tempIndex = 0;
+        DebugUtil.i(TAG,"tempIndex="+tempIndex);
+        if (tempIndex == 0)
+            switchFilter(null);
+        if (tempIndex == 1)
+            switchFilter("/data/user/0/com.xugame.gameconsole/filters/video/2xSaI.filt");
+        if (tempIndex == 2)
+            switchFilter("/data/user/0/com.xugame.gameconsole/filters/video/Scanline2x.filt");
+        if (tempIndex == 3)
+            switchFilter("/data/user/0/com.xugame.gameconsole/filters/video/Normal2x.filt");
+    }
+
     @Override
     public boolean onKeyDown(int keyCode, KeyEvent event) {
         DebugUtil.i(TAG, "onKeyDown=" + event.getKeyCode());
@@ -261,17 +293,17 @@ public class RetroArchEmulatorActivity extends RetroActivityCamera {
         if (mUpdateScreen) {
             switch (mScreenType) {
                 case NORMAL:
-                    switchFilter(null);
+                    switchFilter("/data/user/0/com.xugame.gameconsole/filters/video/Scale2x.filt");
                     break;
                 case SAI_2X:
-                    switchFilter("/data/user/0/com.xugame.gameconsole/filters/video/2xSaI.filt");
+                    switchFilter("/data/user/0/com.xugame.gameconsole/filters/video/LQ2x.filt");
                     break;
                 case SCANLINE:
-                    switchFilter("/data/user/0/com.xugame.gameconsole/filters/video/Scanline2x.filt");
+                    switchFilter("/data/user/0/com.xugame.gameconsole/filters/video/EPX.filt");
                     break;
             }
         }
-
+        DebugUtil.i(TAG,"onWindowFocusChanged"+hasFocus);
         super.onWindowFocusChanged(hasFocus);
     }
 
@@ -357,35 +389,35 @@ public class RetroArchEmulatorActivity extends RetroActivityCamera {
                 if (data != null) {
                     int scanLine = data.getIntExtra("scanLine", 0);
                     int screen = data.getIntExtra("screen", 0);
-                    DebugUtil.i(TAG,"scanline="+scanLine+"screen="+screen);
+                    DebugUtil.i(TAG, "scanline=" + scanLine + "screen=" + screen);
 
                     if (screen >= 0 && screen < 3) {
                         switch (screen) {
                             case 0:
-                                setAspectRatio(AspectRatio.ASPECT_RATIO_CORE.getValue());
-                                break;
-                            case 1:
-                                setAspectRatio(AspectRatio.ASPECT_RATIO_FULL.getValue());
-                                break;
-                            case 2:
                                 setAspectRatio(AspectRatio.ASPECT_RATIO_CUSTOM.getValue());
                                 setCustomViewPort(Util.getSize(420), Util.getSize(87), Util.getSize(1080), Util.getSize(810));
                                 break;
-                        }
-                    }
-                    if (scanLine >= 0 && scanLine < 3) {
-                        switch (ScreenType.values()[scanLine]) {
-                            case NORMAL:
-                                switchFilter(null);
-                                break;
-                            case SAI_2X:
-                                switchFilter("/data/user/0/com.xugame.gameconsole/filters/video/2xSaI.filt");
+                            case 1:
+                                setAspectRatio(AspectRatio.ASPECT_RATIO_CORE.getValue());
                                 break;
-                            case SCANLINE:
-                                switchFilter("/data/user/0/com.xugame.gameconsole/filters/video/Scanline2x.filt");
+                            case 2:
+                                setAspectRatio(AspectRatio.ASPECT_RATIO_FULL.getValue());
                                 break;
                         }
                     }
+//                    if (scanLine >= 0 && scanLine < 3) {
+//                        switch (ScreenType.values()[scanLine]) {
+//                            case NORMAL:
+//                                switchFilter(null);
+//                                break;
+//                            case SAI_2X:
+//                                switchFilter("/data/user/0/com.xugame.gameconsole/filters/video/2xSaI.filt");
+//                                break;
+//                            case SCANLINE:
+//                                switchFilter("/data/user/0/com.xugame.gameconsole/filters/video/Scanline2x.filt");
+//                                break;
+//                        }
+//                    }
                 }
             } else if (resultCode == 0) {
                 exitLocalGame();

+ 3 - 3
app/src/main/res/layout/dialog_gamemenu_layout.xml

@@ -51,7 +51,7 @@
             android:layout_height="wrap_content"
             android:checked="true"
             android:focusable="false"
-            android:text="Normal"
+            android:text="2x缩放"
             android:textColor="#000000"></RadioButton>
 
         <RadioButton
@@ -59,7 +59,7 @@
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:focusable="false"
-            android:text="2xSaI"
+            android:text="LQ缩放"
             android:textColor="#000000"></RadioButton>
 
         <RadioButton
@@ -67,7 +67,7 @@
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:focusable="false"
-            android:text="Scanline2x"
+            android:text="EPX缩放"
             android:textColor="#000000"></RadioButton>
     </RadioGroup>
 

+ 25 - 0
app/src/main/res/raw/robot.cfg

@@ -0,0 +1,25 @@
+input_driver = "android"
+input_device = "robot"
+input_device_display_name = "robot"
+input_vendor_id = "0"
+input_product_id = "0"
+input_b_btn = "97"
+input_b_btn_label = "B"
+input_a_btn = "96"
+input_a_btn_label = "A"
+input_select_btn = "104"
+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"

BIN
q5_t509_system.jks