Debug option to emulate Ouya

This commit is contained in:
pelya
2013-09-01 20:02:42 +03:00
parent 14eb0dd1c0
commit 1c058ff98f
7 changed files with 51 additions and 10 deletions

View File

@@ -1,10 +1,6 @@
Known bugs (see also todo.txt)
==============================
- With 4:3 screen aspect ratio the on-screen buttons are not shown on the inactive part of screen.
- Put video at the center of the screen with 4:3 aspect ratio option
- Calling SDL_SetVideoMode() with SDL 1.3 several times makes it crash.
- Calling SDL_Init()/SDL_Quit() several times will make SDL 1.2 crash.

View File

@@ -121,4 +121,5 @@ class Globals
public static boolean BrokenLibCMessageShown = false;
// Gyroscope calibration
public static float gyro_x1, gyro_x2, gyro_xc, gyro_y1, gyro_y2, gyro_yc, gyro_z1, gyro_z2, gyro_zc;
public static boolean OuyaEmulation = false; // For debugging
}

View File

@@ -1072,7 +1072,7 @@ public class MainActivity extends Activity
return true;
} catch (PackageManager.NameNotFoundException e) {
}
return false;
return Globals.OuyaEmulation;
}
public boolean isCurrentOrientationHorizontal()

View File

@@ -170,6 +170,8 @@ class Settings
out.writeFloat(Globals.gyro_z2);
out.writeFloat(Globals.gyro_zc);
out.writeBoolean(Globals.OuyaEmulation);
out.close();
settingsLoaded = true;
@@ -349,6 +351,8 @@ class Settings
Globals.gyro_z2 = settingsFile.readFloat();
Globals.gyro_zc = settingsFile.readFloat();
Globals.OuyaEmulation = settingsFile.readBoolean();
settingsLoaded = true;
Log.i("SDL", "libSDL: Settings.Load(): loaded settings successfully");

View File

@@ -332,6 +332,7 @@ class SettingsMenuMisc extends SettingsMenu
static class VideoSettingsConfig extends Menu
{
static int debugMenuShowCount = 0;
String title(final MainActivity p)
{
return p.getResources().getString(R.string.video);
@@ -339,6 +340,7 @@ class SettingsMenuMisc extends SettingsMenu
//boolean enabled() { return true; };
void run (final MainActivity p)
{
debugMenuShowCount++;
CharSequence[] items = {
p.getResources().getString(R.string.pointandclick_keepaspectratio),
p.getResources().getString(R.string.video_smooth)
@@ -391,6 +393,48 @@ class SettingsMenuMisc extends SettingsMenu
}
});
builder.setPositiveButton(p.getResources().getString(R.string.ok), new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{
dialog.dismiss();
if( debugMenuShowCount > 5 || Globals.OuyaEmulation )
showDebugMenu(p);
else
goBack(p);
}
});
builder.setOnCancelListener(new DialogInterface.OnCancelListener()
{
public void onCancel(DialogInterface dialog)
{
goBack(p);
}
});
AlertDialog alert = builder.create();
alert.setOwnerActivity(p);
alert.show();
}
void showDebugMenu (final MainActivity p)
{
CharSequence[] items = {
"OUYA emulation"
};
boolean defaults[] = {
false,
};
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle("Debug settings");
builder.setMultiChoiceItems(items, defaults, new DialogInterface.OnMultiChoiceClickListener()
{
public void onClick(DialogInterface dialog, int item, boolean isChecked)
{
if( item == 0 )
Globals.OuyaEmulation = isChecked;
}
});
builder.setPositiveButton(p.getResources().getString(R.string.ok), new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{

View File

@@ -1,14 +1,10 @@
Requested features (see also bugs.txt)
======================================
- Redesign on-screen keyboard layout dialog, to show all keys, and to use dragon droppings.
- Option for default on-screen key theme in AndroidAppSettings.cfg.
- Select between normal mouse input and magnifying glass/relative input automatically, based on screen size.
- Split Settings.java into several files.
- Show/hide screen controls with longpress on Text Edit button.
- Floating on-screen joystick - initially invisible, it appears when you touch the screen,