|
@@ -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");
|
|
|
+//
|
|
|
+// }
|
|
|
+ }
|
|
|
}
|