mirror of
https://github.com/izzy2lost/dolphin.git
synced 2026-06-19 01:16:48 -07:00
Merge pull request #8975 from JosJuice/android-new-config
Android: Hook up the new config system
This commit is contained in:
@@ -335,6 +335,8 @@ public final class NativeLibrary
|
||||
|
||||
public static native int DefaultCPUCore();
|
||||
|
||||
public static native String GetDefaultGraphicsBackendName();
|
||||
|
||||
public static native int GetMaxLogLevel();
|
||||
|
||||
public static native void ReloadConfig();
|
||||
|
||||
+23
-3
@@ -34,6 +34,8 @@ import androidx.fragment.app.FragmentManager;
|
||||
import org.dolphinemu.dolphinemu.NativeLibrary;
|
||||
import org.dolphinemu.dolphinemu.R;
|
||||
import org.dolphinemu.dolphinemu.features.settings.model.Settings;
|
||||
import org.dolphinemu.dolphinemu.features.settings.ui.MenuTag;
|
||||
import org.dolphinemu.dolphinemu.features.settings.ui.SettingsActivity;
|
||||
import org.dolphinemu.dolphinemu.features.settings.utils.SettingsFile;
|
||||
import org.dolphinemu.dolphinemu.fragments.EmulationFragment;
|
||||
import org.dolphinemu.dolphinemu.fragments.MenuFragment;
|
||||
@@ -101,7 +103,8 @@ public final class EmulationActivity extends AppCompatActivity
|
||||
MENU_ACTION_LOAD_SLOT6, MENU_ACTION_EXIT, MENU_ACTION_CHANGE_DISC,
|
||||
MENU_ACTION_RESET_OVERLAY, MENU_SET_IR_SENSITIVITY, MENU_ACTION_CHOOSE_DOUBLETAP,
|
||||
MENU_ACTION_SCREEN_ORIENTATION, MENU_ACTION_MOTION_CONTROLS, MENU_ACTION_PAUSE_EMULATION,
|
||||
MENU_ACTION_UNPAUSE_EMULATION, MENU_ACTION_OVERLAY_CONTROLS})
|
||||
MENU_ACTION_UNPAUSE_EMULATION, MENU_ACTION_OVERLAY_CONTROLS, MENU_ACTION_SETTINGS_CORE,
|
||||
MENU_ACTION_SETTINGS_GRAPHICS})
|
||||
public @interface MenuAction
|
||||
{
|
||||
}
|
||||
@@ -140,6 +143,8 @@ public final class EmulationActivity extends AppCompatActivity
|
||||
public static final int MENU_ACTION_PAUSE_EMULATION = 31;
|
||||
public static final int MENU_ACTION_UNPAUSE_EMULATION = 32;
|
||||
public static final int MENU_ACTION_OVERLAY_CONTROLS = 33;
|
||||
public static final int MENU_ACTION_SETTINGS_CORE = 34;
|
||||
public static final int MENU_ACTION_SETTINGS_GRAPHICS = 35;
|
||||
|
||||
private static SparseIntArray buttonsActionsMap = new SparseIntArray();
|
||||
|
||||
@@ -363,6 +368,13 @@ public final class EmulationActivity extends AppCompatActivity
|
||||
super.onStop();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy()
|
||||
{
|
||||
super.onDestroy();
|
||||
mSettings.close();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed()
|
||||
{
|
||||
@@ -641,6 +653,14 @@ public final class EmulationActivity extends AppCompatActivity
|
||||
showMotionControlsOptions();
|
||||
return;
|
||||
|
||||
case MENU_ACTION_SETTINGS_CORE:
|
||||
SettingsActivity.launch(this, MenuTag.CONFIG);
|
||||
return;
|
||||
|
||||
case MENU_ACTION_SETTINGS_GRAPHICS:
|
||||
SettingsActivity.launch(this, MenuTag.GRAPHICS);
|
||||
return;
|
||||
|
||||
case MENU_ACTION_EXIT:
|
||||
mEmulationFragment.stopEmulation();
|
||||
finish();
|
||||
@@ -855,7 +875,7 @@ public final class EmulationActivity extends AppCompatActivity
|
||||
{
|
||||
editor.putInt("wiiController", indexSelected);
|
||||
|
||||
File wiimoteNewFile = SettingsFile.getSettingsFile(SettingsFile.FILE_NAME_WIIMOTE);
|
||||
File wiimoteNewFile = SettingsFile.getSettingsFile(Settings.FILE_WIIMOTE);
|
||||
IniFile wiimoteNewIni = new IniFile(wiimoteNewFile);
|
||||
wiimoteNewIni.setString("Wiimote1", "Extension",
|
||||
getResources().getStringArray(R.array.controllersValues)[indexSelected]);
|
||||
@@ -889,7 +909,7 @@ public final class EmulationActivity extends AppCompatActivity
|
||||
else
|
||||
mMotionListener.disable();
|
||||
|
||||
File wiimoteNewFile = SettingsFile.getSettingsFile(SettingsFile.FILE_NAME_WIIMOTE);
|
||||
File wiimoteNewFile = SettingsFile.getSettingsFile(Settings.FILE_WIIMOTE);
|
||||
IniFile wiimoteNewIni = new IniFile(wiimoteNewFile);
|
||||
wiimoteNewIni.setBoolean("Wiimote1", "IMUIR/Enabled", indexSelected != 1);
|
||||
wiimoteNewIni.save(wiimoteNewFile);
|
||||
|
||||
+4
-3
@@ -156,11 +156,12 @@ public final class GameAdapter extends RecyclerView.Adapter<GameViewHolder> impl
|
||||
return true;
|
||||
}
|
||||
|
||||
GamePropertiesDialog fragment =
|
||||
GamePropertiesDialog
|
||||
.newInstance(holder.gameFile.getPath(), gameId, holder.gameFile.getPlatform());
|
||||
GamePropertiesDialog fragment = GamePropertiesDialog.newInstance(holder.gameFile.getPath(),
|
||||
gameId, holder.gameFile.getRevision(), holder.gameFile.getPlatform());
|
||||
|
||||
((FragmentActivity) view.getContext()).getSupportFragmentManager().beginTransaction()
|
||||
.add(fragment, GamePropertiesDialog.TAG).commit();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -100,9 +100,9 @@ public final class GameRowPresenter extends Presenter
|
||||
return true;
|
||||
}
|
||||
|
||||
GamePropertiesDialog fragment =
|
||||
GamePropertiesDialog.newInstance(holder.gameFile.getPath(), gameId,
|
||||
holder.gameFile.getPlatform());
|
||||
GamePropertiesDialog fragment = GamePropertiesDialog.newInstance(holder.gameFile.getPath(),
|
||||
gameId, holder.gameFile.getRevision(), holder.gameFile.getPlatform());
|
||||
|
||||
((FragmentActivity) view.getContext()).getSupportFragmentManager().beginTransaction()
|
||||
.add(fragment, GamePropertiesDialog.TAG).commit();
|
||||
|
||||
|
||||
+16
-16
@@ -8,15 +8,13 @@ import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
|
||||
import org.dolphinemu.dolphinemu.NativeLibrary;
|
||||
import org.dolphinemu.dolphinemu.R;
|
||||
import org.dolphinemu.dolphinemu.features.settings.model.Settings;
|
||||
import org.dolphinemu.dolphinemu.features.settings.model.StringSetting;
|
||||
import org.dolphinemu.dolphinemu.features.settings.ui.MenuTag;
|
||||
import org.dolphinemu.dolphinemu.features.settings.ui.SettingsActivity;
|
||||
import org.dolphinemu.dolphinemu.features.settings.utils.SettingsFile;
|
||||
import org.dolphinemu.dolphinemu.ui.platform.Platform;
|
||||
import org.dolphinemu.dolphinemu.utils.DirectoryInitialization;
|
||||
import org.dolphinemu.dolphinemu.utils.IniFile;
|
||||
import org.dolphinemu.dolphinemu.utils.Log;
|
||||
|
||||
import java.io.File;
|
||||
@@ -26,15 +24,18 @@ public class GamePropertiesDialog extends DialogFragment
|
||||
public static final String TAG = "GamePropertiesDialog";
|
||||
public static final String ARG_PATH = "path";
|
||||
public static final String ARG_GAMEID = "game_id";
|
||||
public static final String ARG_REVISION = "revision";
|
||||
public static final String ARG_PLATFORM = "platform";
|
||||
|
||||
public static GamePropertiesDialog newInstance(String path, String gameId, int platform)
|
||||
public static GamePropertiesDialog newInstance(String path, String gameId, int revision,
|
||||
int platform)
|
||||
{
|
||||
GamePropertiesDialog fragment = new GamePropertiesDialog();
|
||||
|
||||
Bundle arguments = new Bundle();
|
||||
arguments.putString(ARG_PATH, path);
|
||||
arguments.putString(ARG_GAMEID, gameId);
|
||||
arguments.putInt(ARG_REVISION, revision);
|
||||
arguments.putInt(ARG_PLATFORM, platform);
|
||||
fragment.setArguments(arguments);
|
||||
|
||||
@@ -50,6 +51,7 @@ public class GamePropertiesDialog extends DialogFragment
|
||||
|
||||
String path = requireArguments().getString(ARG_PATH);
|
||||
String gameId = requireArguments().getString(ARG_GAMEID);
|
||||
int revision = requireArguments().getInt(ARG_REVISION);
|
||||
int platform = requireArguments().getInt(ARG_PLATFORM);
|
||||
|
||||
builder.setTitle(requireContext()
|
||||
@@ -65,30 +67,28 @@ public class GamePropertiesDialog extends DialogFragment
|
||||
.getSupportFragmentManager(), "game_details");
|
||||
break;
|
||||
case 1:
|
||||
File dolphinFile = SettingsFile.getSettingsFile(SettingsFile.FILE_NAME_DOLPHIN);
|
||||
IniFile dolphinIni = new IniFile(dolphinFile);
|
||||
dolphinIni.setString(Settings.SECTION_INI_CORE, SettingsFile.KEY_DEFAULT_ISO,
|
||||
path);
|
||||
dolphinIni.save(dolphinFile);
|
||||
|
||||
NativeLibrary.ReloadConfig();
|
||||
Toast.makeText(getContext(), "Default ISO set", Toast.LENGTH_SHORT).show();
|
||||
try (Settings settings = new Settings())
|
||||
{
|
||||
settings.loadSettings(null);
|
||||
StringSetting.MAIN_DEFAULT_ISO.setString(settings, path);
|
||||
settings.saveSettings(null, getContext());
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
SettingsActivity.launch(getContext(), MenuTag.CONFIG, gameId);
|
||||
SettingsActivity.launch(getContext(), MenuTag.CONFIG, gameId, revision);
|
||||
break;
|
||||
case 3:
|
||||
SettingsActivity.launch(getContext(), MenuTag.GRAPHICS, gameId);
|
||||
SettingsActivity.launch(getContext(), MenuTag.GRAPHICS, gameId, revision);
|
||||
break;
|
||||
case 4:
|
||||
SettingsActivity.launch(getContext(), MenuTag.GCPAD_TYPE, gameId);
|
||||
SettingsActivity.launch(getContext(), MenuTag.GCPAD_TYPE, gameId, revision);
|
||||
break;
|
||||
case 5:
|
||||
// Clear option for GC, Wii controls for else
|
||||
if (platform == Platform.GAMECUBE.toInt())
|
||||
clearGameSettings(gameId);
|
||||
else
|
||||
SettingsActivity.launch(getActivity(), MenuTag.WIIMOTE, gameId);
|
||||
SettingsActivity.launch(getActivity(), MenuTag.WIIMOTE, gameId, revision);
|
||||
break;
|
||||
case 6:
|
||||
clearGameSettings(gameId);
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
package org.dolphinemu.dolphinemu.features.settings.model;
|
||||
|
||||
public interface AbstractBooleanSetting extends AbstractSetting
|
||||
{
|
||||
boolean getBoolean(Settings settings);
|
||||
|
||||
void setBoolean(Settings settings, boolean newValue);
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
package org.dolphinemu.dolphinemu.features.settings.model;
|
||||
|
||||
public interface AbstractFloatSetting extends AbstractSetting
|
||||
{
|
||||
float getFloat(Settings settings);
|
||||
|
||||
void setFloat(Settings settings, float newValue);
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
package org.dolphinemu.dolphinemu.features.settings.model;
|
||||
|
||||
public interface AbstractIntSetting extends AbstractSetting
|
||||
{
|
||||
int getInt(Settings settings);
|
||||
|
||||
void setInt(Settings settings, int newValue);
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
package org.dolphinemu.dolphinemu.features.settings.model;
|
||||
|
||||
public class AbstractLegacySetting implements AbstractSetting
|
||||
{
|
||||
protected final String mFile;
|
||||
protected final String mSection;
|
||||
protected final String mKey;
|
||||
|
||||
public AbstractLegacySetting(String file, String section, String key)
|
||||
{
|
||||
mFile = file;
|
||||
mSection = section;
|
||||
mKey = key;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOverridden(Settings settings)
|
||||
{
|
||||
return settings.isGameSpecific() && settings.getSection(mFile, mSection).exists(mKey);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRuntimeEditable()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean delete(Settings settings)
|
||||
{
|
||||
return settings.getSection(mFile, mSection).delete(mKey);
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package org.dolphinemu.dolphinemu.features.settings.model;
|
||||
|
||||
public interface AbstractSetting
|
||||
{
|
||||
boolean isOverridden(Settings settings);
|
||||
|
||||
boolean isRuntimeEditable();
|
||||
|
||||
boolean delete(Settings settings);
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
package org.dolphinemu.dolphinemu.features.settings.model;
|
||||
|
||||
public interface AbstractStringSetting extends AbstractSetting
|
||||
{
|
||||
String getString(Settings settings);
|
||||
|
||||
void setString(Settings settings, String newValue);
|
||||
}
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
package org.dolphinemu.dolphinemu.features.settings.model;
|
||||
|
||||
public class AdHocBooleanSetting implements AbstractBooleanSetting
|
||||
{
|
||||
private final String mFile;
|
||||
private final String mSection;
|
||||
private final String mKey;
|
||||
private final boolean mDefaultValue;
|
||||
|
||||
public AdHocBooleanSetting(String file, String section, String key, boolean defaultValue)
|
||||
{
|
||||
mFile = file;
|
||||
mSection = section;
|
||||
mKey = key;
|
||||
mDefaultValue = defaultValue;
|
||||
|
||||
if (!NativeConfig.isSettingSaveable(file, section, key))
|
||||
{
|
||||
throw new IllegalArgumentException("File/section/key is unknown or legacy");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOverridden(Settings settings)
|
||||
{
|
||||
return NativeConfig.isOverridden(mFile, mSection, mKey);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRuntimeEditable()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean delete(Settings settings)
|
||||
{
|
||||
return NativeConfig.deleteKey(settings.getActiveLayer(), mFile, mSection, mKey);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getBoolean(Settings settings)
|
||||
{
|
||||
return NativeConfig.getBoolean(settings.getActiveLayer(), mFile, mSection, mKey, mDefaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBoolean(Settings settings, boolean newValue)
|
||||
{
|
||||
NativeConfig.setBoolean(settings.getActiveLayer(), mFile, mSection, mKey, newValue);
|
||||
}
|
||||
}
|
||||
+185
@@ -0,0 +1,185 @@
|
||||
package org.dolphinemu.dolphinemu.features.settings.model;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public enum BooleanSetting implements AbstractBooleanSetting
|
||||
{
|
||||
// These entries have the same names and order as in C++, just for consistency.
|
||||
|
||||
MAIN_DSP_HLE(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "DSPHLE", true),
|
||||
MAIN_CPU_THREAD(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "CPUThread", true),
|
||||
MAIN_OVERRIDE_REGION_SETTINGS(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE,
|
||||
"OverrideRegionSettings", false),
|
||||
MAIN_AUDIO_STRETCH(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "AudioStretch", false),
|
||||
MAIN_WII_SD_CARD(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "WiiSDCard", true),
|
||||
MAIN_WIIMOTE_CONTINUOUS_SCANNING(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE,
|
||||
"WiimoteContinuousScanning", false),
|
||||
MAIN_WIIMOTE_ENABLE_SPEAKER(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE,
|
||||
"WiimoteEnableSpeaker", false),
|
||||
MAIN_OVERCLOCK_ENABLE(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "OverclockEnable", false),
|
||||
MAIN_AUTO_DISC_CHANGE(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "AutoDiscChange", false),
|
||||
MAIN_ALLOW_SD_WRITES(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "WiiSDCardAllowWrites",
|
||||
true),
|
||||
MAIN_ENABLE_SAVESTATES(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "EnableSaveStates",
|
||||
false),
|
||||
|
||||
MAIN_DSP_JIT(Settings.FILE_DOLPHIN, Settings.SECTION_INI_DSP, "EnableJIT", true),
|
||||
|
||||
MAIN_USE_PANIC_HANDLERS(Settings.FILE_DOLPHIN, Settings.SECTION_INI_INTERFACE,
|
||||
"UsePanicHandlers", true),
|
||||
MAIN_OSD_MESSAGES(Settings.FILE_DOLPHIN, Settings.SECTION_INI_INTERFACE,
|
||||
"OnScreenDisplayMessages", true),
|
||||
|
||||
MAIN_ANALYTICS_ENABLED(Settings.FILE_DOLPHIN, Settings.SECTION_ANALYTICS, "Enabled", false),
|
||||
MAIN_ANALYTICS_PERMISSION_ASKED(Settings.FILE_DOLPHIN, Settings.SECTION_ANALYTICS,
|
||||
"PermissionAsked", false),
|
||||
|
||||
MAIN_RECURSIVE_ISO_PATHS(Settings.FILE_DOLPHIN, Settings.SECTION_INI_GENERAL,
|
||||
"RecursiveISOPaths", false),
|
||||
|
||||
GFX_WIDESCREEN_HACK(Settings.FILE_GFX, Settings.SECTION_GFX_SETTINGS, "wideScreenHack", false),
|
||||
GFX_SHOW_FPS(Settings.FILE_GFX, Settings.SECTION_GFX_SETTINGS, "ShowFPS", false),
|
||||
GFX_ENABLE_GPU_TEXTURE_DECODING(Settings.FILE_GFX, Settings.SECTION_GFX_SETTINGS,
|
||||
"EnableGPUTextureDecoding", false),
|
||||
GFX_ENABLE_PIXEL_LIGHTING(Settings.FILE_GFX, Settings.SECTION_GFX_SETTINGS,
|
||||
"EnablePixelLighting", false),
|
||||
GFX_FAST_DEPTH_CALC(Settings.FILE_GFX, Settings.SECTION_GFX_SETTINGS, "FastDepthCalc", true),
|
||||
GFX_DISABLE_FOG(Settings.FILE_GFX, Settings.SECTION_GFX_SETTINGS, "DisableFog", false),
|
||||
GFX_BACKEND_MULTITHREADING(Settings.FILE_GFX, Settings.SECTION_GFX_SETTINGS,
|
||||
"BackendMultithreading", false),
|
||||
GFX_WAIT_FOR_SHADERS_BEFORE_STARTING(Settings.FILE_GFX, Settings.SECTION_GFX_SETTINGS,
|
||||
"WaitForShadersBeforeStarting", false),
|
||||
|
||||
GFX_ENHANCE_FORCE_FILTERING(Settings.FILE_GFX, Settings.SECTION_GFX_ENHANCEMENTS,
|
||||
"ForceFiltering", false),
|
||||
GFX_ENHANCE_FORCE_TRUE_COLOR(Settings.FILE_GFX, Settings.SECTION_GFX_ENHANCEMENTS,
|
||||
"ForceTrueColor", true),
|
||||
GFX_ENHANCE_DISABLE_COPY_FILTER(Settings.FILE_GFX, Settings.SECTION_GFX_ENHANCEMENTS,
|
||||
"DisableCopyFilter", true),
|
||||
GFX_ENHANCE_ARBITRARY_MIPMAP_DETECTION(Settings.FILE_GFX, Settings.SECTION_GFX_ENHANCEMENTS,
|
||||
"ArbitraryMipmapDetection", true),
|
||||
|
||||
GFX_STEREO_SWAP_EYES(Settings.FILE_GFX, Settings.SECTION_STEREOSCOPY, "StereoSwapEyes", false),
|
||||
|
||||
GFX_HACK_EFB_ACCESS_ENABLE(Settings.FILE_GFX, Settings.SECTION_GFX_HACKS, "EFBAccessEnable",
|
||||
true),
|
||||
GFX_HACK_SKIP_EFB_COPY_TO_RAM(Settings.FILE_GFX, Settings.SECTION_GFX_HACKS,
|
||||
"EFBToTextureEnable", true),
|
||||
GFX_HACK_SKIP_XFB_COPY_TO_RAM(Settings.FILE_GFX, Settings.SECTION_GFX_HACKS,
|
||||
"XFBToTextureEnable", true),
|
||||
GFX_HACK_DEFER_EFB_COPIES(Settings.FILE_GFX, Settings.SECTION_GFX_HACKS, "DeferEFBCopies", true),
|
||||
GFX_HACK_IMMEDIATE_XFB(Settings.FILE_GFX, Settings.SECTION_GFX_HACKS, "ImmediateXFBEnable",
|
||||
false),
|
||||
GFX_HACK_SKIP_DUPLICATE_XFBS(Settings.FILE_GFX, Settings.SECTION_GFX_HACKS, "SkipDuplicateXFBs",
|
||||
true),
|
||||
GFX_HACK_COPY_EFB_SCALED(Settings.FILE_GFX, Settings.SECTION_GFX_HACKS, "EFBScaledCopy", true),
|
||||
GFX_HACK_EFB_EMULATE_FORMAT_CHANGES(Settings.FILE_GFX, Settings.SECTION_GFX_HACKS,
|
||||
"EFBEmulateFormatChanges", false),
|
||||
|
||||
LOGGER_WRITE_TO_FILE(Settings.FILE_LOGGER, Settings.SECTION_LOGGER_OPTIONS, "WriteToFile", false),
|
||||
|
||||
// These settings are not yet in the new config system in C++ - please move them once they are
|
||||
|
||||
MAIN_JIT_OFF(Settings.FILE_DOLPHIN, Settings.SECTION_DEBUG, "JitOff", false),
|
||||
MAIN_JIT_LOAD_STORE_OFF(Settings.FILE_DOLPHIN, Settings.SECTION_DEBUG, "JitLoadStoreOff", false),
|
||||
MAIN_JIT_LOAD_STORE_FLOATING_OFF(Settings.FILE_DOLPHIN, Settings.SECTION_DEBUG,
|
||||
"JitLoadStoreFloatingOff", false),
|
||||
MAIN_JIT_LOAD_STORE_PAIRED_OFF(Settings.FILE_DOLPHIN, Settings.SECTION_DEBUG,
|
||||
"JitLoadStorePairedOff", false),
|
||||
MAIN_JIT_FLOATING_POINT_OFF(Settings.FILE_DOLPHIN, Settings.SECTION_DEBUG, "JitFloatingPointOff",
|
||||
false),
|
||||
MAIN_JIT_INTEGER_OFF(Settings.FILE_DOLPHIN, Settings.SECTION_DEBUG, "JitIntegerOff", false),
|
||||
MAIN_JIT_PAIRED_OFF(Settings.FILE_DOLPHIN, Settings.SECTION_DEBUG, "JitPairedOff", false),
|
||||
MAIN_JIT_SYSTEM_REGISTERS_OFF(Settings.FILE_DOLPHIN, Settings.SECTION_DEBUG,
|
||||
"JitSystemRegistersOff", false),
|
||||
MAIN_JIT_BRANCH_OFF(Settings.FILE_DOLPHIN, Settings.SECTION_DEBUG, "JitBranchOff", false),
|
||||
MAIN_JIT_REGISTER_CACHE_OFF(Settings.FILE_DOLPHIN, Settings.SECTION_DEBUG, "JitRegisterCacheOff",
|
||||
false);
|
||||
|
||||
private static final BooleanSetting[] NOT_RUNTIME_EDITABLE_ARRAY = new BooleanSetting[]{
|
||||
MAIN_DSP_HLE,
|
||||
MAIN_CPU_THREAD,
|
||||
MAIN_OVERRIDE_REGION_SETTINGS,
|
||||
MAIN_WII_SD_CARD, // Can actually be changed, but specific code is required
|
||||
MAIN_DSP_JIT
|
||||
};
|
||||
|
||||
private static final Set<BooleanSetting> NOT_RUNTIME_EDITABLE =
|
||||
new HashSet<>(Arrays.asList(NOT_RUNTIME_EDITABLE_ARRAY));
|
||||
|
||||
private final String mFile;
|
||||
private final String mSection;
|
||||
private final String mKey;
|
||||
private final boolean mDefaultValue;
|
||||
|
||||
BooleanSetting(String file, String section, String key, boolean defaultValue)
|
||||
{
|
||||
mFile = file;
|
||||
mSection = section;
|
||||
mKey = key;
|
||||
mDefaultValue = defaultValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOverridden(Settings settings)
|
||||
{
|
||||
if (settings.isGameSpecific() && !NativeConfig.isSettingSaveable(mFile, mSection, mKey))
|
||||
return settings.getSection(mFile, mSection).exists(mKey);
|
||||
else
|
||||
return NativeConfig.isOverridden(mFile, mSection, mKey);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRuntimeEditable()
|
||||
{
|
||||
for (BooleanSetting setting : NOT_RUNTIME_EDITABLE)
|
||||
{
|
||||
if (setting == this)
|
||||
return false;
|
||||
}
|
||||
|
||||
return NativeConfig.isSettingSaveable(mFile, mSection, mKey);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean delete(Settings settings)
|
||||
{
|
||||
if (NativeConfig.isSettingSaveable(mFile, mSection, mKey))
|
||||
{
|
||||
return NativeConfig.deleteKey(settings.getActiveLayer(), mFile, mSection, mKey);
|
||||
}
|
||||
else
|
||||
{
|
||||
return settings.getSection(mFile, mSection).delete(mKey);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getBoolean(Settings settings)
|
||||
{
|
||||
if (NativeConfig.isSettingSaveable(mFile, mSection, mKey))
|
||||
{
|
||||
return NativeConfig.getBoolean(settings.getActiveLayer(), mFile, mSection, mKey,
|
||||
mDefaultValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
return settings.getSection(mFile, mSection).getBoolean(mKey, mDefaultValue);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBoolean(Settings settings, boolean newValue)
|
||||
{
|
||||
if (NativeConfig.isSettingSaveable(mFile, mSection, mKey))
|
||||
{
|
||||
NativeConfig.setBoolean(settings.getActiveLayer(), mFile, mSection, mKey, newValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
settings.getSection(mFile, mSection).setBoolean(mKey, newValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
+76
@@ -0,0 +1,76 @@
|
||||
package org.dolphinemu.dolphinemu.features.settings.model;
|
||||
|
||||
public enum FloatSetting implements AbstractFloatSetting
|
||||
{
|
||||
// These entries have the same names and order as in C++, just for consistency.
|
||||
|
||||
MAIN_EMULATION_SPEED(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "EmulationSpeed", 1.0f),
|
||||
MAIN_OVERCLOCK(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "Overclock", 1.0f);
|
||||
|
||||
private final String mFile;
|
||||
private final String mSection;
|
||||
private final String mKey;
|
||||
private final float mDefaultValue;
|
||||
|
||||
FloatSetting(String file, String section, String key, float defaultValue)
|
||||
{
|
||||
mFile = file;
|
||||
mSection = section;
|
||||
mKey = key;
|
||||
mDefaultValue = defaultValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOverridden(Settings settings)
|
||||
{
|
||||
if (settings.isGameSpecific() && !NativeConfig.isSettingSaveable(mFile, mSection, mKey))
|
||||
return settings.getSection(mFile, mSection).exists(mKey);
|
||||
else
|
||||
return NativeConfig.isOverridden(mFile, mSection, mKey);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRuntimeEditable()
|
||||
{
|
||||
return NativeConfig.isSettingSaveable(mFile, mSection, mKey);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean delete(Settings settings)
|
||||
{
|
||||
if (NativeConfig.isSettingSaveable(mFile, mSection, mKey))
|
||||
{
|
||||
return NativeConfig.deleteKey(settings.getActiveLayer(), mFile, mSection, mKey);
|
||||
}
|
||||
else
|
||||
{
|
||||
return settings.getSection(mFile, mSection).delete(mKey);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getFloat(Settings settings)
|
||||
{
|
||||
if (NativeConfig.isSettingSaveable(mFile, mSection, mKey))
|
||||
{
|
||||
return NativeConfig.getFloat(settings.getActiveLayer(), mFile, mSection, mKey, mDefaultValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
return settings.getSection(mFile, mSection).getFloat(mKey, mDefaultValue);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFloat(Settings settings, float newValue)
|
||||
{
|
||||
if (NativeConfig.isSettingSaveable(mFile, mSection, mKey))
|
||||
{
|
||||
NativeConfig.setFloat(settings.getActiveLayer(), mFile, mSection, mKey, newValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
settings.getSection(mFile, mSection).setFloat(mKey, newValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
+123
@@ -0,0 +1,123 @@
|
||||
package org.dolphinemu.dolphinemu.features.settings.model;
|
||||
|
||||
import org.dolphinemu.dolphinemu.NativeLibrary;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public enum IntSetting implements AbstractIntSetting
|
||||
{
|
||||
// These entries have the same names and order as in C++, just for consistency.
|
||||
|
||||
MAIN_CPU_CORE(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "CPUCore",
|
||||
NativeLibrary.DefaultCPUCore()),
|
||||
MAIN_GC_LANGUAGE(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "SelectedLanguage", 0),
|
||||
MAIN_SLOT_A(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "SlotA", 8),
|
||||
MAIN_SLOT_B(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "SlotB", 255),
|
||||
|
||||
MAIN_AUDIO_VOLUME(Settings.FILE_DOLPHIN, Settings.SECTION_INI_DSP, "Volume", 100),
|
||||
|
||||
MAIN_LAST_PLATFORM_TAB(Settings.FILE_DOLPHIN, Settings.SECTION_INI_ANDROID, "LastPlatformTab", 0),
|
||||
|
||||
GFX_ASPECT_RATIO(Settings.FILE_GFX, Settings.SECTION_GFX_SETTINGS, "AspectRatio", 0),
|
||||
GFX_SAFE_TEXTURE_CACHE_COLOR_SAMPLES(Settings.FILE_GFX, Settings.SECTION_GFX_SETTINGS,
|
||||
"SafeTextureCacheColorSamples", 128),
|
||||
GFX_MSAA(Settings.FILE_GFX, Settings.SECTION_GFX_SETTINGS, "MSAA", 1),
|
||||
GFX_EFB_SCALE(Settings.FILE_GFX, Settings.SECTION_GFX_SETTINGS, "InternalResolution", 1),
|
||||
GFX_SHADER_COMPILATION_MODE(Settings.FILE_GFX, Settings.SECTION_GFX_SETTINGS,
|
||||
"ShaderCompilationMode", 0),
|
||||
|
||||
GFX_ENHANCE_MAX_ANISOTROPY(Settings.FILE_GFX, Settings.SECTION_GFX_ENHANCEMENTS, "MaxAnisotropy",
|
||||
0),
|
||||
|
||||
GFX_STEREO_MODE(Settings.FILE_GFX, Settings.SECTION_STEREOSCOPY, "StereoMode", 0),
|
||||
GFX_STEREO_DEPTH(Settings.FILE_GFX, Settings.SECTION_STEREOSCOPY, "StereoDepth", 20),
|
||||
GFX_STEREO_CONVERGENCE_PERCENTAGE(Settings.FILE_GFX, Settings.SECTION_STEREOSCOPY,
|
||||
"StereoConvergencePercentage", 100),
|
||||
|
||||
LOGGER_VERBOSITY(Settings.FILE_LOGGER, Settings.SECTION_LOGGER_OPTIONS, "Verbosity", 1);
|
||||
|
||||
private static final IntSetting[] NOT_RUNTIME_EDITABLE_ARRAY = new IntSetting[]{
|
||||
MAIN_CPU_CORE,
|
||||
MAIN_GC_LANGUAGE,
|
||||
MAIN_SLOT_A, // Can actually be changed, but specific code is required
|
||||
MAIN_SLOT_B, // Can actually be changed, but specific code is required
|
||||
};
|
||||
|
||||
private static final Set<IntSetting> NOT_RUNTIME_EDITABLE =
|
||||
new HashSet<>(Arrays.asList(NOT_RUNTIME_EDITABLE_ARRAY));
|
||||
|
||||
private final String mFile;
|
||||
private final String mSection;
|
||||
private final String mKey;
|
||||
private final int mDefaultValue;
|
||||
|
||||
IntSetting(String file, String section, String key, int defaultValue)
|
||||
{
|
||||
mFile = file;
|
||||
mSection = section;
|
||||
mKey = key;
|
||||
mDefaultValue = defaultValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOverridden(Settings settings)
|
||||
{
|
||||
if (settings.isGameSpecific() && !NativeConfig.isSettingSaveable(mFile, mSection, mKey))
|
||||
return settings.getSection(mFile, mSection).exists(mKey);
|
||||
else
|
||||
return NativeConfig.isOverridden(mFile, mSection, mKey);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRuntimeEditable()
|
||||
{
|
||||
for (IntSetting setting : NOT_RUNTIME_EDITABLE)
|
||||
{
|
||||
if (setting == this)
|
||||
return false;
|
||||
}
|
||||
|
||||
return NativeConfig.isSettingSaveable(mFile, mSection, mKey);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean delete(Settings settings)
|
||||
{
|
||||
if (NativeConfig.isSettingSaveable(mFile, mSection, mKey))
|
||||
{
|
||||
return NativeConfig.deleteKey(settings.getActiveLayer(), mFile, mSection, mKey);
|
||||
}
|
||||
else
|
||||
{
|
||||
return settings.getSection(mFile, mSection).delete(mKey);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInt(Settings settings)
|
||||
{
|
||||
if (NativeConfig.isSettingSaveable(mFile, mSection, mKey))
|
||||
{
|
||||
return NativeConfig.getInt(settings.getActiveLayer(), mFile, mSection, mKey, mDefaultValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
return settings.getSection(mFile, mSection).getInt(mKey, mDefaultValue);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInt(Settings settings, int newValue)
|
||||
{
|
||||
if (NativeConfig.isSettingSaveable(mFile, mSection, mKey))
|
||||
{
|
||||
NativeConfig.setInt(settings.getActiveLayer(), mFile, mSection, mKey, newValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
settings.getSection(mFile, mSection).setInt(mKey, newValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
package org.dolphinemu.dolphinemu.features.settings.model;
|
||||
|
||||
public class LegacyBooleanSetting extends AbstractLegacySetting implements AbstractBooleanSetting
|
||||
{
|
||||
private final boolean mDefaultValue;
|
||||
|
||||
public LegacyBooleanSetting(String file, String section, String key, boolean defaultValue)
|
||||
{
|
||||
super(file, section, key);
|
||||
mDefaultValue = defaultValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getBoolean(Settings settings)
|
||||
{
|
||||
return settings.getSection(mFile, mSection).getBoolean(mKey, mDefaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBoolean(Settings settings, boolean newValue)
|
||||
{
|
||||
settings.getSection(mFile, mSection).setBoolean(mKey, newValue);
|
||||
}
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
package org.dolphinemu.dolphinemu.features.settings.model;
|
||||
|
||||
public class LegacyFloatSetting extends AbstractLegacySetting implements AbstractFloatSetting
|
||||
{
|
||||
private final float mDefaultValue;
|
||||
|
||||
public LegacyFloatSetting(String file, String section, String key, float defaultValue)
|
||||
{
|
||||
super(file, section, key);
|
||||
mDefaultValue = defaultValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getFloat(Settings settings)
|
||||
{
|
||||
return settings.getSection(mFile, mSection).getFloat(mKey, mDefaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFloat(Settings settings, float newValue)
|
||||
{
|
||||
settings.getSection(mFile, mSection).setFloat(mKey, newValue);
|
||||
}
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
package org.dolphinemu.dolphinemu.features.settings.model;
|
||||
|
||||
public class LegacyIntSetting extends AbstractLegacySetting implements AbstractIntSetting
|
||||
{
|
||||
private final int mDefaultValue;
|
||||
|
||||
public LegacyIntSetting(String file, String section, String key, int defaultValue)
|
||||
{
|
||||
super(file, section, key);
|
||||
mDefaultValue = defaultValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInt(Settings settings)
|
||||
{
|
||||
return settings.getSection(mFile, mSection).getInt(mKey, mDefaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInt(Settings settings, int newValue)
|
||||
{
|
||||
settings.getSection(mFile, mSection).setInt(mKey, newValue);
|
||||
}
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
package org.dolphinemu.dolphinemu.features.settings.model;
|
||||
|
||||
public class LegacyStringSetting extends AbstractLegacySetting implements AbstractStringSetting
|
||||
{
|
||||
private final String mDefaultValue;
|
||||
|
||||
public LegacyStringSetting(String file, String section, String key, String defaultValue)
|
||||
{
|
||||
super(file, section, key);
|
||||
mDefaultValue = defaultValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getString(Settings settings)
|
||||
{
|
||||
return settings.getSection(mFile, mSection).getString(mKey, mDefaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setString(Settings settings, String newValue)
|
||||
{
|
||||
settings.getSection(mFile, mSection).setString(mKey, newValue);
|
||||
}
|
||||
}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
package org.dolphinemu.dolphinemu.features.settings.model;
|
||||
|
||||
public class NativeConfig
|
||||
{
|
||||
public static final int LAYER_BASE_OR_CURRENT = 0;
|
||||
public static final int LAYER_LOCAL_GAME = 1;
|
||||
|
||||
public static native boolean isSettingSaveable(String file, String section, String key);
|
||||
|
||||
public static native void loadGameInis(String gameId, int revision);
|
||||
|
||||
public static native void unloadGameInis();
|
||||
|
||||
public static native void save(int layer);
|
||||
|
||||
public static native boolean isOverridden(String file, String section, String key);
|
||||
|
||||
public static native boolean deleteKey(int layer, String file, String section, String key);
|
||||
|
||||
public static native String getString(int layer, String file, String section, String key,
|
||||
String defaultValue);
|
||||
|
||||
public static native boolean getBoolean(int layer, String file, String section, String key,
|
||||
boolean defaultValue);
|
||||
|
||||
public static native int getInt(int layer, String file, String section, String key,
|
||||
int defaultValue);
|
||||
|
||||
public static native float getFloat(int layer, String file, String section, String key,
|
||||
float defaultValue);
|
||||
|
||||
public static native void setString(int layer, String file, String section, String key,
|
||||
String value);
|
||||
|
||||
public static native void setBoolean(int layer, String file, String section, String key,
|
||||
boolean value);
|
||||
|
||||
public static native void setInt(int layer, String file, String section, String key, int value);
|
||||
|
||||
public static native void setFloat(int layer, String file, String section, String key,
|
||||
float value);
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user