Merge pull request #249 from NoblesseOblige/master
Cleaning up and enhancing the runtime configuration menu
This commit is contained in:
commit
37d9060b17
|
@ -207,12 +207,15 @@ void dc_term()
|
|||
plugins_Term();
|
||||
_vmem_release();
|
||||
|
||||
#ifndef _ANDROID
|
||||
SaveSettings();
|
||||
#endif
|
||||
SaveRomFiles(GetPath("/data/"));
|
||||
}
|
||||
|
||||
void LoadSettings()
|
||||
{
|
||||
#ifndef _ANDROID
|
||||
settings.dynarec.Enable = cfgLoadInt("config","Dynarec.Enabled", 1)!=0;
|
||||
settings.dynarec.idleskip = cfgLoadInt("config","Dynarec.idleskip",1)!=0;
|
||||
settings.dynarec.unstable_opt = cfgLoadInt("config","Dynarec.unstable-opt",0);
|
||||
|
@ -229,6 +232,7 @@ void LoadSettings()
|
|||
|
||||
settings.pvr.ta_skip = cfgLoadInt("config","ta.skip",0);
|
||||
settings.pvr.rend = cfgLoadInt("config","pvr.rend",0);
|
||||
#endif
|
||||
|
||||
#if (HOST_OS != OS_LINUX || defined(_ANDROID) || defined(TARGET_PANDORA))
|
||||
settings.aica.BufferSize=2048;
|
||||
|
|
|
@ -41,10 +41,97 @@ extern "C"
|
|||
JNIEXPORT void JNICALL Java_com_reicast_emulator_JNIdc_setupMic(JNIEnv *env,jobject obj,jobject sip) __attribute__((visibility("default")));
|
||||
JNIEXPORT void JNICALL Java_com_reicast_emulator_JNIdc_vmuSwap(JNIEnv *env,jobject obj) __attribute__((visibility("default")));
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_reicast_emulator_JNIdc_frameskip(JNIEnv *env,jobject obj, jint frames) __attribute__((visibility("default")));
|
||||
JNIEXPORT void JNICALL Java_com_reicast_emulator_JNIdc_widescreen(JNIEnv *env,jobject obj, jint stretch) __attribute__((visibility("default")));
|
||||
JNIEXPORT void JNICALL Java_com_reicast_emulator_JNIdc_dynarec(JNIEnv *env,jobject obj, jint dynarec) __attribute__((visibility("default")));
|
||||
JNIEXPORT void JNICALL Java_com_reicast_emulator_JNIdc_idleskip(JNIEnv *env,jobject obj, jint idleskip) __attribute__((visibility("default")));
|
||||
JNIEXPORT void JNICALL Java_com_reicast_emulator_JNIdc_unstable(JNIEnv *env,jobject obj, jint unstable) __attribute__((visibility("default")));
|
||||
JNIEXPORT void JNICALL Java_com_reicast_emulator_JNIdc_cable(JNIEnv *env,jobject obj, jint cable) __attribute__((visibility("default")));
|
||||
JNIEXPORT void JNICALL Java_com_reicast_emulator_JNIdc_region(JNIEnv *env,jobject obj, jint region) __attribute__((visibility("default")));
|
||||
JNIEXPORT void JNICALL Java_com_reicast_emulator_JNIdc_broadcast(JNIEnv *env,jobject obj, jint broadcast) __attribute__((visibility("default")));
|
||||
JNIEXPORT void JNICALL Java_com_reicast_emulator_JNIdc_limitfps(JNIEnv *env,jobject obj, jint limiter) __attribute__((visibility("default")));
|
||||
JNIEXPORT void JNICALL Java_com_reicast_emulator_JNIdc_nobatch(JNIEnv *env,jobject obj, jint nobatch) __attribute__((visibility("default")));
|
||||
JNIEXPORT void JNICALL Java_com_reicast_emulator_JNIdc_mipmaps(JNIEnv *env,jobject obj, jint mipmaps) __attribute__((visibility("default")));
|
||||
JNIEXPORT void JNICALL Java_com_reicast_emulator_JNIdc_widescreen(JNIEnv *env,jobject obj, jint stretch) __attribute__((visibility("default")));
|
||||
JNIEXPORT void JNICALL Java_com_reicast_emulator_JNIdc_subdivide(JNIEnv *env,jobject obj, jint subdivide) __attribute__((visibility("default")));
|
||||
JNIEXPORT void JNICALL Java_com_reicast_emulator_JNIdc_frameskip(JNIEnv *env,jobject obj, jint frames) __attribute__((visibility("default")));
|
||||
JNIEXPORT void JNICALL Java_com_reicast_emulator_JNIdc_pvrrender(JNIEnv *env,jobject obj, jint render) __attribute__((visibility("default")));
|
||||
JNIEXPORT void JNICALL Java_com_reicast_emulator_JNIdc_cheatdisk(JNIEnv *env,jobject obj, jstring disk) __attribute__((visibility("default")));
|
||||
JNIEXPORT void JNICALL Java_com_reicast_emulator_JNIdc_dreamtime(JNIEnv *env,jobject obj, u32 clock) __attribute__((visibility("default")));
|
||||
};
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_reicast_emulator_JNIdc_dynarec(JNIEnv *env,jobject obj, jint dynarec)
|
||||
{
|
||||
settings.dynarec.Enable = dynarec;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_reicast_emulator_JNIdc_idleskip(JNIEnv *env,jobject obj, jint idleskip)
|
||||
{
|
||||
settings.dynarec.idleskip = idleskip;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_reicast_emulator_JNIdc_unstable(JNIEnv *env,jobject obj, jint unstable)
|
||||
{
|
||||
settings.dynarec.unstable_opt = unstable;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_reicast_emulator_JNIdc_cable(JNIEnv *env,jobject obj, jint cable)
|
||||
{
|
||||
settings.dreamcast.cable = cable;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_reicast_emulator_JNIdc_region(JNIEnv *env,jobject obj, jint region)
|
||||
{
|
||||
settings.dreamcast.region = region;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_reicast_emulator_JNIdc_broadcast(JNIEnv *env,jobject obj, jint broadcast)
|
||||
{
|
||||
settings.dreamcast.broadcast = broadcast;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_reicast_emulator_JNIdc_limitfps(JNIEnv *env,jobject obj, jint limiter)
|
||||
{
|
||||
settings.aica.LimitFPS = limiter;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_reicast_emulator_JNIdc_nobatch(JNIEnv *env,jobject obj, jint nobatch)
|
||||
{
|
||||
settings.aica.NoBatch = nobatch;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_reicast_emulator_JNIdc_mipmaps(JNIEnv *env,jobject obj, jint mipmaps)
|
||||
{
|
||||
settings.rend.UseMipmaps = mipmaps;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_reicast_emulator_JNIdc_widescreen(JNIEnv *env,jobject obj, jint stretch)
|
||||
{
|
||||
settings.rend.WideScreen = stretch;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_reicast_emulator_JNIdc_subdivide(JNIEnv *env,jobject obj, jint subdivide)
|
||||
{
|
||||
settings.pvr.subdivide_transp = subdivide;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_reicast_emulator_JNIdc_frameskip(JNIEnv *env,jobject obj, jint frames)
|
||||
{
|
||||
settings.pvr.ta_skip = frames;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_reicast_emulator_JNIdc_pvrrender(JNIEnv *env,jobject obj, jint render)
|
||||
{
|
||||
settings.pvr.rend = render;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_reicast_emulator_JNIdc_cheatdisk(JNIEnv *env,jobject obj, jstring disk)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_reicast_emulator_JNIdc_dreamtime(JNIEnv *env,jobject obj, u32 clock)
|
||||
{
|
||||
settings.dreamcast.RTC = clock;
|
||||
}
|
||||
|
||||
void egl_stealcntx();
|
||||
void SetApplicationPath(wchar *path);
|
||||
|
@ -322,16 +409,6 @@ JNIEXPORT void JNICALL Java_com_reicast_emulator_JNIdc_kcode(JNIEnv * env, jobje
|
|||
env->ReleaseIntArrayElements(jy, jy_body, 0);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_reicast_emulator_JNIdc_frameskip(JNIEnv *env,jobject obj, jint frames)
|
||||
{
|
||||
settings.pvr.ta_skip = frames;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_reicast_emulator_JNIdc_widescreen(JNIEnv *env,jobject obj, jint stretch)
|
||||
{
|
||||
settings.rend.WideScreen = stretch;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_reicast_emulator_JNIdc_rendinit(JNIEnv * env, jobject obj, jint w,jint h)
|
||||
{
|
||||
screen_width = w;
|
||||
|
|
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 8.6 KiB |
Binary file not shown.
After Width: | Height: | Size: 8.6 KiB |
Binary file not shown.
After Width: | Height: | Size: 9.5 KiB |
Binary file not shown.
After Width: | Height: | Size: 9.3 KiB |
Binary file not shown.
After Width: | Height: | Size: 8.7 KiB |
Binary file not shown.
Before Width: | Height: | Size: 7.5 KiB |
|
@ -99,7 +99,7 @@
|
|||
<string name="textOff">OFF</string>
|
||||
|
||||
<string name="platform">Copying logcat content to clipboard\nPlease paste in the issue report</string>
|
||||
<string name="bios_config">Please generate a config\n(Run BIOS at least once)</string>
|
||||
<string name="bios_config">Configuration failed!</string>
|
||||
<string name="menu_debug">Submit Error Logs</string>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -6,11 +6,11 @@ public class DreamTime {
|
|||
|
||||
private static long dreamRTC = ((20 * 365 + 5) * 86400);
|
||||
|
||||
public static String getDreamtime() {
|
||||
public static long getDreamtime() {
|
||||
Calendar cal = Calendar.getInstance();
|
||||
int utcOffset = cal.get(Calendar.ZONE_OFFSET)
|
||||
+ cal.get(Calendar.DST_OFFSET);
|
||||
return String.valueOf((System.currentTimeMillis() / 1000) + dreamRTC
|
||||
+ utcOffset / 1000);
|
||||
return (System.currentTimeMillis() / 1000) + dreamRTC
|
||||
+ utcOffset / 1000;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,11 +44,16 @@ public class ConfigureFragment extends Fragment {
|
|||
OnClickListener mCallback;
|
||||
|
||||
public static boolean dynarecopt = true;
|
||||
public static boolean idleskip = false;
|
||||
public static boolean unstableopt = false;
|
||||
public static int cable = 3;
|
||||
public static int dcregion = 3;
|
||||
public static int broadcast = 4;
|
||||
public static boolean limitfps = true;
|
||||
public static boolean nobatch = false;
|
||||
public static boolean mipmaps = true;
|
||||
public static boolean widescreen = false;
|
||||
public static boolean subdivide = false;
|
||||
public static int frameskip = 0;
|
||||
public static boolean pvrrender = false;
|
||||
public static String cheatdisk = "null";
|
||||
|
@ -84,7 +89,7 @@ public class ConfigureFragment extends Fragment {
|
|||
mPrefs = PreferenceManager.getDefaultSharedPreferences(parentActivity);
|
||||
home_directory = mPrefs.getString("home_directory", home_directory);
|
||||
|
||||
getCurrentConfiguration(home_directory);
|
||||
getCurrentConfiguration(mPrefs);
|
||||
|
||||
// Generate the menu options and fill in existing settings
|
||||
final Switch force_gpu_opt = (Switch) getView().findViewById(
|
||||
|
@ -126,7 +131,8 @@ public class ConfigureFragment extends Fragment {
|
|||
}
|
||||
}
|
||||
};
|
||||
int software = mPrefs.getInt("render_type", GL2JNIView.LAYER_TYPE_HARDWARE);
|
||||
int software = mPrefs.getInt("render_type",
|
||||
GL2JNIView.LAYER_TYPE_HARDWARE);
|
||||
if (software == GL2JNIView.LAYER_TYPE_SOFTWARE) {
|
||||
force_software_opt.setChecked(true);
|
||||
} else {
|
||||
|
@ -139,15 +145,12 @@ public class ConfigureFragment extends Fragment {
|
|||
public void onCheckedChanged(CompoundButton buttonView,
|
||||
boolean isChecked) {
|
||||
mPrefs.edit().putBoolean("dynarec_opt", isChecked).commit();
|
||||
dynarecopt = isChecked;
|
||||
executeAppendConfig("Dynarec.Enabled",
|
||||
String.valueOf(isChecked ? 1 : 0));
|
||||
ConfigureFragment.dynarecopt = isChecked;
|
||||
}
|
||||
};
|
||||
Switch dynarec_opt = (Switch) getView().findViewById(
|
||||
R.id.dynarec_option);
|
||||
boolean dynarec = mPrefs.getBoolean("dynarec_opt", dynarecopt);
|
||||
if (dynarec) {
|
||||
if (ConfigureFragment.dynarecopt) {
|
||||
dynarec_opt.setChecked(true);
|
||||
} else {
|
||||
dynarec_opt.setChecked(false);
|
||||
|
@ -159,15 +162,12 @@ public class ConfigureFragment extends Fragment {
|
|||
public void onCheckedChanged(CompoundButton buttonView,
|
||||
boolean isChecked) {
|
||||
mPrefs.edit().putBoolean("unstable_opt", isChecked).commit();
|
||||
unstableopt = isChecked;
|
||||
executeAppendConfig("Dynarec.unstable-opt",
|
||||
String.valueOf(isChecked ? 1 : 0));
|
||||
ConfigureFragment.unstableopt = isChecked;
|
||||
}
|
||||
};
|
||||
Switch unstable_opt = (Switch) getView().findViewById(
|
||||
R.id.unstable_option);
|
||||
boolean unstable = mPrefs.getBoolean("unstable_opt", unstableopt);
|
||||
if (unstable) {
|
||||
if (ConfigureFragment.unstableopt) {
|
||||
unstable_opt.setChecked(true);
|
||||
} else {
|
||||
unstable_opt.setChecked(false);
|
||||
|
@ -185,22 +185,20 @@ public class ConfigureFragment extends Fragment {
|
|||
.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
region_spnr.setAdapter(localeAdapter);
|
||||
|
||||
int dc_region = mPrefs.getInt("dc_region", dcregion);
|
||||
region_spnr.setSelection(dc_region, true);
|
||||
region_spnr.setSelection(ConfigureFragment.dcregion, true);
|
||||
|
||||
region_spnr.setOnItemSelectedListener(new OnItemSelectedListener() {
|
||||
|
||||
public void onItemSelected(AdapterView<?> parent, View view,
|
||||
int pos, long id) {
|
||||
mPrefs.edit().putInt("dc_region", pos).commit();
|
||||
dcregion = pos;
|
||||
executeAppendConfig("Dreamcast.Region",
|
||||
String.valueOf(pos));
|
||||
ConfigureFragment.dcregion = pos;
|
||||
|
||||
}
|
||||
|
||||
public void onNothingSelected(AdapterView<?> arg0) {
|
||||
mPrefs.edit().putInt("dc_region", dcregion).commit();
|
||||
mPrefs.edit().putInt("dc_region", ConfigureFragment.dcregion)
|
||||
.commit();
|
||||
}
|
||||
|
||||
});
|
||||
|
@ -210,15 +208,12 @@ public class ConfigureFragment extends Fragment {
|
|||
public void onCheckedChanged(CompoundButton buttonView,
|
||||
boolean isChecked) {
|
||||
mPrefs.edit().putBoolean("limit_fps", isChecked).commit();
|
||||
limitfps = isChecked;
|
||||
executeAppendConfig("aica.LimitFPS",
|
||||
String.valueOf(isChecked ? 1 : 0));
|
||||
ConfigureFragment.limitfps = isChecked;
|
||||
}
|
||||
};
|
||||
Switch limit_fps = (Switch) getView()
|
||||
.findViewById(R.id.limitfps_option);
|
||||
boolean limited = mPrefs.getBoolean("limit_fps", limitfps);
|
||||
if (limited) {
|
||||
if (ConfigureFragment.limitfps) {
|
||||
limit_fps.setChecked(true);
|
||||
} else {
|
||||
limit_fps.setChecked(false);
|
||||
|
@ -230,15 +225,12 @@ public class ConfigureFragment extends Fragment {
|
|||
public void onCheckedChanged(CompoundButton buttonView,
|
||||
boolean isChecked) {
|
||||
mPrefs.edit().putBoolean("use_mipmaps", isChecked).commit();
|
||||
mipmaps = isChecked;
|
||||
executeAppendConfig("rend.UseMipmaps",
|
||||
String.valueOf(isChecked ? 1 : 0));
|
||||
ConfigureFragment.mipmaps = isChecked;
|
||||
}
|
||||
};
|
||||
Switch mipmap_opt = (Switch) getView()
|
||||
.findViewById(R.id.mipmaps_option);
|
||||
boolean mipmapped = mPrefs.getBoolean("use_mipmaps", mipmaps);
|
||||
if (mipmapped) {
|
||||
if (ConfigureFragment.mipmaps) {
|
||||
mipmap_opt.setChecked(true);
|
||||
} else {
|
||||
mipmap_opt.setChecked(false);
|
||||
|
@ -250,39 +242,40 @@ public class ConfigureFragment extends Fragment {
|
|||
public void onCheckedChanged(CompoundButton buttonView,
|
||||
boolean isChecked) {
|
||||
mPrefs.edit().putBoolean("stretch_view", isChecked).commit();
|
||||
widescreen = isChecked;
|
||||
executeAppendConfig("rend.WideScreen",
|
||||
String.valueOf(isChecked ? 1 : 0));
|
||||
ConfigureFragment.widescreen = isChecked;
|
||||
}
|
||||
};
|
||||
Switch stretch_view = (Switch) getView().findViewById(
|
||||
R.id.stretch_option);
|
||||
boolean stretched = mPrefs.getBoolean("stretch_view", widescreen);
|
||||
if (stretched) {
|
||||
if (ConfigureFragment.widescreen) {
|
||||
stretch_view.setChecked(true);
|
||||
} else {
|
||||
stretch_view.setChecked(false);
|
||||
}
|
||||
stretch_view.setOnCheckedChangeListener(full_screen);
|
||||
|
||||
|
||||
Switch showProfilingToolsSwitch = (Switch) getView().findViewById(
|
||||
R.id.debug_profling_tools);
|
||||
boolean showProfilingTools = mPrefs.getBoolean("debug_profling_tools", false);
|
||||
boolean showProfilingTools = mPrefs.getBoolean("debug_profling_tools",
|
||||
false);
|
||||
showProfilingToolsSwitch.setChecked(showProfilingTools);
|
||||
showProfilingToolsSwitch.setOnCheckedChangeListener(new OnCheckedChangeListener() {
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
mPrefs.edit().putBoolean("debug_profling_tools", isChecked).commit();
|
||||
}
|
||||
});
|
||||
showProfilingToolsSwitch
|
||||
.setOnCheckedChangeListener(new OnCheckedChangeListener() {
|
||||
public void onCheckedChanged(CompoundButton buttonView,
|
||||
boolean isChecked) {
|
||||
mPrefs.edit()
|
||||
.putBoolean("debug_profling_tools", isChecked)
|
||||
.commit();
|
||||
}
|
||||
});
|
||||
|
||||
mainFrames = (TextView) getView().findViewById(R.id.current_frames);
|
||||
mainFrames.setText(String.valueOf(frameskip));
|
||||
mainFrames.setText(String.valueOf(ConfigureFragment.frameskip));
|
||||
|
||||
SeekBar frameSeek = (SeekBar) getView()
|
||||
.findViewById(R.id.frame_seekbar);
|
||||
|
||||
int userFrames = mPrefs.getInt("frame_skip", frameskip);
|
||||
frameSeek.setProgress(userFrames);
|
||||
frameSeek.setProgress(ConfigureFragment.frameskip);
|
||||
|
||||
frameSeek.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {
|
||||
int progressChanged = 0;
|
||||
|
@ -299,9 +292,7 @@ public class ConfigureFragment extends Fragment {
|
|||
|
||||
public void onStopTrackingTouch(SeekBar seekBar) {
|
||||
mPrefs.edit().putInt("frame_skip", progressChanged).commit();
|
||||
frameskip = progressChanged;
|
||||
executeAppendConfig("ta.skip",
|
||||
String.valueOf(progressChanged));
|
||||
ConfigureFragment.frameskip = progressChanged;
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -310,14 +301,11 @@ public class ConfigureFragment extends Fragment {
|
|||
public void onCheckedChanged(CompoundButton buttonView,
|
||||
boolean isChecked) {
|
||||
mPrefs.edit().putBoolean("pvr_render", isChecked).commit();
|
||||
pvrrender = isChecked;
|
||||
executeAppendConfig("pvr.rend",
|
||||
String.valueOf(isChecked ? 1 : 0));
|
||||
ConfigureFragment.pvrrender = isChecked;
|
||||
}
|
||||
};
|
||||
Switch pvr_render = (Switch) getView().findViewById(R.id.render_option);
|
||||
boolean rendered = mPrefs.getBoolean("pvr_render", pvrrender);
|
||||
if (rendered) {
|
||||
if (ConfigureFragment.pvrrender) {
|
||||
pvr_render.setChecked(true);
|
||||
} else {
|
||||
pvr_render.setChecked(false);
|
||||
|
@ -326,14 +314,16 @@ public class ConfigureFragment extends Fragment {
|
|||
|
||||
final EditText cheatEdit = (EditText) getView().findViewById(
|
||||
R.id.cheat_disk);
|
||||
cheatEdit.setText(cheatdisk);
|
||||
cheatEdit.setText(ConfigureFragment.cheatdisk);
|
||||
|
||||
cheatEdit.addTextChangedListener(new TextWatcher() {
|
||||
public void afterTextChanged(Editable s) {
|
||||
if (cheatEdit.getText() != null) {
|
||||
cheatdisk = cheatEdit.getText().toString();
|
||||
mPrefs.edit().putString("cheat_disk", cheatdisk).commit();
|
||||
executeAppendConfig("image", cheatdisk);
|
||||
ConfigureFragment.cheatdisk = cheatEdit.getText()
|
||||
.toString();
|
||||
mPrefs.edit()
|
||||
.putString("cheat_disk",
|
||||
ConfigureFragment.cheatdisk).commit();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -357,8 +347,8 @@ public class ConfigureFragment extends Fragment {
|
|||
|
||||
public void generateErrorLog() {
|
||||
Toast.makeText(parentActivity,
|
||||
parentActivity.getString(R.string.platform),
|
||||
Toast.LENGTH_SHORT).show();
|
||||
parentActivity.getString(R.string.platform), Toast.LENGTH_SHORT)
|
||||
.show();
|
||||
GenerateLogs mGenerateLogs = new GenerateLogs(parentActivity);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
|
||||
mGenerateLogs.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR,
|
||||
|
@ -367,127 +357,73 @@ public class ConfigureFragment extends Fragment {
|
|||
mGenerateLogs.execute(home_directory);
|
||||
}
|
||||
}
|
||||
|
||||
public static void getCurrentConfiguration(String home_directory) {
|
||||
try {
|
||||
File config = new File(home_directory, "emu.cfg");
|
||||
if (config.exists()) {
|
||||
Scanner scanner = new Scanner(config);
|
||||
String currentLine;
|
||||
while (scanner.hasNextLine()) {
|
||||
currentLine = scanner.nextLine();
|
||||
|
||||
// Check if the existing emu.cfg has the setting and get
|
||||
// current value
|
||||
|
||||
if (StringUtils.containsIgnoreCase(currentLine,
|
||||
"Dynarec.Enabled")) {
|
||||
dynarecopt = currentLine.replace(
|
||||
"Dynarec.Enabled=", "").equals("1");
|
||||
}
|
||||
if (StringUtils.containsIgnoreCase(currentLine,
|
||||
"Dynarec.unstable-opt")) {
|
||||
unstableopt = currentLine.replace(
|
||||
"Dynarec.unstable-opt=", "").equals("1");
|
||||
}
|
||||
if (StringUtils.containsIgnoreCase(currentLine,
|
||||
"Dreamcast.Region")) {
|
||||
dcregion = Integer.valueOf(currentLine.replace(
|
||||
"Dreamcast.Region=", ""));
|
||||
}
|
||||
if (StringUtils.containsIgnoreCase(currentLine,
|
||||
"aica.LimitFPS")) {
|
||||
limitfps = currentLine.replace(
|
||||
"aica.LimitFPS=", "").equals("1");
|
||||
}
|
||||
if (StringUtils.containsIgnoreCase(currentLine,
|
||||
"rend.UseMipmaps")) {
|
||||
mipmaps = currentLine.replace(
|
||||
"rend.UseMipmaps=", "").equals("1");
|
||||
}
|
||||
if (StringUtils.containsIgnoreCase(currentLine,
|
||||
"rend.WideScreen")) {
|
||||
widescreen = currentLine.replace(
|
||||
"rend.WideScreen=", "").equals("1");
|
||||
}
|
||||
if (StringUtils.containsIgnoreCase(currentLine, "ta.skip")) {
|
||||
frameskip = Integer.valueOf(currentLine.replace(
|
||||
"ta.skip=", ""));
|
||||
}
|
||||
if (StringUtils.containsIgnoreCase(currentLine, "pvr.rend")) {
|
||||
pvrrender = currentLine.replace(
|
||||
"pvr.rend=", "").equals("1");
|
||||
}
|
||||
if (StringUtils.containsIgnoreCase(currentLine, "image")) {
|
||||
cheatdisk = currentLine.replace("image=", "");
|
||||
}
|
||||
|
||||
}
|
||||
scanner.close();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.d("reicast", "Exception: " + e);
|
||||
}
|
||||
}
|
||||
|
||||
public void executeAppendConfig(String identifier, String value) {
|
||||
File config = new File(home_directory, "emu.cfg");
|
||||
try {
|
||||
if (config.exists()) {
|
||||
// Read existing emu.cfg and substitute new setting value
|
||||
StringBuilder rebuildFile = new StringBuilder();
|
||||
Scanner scanner = new Scanner(config);
|
||||
String currentLine;
|
||||
while (scanner.hasNextLine()) {
|
||||
currentLine = scanner.nextLine();
|
||||
if (StringUtils.containsIgnoreCase(currentLine, identifier)) {
|
||||
rebuildFile.append(identifier + "=" + value + "\n");
|
||||
} else {
|
||||
rebuildFile.append(currentLine + "\n");
|
||||
}
|
||||
}
|
||||
scanner.close();
|
||||
config.delete();
|
||||
FileOutputStream fos = new FileOutputStream(config);
|
||||
fos.write(rebuildFile.toString().getBytes());
|
||||
fos.close();
|
||||
} else if (config.createNewFile()) {
|
||||
StringBuilder rebuildFile = new StringBuilder();
|
||||
rebuildFile.append("[config]" + "\n");
|
||||
rebuildFile.append("Dynarec.Enabled="
|
||||
+ String.valueOf(dynarecopt ? 1 : 0) + "\n");
|
||||
rebuildFile.append("Dynarec.idleskip=1" + "\n");
|
||||
rebuildFile.append("Dynarec.unstable-opt="
|
||||
+ String.valueOf(unstableopt ? 1 : 0) + "\n");
|
||||
rebuildFile.append("Dreamcast.Cable=3" + "\n");
|
||||
rebuildFile.append("Dreamcast.RTC=" + DreamTime.getDreamtime()
|
||||
+ "\n");
|
||||
rebuildFile.append("Dreamcast.Region="
|
||||
+ String.valueOf(dcregion) + "\n");
|
||||
rebuildFile.append("Dreamcast.Broadcast=4" + "\n");
|
||||
rebuildFile.append("aica.LimitFPS="
|
||||
+ String.valueOf(limitfps ? 1 : 0) + "\n");
|
||||
rebuildFile.append("aica.NoBatch=0" + "\n");
|
||||
rebuildFile.append("rend.UseMipmaps="
|
||||
+ String.valueOf(mipmaps ? 1 : 0) + "\n");
|
||||
rebuildFile.append("rend.WideScreen="
|
||||
+ String.valueOf(widescreen ? 1 : 0) + "\n");
|
||||
rebuildFile.append("pvr.Subdivide=0" + "\n");
|
||||
rebuildFile.append("ta.skip=" + String.valueOf(frameskip)
|
||||
+ "\n");
|
||||
rebuildFile.append("pvr.rend="
|
||||
+ String.valueOf(pvrrender ? 1 : 0) + "\n");
|
||||
rebuildFile.append("image=" + cheatdisk + "\n");
|
||||
FileOutputStream fos = new FileOutputStream(config);
|
||||
fos.write(rebuildFile.toString().getBytes());
|
||||
fos.close();
|
||||
} else {
|
||||
Toast.makeText(parentActivity,
|
||||
parentActivity.getString(R.string.bios_config),
|
||||
Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.d("reicast", "Exception: " + e);
|
||||
}
|
||||
public static void getCurrentConfiguration(SharedPreferences mPrefs) {
|
||||
ConfigureFragment.dynarecopt = mPrefs.getBoolean("dynarec_opt",
|
||||
ConfigureFragment.dynarecopt);
|
||||
JNIdc.dynarec(ConfigureFragment.dynarecopt ? 1 : 0);
|
||||
JNIdc.idleskip(ConfigureFragment.idleskip ? 1 : 0);
|
||||
ConfigureFragment.unstableopt = mPrefs.getBoolean("unstable_opt",
|
||||
ConfigureFragment.unstableopt);
|
||||
JNIdc.unstable(ConfigureFragment.unstableopt ? 1 : 0);
|
||||
JNIdc.cable(ConfigureFragment.cable);
|
||||
ConfigureFragment.dcregion = mPrefs.getInt("dc_region", ConfigureFragment.dcregion);
|
||||
JNIdc.region(ConfigureFragment.dcregion);
|
||||
JNIdc.broadcast(ConfigureFragment.broadcast);
|
||||
ConfigureFragment.limitfps = mPrefs.getBoolean("limit_fps",
|
||||
ConfigureFragment.limitfps);
|
||||
JNIdc.limitfps(ConfigureFragment.limitfps ? 1 : 0);
|
||||
JNIdc.nobatch(ConfigureFragment.nobatch ? 1 : 0);
|
||||
ConfigureFragment.mipmaps = mPrefs.getBoolean("use_mipmaps",
|
||||
ConfigureFragment.mipmaps);
|
||||
JNIdc.mipmaps(ConfigureFragment.mipmaps ? 1 : 0);
|
||||
ConfigureFragment.widescreen = mPrefs.getBoolean("stretch_view",
|
||||
ConfigureFragment.widescreen);
|
||||
JNIdc.widescreen(ConfigureFragment.widescreen ? 1 : 0);
|
||||
JNIdc.subdivide(ConfigureFragment.subdivide ? 1 : 0);
|
||||
ConfigureFragment.frameskip = mPrefs.getInt("frame_skip",
|
||||
ConfigureFragment.frameskip);
|
||||
JNIdc.frameskip(ConfigureFragment.frameskip);
|
||||
ConfigureFragment.pvrrender = mPrefs.getBoolean("pvr_render",
|
||||
ConfigureFragment.pvrrender);
|
||||
JNIdc.pvrrender(ConfigureFragment.pvrrender ? 1 : 0);
|
||||
ConfigureFragment.cheatdisk = mPrefs.getString("cheat_disk",
|
||||
ConfigureFragment.cheatdisk);
|
||||
JNIdc.cheatdisk(ConfigureFragment.cheatdisk);
|
||||
JNIdc.dreamtime(DreamTime.getDreamtime());
|
||||
|
||||
// StringBuilder rebuildFile = new StringBuilder();
|
||||
// rebuildFile.append("[config]" + "\n");
|
||||
// rebuildFile.append("Dynarec.Enabled="
|
||||
// + String.valueOf(ConfigureFragment.dynarecopt ? 1 : 0)
|
||||
// + "\n");
|
||||
// rebuildFile.append("Dynarec.idleskip=1" + "\n");
|
||||
// rebuildFile.append("Dynarec.unstable-opt="
|
||||
// + String.valueOf(ConfigureFragment.unstableopt ? 1 : 0)
|
||||
// + "\n");
|
||||
// rebuildFile.append("Dreamcast.Cable=3" + "\n");
|
||||
// rebuildFile.append("Dreamcast.RTC=" + DreamTime.getDreamtime()
|
||||
// + "\n");
|
||||
// rebuildFile.append("Dreamcast.Region="
|
||||
// + String.valueOf(ConfigureFragment.dcregion) + "\n");
|
||||
// rebuildFile.append("Dreamcast.Broadcast=4" + "\n");
|
||||
// rebuildFile.append("aica.LimitFPS="
|
||||
// + String.valueOf(ConfigureFragment.limitfps ? 1 : 0)
|
||||
// + "\n");
|
||||
// rebuildFile.append("aica.NoBatch=0" + "\n");
|
||||
// rebuildFile.append("rend.UseMipmaps="
|
||||
// + String.valueOf(ConfigureFragment.mipmaps ? 1 : 0)
|
||||
// + "\n");
|
||||
// rebuildFile.append("rend.WideScreen="
|
||||
// + String.valueOf(ConfigureFragment.widescreen ? 1 : 0)
|
||||
// + "\n");
|
||||
// rebuildFile.append("pvr.Subdivide=0" + "\n");
|
||||
// rebuildFile.append("ta.skip="
|
||||
// + String.valueOf(ConfigureFragment.frameskip) + "\n");
|
||||
// rebuildFile.append("pvr.rend="
|
||||
// + String.valueOf(ConfigureFragment.pvrrender ? 1 : 0)
|
||||
// + "\n");
|
||||
// rebuildFile.append("image=" + ConfigureFragment.cheatdisk
|
||||
// + "\n");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ package com.reicast.emulator;
|
|||
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Configuration;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
|
@ -14,7 +13,6 @@ import android.view.ViewGroup.LayoutParams;
|
|||
import android.view.Window;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.ImageView.ScaleType;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.PopupWindow;
|
||||
import android.widget.Toast;
|
||||
|
||||
|
@ -22,10 +20,11 @@ import android.widget.Toast;
|
|||
public class EditVJoyActivity extends Activity {
|
||||
GL2JNIView mView;
|
||||
GL2JNIViewV6 mView6;
|
||||
OnScreenMenu menu;
|
||||
PopupWindow popUp;
|
||||
LayoutParams params;
|
||||
|
||||
private static float[][] vjoy_d_cached;
|
||||
public static float[][] vjoy_d_cached;
|
||||
|
||||
View addbut(int x, OnClickListener ocl) {
|
||||
ImageButton but = new ImageButton(this);
|
||||
|
@ -37,54 +36,13 @@ public class EditVJoyActivity extends Activity {
|
|||
return but;
|
||||
}
|
||||
|
||||
void createPopup() {
|
||||
popUp = new PopupWindow(this);
|
||||
int p = GL2JNIActivity.getPixelsFromDp(60, this);
|
||||
params = new LayoutParams(p, p);
|
||||
|
||||
LinearLayout hlay = new LinearLayout(this);
|
||||
|
||||
hlay.setOrientation(LinearLayout.HORIZONTAL);
|
||||
|
||||
hlay.addView(addbut(R.drawable.apply, new OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
Intent inte = new Intent(EditVJoyActivity.this, MainActivity.class);
|
||||
startActivity(inte);
|
||||
EditVJoyActivity.this.finish();
|
||||
}
|
||||
}), params);
|
||||
|
||||
hlay.addView(addbut(R.drawable.reset, new OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
// Reset VJoy positions and scale
|
||||
if (MainActivity.force_gpu) {
|
||||
mView6.resetCustomVjoyValues();
|
||||
} else {
|
||||
mView.resetCustomVjoyValues();
|
||||
}
|
||||
popUp.dismiss();
|
||||
}
|
||||
}), params);
|
||||
|
||||
hlay.addView(addbut(R.drawable.close, new OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
if (MainActivity.force_gpu) {
|
||||
mView6.restoreCustomVjoyValues(vjoy_d_cached);
|
||||
} else {
|
||||
mView.restoreCustomVjoyValues(vjoy_d_cached);
|
||||
}
|
||||
popUp.dismiss();
|
||||
}
|
||||
}), params);
|
||||
|
||||
popUp.setContentView(hlay);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle icicle) {
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
|
||||
createPopup();
|
||||
menu = new OnScreenMenu(this);
|
||||
menu.setGLView(mView, mView6);
|
||||
popUp = menu.createVjoyPopup();
|
||||
|
||||
// Call parent onCreate()
|
||||
super.onCreate(icicle);
|
||||
|
|
|
@ -1,33 +1,25 @@
|
|||
package com.reicast.emulator;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
|
||||
import tv.ouya.console.api.OuyaController;
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Configuration;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
import android.view.InputDevice;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.ViewGroup.LayoutParams;
|
||||
import android.view.Window;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.ImageView.ScaleType;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.PopupWindow;
|
||||
import android.widget.Toast;
|
||||
|
||||
|
@ -35,8 +27,8 @@ import android.widget.Toast;
|
|||
public class GL2JNIActivity extends Activity {
|
||||
GL2JNIView mView;
|
||||
GL2JNIViewV6 mView6;
|
||||
OnScreenMenu menu;
|
||||
PopupWindow popUp;
|
||||
LayoutParams params;
|
||||
MOGAInput moga = new MOGAInput();
|
||||
private SharedPreferences prefs;
|
||||
static String[] portId = { "_A", "_B", "_C", "_D" };
|
||||
|
@ -46,208 +38,24 @@ public class GL2JNIActivity extends Activity {
|
|||
int[] name = { -1, -1, -1, -1 };
|
||||
float[] globalLS_X = new float[4], globalLS_Y = new float[4],
|
||||
previousLS_X = new float[4], previousLS_Y = new float[4];
|
||||
|
||||
private File sdcard = Environment.getExternalStorageDirectory();
|
||||
private String home_directory = sdcard + "/dc";
|
||||
private boolean frameskipping = false;
|
||||
private boolean widescreen;
|
||||
|
||||
public static HashMap<Integer, String> deviceId_deviceDescriptor = new HashMap<Integer, String>();
|
||||
public static HashMap<String, Integer> deviceDescriptor_PlayerNum = new HashMap<String, Integer>();
|
||||
|
||||
int map[][];
|
||||
|
||||
public static int getPixelsFromDp(float dps, Context context) {
|
||||
return (int) (dps * context.getResources().getDisplayMetrics().density + 0.5f);
|
||||
}
|
||||
|
||||
View addbut(int x, OnClickListener ocl) {
|
||||
ImageButton but = new ImageButton(this);
|
||||
|
||||
but.setImageResource(x);
|
||||
but.setScaleType(ScaleType.FIT_CENTER);
|
||||
but.setOnClickListener(ocl);
|
||||
|
||||
return but;
|
||||
}
|
||||
|
||||
static byte[] syms;
|
||||
|
||||
void createPopup() {
|
||||
popUp = new PopupWindow(this);
|
||||
// LinearLayout layout = new LinearLayout(this);
|
||||
|
||||
// tv = new TextView(this);
|
||||
int p = getPixelsFromDp(60, this);
|
||||
params = new LayoutParams(p, p);
|
||||
|
||||
// layout.setOrientation(LinearLayout.VERTICAL);
|
||||
// tv.setText("Hi this is a sample text for popup window");
|
||||
// layout.addView(tv, params);
|
||||
|
||||
LinearLayout hlay = new LinearLayout(this);
|
||||
|
||||
hlay.setOrientation(LinearLayout.HORIZONTAL);
|
||||
|
||||
hlay.addView(addbut(R.drawable.close, new OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
Intent inte = new Intent(GL2JNIActivity.this,
|
||||
MainActivity.class);
|
||||
startActivity(inte);
|
||||
GL2JNIActivity.this.finish();
|
||||
}
|
||||
}), params);
|
||||
|
||||
if(prefs.getBoolean("debug_profling_tools", false)){
|
||||
|
||||
hlay.addView(addbut(R.drawable.clear_cache, new OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
JNIdc.send(0, 0); //Killing texture cache
|
||||
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) {
|
||||
JNIdc.vmuSwap();
|
||||
popUp.dismiss();
|
||||
}
|
||||
}), params);
|
||||
|
||||
hlay.addView(addbut(R.drawable.config, new OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
displayConfigPopup();
|
||||
popUp.dismiss();
|
||||
}
|
||||
}), params);
|
||||
|
||||
// layout.addView(hlay,params);
|
||||
popUp.setContentView(hlay);
|
||||
}
|
||||
|
||||
void displayConfigPopup() {
|
||||
final PopupWindow popUpConfig = new PopupWindow(this);
|
||||
// LinearLayout layout = new LinearLayout(this);
|
||||
|
||||
// tv = new TextView(this);
|
||||
int p = getPixelsFromDp(60, this);
|
||||
LayoutParams configParams = new LayoutParams(p, p);
|
||||
|
||||
// layout.setOrientation(LinearLayout.VERTICAL);
|
||||
// tv.setText("Hi this is a sample text for popup window");
|
||||
// layout.addView(tv, params);
|
||||
|
||||
LinearLayout hlay = new LinearLayout(this);
|
||||
|
||||
hlay.setOrientation(LinearLayout.HORIZONTAL);
|
||||
|
||||
hlay.addView(addbut(R.drawable.close, new OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
popUpConfig.dismiss();
|
||||
}
|
||||
}), configParams);
|
||||
View fullscreen;
|
||||
if (!widescreen) {
|
||||
fullscreen = addbut(R.drawable.widescreen, new OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
JNIdc.widescreen(1);
|
||||
popUpConfig.dismiss();
|
||||
widescreen = true;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
fullscreen = addbut(R.drawable.normal_view, new OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
JNIdc.widescreen(0);
|
||||
popUpConfig.dismiss();
|
||||
widescreen = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
hlay.addView(fullscreen, params);
|
||||
View frameskip;
|
||||
if (!frameskipping) {
|
||||
frameskip = addbut(R.drawable.fast_forward, new OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
JNIdc.frameskip((ConfigureFragment.frameskip + 1) * 5);
|
||||
popUpConfig.dismiss();
|
||||
frameskipping = true;
|
||||
displayConfigPopup();
|
||||
|
||||
}
|
||||
});
|
||||
} else {
|
||||
frameskip = addbut(R.drawable.normal_play, new OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
JNIdc.frameskip(ConfigureFragment.frameskip);
|
||||
popUpConfig.dismiss();
|
||||
frameskipping = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
hlay.addView(frameskip, params);
|
||||
hlay.addView(addbut(R.drawable.up, new OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
popUpConfig.dismiss();
|
||||
if (MainActivity.force_gpu) {
|
||||
popUp.showAtLocation(mView6, Gravity.BOTTOM, 0, 0);
|
||||
} else {
|
||||
popUp.showAtLocation(mView, Gravity.BOTTOM, 0, 0);
|
||||
}
|
||||
popUp.update(LayoutParams.WRAP_CONTENT,
|
||||
LayoutParams.WRAP_CONTENT);
|
||||
}
|
||||
}), configParams);
|
||||
|
||||
// layout.addView(hlay,params);
|
||||
popUpConfig.setContentView(hlay);
|
||||
if (popUp.isShowing()) {
|
||||
popUp.dismiss();
|
||||
}
|
||||
if (MainActivity.force_gpu) {
|
||||
popUpConfig.showAtLocation(mView6, Gravity.BOTTOM, 0, 0);
|
||||
} else {
|
||||
popUpConfig.showAtLocation(mView, Gravity.BOTTOM, 0, 0);
|
||||
}
|
||||
popUpConfig.update(LayoutParams.WRAP_CONTENT,
|
||||
LayoutParams.WRAP_CONTENT);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle icicle) {
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
moga.onCreate(this);
|
||||
|
||||
prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
createPopup();
|
||||
ConfigureFragment.getCurrentConfiguration(prefs);
|
||||
menu = new OnScreenMenu(this, prefs);
|
||||
menu.setGLView(mView, mView6);
|
||||
popUp = menu.createPopup();
|
||||
/*
|
||||
* try { //int rID =
|
||||
* getResources().getIdentifier("fortyonepost.com.lfas:raw/syms.map",
|
||||
|
@ -257,9 +65,7 @@ public class GL2JNIActivity extends Activity {
|
|||
* syms = new byte[(int) is.available()]; is.read(syms); is.close(); }
|
||||
* catch (IOException e) { e.getMessage(); e.printStackTrace(); }
|
||||
*/
|
||||
home_directory = prefs.getString("home_directory", home_directory);
|
||||
ConfigureFragment.getCurrentConfiguration(home_directory);
|
||||
widescreen = ConfigureFragment.widescreen;
|
||||
|
||||
|
||||
String fileName = null;
|
||||
|
||||
|
@ -691,6 +497,26 @@ public class GL2JNIActivity extends Activity {
|
|||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public void displayPopUp(PopupWindow popUp) {
|
||||
if (MainActivity.force_gpu) {
|
||||
popUp.showAtLocation(mView6, Gravity.BOTTOM, 0, 0);
|
||||
} else {
|
||||
popUp.showAtLocation(mView, Gravity.BOTTOM, 0, 0);
|
||||
}
|
||||
popUp.update(LayoutParams.WRAP_CONTENT,
|
||||
LayoutParams.WRAP_CONTENT);
|
||||
}
|
||||
|
||||
public void displayConfig(PopupWindow popUpConfig) {
|
||||
if (MainActivity.force_gpu) {
|
||||
popUpConfig.showAtLocation(mView6, Gravity.BOTTOM, 0, 0);
|
||||
} else {
|
||||
popUpConfig.showAtLocation(mView, Gravity.BOTTOM, 0, 0);
|
||||
}
|
||||
popUpConfig.update(LayoutParams.WRAP_CONTENT,
|
||||
LayoutParams.WRAP_CONTENT);
|
||||
}
|
||||
|
||||
public boolean onKeyUp(int keyCode, KeyEvent event) {
|
||||
Integer playerNum = Arrays.asList(name).indexOf(event.getDeviceId());
|
||||
|
@ -751,14 +577,7 @@ public class GL2JNIActivity extends Activity {
|
|||
|
||||
private boolean showMenu() {
|
||||
if (!popUp.isShowing()) {
|
||||
if (MainActivity.force_gpu) {
|
||||
popUp.showAtLocation(mView6, Gravity.BOTTOM, 0, 0);
|
||||
} else {
|
||||
popUp.showAtLocation(mView, Gravity.BOTTOM, 0, 0);
|
||||
}
|
||||
popUp.update(LayoutParams.WRAP_CONTENT,
|
||||
LayoutParams.WRAP_CONTENT);
|
||||
|
||||
displayPopUp(popUp);
|
||||
} else {
|
||||
popUp.dismiss();
|
||||
}
|
||||
|
|
|
@ -26,8 +26,21 @@ public class JNIdc
|
|||
public static native void setupMic(Object sip);
|
||||
public static native void vmuSwap();
|
||||
|
||||
public static native void frameskip(int frames);
|
||||
public static native void dynarec(int dynarec);
|
||||
public static native void idleskip(int idleskip);
|
||||
public static native void unstable(int unstable);
|
||||
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 nobatch(int nobatch);
|
||||
public static native void mipmaps(int mipmaps);
|
||||
public static native void widescreen(int stretch);
|
||||
public static native void subdivide(int subdivide);
|
||||
public static native void frameskip(int frames);
|
||||
public static native void pvrrender(int render);
|
||||
public static native void cheatdisk(String disk);
|
||||
public static native void dreamtime(long clock);
|
||||
|
||||
public static void show_osd() {
|
||||
JNIdc.vjoy(13, 1,0,0,0);
|
||||
|
|
|
@ -337,9 +337,6 @@ public class MainActivity extends SlidingFragmentActivity implements
|
|||
// show it
|
||||
alertDialog.show();
|
||||
} else {
|
||||
ConfigureFragment config = new ConfigureFragment();
|
||||
config.executeAppendConfig("Dreamcast.RTC",
|
||||
DreamTime.getDreamtime());
|
||||
Intent inte = new Intent(Intent.ACTION_VIEW, uri, getBaseContext(),
|
||||
GL2JNIActivity.class);
|
||||
startActivity(inte);
|
||||
|
|
|
@ -0,0 +1,273 @@
|
|||
package com.reicast.emulator;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Environment;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.ViewGroup.LayoutParams;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.PopupWindow;
|
||||
import android.widget.ImageView.ScaleType;
|
||||
|
||||
public class OnScreenMenu {
|
||||
|
||||
private GL2JNIActivity mContext;
|
||||
private EditVJoyActivity vContext;
|
||||
private SharedPreferences prefs;
|
||||
LayoutParams params;
|
||||
private int frameskip;
|
||||
private boolean widescreen;
|
||||
private boolean limitframes;
|
||||
|
||||
GL2JNIView mView;
|
||||
GL2JNIViewV6 mView6;
|
||||
|
||||
private File sdcard = Environment.getExternalStorageDirectory();
|
||||
private String home_directory = sdcard + "/dc";
|
||||
|
||||
public OnScreenMenu(GL2JNIActivity mContext, SharedPreferences prefs) {
|
||||
this.mContext = mContext;
|
||||
this.prefs = prefs;
|
||||
home_directory = prefs.getString("home_directory", home_directory);
|
||||
widescreen = ConfigureFragment.widescreen;
|
||||
frameskip = ConfigureFragment.frameskip;
|
||||
}
|
||||
|
||||
public OnScreenMenu(EditVJoyActivity vContext) {
|
||||
this.vContext = vContext;
|
||||
}
|
||||
|
||||
public void setGLView(GL2JNIView mView, GL2JNIViewV6 mView6) {
|
||||
this.mView = mView;
|
||||
this.mView6 = mView6;
|
||||
}
|
||||
|
||||
PopupWindow createPopup() {
|
||||
final PopupWindow popUp = new PopupWindow(mContext);
|
||||
|
||||
int p = getPixelsFromDp(60, mContext);
|
||||
params = 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) {
|
||||
Intent inte = new Intent(mContext,
|
||||
MainActivity.class);
|
||||
mContext.startActivity(inte);
|
||||
((Activity) mContext).finish();
|
||||
}
|
||||
}), params);
|
||||
|
||||
if(prefs.getBoolean("debug_profling_tools", false)){
|
||||
|
||||
hlay.addView(addbut(R.drawable.clear_cache, new OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
JNIdc.send(0, 0); //Killing texture cache
|
||||
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) {
|
||||
JNIdc.vmuSwap();
|
||||
popUp.dismiss();
|
||||
}
|
||||
}), params);
|
||||
|
||||
hlay.addView(addbut(R.drawable.config, new OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
displayConfigPopup(popUp);
|
||||
popUp.dismiss();
|
||||
}
|
||||
}), params);
|
||||
|
||||
// layout.addView(hlay,params);
|
||||
popUp.setContentView(hlay);
|
||||
return popUp;
|
||||
}
|
||||
|
||||
PopupWindow createVjoyPopup() {
|
||||
final PopupWindow popUp = new PopupWindow(vContext);
|
||||
int p = getPixelsFromDp(60, vContext);
|
||||
params = new LayoutParams(p, p);
|
||||
|
||||
LinearLayout hlay = new LinearLayout(vContext);
|
||||
|
||||
hlay.setOrientation(LinearLayout.HORIZONTAL);
|
||||
|
||||
hlay.addView(addbut(R.drawable.apply, new OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
Intent inte = new Intent(vContext, MainActivity.class);
|
||||
vContext.startActivity(inte);
|
||||
((Activity) vContext).finish();
|
||||
}
|
||||
}), params);
|
||||
|
||||
hlay.addView(addbut(R.drawable.reset, new OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
// Reset VJoy positions and scale
|
||||
if (MainActivity.force_gpu) {
|
||||
mView6.resetCustomVjoyValues();
|
||||
} else {
|
||||
mView.resetCustomVjoyValues();
|
||||
}
|
||||
popUp.dismiss();
|
||||
}
|
||||
}), params);
|
||||
|
||||
hlay.addView(addbut(R.drawable.close, new OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
if (MainActivity.force_gpu) {
|
||||
mView6.restoreCustomVjoyValues(EditVJoyActivity.vjoy_d_cached);
|
||||
} else {
|
||||
mView.restoreCustomVjoyValues(EditVJoyActivity.vjoy_d_cached);
|
||||
}
|
||||
popUp.dismiss();
|
||||
}
|
||||
}), params);
|
||||
|
||||
popUp.setContentView(hlay);
|
||||
return popUp;
|
||||
}
|
||||
|
||||
void displayConfigPopup(final PopupWindow popUp) {
|
||||
final PopupWindow popUpConfig = new PopupWindow(mContext);
|
||||
|
||||
int p = getPixelsFromDp(60, mContext);
|
||||
LayoutParams configParams = 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) {
|
||||
popUpConfig.dismiss();
|
||||
}
|
||||
}), configParams);
|
||||
View fullscreen;
|
||||
if (!widescreen) {
|
||||
fullscreen = addbut(R.drawable.widescreen, new OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
JNIdc.widescreen(1);
|
||||
popUpConfig.dismiss();
|
||||
widescreen = true;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
fullscreen = addbut(R.drawable.normal_view, new OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
JNIdc.widescreen(0);
|
||||
popUpConfig.dismiss();
|
||||
widescreen = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
hlay.addView(fullscreen, params);
|
||||
View frames_up = addbut(R.drawable.frames_up, new OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
frameskip++;
|
||||
JNIdc.frameskip(frameskip);
|
||||
popUpConfig.dismiss();
|
||||
displayConfigPopup(popUp);
|
||||
|
||||
}
|
||||
});
|
||||
hlay.addView(frames_up, params);
|
||||
if (frameskip >= 5) {
|
||||
frames_up.setEnabled(false);
|
||||
}
|
||||
View frames_down = addbut(R.drawable.frames_down, new OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
frameskip--;
|
||||
JNIdc.frameskip(frameskip);
|
||||
popUpConfig.dismiss();
|
||||
displayConfigPopup(popUp);
|
||||
}
|
||||
});
|
||||
hlay.addView(frames_down, params);
|
||||
if (frameskip <= 0) {
|
||||
frames_down.setEnabled(false);
|
||||
}
|
||||
View framelimit;
|
||||
if (!limitframes) {
|
||||
framelimit = addbut(R.drawable.frames_limit_on, new OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
JNIdc.limitfps(1);
|
||||
popUpConfig.dismiss();
|
||||
limitframes = true;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
framelimit = addbut(R.drawable.frames_limit_off, new OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
JNIdc.limitfps(0);
|
||||
popUpConfig.dismiss();
|
||||
limitframes = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
hlay.addView(framelimit, params);
|
||||
hlay.addView(addbut(R.drawable.up, new OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
popUpConfig.dismiss();
|
||||
mContext.displayPopUp(popUp);
|
||||
}
|
||||
}), configParams);
|
||||
|
||||
popUpConfig.setContentView(hlay);
|
||||
mContext.displayConfig(popUpConfig);
|
||||
}
|
||||
|
||||
public static int getPixelsFromDp(float dps, Context context) {
|
||||
return (int) (dps * context.getResources().getDisplayMetrics().density + 0.5f);
|
||||
}
|
||||
|
||||
View addbut(int x, OnClickListener ocl) {
|
||||
ImageButton but = new ImageButton(mContext);
|
||||
|
||||
but.setImageResource(x);
|
||||
but.setScaleType(ScaleType.FIT_CENTER);
|
||||
but.setOnClickListener(ocl);
|
||||
|
||||
return but;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue