Add permanent sound option, Split debug into menu, Clean
This commit is contained in:
parent
24c4c04945
commit
4368f327ae
|
@ -39,7 +39,7 @@
|
|||
android:id="@+id/unstable_option"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:focusable="true" />
|
||||
android:focusable="true" />
|
||||
</LinearLayout>
|
||||
</TableRow>
|
||||
|
||||
|
@ -135,6 +135,109 @@
|
|||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<TableRow
|
||||
android:layout_marginTop="20dp"
|
||||
android:gravity="center_vertical" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/optimization_text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:ems="10"
|
||||
android:gravity="center_vertical"
|
||||
android:text="@string/optimization_opts" />
|
||||
</TableRow>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="2dp"
|
||||
android:background="@drawable/list_item_border" />
|
||||
|
||||
<TableRow
|
||||
android:layout_marginTop="20dp"
|
||||
android:gravity="center_vertical" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/software_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_software" />
|
||||
|
||||
<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/software_option"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:focusable="true" />
|
||||
</LinearLayout>
|
||||
</TableRow>
|
||||
|
||||
<TableRow
|
||||
android:layout_marginTop="10dp"
|
||||
android:gravity="center_vertical" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/sound_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_sound" />
|
||||
|
||||
<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/sound_option"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:focusable="true" />
|
||||
</LinearLayout>
|
||||
</TableRow>
|
||||
|
||||
<TableRow
|
||||
android:layout_marginTop="10dp"
|
||||
android:gravity="center_vertical" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/force_gpu_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_force_gpu" />
|
||||
|
||||
<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/force_gpu_option"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:focusable="true" />
|
||||
</LinearLayout>
|
||||
</TableRow>
|
||||
|
||||
<TableRow
|
||||
android:layout_marginTop="10dp"
|
||||
android:gravity="center_vertical" >
|
||||
|
@ -166,6 +269,19 @@
|
|||
android:layout_marginTop="10dp"
|
||||
android:gravity="center_vertical" >
|
||||
|
||||
<Button
|
||||
android:id="@+id/debug_button"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:ems="8"
|
||||
android:text="@string/menu_debug" />
|
||||
</TableRow>
|
||||
|
||||
<TableRow
|
||||
android:layout_marginTop="20dp"
|
||||
android:gravity="center_vertical" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/experimental_text"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -176,8 +292,13 @@
|
|||
android:text="@string/experimental_opts" />
|
||||
</TableRow>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="2dp"
|
||||
android:background="@drawable/list_item_border" />
|
||||
|
||||
<TableRow
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:gravity="center_vertical" >
|
||||
|
||||
<TextView
|
||||
|
@ -316,75 +437,6 @@
|
|||
</EditText>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<TableRow
|
||||
android:layout_marginTop="10dp"
|
||||
android:gravity="center_vertical" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/software_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_software" />
|
||||
|
||||
<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/software_option"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:focusable="true" />
|
||||
</LinearLayout>
|
||||
</TableRow>
|
||||
|
||||
<TableRow
|
||||
android:layout_marginTop="10dp"
|
||||
android:gravity="center_vertical" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/force_gpu_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_force_gpu" />
|
||||
|
||||
<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/force_gpu_option"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:focusable="true" />
|
||||
</LinearLayout>
|
||||
</TableRow>
|
||||
|
||||
<TableRow
|
||||
android:layout_marginTop="10dp"
|
||||
android:gravity="center_vertical" >
|
||||
|
||||
<Button
|
||||
android:id="@+id/debug_button"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:ems="8"
|
||||
android:text="@string/menu_debug" />
|
||||
</TableRow>
|
||||
</TableLayout>
|
||||
</LinearLayout>
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
<string name="folder_bios">BOOT BIOS</string>
|
||||
<string name="folder_select">SELECT CURRENT FOLDER</string>
|
||||
|
||||
<string name="optimization_opts">Optimization and Debugging Options</string>
|
||||
<string name="experimental_opts">Experimental (May cause widespread panic)</string>
|
||||
<string name="select_dynarec">Dynarec Options</string>
|
||||
<string name="select_unstable">Unstable Optimisations</string>
|
||||
|
@ -26,6 +27,7 @@
|
|||
<string name="set_frameskip">Frameskip Value</string>
|
||||
<string name="select_render">PVR Rendering (does nothing for now)</string>
|
||||
<string name="select_software">Force Software Rendering</string>
|
||||
<string name="select_sound">Enable Emulator Sound</string>
|
||||
<string name="select_force_gpu">Force v6 GPU Config</string>
|
||||
<string name="default_disk">Set Default Disk</string>
|
||||
<string name="show_profiling_tools">Show BIOS Debug Tools</string>
|
||||
|
|
|
@ -144,6 +144,24 @@ public class ConfigureFragment extends Fragment {
|
|||
force_software_opt.setChecked(false);
|
||||
}
|
||||
force_software_opt.setOnCheckedChangeListener(force_software);
|
||||
|
||||
Switch sound_opt = (Switch) getView().findViewById(
|
||||
R.id.sound_option);
|
||||
OnCheckedChangeListener emu_sound = new OnCheckedChangeListener() {
|
||||
|
||||
public void onCheckedChanged(CompoundButton buttonView,
|
||||
boolean isChecked) {
|
||||
mPrefs.edit().putBoolean("sound_enabled", isChecked).commit();
|
||||
}
|
||||
};
|
||||
boolean sound = mPrefs.getBoolean("sound_enabled",
|
||||
true);
|
||||
if (sound) {
|
||||
sound_opt.setChecked(true);
|
||||
} else {
|
||||
sound_opt.setChecked(false);
|
||||
}
|
||||
sound_opt.setOnCheckedChangeListener(emu_sound);
|
||||
|
||||
OnCheckedChangeListener dynarec_options = new OnCheckedChangeListener() {
|
||||
|
||||
|
|
|
@ -482,6 +482,16 @@ public class GL2JNIActivity extends Activity {
|
|||
LayoutParams.WRAP_CONTENT);
|
||||
}
|
||||
|
||||
public void displayDebug(PopupWindow popUpDebug) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||
popUpDebug.showAtLocation(mView, Gravity.BOTTOM, 0, 60);
|
||||
} else {
|
||||
popUpDebug.showAtLocation(mView, Gravity.BOTTOM, 0, 0);
|
||||
}
|
||||
popUpDebug.update(LayoutParams.WRAP_CONTENT,
|
||||
LayoutParams.WRAP_CONTENT);
|
||||
}
|
||||
|
||||
public void displayConfig(PopupWindow popUpConfig) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||
popUpConfig.showAtLocation(mView, Gravity.BOTTOM, 0, 60);
|
||||
|
|
|
@ -54,7 +54,7 @@ public class GL2JNIView extends GLSurfaceView
|
|||
{
|
||||
private static String fileName;
|
||||
//private AudioThread audioThread;
|
||||
private EmuThread ethd = new EmuThread();
|
||||
private EmuThread ethd;
|
||||
|
||||
public static final boolean DEBUG = false;
|
||||
|
||||
|
@ -107,6 +107,7 @@ public class GL2JNIView extends GLSurfaceView
|
|||
System.gc();
|
||||
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
ethd = new EmuThread(prefs.getBoolean("sound_enabled", true));
|
||||
touchVibrationEnabled = prefs.getBoolean("touch_vibration_enabled", true);
|
||||
|
||||
int rederType = prefs.getInt("render_type", LAYER_TYPE_HARDWARE);
|
||||
|
@ -170,8 +171,9 @@ public class GL2JNIView extends GLSurfaceView
|
|||
|
||||
// Initialize audio
|
||||
//configAudio(44100,250);
|
||||
|
||||
|
||||
ethd.start();
|
||||
|
||||
}
|
||||
|
||||
public GLSurfaceView.Renderer getRenderer()
|
||||
|
@ -808,9 +810,15 @@ private static class ContextFactory implements GLSurfaceView.EGLContextFactory
|
|||
AudioTrack Player;
|
||||
long pos; //write position
|
||||
long size; //size in frames
|
||||
private boolean sound;
|
||||
|
||||
public EmuThread(boolean sound) {
|
||||
this.sound = sound;
|
||||
}
|
||||
|
||||
@Override public void run()
|
||||
{
|
||||
if (sound) {
|
||||
int min=AudioTrack.getMinBufferSize(44100,AudioFormat.CHANNEL_OUT_STEREO,AudioFormat.ENCODING_PCM_16BIT);
|
||||
|
||||
if (2048>min)
|
||||
|
@ -830,12 +838,14 @@ private static class ContextFactory implements GLSurfaceView.EGLContextFactory
|
|||
|
||||
Log.i("audcfg", "Audio streaming: buffer size " + min + " samples / " + min/44100.0 + " ms");
|
||||
Player.play();
|
||||
}
|
||||
|
||||
JNIdc.run(this);
|
||||
}
|
||||
|
||||
int WriteBuffer(short[] samples, int wait)
|
||||
{
|
||||
if (sound) {
|
||||
int newdata=samples.length/2;
|
||||
|
||||
if (wait==0)
|
||||
|
@ -853,6 +863,7 @@ private static class ContextFactory implements GLSurfaceView.EGLContextFactory
|
|||
pos+=newdata;
|
||||
|
||||
Player.write(samples, 0, samples.length);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -64,41 +64,13 @@ public class OnScreenMenu {
|
|||
|
||||
if (prefs.getBoolean("debug_profling_tools", false)) {
|
||||
|
||||
hlay.addView(addbut(R.drawable.clear_cache, new OnClickListener() {
|
||||
hlay.addView(addbut(R.drawable.disk_unknown, new OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
JNIdc.send(0, 0); // Killing texture cache
|
||||
displayDebugPopup(popUp);
|
||||
popUp.dismiss();
|
||||
}
|
||||
}), params);
|
||||
|
||||
hlay.addView(addbut(R.drawable.profiler, new OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
JNIdc.send(1, 3000); // sample_Start(param);
|
||||
popUp.dismiss();
|
||||
}
|
||||
}), params);
|
||||
|
||||
hlay.addView(addbut(R.drawable.profiler, new OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
JNIdc.send(1, 0); // sample_Start(param);
|
||||
popUp.dismiss();
|
||||
}
|
||||
}), params);
|
||||
|
||||
// hlay.addView(addbut(R.drawable.disk_unknown, new
|
||||
// OnClickListener() {
|
||||
// public void onClick(View v) {
|
||||
// JNIdc.send(0, 1); //settings.pvr.ta_skip
|
||||
// popUp.dismiss();
|
||||
// }
|
||||
// }), params);
|
||||
|
||||
hlay.addView(addbut(R.drawable.print_stats, new OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
JNIdc.send(0, 2);
|
||||
popUp.dismiss(); // print_stats=true;
|
||||
}
|
||||
}), params);
|
||||
}
|
||||
hlay.addView(addbut(R.drawable.vmu_swap, new OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
|
@ -119,7 +91,68 @@ public class OnScreenMenu {
|
|||
return popUp;
|
||||
}
|
||||
|
||||
|
||||
void displayDebugPopup(final PopupWindow popUp) {
|
||||
final PopupWindow popUpDebug = new PopupWindow(mContext);
|
||||
|
||||
int p = getPixelsFromDp(60, mContext);
|
||||
LayoutParams debugParams = new LayoutParams(p, p);
|
||||
|
||||
LinearLayout hlay = new LinearLayout(mContext);
|
||||
|
||||
hlay.setOrientation(LinearLayout.HORIZONTAL);
|
||||
|
||||
hlay.addView(addbut(R.drawable.close, new OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
popUpDebug.dismiss();
|
||||
}
|
||||
}), debugParams);
|
||||
|
||||
hlay.addView(addbut(R.drawable.clear_cache, new OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
JNIdc.send(0, 0); // Killing texture cache
|
||||
popUpDebug.dismiss();
|
||||
}
|
||||
}), debugParams);
|
||||
|
||||
hlay.addView(addbut(R.drawable.profiler, new OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
JNIdc.send(1, 3000); // sample_Start(param);
|
||||
popUpDebug.dismiss();
|
||||
}
|
||||
}), debugParams);
|
||||
|
||||
hlay.addView(addbut(R.drawable.profiler, new OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
JNIdc.send(1, 0); // sample_Start(param);
|
||||
popUpDebug.dismiss();
|
||||
}
|
||||
}), debugParams);
|
||||
|
||||
// hlay.addView(addbut(R.drawable.disk_unknown, new
|
||||
// OnClickListener() {
|
||||
// public void onClick(View v) {
|
||||
// JNIdc.send(0, 1); //settings.pvr.ta_skip
|
||||
// popUp.dismiss();
|
||||
// }
|
||||
// }), debugParams);
|
||||
|
||||
hlay.addView(addbut(R.drawable.print_stats, new OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
JNIdc.send(0, 2);
|
||||
popUpDebug.dismiss(); // print_stats=true;
|
||||
}
|
||||
}), debugParams);
|
||||
|
||||
hlay.addView(addbut(R.drawable.up, new OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
popUpDebug.dismiss();
|
||||
mContext.displayPopUp(popUp);
|
||||
}
|
||||
}), debugParams);
|
||||
|
||||
popUpDebug.setContentView(hlay);
|
||||
mContext.displayDebug(popUpDebug);
|
||||
}
|
||||
|
||||
void displayConfigPopup(final PopupWindow popUp) {
|
||||
final PopupWindow popUpConfig = new PopupWindow(mContext);
|
||||
|
@ -136,6 +169,7 @@ public class OnScreenMenu {
|
|||
popUpConfig.dismiss();
|
||||
}
|
||||
}), configParams);
|
||||
|
||||
View fullscreen;
|
||||
if (!widescreen) {
|
||||
fullscreen = addbut(R.drawable.widescreen, new OnClickListener() {
|
||||
|
@ -155,6 +189,7 @@ public class OnScreenMenu {
|
|||
});
|
||||
}
|
||||
hlay.addView(fullscreen, params);
|
||||
|
||||
View frames_up = addbut(R.drawable.frames_up, new OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
frameskip++;
|
||||
|
@ -165,6 +200,7 @@ public class OnScreenMenu {
|
|||
}
|
||||
});
|
||||
hlay.addView(frames_up, params);
|
||||
|
||||
if (frameskip >= 5) {
|
||||
frames_up.setEnabled(false);
|
||||
}
|
||||
|
@ -181,6 +217,7 @@ public class OnScreenMenu {
|
|||
if (frameskip <= 0) {
|
||||
frames_down.setEnabled(false);
|
||||
}
|
||||
|
||||
View framelimit;
|
||||
if (!limitframes) {
|
||||
framelimit = addbut(R.drawable.frames_limit_on,
|
||||
|
@ -202,27 +239,31 @@ public class OnScreenMenu {
|
|||
});
|
||||
}
|
||||
hlay.addView(framelimit, params);
|
||||
View audiosetting;
|
||||
if (!audiodisabled) {
|
||||
audiosetting = addbut(R.drawable.mute_sound,
|
||||
new OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
mContext.mView.audioDisable(true);
|
||||
popUpConfig.dismiss();
|
||||
audiodisabled = true;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
audiosetting = addbut(R.drawable.enable_sound,
|
||||
new OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
mContext.mView.audioDisable(false);
|
||||
popUpConfig.dismiss();
|
||||
audiodisabled = false;
|
||||
}
|
||||
});
|
||||
|
||||
if (prefs.getBoolean("sound_enabled", true)) {
|
||||
View audiosetting;
|
||||
if (!audiodisabled) {
|
||||
audiosetting = addbut(R.drawable.mute_sound,
|
||||
new OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
mContext.mView.audioDisable(true);
|
||||
popUpConfig.dismiss();
|
||||
audiodisabled = true;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
audiosetting = addbut(R.drawable.enable_sound,
|
||||
new OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
mContext.mView.audioDisable(false);
|
||||
popUpConfig.dismiss();
|
||||
audiodisabled = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
hlay.addView(audiosetting, params);
|
||||
}
|
||||
hlay.addView(audiosetting, params);
|
||||
|
||||
hlay.addView(addbut(R.drawable.up, new OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
popUpConfig.dismiss();
|
||||
|
|
Loading…
Reference in New Issue