Add an option to enable ongoing VMU display, First in menu

This commit is contained in:
TwistedUmbrella 2014-02-13 05:08:55 -05:00
parent b98b087435
commit df50719777
7 changed files with 74 additions and 6 deletions

View File

@ -14,6 +14,34 @@
android:layout_height="wrap_content"
android:layout_marginLeft="6dp"
android:stretchColumns="*" >
<TableRow
android:layout_marginTop="20dp"
android:gravity="center_vertical" >
<TextView
android:id="@+id/vmu_disp_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:ems="10"
android:gravity="center_vertical|left"
android:text="@string/select_vmu_disp" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="right"
android:orientation="vertical" >
<de.ankri.views.Switch
android:id="@+id/vmu_disp_option"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:focusable="true" />
</LinearLayout>
</TableRow>
<TableRow
android:layout_marginTop="10dp"

View File

@ -18,6 +18,7 @@
<string name="optimization_opts">Optimization and Debugging Options</string>
<string name="experimental_opts">Experimental (May cause widespread panic)</string>
<string name="select_vmu_disp">Persistent VMU Display</string>
<string name="select_dynarec">Dynarec Options</string>
<string name="select_unstable">Unstable Optimisations</string>
<string name="select_region">DC Region</string>

View File

@ -311,6 +311,19 @@ public class ConfigureFragment extends Fragment {
int count) {
}
});
OnCheckedChangeListener vmu_option = new OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView,
boolean isChecked) {
mPrefs.edit().putBoolean("vmu_always_on", isChecked).commit();
}
};
Switch vmu_always_on = (Switch) getView()
.findViewById(R.id.vmu_disp_option);
boolean vmu_display = mPrefs.getBoolean("vmu_always_on", false);
vmu_always_on.setChecked(vmu_display);
vmu_always_on.setOnCheckedChangeListener(vmu_option);
Button debug_button = (Button) getView()
.findViewById(R.id.debug_button);

View File

@ -22,6 +22,7 @@ import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.ViewGroup.LayoutParams;
import android.view.Window;
import android.widget.LinearLayout;
import android.widget.PopupWindow;
import android.widget.Toast;
@ -33,6 +34,8 @@ public class GL2JNIActivity extends Activity {
public GL2JNIView mView;
OnScreenMenu menu;
PopupWindow popUp;
PopupWindow vmuPop;
public static Activity mActivity;
MOGAInput moga = new MOGAInput();
private SharedPreferences prefs;
static String[] portId = { "_A", "_B", "_C", "_D" };
@ -59,6 +62,10 @@ public class GL2JNIActivity extends Activity {
ConfigureFragment.getCurrentConfiguration(prefs);
menu = new OnScreenMenu(GL2JNIActivity.this, prefs);
popUp = menu.createPopup();
if (prefs.getBoolean("vmu_always_on", false)) {
vmuPop = menu.generateVMU();
}
mActivity = GL2JNIActivity.this;
/*
* try { //int rID =
@ -284,7 +291,6 @@ public class GL2JNIActivity extends Activity {
//setup vmu screen
JNIdc.setupVmu(menu.getVmuLcd());
}
private void runCompatibilityMode() {
@ -567,6 +573,13 @@ public class GL2JNIActivity extends Activity {
}
private boolean showMenu() {
if (prefs.getBoolean("vmu_always_on", false)) {
if (vmuPop != null && !vmuPop.isShowing()) {
vmuPop.showAtLocation(mView, Gravity.NO_GRAVITY, 20, 20);
vmuPop.update(LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT);
}
}
if (!popUp.isShowing()) {
displayPopUp(popUp);
} else {

View File

@ -182,7 +182,6 @@ public class GL2JNIView extends GLSurfaceView
//configAudio(44100,250);
ethd.start();
}
public GLSurfaceView.Renderer getRenderer()

View File

@ -32,7 +32,7 @@ public class JNIdc
public static native void cable(int cable);
public static native void region(int region);
public static native void broadcast(int broadcast);
public static native void limitfps(int stretch);
public static native void limitfps(int limiter);
public static native void nobatch(int nobatch);
public static native void mipmaps(int mipmaps);
public static native void widescreen(int stretch);

View File

@ -48,6 +48,18 @@ public class OnScreenMenu {
frameskip = ConfigureFragment.frameskip;
}
}
public PopupWindow generateVMU() {
PopupWindow vmuPop = new PopupWindow(mContext);
int p = OnScreenMenu.getPixelsFromDp(60, mContext);
LayoutParams params = new LayoutParams(p, p);
LinearLayout vlay = new LinearLayout(mContext);
vlay.setOrientation(LinearLayout.HORIZONTAL);
vmuLcd = new VmuLcd(mContext);
vlay.addView(vmuLcd, params);
vmuPop.setContentView(vlay);
return vmuPop;
}
public PopupWindow createPopup() {
final PopupWindow popUp = new PopupWindow(mContext);
@ -58,6 +70,11 @@ public class OnScreenMenu {
LinearLayout hlay = new LinearLayout(mContext);
hlay.setOrientation(LinearLayout.HORIZONTAL);
if (!prefs.getBoolean("vmu_always_on", false)) {
vmuLcd = new VmuLcd(mContext);
hlay.addView(vmuLcd, params);
}
hlay.addView(addbut(R.drawable.up, new OnClickListener() {
public void onClick(View v) {
@ -65,9 +82,6 @@ public class OnScreenMenu {
popUp.dismiss();
}
}), params);
vmuLcd = new VmuLcd(mContext);
hlay.addView(vmuLcd, params);
hlay.addView(addbut(R.drawable.vmu_swap, new OnClickListener() {
public void onClick(View v) {