Extend application for global functionality

Rather than attempt to locate each vector reference, it was best to extend the application for global support. This created a good place to handle native options that are separate from UI config

Clean up formatting and remove whitespace

Android Sudio does not verify global variables well

Conflicts:
	shell/android-studio/app/src/main/java/com/reicast/emulator/GL2JNINative.java
This commit is contained in:
TwistedUmbrella 2018-03-28 01:53:12 -04:00
parent 7ab6e9f0c4
commit 03834ad48b
14 changed files with 197 additions and 241 deletions

View File

@ -39,6 +39,7 @@
android:required="false" />
<application
android:name=".Emulator"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme"

View File

@ -0,0 +1,100 @@
package com.reicast.emulator;
import android.app.Application;
import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.support.v7.app.AppCompatDelegate;
import com.android.util.DreamTime;
import com.reicast.emulator.emu.JNIdc;
public class Emulator extends Application {
public static final String pref_nativeact = "enable_native";
public static final String pref_dynarecopt = "dynarec_opt";
public static final String pref_unstable = "unstable_opt";
public static final String pref_cable = "dc_cable";
public static final String pref_dcregion = "dc_region";
public static final String pref_broadcast = "dc_broadcast";
public static final String pref_limitfps = "limit_fps";
public static final String pref_nosound = "sound_disabled";
public static final String pref_mipmaps = "use_mipmaps";
public static final String pref_widescreen = "stretch_view";
public static final String pref_frameskip = "frame_skip";
public static final String pref_pvrrender = "pvr_render";
public static final String pref_syncedrender = "synced_render";
public static final String pref_cheatdisk = "cheat_disk";
public static final String pref_usereios = "use_reios";
public static boolean dynarecopt = true;
public static boolean idleskip = true;
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 nosound = 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 boolean syncedrender = false;
public static String cheatdisk = "null";
public static boolean usereios = false;
public static boolean nativeact = false;
/**
* Load the user configuration from preferences
*
*/
public void getConfigurationPrefs(Context mContext) {
SharedPreferences mPrefs = PreferenceManager.getDefaultSharedPreferences(mContext);
Emulator.dynarecopt = mPrefs.getBoolean(pref_dynarecopt, dynarecopt);
Emulator.unstableopt = mPrefs.getBoolean(pref_unstable, unstableopt);
Emulator.cable = mPrefs.getInt(pref_cable, cable);
Emulator.dcregion = mPrefs.getInt(pref_dcregion, dcregion);
Emulator.broadcast = mPrefs.getInt(pref_broadcast, broadcast);
Emulator.limitfps = mPrefs.getBoolean(pref_limitfps, limitfps);
Emulator.nosound = mPrefs.getBoolean(pref_nosound, nosound);
Emulator.mipmaps = mPrefs.getBoolean(pref_mipmaps, mipmaps);
Emulator.widescreen = mPrefs.getBoolean(pref_widescreen, widescreen);
Emulator.frameskip = mPrefs.getInt(pref_frameskip, frameskip);
Emulator.pvrrender = mPrefs.getBoolean(pref_pvrrender, pvrrender);
Emulator.syncedrender = mPrefs.getBoolean(pref_syncedrender, syncedrender);
Emulator.cheatdisk = mPrefs.getString(pref_cheatdisk, cheatdisk);
Emulator.usereios = mPrefs.getBoolean(pref_usereios, usereios);
Emulator.nativeact = mPrefs.getBoolean(pref_nativeact, nativeact);
}
/**
* Write configuration settings to the emulator
*
*/
public void loadConfigurationPrefs() {
JNIdc.dynarec(Emulator.dynarecopt ? 1 : 0);
JNIdc.idleskip(Emulator.idleskip ? 1 : 0);
JNIdc.unstable(Emulator.unstableopt ? 1 : 0);
JNIdc.cable(Emulator.cable);
JNIdc.region(Emulator.dcregion);
JNIdc.broadcast(Emulator.broadcast);
JNIdc.limitfps(Emulator.limitfps ? 1 : 0);
JNIdc.nobatch(Emulator.nobatch ? 1 : 0);
JNIdc.nosound(Emulator.nosound ? 1 : 0);
JNIdc.mipmaps(Emulator.mipmaps ? 1 : 0);
JNIdc.widescreen(Emulator.widescreen ? 1 : 0);
JNIdc.subdivide(Emulator.subdivide ? 1 : 0);
JNIdc.frameskip(Emulator.frameskip);
JNIdc.pvrrender(Emulator.pvrrender ? 1 : 0);
JNIdc.syncedrender(Emulator.syncedrender ? 1 : 0);
JNIdc.usereios(Emulator.usereios ? 1 : 0);
JNIdc.cheatdisk(Emulator.cheatdisk);
JNIdc.dreamtime(DreamTime.getDreamtime());
}
static {
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
}
}

