Merge pull request #1337 from reicast/lk/abandoned

Android: Optimization, Cleanup, and Release Prep
This commit is contained in:
Abandoned Cart 2018-08-26 23:27:04 -04:00 committed by GitHub
commit e138241bce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 55 additions and 68 deletions

View File

@ -44,7 +44,7 @@ install:
- test -z "$encrypted_c726d225a9d9_key" || mv debug.keystore ~/.android/debug.keystore - test -z "$encrypted_c726d225a9d9_key" || mv debug.keystore ~/.android/debug.keystore
before_script: before_script:
script: script:
- git fetch --depth 50 - git fetch --depth 250
- cd shell/android-studio - cd shell/android-studio
- export NUMBER_OF_PROCESSORS=2 - export NUMBER_OF_PROCESSORS=2
- sudo chmod 755 travis-build.sh - sudo chmod 755 travis-build.sh

View File

@ -246,12 +246,12 @@ void Write_SB_ADST(u32 addr, u32 data)
SB_ADSTAR+=len; SB_ADSTAR+=len;
SB_ADSTAG+=len; SB_ADSTAG+=len;
total_bytes+=len; total_bytes+=len;
SB_ADST = settings.aica.InterruptHack ? 1 : 0x00000000;//dma done SB_ADST = settings.aica.DelayInterrupt ? 1 : 0x00000000;//dma done
SB_ADLEN = 0x00000000; SB_ADLEN = 0x00000000;
aica_pending_dma = ((total_bytes * 200000000) / 65536) + 1; aica_pending_dma = ((total_bytes * 200000000) / 65536) + 1;
if (!settings.aica.InterruptHack) if (!settings.aica.DelayInterrupt)
asic_RaiseInterruptWait(holly_SPU_DMA); asic_RaiseInterruptWait(holly_SPU_DMA);
} }
} }
@ -334,4 +334,4 @@ void aica_sb_Reset(bool Manual)
void aica_sb_Term() void aica_sb_Term()
{ {
} }

View File

@ -210,7 +210,7 @@ int AicaUpdate(int tag, int c, int j)
//aica_sample_cycles-=AICA_SAMPLE_CYCLES; //aica_sample_cycles-=AICA_SAMPLE_CYCLES;
} }
if (settings.aica.InterruptHack) if (settings.aica.DelayInterrupt)
aica_periodical(3584); aica_periodical(3584);
return AICA_TICK; return AICA_TICK;

View File

@ -298,7 +298,7 @@ void LoadSettings()
settings.aica.LimitFPS = cfgLoadInt("config", "aica.LimitFPS", 1); settings.aica.LimitFPS = cfgLoadInt("config", "aica.LimitFPS", 1);
settings.aica.NoBatch = cfgLoadInt("config", "aica.NoBatch", 0); settings.aica.NoBatch = cfgLoadInt("config", "aica.NoBatch", 0);
settings.aica.NoSound = cfgLoadInt("config", "aica.NoSound", 0); settings.aica.NoSound = cfgLoadInt("config", "aica.NoSound", 0);
settings.aica.InterruptHack = cfgLoadInt("config", "aica.InterruptHack", 0); settings.aica.DelayInterrupt = cfgLoadInt("config", "aica.DelayInterrupt", 0);
settings.rend.UseMipmaps = cfgLoadInt("config", "rend.UseMipmaps", 1); settings.rend.UseMipmaps = cfgLoadInt("config", "rend.UseMipmaps", 1);
settings.rend.WideScreen = cfgLoadInt("config", "rend.WideScreen", 0); settings.rend.WideScreen = cfgLoadInt("config", "rend.WideScreen", 0);
settings.rend.ModifierVolumes = cfgLoadInt("config", "rend.ModifierVolumes", 1); settings.rend.ModifierVolumes = cfgLoadInt("config", "rend.ModifierVolumes", 1);
@ -358,7 +358,7 @@ void LoadCustom()
settings.dynarec.idleskip = cfgGameInt(reios_id,"Dynarec.idleskip", settings.dynarec.idleskip ? 1 : 0) != 0; settings.dynarec.idleskip = cfgGameInt(reios_id,"Dynarec.idleskip", settings.dynarec.idleskip ? 1 : 0) != 0;
settings.dynarec.unstable_opt = cfgGameInt(reios_id,"Dynarec.unstable-opt", settings.dynarec.unstable_opt); settings.dynarec.unstable_opt = cfgGameInt(reios_id,"Dynarec.unstable-opt", settings.dynarec.unstable_opt);
settings.dynarec.safemode = cfgGameInt(reios_id,"Dynarec.safemode", settings.dynarec.safemode); settings.dynarec.safemode = cfgGameInt(reios_id,"Dynarec.safemode", settings.dynarec.safemode);
settings.aica.InterruptHack = cfgLoadInt(reios_id,"aica.InterruptHack", settings.aica.InterruptHack); settings.aica.DelayInterrupt = cfgLoadInt(reios_id,"aica.DelayInterrupt", settings.aica.DelayInterrupt);
settings.rend.ModifierVolumes = cfgGameInt(reios_id,"rend.ModifierVolumes", settings.rend.ModifierVolumes); settings.rend.ModifierVolumes = cfgGameInt(reios_id,"rend.ModifierVolumes", settings.rend.ModifierVolumes);
settings.rend.Clipping = cfgGameInt(reios_id,"rend.Clipping", settings.rend.Clipping); settings.rend.Clipping = cfgGameInt(reios_id,"rend.Clipping", settings.rend.Clipping);

