|
@@ -5,6 +5,7 @@ import android.content.Context;
|
|
import android.content.Intent;
|
|
import android.content.Intent;
|
|
import android.hardware.input.InputManager;
|
|
import android.hardware.input.InputManager;
|
|
import android.os.Build;
|
|
import android.os.Build;
|
|
|
|
+import android.os.Bundle;
|
|
import android.util.Log;
|
|
import android.util.Log;
|
|
import android.view.KeyEvent;
|
|
import android.view.KeyEvent;
|
|
import android.view.View;
|
|
import android.view.View;
|
|
@@ -13,6 +14,8 @@ import android.view.WindowManager;
|
|
import com.retroarch.browser.retroactivity.AspectRatio;
|
|
import com.retroarch.browser.retroactivity.AspectRatio;
|
|
import com.xugame.gameconsole.dialog.gamemenu.GameMenuDialog;
|
|
import com.xugame.gameconsole.dialog.gamemenu.GameMenuDialog;
|
|
import com.xugame.gameconsole.dialog.gamemenu.GameMenuDialogListener;
|
|
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.ConfigFile;
|
|
import com.xugame.gameconsole.preferences.UserPreferences;
|
|
import com.xugame.gameconsole.preferences.UserPreferences;
|
|
import com.xugame.gameconsole.util.DebugUtil;
|
|
import com.xugame.gameconsole.util.DebugUtil;
|
|
@@ -28,23 +31,44 @@ import java.lang.reflect.Method;
|
|
// libsPath = intent.getStringExtra("lib_path");
|
|
// libsPath = intent.getStringExtra("lib_path");
|
|
// configPath = intent.getStringExtra("config_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 static final String TAG = "RetroArchEmulatorActivityTAG";
|
|
private ScreenType mScreenType = ScreenType.NORMAL;
|
|
private ScreenType mScreenType = ScreenType.NORMAL;
|
|
private boolean mUpdateScreen = false;
|
|
private boolean mUpdateScreen = false;
|
|
// If set to true then Retroarch will completely exit when it loses focus
|
|
// If set to true then Retroarch will completely exit when it loses focus
|
|
private boolean quitfocus = false;
|
|
private boolean quitfocus = false;
|
|
|
|
+ private EmulatorMonitor mMonitor;
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public void showLocalExitDialog() {
|
|
public void showLocalExitDialog() {
|
|
runOnUiThread(new Runnable() {
|
|
runOnUiThread(new Runnable() {
|
|
@Override
|
|
@Override
|
|
public void run() {
|
|
public void run() {
|
|
- showDialog();
|
|
|
|
|
|
+// 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");
|
|
|
|
|
|
+ DebugUtil.i(TAG, "showLocalExitDialog");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void onCreate(Bundle savedInstanceState) {
|
|
|
|
+ super.onCreate(savedInstanceState);
|
|
|
|
+ mMonitor = new EmulatorMonitor(this, this);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void onDestroy() {
|
|
|
|
+ super.onDestroy();
|
|
|
|
+ if (mMonitor != null)
|
|
|
|
+ mMonitor.unregister();
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -92,8 +116,8 @@ public class RetroArchEmulatorActivity extends RetroActivityCamera {
|
|
// This requires NVIDIA Android extensions (available on NVIDIA Shield), if they are not
|
|
// This requires NVIDIA Android extensions (available on NVIDIA Shield), if they are not
|
|
// available then nothing will be done
|
|
// available then nothing will be done
|
|
if (retro.hasExtra("HIDEMOUSE")) hideMouseCursor();
|
|
if (retro.hasExtra("HIDEMOUSE")) hideMouseCursor();
|
|
- int screenMode=retro.getIntExtra("screenMode",0);
|
|
|
|
- if(screenMode>=0&&screenMode<3){
|
|
|
|
|
|
+ int screenMode = retro.getIntExtra("screenMode", 0);
|
|
|
|
+ if (screenMode >= 0 && screenMode < 3) {
|
|
switch (screenMode) {
|
|
switch (screenMode) {
|
|
case 0:
|
|
case 0:
|
|
setAspectRatio(AspectRatio.ASPECT_RATIO_CORE.getValue());
|
|
setAspectRatio(AspectRatio.ASPECT_RATIO_CORE.getValue());
|
|
@@ -158,11 +182,11 @@ public class RetroArchEmulatorActivity extends RetroActivityCamera {
|
|
if (event.getKeyCode() == KeyEvent.KEYCODE_BACK
|
|
if (event.getKeyCode() == KeyEvent.KEYCODE_BACK
|
|
&& event.getAction() == KeyEvent.ACTION_DOWN) {
|
|
&& event.getAction() == KeyEvent.ACTION_DOWN) {
|
|
// showDialog();
|
|
// showDialog();
|
|
- Intent intent=new Intent();//调出主菜单UI
|
|
|
|
- ComponentName componentName=new ComponentName("com.xugame.gameconsoleMenu",
|
|
|
|
|
|
+ Intent intent = new Intent();//调出主菜单UI
|
|
|
|
+ ComponentName componentName = new ComponentName("com.xugame.gameconsoleMenu",
|
|
"com.xugame.gameconsole.dialog.localgamesetting.LocalGameSettingDialog");
|
|
"com.xugame.gameconsole.dialog.localgamesetting.LocalGameSettingDialog");
|
|
- intent.setComponent(componentName);
|
|
|
|
- startActivityForResult(intent,200);
|
|
|
|
|
|
+ intent.setComponent(componentName);
|
|
|
|
+ startActivityForResult(intent, 200);
|
|
return super.dispatchKeyEvent(event);
|
|
return super.dispatchKeyEvent(event);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -275,8 +299,8 @@ public class RetroArchEmulatorActivity extends RetroActivityCamera {
|
|
if (data != null) {
|
|
if (data != null) {
|
|
int scanLine = data.getIntExtra("scanLine", 0);
|
|
int scanLine = data.getIntExtra("scanLine", 0);
|
|
int screen = data.getIntExtra("screen", 0);
|
|
int screen = data.getIntExtra("screen", 0);
|
|
- DebugUtil.i(TAG,"scanline="+scanLine+"screen="+screen);
|
|
|
|
-
|
|
|
|
|
|
+ DebugUtil.i(TAG, "scanline=" + scanLine + "screen=" + screen);
|
|
|
|
+ mUpdateScreen = true;
|
|
if (screen >= 0 && screen < 3) {
|
|
if (screen >= 0 && screen < 3) {
|
|
switch (screen) {
|
|
switch (screen) {
|
|
case 0:
|
|
case 0:
|
|
@@ -291,19 +315,21 @@ public class RetroArchEmulatorActivity extends RetroActivityCamera {
|
|
break;
|
|
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;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ gameDialogClosed();
|
|
|
|
+
|
|
|
|
+// 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) {
|
|
} else if (resultCode == 0) {
|
|
exitLocalGame();
|
|
exitLocalGame();
|
|
@@ -311,4 +337,29 @@ public class RetroArchEmulatorActivity extends RetroActivityCamera {
|
|
}
|
|
}
|
|
super.onActivityResult(requestCode, resultCode, data);
|
|
super.onActivityResult(requestCode, resultCode, data);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void onHomeClick() {
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void onRecentClick() {
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void onMenuSaveState(int index) {
|
|
|
|
+ DebugUtil.i(TAG,"onMenuSaveState"+index);
|
|
|
|
+ boolean isOk=saveState(index);
|
|
|
|
+ if(isOk){
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void onMenuLoadState(int index) {
|
|
|
|
+ DebugUtil.i(TAG,"onMenuLoadState"+index);
|
|
|
|
+ loadState(index);
|
|
|
|
+ }
|
|
}
|
|
}
|