wangyongj пре 1 година
родитељ
комит
c23a65ba42

+ 2 - 2
app/src/main/cpp/gfx/video_filters/normal5x.c

@@ -120,7 +120,7 @@ static void work_cb_xrgb8888(void *data, void *thread_data) {
 
         /* Row 1 */
         for (x = 0; x < thr->width; ++x) {
-            out_ptr[0] = out_ptr[1] = out_ptr[2] = out_ptr[4] = out_ptr[5] = *(input + x);
+            out_ptr[0] = out_ptr[1] = out_ptr[2] = out_ptr[3] = out_ptr[4] = *(input + x);
             out_ptr += 5;
         }
 
@@ -157,7 +157,7 @@ static void work_cb_rgb565(void *data, void *thread_data) {
 
         /* Row 1 */
         for (x = 0; x < thr->width; ++x) {
-            out_ptr[0] = out_ptr[1] = out_ptr[2] = out_ptr[4] = out_ptr[5] = *(input + x);
+            out_ptr[0] = out_ptr[1] = out_ptr[2] = out_ptr[3] = out_ptr[4] = *(input + x);
             out_ptr += 5;
         }
 

+ 78 - 48
app/src/main/java/com/xugame/gameconsole/emulator/RetroArchEmulatorActivity.java

@@ -151,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);
@@ -409,7 +415,7 @@ public class RetroArchEmulatorActivity extends RetroActivityCamera {
                 if (data != null) {
                     //增加完美像素单独开关,避免混淆
                     boolean isPixelPerfect = data.getBooleanExtra("is_pixelperfect", false);
-                    isPixelPerfect=true;
+//                    isPixelPerfect = true;
                     if (!isPixelPerfect) {
                         int scanLine = data.getIntExtra("scanLine", 0);
                         int screen = data.getIntExtra("screen", 0);
@@ -428,9 +434,7 @@ public class RetroArchEmulatorActivity extends RetroActivityCamera {
                                     case 2:
                                         setAspectRatio(AspectRatio.ASPECT_RATIO_FULL.getValue());
                                         break;
-                                    case 3:
-                                        resetScreenForPerfect();
-                                        break;
+
                                 }
                             }
                         }
@@ -453,7 +457,11 @@ public class RetroArchEmulatorActivity extends RetroActivityCamera {
                             }
                         }
                     } else {
-                        resetScreenForPerfect();
+                        int multiple = data.getIntExtra("multiple", -1);
+                        DebugUtil.i(TAG,"multiple="+multiple);
+                        if (multiple >= 2 && multiple <= 5) {
+                            resetScreenForPerfect(multiple);
+                        }
                     }
 
 
@@ -466,62 +474,84 @@ public class RetroArchEmulatorActivity extends RetroActivityCamera {
     }
 
 
-    private void resetScreenForPerfect() {
+    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;
 
-            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;
+            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");
+                DebugUtil.i(TAG, "file not found");
                 return;
             }
-            DebugUtil.i(TAG, "屏幕分辨率:" + screenX + "x" + screenY + "\n游戏原始WxH=" + w +
-                    "x" + h + "\n设置宽高:" + gameX + "x" + gameY+"\nmultiple"+multiple);
             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");
-
+                    + 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");
+//
+//        }
     }
 }