9 Commits 7cbb9b4251 ... 828ef94174

Author SHA1 Message Date
  wangyongj 828ef94174 Merge branch 'master' of http://8.136.234.80:10002/WangYongJun/GameConsole 1 year ago
  wangyongj c23a65ba42 add main menu data swap 1 year ago
  wangyongj 5a78bd43aa Merge branch 'master' of http://8.136.234.80:10002/WangYongJun/GameConsole 1 year ago
  wangyongj 0741b6de52 sync 1 year ago
  wangyongj 326181a311 Merge branch 'master' of http://8.136.234.80:10002/WangYongJun/GameConsole 1 year ago
  wangyongj 7ab109e900 sync 1 year ago
  wangyongj d175ce878f Merge remote-tracking branch 'origin/master' 1 year ago
  wangyongj 6322d6cbdc Merge branch 'master' of http://8.136.234.80:10002/WangYongJun/GameConsole 1 year ago
  wangyongj 602f89fe8a sync 1 year ago

+ 2 - 2
app/build.gradle

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

+ 10 - 10
app/src/main/AndroidManifest.xml

@@ -63,18 +63,18 @@
 
             android:launchMode="singleTop">
             <intent-filter>
-                <action android:name="android.intent.action.MAIN" />
-                <category android:name="android.intent.category.LAUNCHER" />
-                <data
-                    android:host="com.xugame.gameconsole.TextCopyFileActivity"
-                    android:scheme="com.xugame.gameconsole.TextCopyFileActivity"
-                    tools:ignore="AppLinkUrlError" />
+<!--                <action android:name="android.intent.action.MAIN" />-->
 <!--                <category android:name="android.intent.category.LAUNCHER" />-->
+<!--                <data-->
+<!--                    android:host="com.xugame.gameconsole.TextCopyFileActivity"-->
+<!--                    android:scheme="com.xugame.gameconsole.TextCopyFileActivity"-->
+<!--                    tools:ignore="AppLinkUrlError" />-->
+                <category android:name="android.intent.category.LAUNCHER" />
 
-<!--                <action android:name="android.intent.action.MAIN" />-->
-<!--                <category android:name="android.intent.category.HOME" />-->
-<!--                <category android:name="android.intent.category.DEFAULT" />-->
-<!--                <category android:name="android.intent.category.MONKEY" />-->
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="android.intent.category.HOME" />
+                <category android:name="android.intent.category.DEFAULT" />
+                <category android:name="android.intent.category.MONKEY" />
             </intent-filter>
         </activity>
         <activity

+ 25 - 0
app/src/main/assets/autoconfig/android/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 = "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"

+ 2 - 2
app/src/main/java/com/xugame/bean/SystemAVInfo.java

@@ -141,8 +141,8 @@ public class SystemAVInfo {
     @NonNull
     @Override
     public String toString() {
-        return "fps: { " + this.geometry.toString() +
-                " }, sampleRate: { " + this.systemTiming.toString() +
+        return "geometry: { " + this.geometry.toString() +
+                " }, systemTiming: { " + this.systemTiming.toString() +
                 " }";
     }
 }

+ 135 - 33
app/src/main/java/com/xugame/gameconsole/emulator/RetroArchEmulatorActivity.java

@@ -25,6 +25,7 @@ import com.xugame.gameconsole.preferences.UserPreferences;
 import com.xugame.gameconsole.util.DebugUtil;
 import com.xugame.gameconsole.util.Util;
 
