|
@@ -5,7 +5,6 @@ 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;
|
|
@@ -14,8 +13,6 @@ 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;
|
|
@@ -31,45 +28,23 @@ 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 implements
|
|
|
|
- EmulatorMonitorListener {
|
|
|
|
|
|
+public class RetroArchEmulatorActivity extends RetroActivityCamera {
|
|
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();
|
|
|
|
- Intent intent = new Intent();//调出主菜单UI
|
|
|
|
- ComponentName componentName = new ComponentName("com.xugame.gameconsoleMenu",
|
|
|
|
- "com.xugame.gameconsole.dialog.localgamesetting.LocalGameSettingDialog");
|
|
|
|
- intent.setComponent(componentName);
|
|
|
|
- startActivityForResult(intent, 200);
|
|
|
|
|
|
+ showDialog();
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
|
|
- DebugUtil.i(TAG, "showLocalExitDialog");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @Override
|
|
|
|
- public void onCreate(Bundle savedInstanceState) {
|
|
|
|
- super.onCreate(savedInstanceState);
|
|
|
|
- Util.init(this);
|
|
|
|
- mMonitor = new EmulatorMonitor(this, this);
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @Override
|
|
|
|
- public void onDestroy() {
|
|
|
|
- super.onDestroy();
|
|
|
|
- if (mMonitor != null)
|
|
|
|
- mMonitor.unregister();
|
|
|
|
|
|
+ DebugUtil.i(TAG,"showLocalExitDialog");
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -117,9 +92,8 @@ public class RetroArchEmulatorActivity extends RetroActivityCamera implements
|
|
// 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);
|
|
|
|
- DebugUtil.i(TAG,"onresume screen"+screenMode);
|
|
|
|
- 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());
|
|
@@ -178,37 +152,18 @@ public class RetroArchEmulatorActivity extends RetroActivityCamera implements
|
|
if (quitfocus) System.exit(0);
|
|
if (quitfocus) System.exit(0);
|
|
}
|
|
}
|
|
|
|
|
|
- int index = 0;
|
|
|
|
-
|
|
|
|
@Override
|
|
@Override
|
|
public boolean dispatchKeyEvent(KeyEvent event) {
|
|
public boolean dispatchKeyEvent(KeyEvent event) {
|
|
DebugUtil.i(TAG, "" + event.getKeyCode());
|
|
DebugUtil.i(TAG, "" + event.getKeyCode());
|
|
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);
|
|
|
|
-// switch (index) {
|
|
|
|
-// case 0:
|
|
|
|
-// setAspectRatio(AspectRatio.ASPECT_RATIO_CORE.getValue());
|
|
|
|
-// break;
|
|
|
|
-// case 1:
|
|
|
|
-// setAspectRatio(AspectRatio.ASPECT_RATIO_FULL.getValue());
|
|
|
|
-// break;
|
|
|
|
-// case 2:
|
|
|
|
-// setAspectRatio(AspectRatio.ASPECT_RATIO_CUSTOM.getValue());
|
|
|
|
-// setCustomViewPort(Util.getSize(420), Util.getSize(87), Util.getSize(1080), Util.getSize(810));
|
|
|
|
-// break;
|
|
|
|
-//
|
|
|
|
-// }
|
|
|
|
-// if (index >= 3)
|
|
|
|
-// index = 0;
|
|
|
|
-// else
|
|
|
|
-// index++;
|
|
|
|
- return true;
|
|
|
|
|
|
+ intent.setComponent(componentName);
|
|
|
|
+ startActivityForResult(intent,200);
|
|
|
|
+ return super.dispatchKeyEvent(event);
|
|
}
|
|
}
|
|
|
|
|
|
return super.dispatchKeyEvent(event);
|
|
return super.dispatchKeyEvent(event);
|
|
@@ -222,20 +177,19 @@ public class RetroArchEmulatorActivity extends RetroActivityCamera implements
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public void onWindowFocusChanged(boolean hasFocus) {
|
|
public void onWindowFocusChanged(boolean hasFocus) {
|
|
- DebugUtil.i(TAG, "onWindowFocusChanged" + hasFocus);
|
|
|
|
-// if (mUpdateScreen) {
|
|
|
|
-// switch (mScreenType) {
|
|
|
|
-// 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;
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
|
|
+ if (mUpdateScreen) {
|
|
|
|
+ switch (mScreenType) {
|
|
|
|
+ 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;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
super.onWindowFocusChanged(hasFocus);
|
|
super.onWindowFocusChanged(hasFocus);
|
|
}
|
|
}
|
|
@@ -321,9 +275,7 @@ public class RetroArchEmulatorActivity extends RetroActivityCamera implements
|
|
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);
|
|
|
|
- mUpdateScreen = true;
|
|
|
|
- gameDialogClosed();
|
|
|
|
|
|
+ DebugUtil.i(TAG,"scanline="+scanLine+"screen="+screen);
|
|
|
|
|
|
if (screen >= 0 && screen < 3) {
|
|
if (screen >= 0 && screen < 3) {
|
|
switch (screen) {
|
|
switch (screen) {
|
|
@@ -339,20 +291,19 @@ public class RetroArchEmulatorActivity extends RetroActivityCamera implements
|
|
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;
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
|
|
+ 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();
|
|
@@ -360,29 +311,4 @@ public class RetroArchEmulatorActivity extends RetroActivityCamera implements
|
|
}
|
|
}
|
|
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);
|
|
|
|
- }
|
|
|
|
}
|
|
}
|