View File

@ -653,7 +653,7 @@ struct settings_t
u32 DSPEnabled; //0 -> no, 1 -> yes u32 DSPEnabled; //0 -> no, 1 -> yes
u32 NoBatch; u32 NoBatch;
u32 NoSound; //0 ->sound, 1 -> no sound u32 NoSound; //0 ->sound, 1 -> no sound
u32 InterruptHack; u32 DelayInterrupt;
} aica; } aica;
#if USE_OMX #if USE_OMX

View File

@ -16,7 +16,6 @@
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.BLUETOOTH" /> <uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_SERVICE" />
<uses-feature <uses-feature
android:glEsVersion="0x00020000" android:glEsVersion="0x00020000"
@ -45,6 +44,8 @@
android:hardwareAccelerated="true" android:hardwareAccelerated="true"
android:isGame="true"> android:isGame="true">
<meta-data android:name="android.max_aspect" android:value="2.1" />
<activity <activity
android:name=".MainActivity" android:name=".MainActivity"
android:configChanges="orientation|navigation|screenSize|screenLayout|uiMode|keyboard|keyboardHidden" android:configChanges="orientation|navigation|screenSize|screenLayout|uiMode|keyboard|keyboardHidden"

View File

@ -19,7 +19,7 @@ public class Emulator extends Application {
public static final String pref_broadcast = "dc_broadcast"; public static final String pref_broadcast = "dc_broadcast";
public static final String pref_limitfps = "limit_fps"; public static final String pref_limitfps = "limit_fps";
public static final String pref_nosound = "sound_disabled"; public static final String pref_nosound = "sound_disabled";
public static final String pref_interrupt = "interrupt_hack"; public static final String pref_interrupt = "delay_interrupt";
public static final String pref_mipmaps = "use_mipmaps"; public static final String pref_mipmaps = "use_mipmaps";
public static final String pref_widescreen = "stretch_view"; public static final String pref_widescreen = "stretch_view";
public static final String pref_frameskip = "frame_skip"; public static final String pref_frameskip = "frame_skip";
@ -94,7 +94,7 @@ public class Emulator extends Application {
JNIdc.limitfps(Emulator.limitfps ? 1 : 0); JNIdc.limitfps(Emulator.limitfps ? 1 : 0);
JNIdc.nobatch(Emulator.nobatch ? 1 : 0); JNIdc.nobatch(Emulator.nobatch ? 1 : 0);
JNIdc.nosound(Emulator.nosound ? 1 : 0); JNIdc.nosound(Emulator.nosound ? 1 : 0);
JNIdc.interrupthack(Emulator.interrupt ? 1 : 0); JNIdc.delayinterrupt(Emulator.interrupt ? 1 : 0);
JNIdc.mipmaps(Emulator.mipmaps ? 1 : 0); JNIdc.mipmaps(Emulator.mipmaps ? 1 : 0);
JNIdc.widescreen(Emulator.widescreen ? 1 : 0); JNIdc.widescreen(Emulator.widescreen ? 1 : 0);
JNIdc.subdivide(Emulator.subdivide ? 1 : 0); JNIdc.subdivide(Emulator.subdivide ? 1 : 0);
@ -113,7 +113,7 @@ public class Emulator extends Application {
JNIdc.dynarec(mPrefs.getBoolean(pref_dynarecopt, dynarecopt) ? 1 : 0); JNIdc.dynarec(mPrefs.getBoolean(pref_dynarecopt, dynarecopt) ? 1 : 0);
JNIdc.unstable(mPrefs.getBoolean(pref_unstable, unstableopt) ? 1 : 0); JNIdc.unstable(mPrefs.getBoolean(pref_unstable, unstableopt) ? 1 : 0);
JNIdc.safemode(mPrefs.getBoolean(pref_dynsafemode, dynsafemode) ? 1 : 0); JNIdc.safemode(mPrefs.getBoolean(pref_dynsafemode, dynsafemode) ? 1 : 0);
JNIdc.interrupthack(mPrefs.getBoolean(pref_interrupt, interrupt) ? 1 : 0); JNIdc.delayinterrupt(mPrefs.getBoolean(pref_interrupt, interrupt) ? 1 : 0);
JNIdc.frameskip(mPrefs.getInt(pref_frameskip, frameskip)); JNIdc.frameskip(mPrefs.getInt(pref_frameskip, frameskip));
JNIdc.pvrrender(mPrefs.getBoolean(pref_pvrrender, pvrrender) ? 1 : 0); JNIdc.pvrrender(mPrefs.getBoolean(pref_pvrrender, pvrrender) ? 1 : 0);
JNIdc.syncedrender(mPrefs.getBoolean(pref_syncedrender, syncedrender) ? 1 : 0); JNIdc.syncedrender(mPrefs.getBoolean(pref_syncedrender, syncedrender) ? 1 : 0);

View File

@ -40,7 +40,6 @@ import com.reicast.emulator.debug.GenerateLogs;
import com.reicast.emulator.emu.JNIdc; import com.reicast.emulator.emu.JNIdc;
import com.reicast.emulator.periph.Gamepad; import com.reicast.emulator.periph.Gamepad;
import java.io.File;
import java.lang.Thread.UncaughtExceptionHandler; import java.lang.Thread.UncaughtExceptionHandler;
import java.util.List; import java.util.List;
@ -215,29 +214,10 @@ public class MainActivity extends AppCompatActivity implements
builder.show(); builder.show();
} }
public static boolean isBiosExisting(String home_directory) {
return new File (home_directory, "data/dc_boot.bin").exists();
}
public static boolean isFlashExisting(String home_directory) {
return new File (home_directory, "data/dc_flash.bin").exists();
}
public void onGameSelected(Uri uri) { public void onGameSelected(Uri uri) {
String home_directory = mPrefs.getString(Config.pref_home, String home_directory = mPrefs.getString(Config.pref_home,
Environment.getExternalStorageDirectory().getAbsolutePath()); Environment.getExternalStorageDirectory().getAbsolutePath());
if (!mPrefs.getBoolean(Emulator.pref_usereios, false)) {
if (!isBiosExisting(home_directory)) {
launchBIOSdetection();
return;
}
if (!isFlashExisting(home_directory)) {
launchBIOSdetection();
return;
}
}
JNIdc.config(home_directory); JNIdc.config(home_directory);
Emulator.nativeact = PreferenceManager.getDefaultSharedPreferences( Emulator.nativeact = PreferenceManager.getDefaultSharedPreferences(
@ -251,28 +231,6 @@ public class MainActivity extends AppCompatActivity implements
} }
} }
private void launchBIOSdetection() {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(R.string.bios_selection);
builder.setPositiveButton(R.string.browse,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
String home_directory = mPrefs.getString(Config.pref_home,
Environment.getExternalStorageDirectory().getAbsolutePath());
onMainBrowseSelected(false, home_directory, false, null);
}
});
builder.setNegativeButton(R.string.gdrive,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
showToastMessage(getString(R.string.require_bios),
Snackbar.LENGTH_SHORT);
}
});
builder.create();
builder.show();
}
public void onFolderSelected(Uri uri) { public void onFolderSelected(Uri uri) {
FileBrowser browserFrag = (FileBrowser) getSupportFragmentManager() FileBrowser browserFrag = (FileBrowser) getSupportFragmentManager()
.findFragmentByTag("MAIN_BROWSER"); .findFragmentByTag("MAIN_BROWSER");
@ -327,6 +285,28 @@ public class MainActivity extends AppCompatActivity implements
setTitle(R.string.browser); setTitle(R.string.browser);
} }
public void launchBIOSdetection() {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(R.string.bios_selection);
builder.setPositiveButton(R.string.browse,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
String home_directory = mPrefs.getString(Config.pref_home,
Environment.getExternalStorageDirectory().getAbsolutePath());
onMainBrowseSelected(false, home_directory, false, null);
}
});
builder.setNegativeButton(R.string.gdrive,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
showToastMessage(getString(R.string.require_bios),
Snackbar.LENGTH_SHORT);
}
});
builder.create();
builder.show();
}
@Override @Override
public void onConfigurationChanged(Configuration newConfig) { public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig); super.onConfigurationChanged(newConfig);

