From 8352d1bd61eaf7ad025d68fa3311eb3919185e94 Mon Sep 17 00:00:00 2001 From: zilmar Date: Wed, 23 Nov 2016 19:27:53 +1100 Subject: [PATCH] [Android] Add Audio logging settings --- Android/res/values/strings.xml | 4 ++ Android/res/xml/logging_audio.xml | 14 +++++++ Android/res/xml/settings_advanced.xml | 9 +++-- .../src/emu/project64/jni/AudioSettingID.java | 40 +++++++++++++++++++ .../settings/BaseSettingsFragment.java | 4 ++ .../emu/project64/settings/LoggingAudio.java | 28 +++++++++++++ .../project64/settings/SettingsActivity.java | 25 +++++------- 7 files changed, 105 insertions(+), 19 deletions(-) create mode 100644 Android/res/xml/logging_audio.xml create mode 100644 Android/src/emu/project64/jni/AudioSettingID.java create mode 100644 Android/src/emu/project64/settings/LoggingAudio.java diff --git a/Android/res/values/strings.xml b/Android/res/values/strings.xml index 40f6c6c6d..e13427277 100644 --- a/Android/res/values/strings.xml +++ b/Android/res/values/strings.xml @@ -129,7 +129,9 @@ Log recompiler code Logging Project64 Core + Audio Plugin Logging - Project64 Core + Logging - Audio Error Warning Notice @@ -158,6 +160,8 @@ User Interface Rom List Exception Handler + Init/Shutdown + Interface CPU core style Interpreter Recompiler diff --git a/Android/res/xml/logging_audio.xml b/Android/res/xml/logging_audio.xml new file mode 100644 index 000000000..a23d2a5d1 --- /dev/null +++ b/Android/res/xml/logging_audio.xml @@ -0,0 +1,14 @@ + + + + + + diff --git a/Android/res/xml/settings_advanced.xml b/Android/res/xml/settings_advanced.xml index 189024c8c..d283feaa0 100644 --- a/Android/res/xml/settings_advanced.xml +++ b/Android/res/xml/settings_advanced.xml @@ -31,8 +31,11 @@ android:summary="@string/ForceGfxReset_summary" android:title="@string/ForceGfxReset_title" /> - + + diff --git a/Android/src/emu/project64/jni/AudioSettingID.java b/Android/src/emu/project64/jni/AudioSettingID.java new file mode 100644 index 000000000..3ca92318c --- /dev/null +++ b/Android/src/emu/project64/jni/AudioSettingID.java @@ -0,0 +1,40 @@ +/**************************************************************************** +* * +* Project 64 - A Nintendo 64 emulator. * +* http://www.pj64-emu.com/ * +* Copyright (C) 2012 Project64. All rights reserved. * +* * +* License: * +* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html * +* * +****************************************************************************/ +package emu.project64.jni; + +public enum AudioSettingID +{ + Output_SwapChannels, + Output_DefaultFrequency, + Buffer_PrimarySize, + Buffer_SecondarySize, + Buffer_SecondaryNbr, + Logging_LogAudioInitShutdown, + Logging_LogAudioInterface, + ; + + private int value; + + public int getValue() + { + return this.value; + } + private static final class StaticFields + { + public static int Counter = 0; + } + + private AudioSettingID() + { + this.value = StaticFields.Counter; + StaticFields.Counter += 1; + } +} diff --git a/Android/src/emu/project64/settings/BaseSettingsFragment.java b/Android/src/emu/project64/settings/BaseSettingsFragment.java index 77869986e..50b1459c0 100644 --- a/Android/src/emu/project64/settings/BaseSettingsFragment.java +++ b/Android/src/emu/project64/settings/BaseSettingsFragment.java @@ -129,6 +129,10 @@ public abstract class BaseSettingsFragment extends PreferenceFragmentCompat { loadFragment(new LoggingProject64Core()); } + else if (preference.getKey().equals("logging_audio")) + { + loadFragment(new LoggingAudio()); + } else if (preference.getKey().equals("settings_reset")) { DialogInterface.OnClickListener internalListener = new DialogInterface.OnClickListener() diff --git a/Android/src/emu/project64/settings/LoggingAudio.java b/Android/src/emu/project64/settings/LoggingAudio.java new file mode 100644 index 000000000..e42e99c73 --- /dev/null +++ b/Android/src/emu/project64/settings/LoggingAudio.java @@ -0,0 +1,28 @@ +/**************************************************************************** +* * +* Project64 - A Nintendo 64 emulator. * +* http://www.pj64-emu.com/ * +* Copyright (C) 2012 Project64. All rights reserved. * +* * +* License: * +* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html * +* * +****************************************************************************/ +package emu.project64.settings; + +import emu.project64.R; + +public class LoggingAudio extends BaseSettingsFragment +{ + @Override + protected int getXml() + { + return R.xml.logging_audio; + } + + @Override + protected int getTitleId() + { + return R.string.logging_Audio; + } +} diff --git a/Android/src/emu/project64/settings/SettingsActivity.java b/Android/src/emu/project64/settings/SettingsActivity.java index 6e4e8059b..081591ab7 100644 --- a/Android/src/emu/project64/settings/SettingsActivity.java +++ b/Android/src/emu/project64/settings/SettingsActivity.java @@ -12,6 +12,7 @@ package emu.project64.settings; import emu.project64.AndroidDevice; import emu.project64.R; +import emu.project64.jni.AudioSettingID; import emu.project64.jni.NativeExports; import emu.project64.jni.SettingsID; import emu.project64.jni.SystemEvent; @@ -85,6 +86,8 @@ public class SettingsActivity extends AppCompatActivity implements SharedPrefere .putString("Debugger_TraceUserInterface",String.valueOf(NativeExports.SettingsLoadDword(SettingsID.Debugger_TraceUserInterface.getValue()))) .putString("Debugger_TraceRomList",String.valueOf(NativeExports.SettingsLoadDword(SettingsID.Debugger_TraceRomList.getValue()))) .putString("Debugger_TraceExceptionHandler",String.valueOf(NativeExports.SettingsLoadDword(SettingsID.Debugger_TraceExceptionHandler.getValue()))) + .putString("Debugger_TraceAudioInitShutdown",String.valueOf(NativeExports.SettingsLoadDword(SettingsID.FirstAudioSettings.getValue() + AudioSettingID.Logging_LogAudioInitShutdown.getValue()))) + .putString("Debugger_TraceAudioAudioInterface",String.valueOf(NativeExports.SettingsLoadDword(SettingsID.FirstAudioSettings.getValue() + AudioSettingID.Logging_LogAudioInterface.getValue()))) .putInt("MaxRomsRemembered",NativeExports.UISettingsLoadDword(UISettingID.File_RecentGameFileCount.getValue())) .apply(); @@ -188,22 +191,12 @@ public class SettingsActivity extends AppCompatActivity implements SharedPrefere { NativeExports.SettingsSaveDword(SettingsID.Debugger_TraceTLB.getValue(), Integer.valueOf(sharedPreferences.getString(key, "1"))); } - else if (key.equals("Debugger_TraceProtectedMEM")) - { - NativeExports.SettingsSaveDword(SettingsID.Debugger_TraceProtectedMEM.getValue(), Integer.valueOf(sharedPreferences.getString(key, "1"))); - } - else if (key.equals("Debugger_TraceUserInterface")) - { - NativeExports.SettingsSaveDword(SettingsID.Debugger_TraceUserInterface.getValue(), Integer.valueOf(sharedPreferences.getString(key, "1"))); - } - else if (key.equals("Debugger_TraceRomList")) - { - NativeExports.SettingsSaveDword(SettingsID.Debugger_TraceRomList.getValue(), Integer.valueOf(sharedPreferences.getString(key, "1"))); - } - else if (key.equals("Debugger_TraceExceptionHandler")) - { - NativeExports.SettingsSaveDword(SettingsID.Debugger_TraceExceptionHandler.getValue(), Integer.valueOf(sharedPreferences.getString(key, "1"))); - } + else if (key.equals("Debugger_TraceProtectedMEM")) { NativeExports.SettingsSaveDword(SettingsID.Debugger_TraceProtectedMEM.getValue(), Integer.valueOf(sharedPreferences.getString(key, "1"))); } + else if (key.equals("Debugger_TraceUserInterface")) { NativeExports.SettingsSaveDword(SettingsID.Debugger_TraceUserInterface.getValue(), Integer.valueOf(sharedPreferences.getString(key, "1"))); } + else if (key.equals("Debugger_TraceRomList")) { NativeExports.SettingsSaveDword(SettingsID.Debugger_TraceRomList.getValue(), Integer.valueOf(sharedPreferences.getString(key, "1"))); } + else if (key.equals("Debugger_TraceExceptionHandler")) { NativeExports.SettingsSaveDword(SettingsID.Debugger_TraceExceptionHandler.getValue(), Integer.valueOf(sharedPreferences.getString(key, "1"))); } + else if (key.equals("Debugger_TraceAudioInitShutdown")) { NativeExports.SettingsSaveDword(SettingsID.FirstAudioSettings.getValue() + AudioSettingID.Logging_LogAudioInitShutdown.getValue(), Integer.valueOf(sharedPreferences.getString(key, "1"))); } + else if (key.equals("Debugger_TraceAudioAudioInterface")) { NativeExports.SettingsSaveDword(SettingsID.FirstAudioSettings.getValue() + AudioSettingID.Logging_LogAudioInterface.getValue(), Integer.valueOf(sharedPreferences.getString(key, "1"))); } else if (key.equals("MaxRomsRemembered")) { NativeExports.UISettingsSaveDword(UISettingID.File_RecentGameFileCount.getValue(), sharedPreferences.getInt(key, 10)); } } }