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