View File

@ -33,10 +33,12 @@ import android.widget.Spinner;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import com.reicast.emulator.MainActivity; import com.reicast.emulator.Emulator;
import com.reicast.emulator.R; import com.reicast.emulator.R;
import com.reicast.emulator.periph.Gamepad; import com.reicast.emulator.periph.Gamepad;
import java.io.File;
public class InputFragment extends Fragment { public class InputFragment extends Fragment {
private static final int PERMISSION_REQUEST = 1001; private static final int PERMISSION_REQUEST = 1001;
@ -90,11 +92,7 @@ public class InputFragment extends Fragment {
} }
}); });
String home_directory = mPrefs.getString(Config.pref_home, buttonLaunchEditor.setEnabled(isBIOSAvailable());
Environment.getExternalStorageDirectory().getAbsolutePath());
if (!MainActivity.isBiosExisting(home_directory) || !MainActivity.isFlashExisting(home_directory))
buttonLaunchEditor.setEnabled(false);
final TextView duration = (TextView) getView().findViewById(R.id.vibDuration_current); final TextView duration = (TextView) getView().findViewById(R.id.vibDuration_current);
final LinearLayout vibLay = (LinearLayout) getView().findViewById(R.id.vibDuration_layout); final LinearLayout vibLay = (LinearLayout) getView().findViewById(R.id.vibDuration_layout);
@ -251,6 +249,13 @@ public class InputFragment extends Fragment {
updateVibration(); updateVibration();
} }
private boolean isBIOSAvailable() {
String home_directory = mPrefs.getString(Config.pref_home,
Environment.getExternalStorageDirectory().getAbsolutePath());
return new File(home_directory, "data/dc_flash.bin").exists()
|| mPrefs.getBoolean(Emulator.pref_usereios, false);
}
private void updateVibration() { private void updateVibration() {
boolean touchVibrationEnabled = mPrefs.getBoolean(Config.pref_touchvibe, true); boolean touchVibrationEnabled = mPrefs.getBoolean(Config.pref_touchvibe, true);
switchTouchVibrationEnabled.setChecked(touchVibrationEnabled); switchTouchVibrationEnabled.setChecked(touchVibrationEnabled);

View File

@ -71,6 +71,7 @@ public class OptionsFragment extends Fragment {
// Container Activity must implement this interface // Container Activity must implement this interface
public interface OnClickListener { public interface OnClickListener {
void onMainBrowseSelected(boolean browse, String path_entry, boolean games, String query); void onMainBrowseSelected(boolean browse, String path_entry, boolean games, String query);
void launchBIOSdetection();
} }
@Override @Override
@ -141,7 +142,7 @@ public class OptionsFragment extends Fragment {
public void onClick(View view) { public void onClick(View view) {
mPrefs.edit().remove(Config.pref_home).apply(); mPrefs.edit().remove(Config.pref_home).apply();
hideSoftKeyBoard(); hideSoftKeyBoard();
mCallback.onMainBrowseSelected(false, home_directory, false, null); mCallback.launchBIOSdetection();
} }
}); });
@ -474,14 +475,14 @@ public class OptionsFragment extends Fragment {
modifier_volumes.setOnCheckedChangeListener(mod_volumes); modifier_volumes.setOnCheckedChangeListener(mod_volumes);
CompoundButton interrupt_opt = (CompoundButton) getView().findViewById(R.id.interrupt_option); CompoundButton interrupt_opt = (CompoundButton) getView().findViewById(R.id.interrupt_option);
OnCheckedChangeListener interrupthack = new OnCheckedChangeListener() { OnCheckedChangeListener delayinterrupt = new OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
mPrefs.edit().putBoolean(Emulator.pref_interrupt, isChecked).apply(); mPrefs.edit().putBoolean(Emulator.pref_interrupt, isChecked).apply();
} }
}; };
interrupt_opt.setChecked(mPrefs.getBoolean(Emulator.pref_interrupt, false)); interrupt_opt.setChecked(mPrefs.getBoolean(Emulator.pref_interrupt, false));
interrupt_opt.setOnCheckedChangeListener(interrupthack); interrupt_opt.setOnCheckedChangeListener(delayinterrupt);
// final EditText bootdiskEdit = (EditText) getView().findViewById(R.id.boot_disk); // final EditText bootdiskEdit = (EditText) getView().findViewById(R.id.boot_disk);
// String disk = Emulator.bootdisk; // String disk = Emulator.bootdisk;

