added 128 MiB option in settings

This commit is contained in:
izzy2lost
2026-03-04 06:50:06 -05:00
parent d94f73c88a
commit d5e92df263
5 changed files with 81 additions and 0 deletions
@@ -576,6 +576,7 @@ cleanup:
struct EmulatorSettings {
int surface_scale = 1; // 1, 2, or 3
int frame_rate_limit = 60; // 30 or 60
int system_memory_mib = 64; // 64 or 128
std::string tcg_thread = "multi"; // "single" or "multi"
bool use_dsp = false;
bool hrtf = true;
@@ -686,6 +687,8 @@ static bool WriteConfigToml(const std::string& config_path,
if (!android->contains("audio_driver")) {
android->insert_or_assign("audio_driver", "openslES");
}
sys->insert_or_assign(
"mem_limit", settings.system_memory_mib == 128 ? "128" : "64");
files->insert_or_assign("bootrom_path", mcpx);
files->insert_or_assign("flashrom_path", flash);
@@ -806,6 +809,12 @@ static SetupFiles SyncSetupFiles() {
emuSettings.frame_rate_limit != 60) {
emuSettings.frame_rate_limit = 60;
}
emuSettings.system_memory_mib =
GetPrefInt(env, activity, "setting_system_memory_mib", 64);
if (emuSettings.system_memory_mib != 64 &&
emuSettings.system_memory_mib != 128) {
emuSettings.system_memory_mib = 64;
}
emuSettings.use_dsp = GetPrefBool(env, activity, "setting_use_dsp", false);
emuSettings.hrtf = GetPrefBool(env, activity, "setting_hrtf", true);
emuSettings.cache_shaders = GetPrefBool(env, activity, "setting_cache_shaders", true);
@@ -404,6 +404,20 @@ bool xemu_settings_load(void)
}
}
if (auto mem_limit = sys["mem_limit"].value<std::string>()) {
if (*mem_limit == "128") {
g_config.sys.mem_limit = CONFIG_SYS_MEM_LIMIT_128;
} else {
g_config.sys.mem_limit = CONFIG_SYS_MEM_LIMIT_64;
}
} else if (auto mem_limit = sys["mem_limit"].value<int64_t>()) {
if ((int)*mem_limit == 128) {
g_config.sys.mem_limit = CONFIG_SYS_MEM_LIMIT_128;
} else {
g_config.sys.mem_limit = CONFIG_SYS_MEM_LIMIT_64;
}
}
// System file paths
if (auto bootrom = sys_files["bootrom_path"].value<std::string>()) {
xemu_settings_set_string(&g_config.sys.files.bootrom_path, bootrom->c_str());
@@ -41,6 +41,7 @@ class SettingsActivity : AppCompatActivity() {
val btn3x = findViewById<MaterialButton>(R.id.btn_scale_3x)
val toggleDisplayMode = findViewById<MaterialButtonToggleGroup>(R.id.toggle_display_mode)
val toggleFrameRate = findViewById<MaterialButtonToggleGroup>(R.id.toggle_frame_rate)
val toggleSystemMemory = findViewById<MaterialButtonToggleGroup>(R.id.toggle_system_memory)
val toggleThread = findViewById<MaterialButtonToggleGroup>(R.id.toggle_tcg_thread)
val btnMulti = findViewById<MaterialButton>(R.id.btn_thread_multi)
val btnSingle = findViewById<MaterialButton>(R.id.btn_thread_single)
@@ -76,6 +77,12 @@ class SettingsActivity : AppCompatActivity() {
else -> toggleFrameRate.check(R.id.btn_fps_60)
}
val systemMemoryMiB = prefs.getInt("setting_system_memory_mib", 64)
when (systemMemoryMiB) {
128 -> toggleSystemMemory.check(R.id.btn_memory_128)
else -> toggleSystemMemory.check(R.id.btn_memory_64)
}
tvVulkanDriverName.text =
prefs.getString("setting_vulkan_driver_name", null)
?: getString(R.string.settings_vulkan_driver_none)
@@ -132,6 +139,10 @@ class SettingsActivity : AppCompatActivity() {
R.id.btn_thread_single -> "single"
else -> "multi"
}
val selectedSystemMemoryMiB = when (toggleSystemMemory.checkedButtonId) {
R.id.btn_memory_128 -> 128
else -> 64
}
val selectedAudioDriver = when (toggleAudioDriver.checkedButtonId) {
R.id.btn_audio_aaudio -> "aaudio"
R.id.btn_audio_disabled -> "dummy"
@@ -142,6 +153,7 @@ class SettingsActivity : AppCompatActivity() {
.putInt("setting_display_mode", selectedDisplayMode)
.putInt("setting_surface_scale", selectedScale)
.putInt("setting_frame_rate_limit", selectedFrameRate)
.putInt("setting_system_memory_mib", selectedSystemMemoryMiB)
.putString("setting_tcg_thread", selectedThread)
.putBoolean("setting_use_dsp", switchDsp.isChecked)
.putBoolean("setting_hrtf", switchHrtf.isChecked)
@@ -174,6 +174,48 @@
</com.google.android.material.button.MaterialButtonToggleGroup>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="6dp"
android:text="@string/settings_system_memory"
android:textAppearance="@style/TextAppearance.Material3.BodyMedium"
android:textColor="@color/xemu_text_muted" />
<com.google.android.material.button.MaterialButtonToggleGroup
android:id="@+id/toggle_system_memory"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
app:selectionRequired="true"
app:singleSelection="true">
<com.google.android.material.button.MaterialButton
android:id="@+id/btn_memory_64"
style="?attr/materialButtonOutlinedStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/settings_system_memory_64" />
<com.google.android.material.button.MaterialButton
android:id="@+id/btn_memory_128"
style="?attr/materialButtonOutlinedStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/settings_system_memory_128" />
</com.google.android.material.button.MaterialButtonToggleGroup>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="12dp"
android:text="@string/settings_system_memory_hint"
android:textAppearance="@style/TextAppearance.Material3.BodySmall"
android:textColor="@color/xemu_text_muted" />
<!-- ── VULKAN DRIVER ── -->
<TextView
android:layout_width="match_parent"
@@ -92,6 +92,10 @@
<string name="settings_frame_rate_limit">Frame Rate Limit</string>
<string name="settings_frame_rate_limit_30">30 FPS</string>
<string name="settings_frame_rate_limit_60">60 FPS</string>
<string name="settings_system_memory">System Memory</string>
<string name="settings_system_memory_64">64 MiB (Default)</string>
<string name="settings_system_memory_128">128 MiB (Debug/Homebrew)</string>
<string name="settings_system_memory_hint">Use 64 MiB for retail games. 128 MiB is mainly for debug/homebrew and may reduce compatibility.</string>
<string name="settings_resolution_scale">Internal Resolution Scale</string>
<string name="settings_resolution_scale_1x">1x (Native 480p)</string>
<string name="settings_resolution_scale_2x">2x (960p)</string>