View File

@ -1,6 +1,5 @@
package com.reicast.emulator;
import android.annotation.TargetApi;
import android.app.Activity;
import android.content.SharedPreferences;
import android.content.res.Configuration;
@ -44,8 +43,7 @@ public class GL2JNIActivity extends Activity {
FpsPopup fpsPop;
MOGAInput moga = new MOGAInput();
private SharedPreferences prefs;
private Config config;
private Gamepad pad = new Gamepad();
public static byte[] syms;
@ -59,8 +57,8 @@ public class GL2JNIActivity extends Activity {
WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED,
WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED);
}
config = new Config(GL2JNIActivity.this);
config.getConfigurationPrefs();
Emulator app = (Emulator)getApplicationContext();
app.getConfigurationPrefs(GL2JNIActivity.this);
menu = new OnScreenMenu(GL2JNIActivity.this, prefs);
pad.isXperiaPlay = pad.IsXperiaPlay();
@ -198,14 +196,14 @@ public class GL2JNIActivity extends Activity {
pad.fullCompatibilityMode(prefs);
}
config.loadConfigurationPrefs();
app.loadConfigurationPrefs();
// When viewing a resource, pass its URI to the native code for opening
if (getIntent().getAction().equals("com.reicast.EMULATOR"))
fileName = Uri.decode(getIntent().getData().toString());
// Create the actual GLES view
mView = new GL2JNIView(GL2JNIActivity.this, config, fileName, false,
mView = new GL2JNIView(GL2JNIActivity.this, fileName, false,
prefs.getInt(Config.pref_renderdepth, 24), 0, false);
setContentView(mView);

View File

@ -47,7 +47,6 @@ public class GL2JNINative extends NativeActivity {
MOGAInput moga = new MOGAInput();
private SharedPreferences prefs;
private Config config;
private Gamepad pad = new Gamepad();
public static byte[] syms;
@ -75,9 +74,9 @@ public class GL2JNINative extends NativeActivity {
// isNvidiaShield = Gamepad.IsNvidiaShield();
RegisterNative(pad.isXperiaPlay);
config = new Config(GL2JNINative.this);
config.getConfigurationPrefs();
Emulator app = (Emulator)getApplicationContext();
app.getConfigurationPrefs(GL2JNINative.this);
menu = new OnScreenMenu(GL2JNINative.this, prefs);
String fileName = null;
@ -214,14 +213,14 @@ public class GL2JNINative extends NativeActivity {
}
}
config.loadConfigurationPrefs();
app.loadConfigurationPrefs();
// When viewing a resource, pass its URI to the native code for opening
if (getIntent().getAction().equals("com.reicast.EMULATOR"))
fileName = Uri.decode(getIntent().getData().toString());
// Create the actual GLES view
mView = new GL2JNIView(getApplication(), config, fileName, false,
mView = new GL2JNIView(getApplication(), fileName, false,
prefs.getInt(Config.pref_renderdepth, 24), 0, false);
setContentView(mView);

View File

@ -259,9 +259,9 @@ public class MainActivity extends AppCompatActivity implements
if (msg != null) {
launchBIOSdetection();
} else {
Config.nativeact = PreferenceManager.getDefaultSharedPreferences(
getApplicationContext()).getBoolean(Config.pref_nativeact, Config.nativeact);
if (Config.nativeact) {
Emulator.nativeact = PreferenceManager.getDefaultSharedPreferences(
getApplicationContext()).getBoolean(Emulator.pref_nativeact, Emulator.nativeact);
if (Emulator.nativeact) {
startActivity(new Intent("com.reicast.EMULATOR", uri, getApplicationContext(),
GL2JNINative.class));
} else {

View File

@ -1,12 +1,5 @@
package com.reicast.emulator.config;
import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import com.android.util.DreamTime;
import com.reicast.emulator.emu.JNIdc;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
@ -18,112 +11,27 @@ public class Config {
public static final String pref_theme = "button_theme";
public static final String pref_gamedetails = "game_details";
public static final String pref_nativeact = "enable_native";
public static final String pref_dynarecopt = "dynarec_opt";
public static final String pref_unstable = "unstable_opt";
public static final String pref_cable = "dc_cable";
public static final String pref_dcregion = "dc_region";
public static final String pref_broadcast = "dc_broadcast";
public static final String pref_limitfps = "limit_fps";
public static final String pref_nosound = "sound_disabled";
public static final String pref_mipmaps = "use_mipmaps";
public static final String pref_widescreen = "stretch_view";
public static final String pref_frameskip = "frame_skip";
public static final String pref_pvrrender = "pvr_render";
public static final String pref_syncedrender = "synced_render";
public static final String pref_cheatdisk = "cheat_disk";
public static final String pref_usereios = "use_reios";
public static final String pref_showfps = "show_fps";
public static final String pref_forcegpu = "force_gpu";
public static final String pref_rendertype = "render_type";
public static final String pref_renderdepth = "depth_render";
public static final String pref_forcegpu = "force_gpu";
public static final String pref_touchvibe = "touch_vibration_enabled";
public static final String pref_vibrationDuration = "vibration_duration";
public static int vibrationDuration = 20;
public static final String pref_mic = "mic_plugged_in";
public static final String pref_vmu = "vmu_floating";
public static boolean dynarecopt = true;
public static boolean idleskip = true;
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 nosound = 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 boolean syncedrender = false;
public static String cheatdisk = "null";
public static boolean usereios = false;
public static boolean nativeact = false;
public static int vibrationDuration = 20;
public static String git_api = "https://api.github.com/repos/reicast/reicast-emulator/commits";
public static String git_issues = "https://github.com/reicast/reicast-emulator/issues/";
public static String log_url = "http://loungekatt.sytes.net:3194/ReicastBot/report/submit.php";
public static String report_url = "http://loungekatt.sytes.net:3194/ReicastBot/report/logs/";
public static boolean externalIntent = false;
private SharedPreferences mPrefs;
public Config(Context mContext) {
mPrefs = PreferenceManager.getDefaultSharedPreferences(mContext);
}
/**
* Load the user configuration from preferences
*
*/
public void getConfigurationPrefs() {
Config.dynarecopt = mPrefs.getBoolean(pref_dynarecopt, dynarecopt);
Config.unstableopt = mPrefs.getBoolean(pref_unstable, unstableopt);
Config.cable = mPrefs.getInt(pref_cable, cable);
Config.dcregion = mPrefs.getInt(pref_dcregion, dcregion);
Config.broadcast = mPrefs.getInt(pref_broadcast, broadcast);
Config.limitfps = mPrefs.getBoolean(pref_limitfps, limitfps);
Config.nosound = mPrefs.getBoolean(pref_nosound, nosound);
Config.mipmaps = mPrefs.getBoolean(pref_mipmaps, mipmaps);
Config.widescreen = mPrefs.getBoolean(pref_widescreen, widescreen);
Config.frameskip = mPrefs.getInt(pref_frameskip, frameskip);
Config.pvrrender = mPrefs.getBoolean(pref_pvrrender, pvrrender);
Config.syncedrender = mPrefs.getBoolean(pref_syncedrender, syncedrender);
Config.cheatdisk = mPrefs.getString(pref_cheatdisk, cheatdisk);
Config.usereios = mPrefs.getBoolean(pref_usereios, usereios);
Config.nativeact = mPrefs.getBoolean(pref_nativeact, nativeact);
}
/**
* Write configuration settings to the emulator
*
*/
public void loadConfigurationPrefs() {
JNIdc.dynarec(Config.dynarecopt ? 1 : 0);
JNIdc.idleskip(Config.idleskip ? 1 : 0);
JNIdc.unstable(Config.unstableopt ? 1 : 0);
JNIdc.cable(Config.cable);
JNIdc.region(Config.dcregion);
JNIdc.broadcast(Config.broadcast);
JNIdc.limitfps(Config.limitfps ? 1 : 0);
JNIdc.nobatch(Config.nobatch ? 1 : 0);
JNIdc.nosound(Config.nosound ? 1 : 0);
JNIdc.mipmaps(Config.mipmaps ? 1 : 0);
JNIdc.widescreen(Config.widescreen ? 1 : 0);
JNIdc.subdivide(Config.subdivide ? 1 : 0);
JNIdc.frameskip(Config.frameskip);
JNIdc.pvrrender(Config.pvrrender ? 1 : 0);
JNIdc.syncedrender(Config.syncedrender ? 1 : 0);
JNIdc.usereios(Config.usereios ? 1 : 0);
JNIdc.cheatdisk(Config.cheatdisk);
JNIdc.dreamtime(DreamTime.getDreamtime());
}
/**
* Read the output of a shell command
*

View File

@ -1,6 +1,5 @@
package com.reicast.emulator.config;
import android.annotation.TargetApi;
import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
@ -19,6 +18,7 @@ import android.widget.ImageView.ScaleType;
import android.widget.LinearLayout;
import android.widget.PopupWindow;
import com.reicast.emulator.Emulator;
import com.reicast.emulator.MainActivity;
import com.reicast.emulator.R;
import com.reicast.emulator.emu.GL2JNIView;
@ -31,8 +31,6 @@ public class EditVJoyActivity extends Activity {
GL2JNIView mView;
PopupWindow popUp;
LayoutParams params;
private Config config;
private float[][] vjoy_d_cached;
@ -57,11 +55,11 @@ public class EditVJoyActivity extends Activity {
SharedPreferences prefs = PreferenceManager
.getDefaultSharedPreferences(this);
config = new Config(EditVJoyActivity.this);
config.getConfigurationPrefs();
Emulator app = (Emulator)getApplicationContext();
app.getConfigurationPrefs(EditVJoyActivity.this);
// Create the actual GLES view
mView = new GL2JNIView(EditVJoyActivity.this, config, null, false,
mView = new GL2JNIView(EditVJoyActivity.this, null, false,
prefs.getInt(Config.pref_renderdepth, 24), 0, true);
mView.setFpsDisplay(null);
setContentView(mView);

View File

@ -28,7 +28,9 @@ import android.widget.Spinner;
import android.widget.Toast;
import com.android.util.FileUtils;
import com.reicast.emulator.Emulator;
import com.reicast.emulator.FileBrowser;
import com.reicast.emulator.GL2JNIActivity;
import com.reicast.emulator.R;
import com.reicast.emulator.emu.GL2JNIView;
import com.reicast.emulator.emu.JNIdc;
@ -44,7 +46,7 @@ import java.util.List;
public class OptionsFragment extends Fragment {
private Config config;
private Emulator app;
private Button mainBrowse;
private Button gameBrowse;
@ -102,8 +104,8 @@ public class OptionsFragment extends Fragment {
}
home_directory = mPrefs.getString(Config.pref_home, home_directory);
config = new Config(getActivity());
config.getConfigurationPrefs();
app = (Emulator) getActivity().getApplicationContext();
app.getConfigurationPrefs(getActivity());
// Generate the menu options and fill in existing settings
@ -150,12 +152,12 @@ public class OptionsFragment extends Fragment {
public void onCheckedChanged(CompoundButton buttonView,
boolean isChecked) {
mPrefs.edit().putBoolean(Config.pref_usereios, isChecked).commit();
mPrefs.edit().putBoolean(Emulator.pref_usereios, isChecked).commit();
}
};
CompoundButton reios_opt = (CompoundButton) getView().findViewById(
R.id.reios_option);
reios_opt.setChecked(mPrefs.getBoolean(Config.pref_usereios, false));
reios_opt.setChecked(mPrefs.getBoolean(Emulator.pref_usereios, false));
reios_opt.setOnCheckedChangeListener(reios_options);
OnCheckedChangeListener details_options = new OnCheckedChangeListener() {
@ -241,39 +243,39 @@ public class OptionsFragment extends Fragment {
public void onCheckedChanged(CompoundButton buttonView,
boolean isChecked) {
mPrefs.edit().putBoolean(Config.pref_nativeact, isChecked).commit();
Config.nativeact = isChecked;
mPrefs.edit().putBoolean(Emulator.pref_nativeact, isChecked).commit();
Emulator.nativeact = isChecked;
}
};
CompoundButton native_opt = (CompoundButton) getView().findViewById(
R.id.native_option);
native_opt.setChecked(Config.nativeact);
native_opt.setChecked(Emulator.nativeact);
native_opt.setOnCheckedChangeListener(native_options);
OnCheckedChangeListener dynarec_options = new OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView,
boolean isChecked) {
mPrefs.edit().putBoolean(Config.pref_dynarecopt, isChecked).commit();
Config.dynarecopt = isChecked;
mPrefs.edit().putBoolean(Emulator.pref_dynarecopt, isChecked).commit();
Emulator.dynarecopt = isChecked;
}
};
CompoundButton dynarec_opt = (CompoundButton) getView().findViewById(
R.id.dynarec_option);
dynarec_opt.setChecked(Config.dynarecopt);
dynarec_opt.setChecked(Emulator.dynarecopt);
dynarec_opt.setOnCheckedChangeListener(dynarec_options);
OnCheckedChangeListener unstable_option = new OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView,
boolean isChecked) {
mPrefs.edit().putBoolean(Config.pref_unstable, isChecked).commit();
Config.unstableopt = isChecked;
mPrefs.edit().putBoolean(Emulator.pref_unstable, isChecked).commit();
Emulator.unstableopt = isChecked;
}
};
CompoundButton unstable_opt = (CompoundButton) getView().findViewById(
R.id.unstable_option);
if (Config.unstableopt) {
if (Emulator.unstableopt) {
unstable_opt.setChecked(true);
} else {
unstable_opt.setChecked(false);
@ -290,14 +292,14 @@ public class OptionsFragment extends Fragment {
.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
cable_spnr.setAdapter(cableAdapter);
cable_spnr.setSelection(Config.cable - 1, true);
cable_spnr.setSelection(Emulator.cable - 1, true);
cable_spnr.setOnItemSelectedListener(new OnItemSelectedListener() {
public void onItemSelected(AdapterView<?> parent, View view,
int pos, long id) {
mPrefs.edit().putInt(Config.pref_cable, pos + 1).commit();
Config.cable = pos + 1;
mPrefs.edit().putInt(Emulator.pref_cable, pos + 1).commit();
Emulator.cable = pos + 1;
}
public void onNothingSelected(AdapterView<?> arg0) {
@ -316,11 +318,11 @@ public class OptionsFragment extends Fragment {
getActivity(), R.layout.spinner_selected, regions);
regionAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
region_spnr.setAdapter(regionAdapter);
region_spnr.setSelection(Config.dcregion, true);
region_spnr.setSelection(Emulator.dcregion, true);
region_spnr.setOnItemSelectedListener(new OnItemSelectedListener() {
public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
mPrefs.edit().putInt(Config.pref_dcregion, pos).commit();
Config.dcregion = pos;
mPrefs.edit().putInt(Emulator.pref_dcregion, pos).commit();
Emulator.dcregion = pos;
}
@ -337,7 +339,7 @@ public class OptionsFragment extends Fragment {
broadcast_spnr.setAdapter(broadcastAdapter);
int select = 0;
String cast = String.valueOf(Config.broadcast);
String cast = String.valueOf(Emulator.broadcast);
for (int i = 0; i < broadcasts.length; i++) {
if (broadcasts[i].startsWith(cast + " - "))
select = i;
@ -350,9 +352,9 @@ public class OptionsFragment extends Fragment {
String item = parent.getItemAtPosition(pos).toString();
String selection = item.substring(0, item.indexOf(" - "));
mPrefs.edit()
.putInt(Config.pref_broadcast, Integer.parseInt(selection))
.putInt(Emulator.pref_broadcast, Integer.parseInt(selection))
.commit();
Config.broadcast = Integer.parseInt(selection);
Emulator.broadcast = Integer.parseInt(selection);
}
@ -364,41 +366,41 @@ public class OptionsFragment extends Fragment {
OnCheckedChangeListener limitfps_option = new OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
mPrefs.edit().putBoolean(Config.pref_limitfps, isChecked).commit();
Config.limitfps = isChecked;
mPrefs.edit().putBoolean(Emulator.pref_limitfps, isChecked).commit();
Emulator.limitfps = isChecked;
}
};
CompoundButton limit_fps = (CompoundButton) getView().findViewById(R.id.limitfps_option);
limit_fps.setChecked(Config.limitfps);
limit_fps.setChecked(Emulator.limitfps);
limit_fps.setOnCheckedChangeListener(limitfps_option);
OnCheckedChangeListener mipmaps_option = new OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
mPrefs.edit().putBoolean(Config.pref_mipmaps, isChecked).commit();
Config.mipmaps = isChecked;
mPrefs.edit().putBoolean(Emulator.pref_mipmaps, isChecked).commit();
Emulator.mipmaps = isChecked;
}
};
CompoundButton mipmap_opt = (CompoundButton) getView().findViewById(R.id.mipmaps_option);
mipmap_opt.setChecked(Config.mipmaps);
mipmap_opt.setChecked(Emulator.mipmaps);
mipmap_opt.setOnCheckedChangeListener(mipmaps_option);
OnCheckedChangeListener full_screen = new OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
mPrefs.edit().putBoolean(Config.pref_widescreen, isChecked).commit();
Config.widescreen = isChecked;
mPrefs.edit().putBoolean(Emulator.pref_widescreen, isChecked).commit();
Emulator.widescreen = isChecked;
}
};
CompoundButton stretch_view = (CompoundButton) getView().findViewById(R.id.stretch_option);
stretch_view.setChecked(Config.widescreen);
stretch_view.setChecked(Emulator.widescreen);
stretch_view.setOnCheckedChangeListener(full_screen);
final EditText mainFrames = (EditText) getView().findViewById(R.id.current_frames);
mainFrames.setText(String.valueOf(Config.frameskip));
mainFrames.setText(String.valueOf(Emulator.frameskip));
final SeekBar frameSeek = (SeekBar) getView().findViewById(R.id.frame_seekbar);
frameSeek.setProgress(Config.frameskip);
frameSeek.setProgress(Emulator.frameskip);
frameSeek.setIndeterminate(false);
frameSeek.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
@ -411,8 +413,8 @@ public class OptionsFragment extends Fragment {
public void onStopTrackingTouch(SeekBar seekBar) {
int progress = seekBar.getProgress();
mPrefs.edit().putInt(Config.pref_frameskip, progress).commit();
Config.frameskip = progress;
mPrefs.edit().putInt(Emulator.pref_frameskip, progress).commit();
Emulator.frameskip = progress;
}
});
mainFrames.addTextChangedListener(new TextWatcher() {
@ -421,8 +423,8 @@ public class OptionsFragment extends Fragment {
if (frameText != null) {
int frames = Integer.parseInt(frameText);
frameSeek.setProgress(frames);
mPrefs.edit().putInt(Config.pref_frameskip, frames).commit();
Config.frameskip = frames;
mPrefs.edit().putInt(Emulator.pref_frameskip, frames).commit();
Emulator.frameskip = frames;
}
}
@ -436,26 +438,26 @@ public class OptionsFragment extends Fragment {
OnCheckedChangeListener pvr_rendering = new OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
mPrefs.edit().putBoolean(Config.pref_pvrrender, isChecked).commit();
Config.pvrrender = isChecked;
mPrefs.edit().putBoolean(Emulator.pref_pvrrender, isChecked).commit();
Emulator.pvrrender = isChecked;
}
};
CompoundButton pvr_render = (CompoundButton) getView().findViewById(R.id.render_option);
pvr_render.setChecked(Config.pvrrender);
pvr_render.setChecked(Emulator.pvrrender);
pvr_render.setOnCheckedChangeListener(pvr_rendering);
OnCheckedChangeListener synchronous = new OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
mPrefs.edit().putBoolean(Config.pref_syncedrender, isChecked).commit();
Config.syncedrender = isChecked;
mPrefs.edit().putBoolean(Emulator.pref_syncedrender, isChecked).commit();
Emulator.syncedrender = isChecked;
}
};
CompoundButton synced_render = (CompoundButton) getView().findViewById(R.id.syncrender_option);
synced_render.setChecked(Config.syncedrender);
synced_render.setChecked(Emulator.syncedrender);
synced_render.setOnCheckedChangeListener(synchronous);
final EditText cheatEdit = (EditText) getView().findViewById(R.id.cheat_disk);
String disk = Config.cheatdisk;
String disk = Emulator.cheatdisk;
if (disk != null && disk.contains("/")) {
cheatEdit.setText(disk.substring(disk.lastIndexOf("/"),
disk.length()));
@ -473,8 +475,8 @@ public class OptionsFragment extends Fragment {
} else {
cheatEdit.setText(disk);
}
mPrefs.edit().putString(Config.pref_cheatdisk, disk).commit();
Config.cheatdisk = disk;
mPrefs.edit().putString(Emulator.pref_cheatdisk, disk).commit();
Emulator.cheatdisk = disk;
}
}
@ -540,11 +542,11 @@ public class OptionsFragment extends Fragment {
OnCheckedChangeListener emu_sound = new OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
mPrefs.edit().putBoolean(Config.pref_nosound, isChecked).commit();
Config.nosound = isChecked;
mPrefs.edit().putBoolean(Emulator.pref_nosound, isChecked).commit();
Emulator.nosound = isChecked;
}
};
boolean sound = mPrefs.getBoolean(Config.pref_nosound, false);
boolean sound = mPrefs.getBoolean(Emulator.pref_nosound, false);
sound_opt.setChecked(sound);
sound_opt.setOnCheckedChangeListener(emu_sound);

View File

@ -27,6 +27,7 @@ import android.view.WindowManager;
import android.widget.Toast;
import com.android.util.FileUtils;
import com.reicast.emulator.Emulator;
import com.reicast.emulator.GL2JNIActivity;
import com.reicast.emulator.GL2JNINative;
import com.reicast.emulator.MainActivity;
@ -114,7 +115,7 @@ public class GL2JNIView extends GLSurfaceView
}
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public GL2JNIView(Context context, Config config, String newFileName,
public GL2JNIView(Context context, String newFileName,
boolean translucent, int depth, int stencil, boolean editVjoyMode) {
super(context);
this.context = context;
@ -151,7 +152,7 @@ public class GL2JNIView extends GLSurfaceView
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
ethd = new EmuThread(!Config.nosound);
ethd = new EmuThread(!Emulator.nosound);
touchVibrationEnabled = prefs.getBoolean(Config.pref_touchvibe, true);
vibrationDuration = prefs.getInt(Config.pref_vibrationDuration, 20);
@ -172,8 +173,6 @@ public class GL2JNIView extends GLSurfaceView
}
}
// config.loadConfigurationPrefs();
vjoy_d_custom = VJoy.readCustomVjoyValues(context);
scaleGestureDetector = new ScaleGestureDetector(context, new OscOnScaleGestureListener());
@ -181,7 +180,7 @@ public class GL2JNIView extends GLSurfaceView
// This is the game we are going to run
fileName = newFileName;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD && Config.nativeact) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD && Emulator.nativeact) {
if (GL2JNINative.syms != null)
JNIdc.data(1, GL2JNINative.syms);
} else {

View File

@ -17,6 +17,7 @@ import android.widget.PopupWindow;
import android.widget.ScrollView;
import android.widget.TextView;
import com.reicast.emulator.Emulator;
import com.reicast.emulator.GL2JNIActivity;
import com.reicast.emulator.GL2JNINative;
import com.reicast.emulator.MainActivity;
@ -39,9 +40,9 @@ public class OnScreenMenu {
private File sdcard = Environment.getExternalStorageDirectory();
private String home_directory = sdcard + "/dc";
private int frames = Config.frameskip;
private boolean screen = Config.widescreen;
private boolean limit = Config.limitfps;
private int frames = Emulator.frameskip;
private boolean screen = Emulator.widescreen;
private boolean limit = Emulator.limitfps;
private boolean audio;
private boolean masteraudio;
private boolean boosted = false;
@ -58,9 +59,9 @@ public class OnScreenMenu {
if (prefs != null) {
this.prefs = prefs;
home_directory = prefs.getString(Config.pref_home, home_directory);
masteraudio = !Config.nosound;
masteraudio = !Emulator.nosound;
audio = masteraudio;
syncedrender = Config.syncedrender;
syncedrender = Emulator.syncedrender;
}
vmuLcd = new VmuLcd(mContext);
vmuLcd.setOnClickListener(new OnClickListener() {

View File

@ -1,15 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item>
<shape android:shape="rectangle" android:padding="10dp" >
<solid android:color="#D0000000"/>
</shape>
</item>
<item>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:gravity="center"
app:srcCompat="@drawable/menutile"
android:tileMode="repeat" />
</item>
<item>
<shape android:shape="rectangle" android:padding="10dp" >
<solid android:color="#D0000000"/>
</shape>
</item>
<item>
<bitmap
android:gravity="center"
app:srcCompat="@drawable/menutile"
android:tileMode="repeat" />
</item>
</layer-list>

View File

@ -4,7 +4,7 @@
android:id="@+id/child_root"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
android:orientation="vertical">
<View
android:layout_width="match_parent"

View File

@ -6,7 +6,6 @@
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:id="@+id/childview"
android:layout_width="match_parent"

View File

@ -1,49 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/child_root"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:id="@+id/childview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_centerInParent="true"
android:clickable="true"
android:focusable="true"
android:background="@drawable/game_selector" >
<ImageView
android:id="@+id/item_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_gravity="center"
android:tint="@color/ice_light"
app:srcCompat="@drawable/ic_folder_black_24dp" />
<TextView
android:id="@+id/item_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="sans-serif-light"
android:paddingBottom="18dp"
android:paddingTop="18dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:textSize="@dimen/primary_text_material"
android:textColor="@color/ice_light"
android:text="@string/disk_loading" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="73dp"
android:background="?android:attr/listDivider"/>
</LinearLayout>