View File

@ -39,7 +39,7 @@ public final class JNIdc
public static native void limitfps(int limiter); public static native void limitfps(int limiter);
public static native void nobatch(int nobatch); public static native void nobatch(int nobatch);
public static native void nosound(int noaudio); public static native void nosound(int noaudio);
public static native void interrupthack(int interrupt); public static native void delayinterrupt(int delayed);
public static native void mipmaps(int mipmaps); public static native void mipmaps(int mipmaps);
public static native void widescreen(int stretch); public static native void widescreen(int stretch);
public static native void subdivide(int subdivide); public static native void subdivide(int subdivide);

View File

@ -54,7 +54,7 @@ JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_broadcast(JNIEnv *env
JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_limitfps(JNIEnv *env,jobject obj, jint limiter) __attribute__((visibility("default"))); JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_limitfps(JNIEnv *env,jobject obj, jint limiter) __attribute__((visibility("default")));
JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_nobatch(JNIEnv *env,jobject obj, jint nobatch) __attribute__((visibility("default"))); JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_nobatch(JNIEnv *env,jobject obj, jint nobatch) __attribute__((visibility("default")));
JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_nosound(JNIEnv *env,jobject obj, jint noaudio) __attribute__((visibility("default"))); JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_nosound(JNIEnv *env,jobject obj, jint noaudio) __attribute__((visibility("default")));
JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_interrupthack(JNIEnv *env,jobject obj, jint interrupt) __attribute__((visibility("default"))); JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_delayinterrupt(JNIEnv *env,jobject obj, jint delayed) __attribute__((visibility("default")));
JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_mipmaps(JNIEnv *env,jobject obj, jint mipmaps) __attribute__((visibility("default"))); JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_mipmaps(JNIEnv *env,jobject obj, jint mipmaps) __attribute__((visibility("default")));
JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_widescreen(JNIEnv *env,jobject obj, jint stretch) __attribute__((visibility("default"))); JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_widescreen(JNIEnv *env,jobject obj, jint stretch) __attribute__((visibility("default")));
JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_subdivide(JNIEnv *env,jobject obj, jint subdivide) __attribute__((visibility("default"))); JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_subdivide(JNIEnv *env,jobject obj, jint subdivide) __attribute__((visibility("default")));
@ -118,9 +118,9 @@ JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_nosound(JNIEnv *env,j
settings.aica.NoSound = noaudio; settings.aica.NoSound = noaudio;
} }
JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_interrupthack(JNIEnv *env,jobject obj, jint interrupt) JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_delayinterrupt(JNIEnv *env,jobject obj, jint delayed)
{ {
settings.aica.InterruptHack = interrupt; settings.aica.DelayInterrupt = delayed;
} }
JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_mipmaps(JNIEnv *env,jobject obj, jint mipmaps) JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_mipmaps(JNIEnv *env,jobject obj, jint mipmaps)

View File

@ -50,7 +50,7 @@
<string name="select_syncrender">Synchronous Rendering</string> <string name="select_syncrender">Synchronous Rendering</string>
<string name="select_queuerender">Force Queue Rendering</string> <string name="select_queuerender">Force Queue Rendering</string>
<string name="select_modvols">Enable Modifier Volumes</string> <string name="select_modvols">Enable Modifier Volumes</string>
<string name="select_interrupt">Enable Interrupt Hack</string> <string name="select_interrupt">Enable Delay Interrupt</string>
<string name="select_fps">Show On-Screen FPS</string> <string name="select_fps">Show On-Screen FPS</string>
<string name="select_software">Use Software Layer</string> <string name="select_software">Use Software Layer</string>
<string name="select_sound">Disable Emulator Sound</string> <string name="select_sound">Disable Emulator Sound</string>