+import java.io.File;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 
@@ -150,6 +151,12 @@ public class RetroArchEmulatorActivity extends RetroActivityCamera {
                     else
                         mLoadingDialog.show();
                     Intent intent = new Intent();//调出主菜单UI
+                    if (system != null && system.systemAVInfo != null) {
+                        int w = system.systemAVInfo.getGeometry().getBaseWidth();
+                        int h = system.systemAVInfo.getGeometry().getBaseHeight();
+                        intent.putExtra("game_x", w);
+                        intent.putExtra("game_y", h);
+                    }
                     ComponentName componentName = new ComponentName("com.xugame.gameconsoleMenu",
                             "com.xugame.gameconsole.dialog.localgamesetting.LocalGameSettingDialog");
                     intent.setComponent(componentName);
@@ -406,45 +413,58 @@ public class RetroArchEmulatorActivity extends RetroActivityCamera {
             if (resultCode == 201) {//继续游戏
                 gameDialogClosed();
                 if (data != null) {
-                    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;
+                    //增加完美像素单独开关,避免混淆
+                    boolean isPixelPerfect = data.getBooleanExtra("is_pixelperfect", false);
+//                    isPixelPerfect = true;
+                    if (!isPixelPerfect) {
+                        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 (mScanline != scanLine) {
-                        if (scanLine >= 0 && scanLine < 4) {
-                            switch (ScreenType.values()[scanLine]) {
-                                case NORMAL:
-                                    switchFilter(null);
-                                    break;
-                                case SAI_2X:
-                                    switchFilter("/data/user/0/com.xugame.gameconsole/filters/video/Scale2x.filt");
-                                    break;
-                                case SCANLINE:
-                                    switchFilter("/data/user/0/com.xugame.gameconsole/filters/video/Scanline2x.filt");
-                                    break;
-                                case EPX:
-                                    switchFilter("/data/user/0/com.xugame.gameconsole/filters/video/EPX.filt");
-                                    break;
+                        if (mScanline != scanLine) {
+                            if (scanLine >= 0 && scanLine < 4) {
+                                switch (ScreenType.values()[scanLine]) {
+                                    case NORMAL:
+                                        switchFilter(null);
+                                        break;
+                                    case SAI_2X:
+                                        switchFilter("/data/user/0/com.xugame.gameconsole/filters/video/Scale2x.filt");
+                                        break;
+                                    case SCANLINE:
+                                        switchFilter("/data/user/0/com.xugame.gameconsole/filters/video/Scanline2x.filt");
+                                        break;
+                                    case EPX:
+                                        switchFilter("/data/user/0/com.xugame.gameconsole/filters/video/EPX.filt");
+                                        break;
+                                }
                             }
                         }
+                    } else {
+                        int multiple = data.getIntExtra("multiple", -1);
+                        DebugUtil.i(TAG,"multiple="+multiple);
+                        if (multiple >= 2 && multiple <= 5) {
+                            resetScreenForPerfect(multiple);
+                        }
                     }
 
+
                 }
             } else if (resultCode == 0) {
                 exitLocalGame();
@@ -452,4 +472,86 @@ public class RetroArchEmulatorActivity extends RetroActivityCamera {
         }
         super.onActivityResult(requestCode, resultCode, data);
     }
+
+
+    private void resetScreenForPerfect(int multiple) {
+        if (system != null && system.systemAVInfo != null) {
+            int w = system.systemAVInfo.getGeometry().getBaseWidth();
+            int h = system.systemAVInfo.getGeometry().getBaseHeight();
+            int screenX = Util.getScreenWidth();//屏幕真实大小
+            int screenY = Util.getScreenHeight();
+            int gameX = w * multiple;
+            int gameY = h * multiple;
+
+            setCustomViewPort((screenX - gameX) / 2, (screenY - gameY) / 2, gameX, gameY);
+//            setCustomWidth(gameX);
+//            setCustomHeight(gameY);
+
+            File file = new File("/data/user/0/com.xugame.gameconsole/filters/video/Normal" + multiple + "x.filt");
+            if (!file.exists()) {
+                DebugUtil.i(TAG, "file not found");
+                return;
+            }
+            setAspectRatio(AspectRatio.ASPECT_RATIO_CUSTOM.getValue());
+            switchFilter("/data/user/0/com.xugame.gameconsole/filters/video/Normal"
+                    + multiple + "x.filt");
+            DebugUtil.i(TAG, "屏幕分辨率:" + screenX + "x" + screenY + "\n游戏原始WxH=" + w +
+                    "x" + h + "\n设置宽高:" + gameX + "x" + gameY + "\nmultiple" + multiple);
+        }
+//        if (system != null && system.systemAVInfo != null) {
+//            int w = system.systemAVInfo.getGeometry().getBaseWidth();
+//            int h = system.systemAVInfo.getGeometry().getBaseHeight();
+//
+//            int screenX = Util.getScreenWidth();//屏幕真实大小
+//            int screenY = Util.getScreenHeight();
+//
+//            int multiple = -1;//动态统一缩放倍数
+//
+//            int gameX = -1;
+//            int gameY = -1;
+//            if (screenX > screenY) {//屏幕宽为最大值
+//                multiple = screenY / h;
+//                gameY = multiple * h;//以高为准
+//                gameX = (gameY * w) / h;
+//            } else if (screenX < screenY) {//屏幕高为最大值
+//                multiple = screenX / w;
+//                gameX = multiple * w;//以宽为准
+//                gameY = (gameX * h) / w;
+//            } else if (screenX == screenY) {//以最小倍数为准
+//                int tempX = screenX / w * w;
+//                int tempY = screenY / h * h;
+//                if (tempX > tempY) {
+//                    multiple = tempY;
+//                    gameY = tempY * h;
+//                    gameX = (gameY * w) / h;
+//                } else if (tempX < tempY) {
+//                    multiple = tempX;
+//                    gameX = tempX * w;
+//                    gameY = (gameX * h) / w;
+//                } else if (tempX == tempY) {
+//                    multiple = tempX;
+//                    gameX = tempX * w;
+//                    gameY = tempY * h;
+//                }
+//            }
+//            if (multiple <= 0)
+//                return;
+//
+//            File file = new File("/data/user/0/com.xugame.gameconsole/filters/video/Normal" + multiple + "x.filt");
+//            if (!file.exists()) {
+//                DebugUtil.i(TAG, "file not found");
+//                return;
+//            }
+//
+//            setAspectRatio(AspectRatio.ASPECT_RATIO_CUSTOM.getValue());
+//
+//            setCustomViewPort((screenX - gameX) / 2, (screenY - gameY) / 2, gameX, gameY);
+////            setCustomWidth(gameX);
+////            setCustomHeight(gameY);
+//
+//            switchFilter("/data/user/0/com.xugame.gameconsole/filters/video/Normal"
+//                    + multiple + "x.filt");
+//
+//        }
+    }
 }