From 693eb0e86347df07677b1c8039540f8556c19c27 Mon Sep 17 00:00:00 2001 From: Zephyron Date: Sun, 25 May 2025 19:44:29 +1000 Subject: [PATCH] android: Port advanced emulation settings to Zep Zone - Add memory layout configuration (4GB-16GB DRAM options) - Implement ASTC texture handling controls - Add shader backend selection (GLSL/GLASM/SPIR-V) - Include VRAM usage mode settings - Create organized UI with headers and detailed descriptions - Based On Uzuy Commit 8f49bef05c 14/09/2024 Signed-off-by: Zephyron --- .../features/settings/model/IntSetting.kt | 10 ++- .../features/settings/model/Settings.kt | 4 +- .../settings/model/view/SettingsItem.kt | 48 +++++++++++++ .../settings/ui/SettingsFragmentPresenter.kt | 25 +++++++ .../app/src/main/res/values/arrays.xml | 67 +++++++++++++++++++ .../app/src/main/res/values/strings.xml | 19 ++++++ 6 files changed, 171 insertions(+), 2 deletions(-) diff --git a/src/android/app/src/main/java/org/citron/citron_emu/features/settings/model/IntSetting.kt b/src/android/app/src/main/java/org/citron/citron_emu/features/settings/model/IntSetting.kt index f1cf5df75..8608616c3 100644 --- a/src/android/app/src/main/java/org/citron/citron_emu/features/settings/model/IntSetting.kt +++ b/src/android/app/src/main/java/org/citron/citron_emu/features/settings/model/IntSetting.kt @@ -1,4 +1,5 @@ // SPDX-FileCopyrightText: 2023 yuzu Emulator Project +// SPDX-FileCopyrightText: 2025 citron Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later package org.citron.citron_emu.features.settings.model @@ -26,7 +27,14 @@ enum class IntSetting(override val key: String) : AbstractIntSetting { OVERLAY_OPACITY("control_opacity"), LOCK_DRAWER("lock_drawer"), VERTICAL_ALIGNMENT("vertical_alignment"), - FSR_SHARPENING_SLIDER("fsr_sharpening_slider"); + FSR_SHARPENING_SLIDER("fsr_sharpening_slider"), + + // Zep Zone settings + MEMORY_LAYOUT_MODE("memory_layout_mode"), + ASTC_DECODE_MODE("accelerate_astc"), + ASTC_RECOMPRESSION("astc_recompression"), + SHADER_BACKEND("shader_backend"), + VRAM_USAGE_MODE("vram_usage_mode"); override fun getInt(needsGlobal: Boolean): Int = NativeConfig.getInt(key, needsGlobal) diff --git a/src/android/app/src/main/java/org/citron/citron_emu/features/settings/model/Settings.kt b/src/android/app/src/main/java/org/citron/citron_emu/features/settings/model/Settings.kt index 7ae4a7c00..279ee1aad 100644 --- a/src/android/app/src/main/java/org/citron/citron_emu/features/settings/model/Settings.kt +++ b/src/android/app/src/main/java/org/citron/citron_emu/features/settings/model/Settings.kt @@ -1,4 +1,5 @@ // SPDX-FileCopyrightText: 2023 yuzu Emulator Project +// SPDX-FileCopyrightText: 2025 citron Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later package org.citron.citron_emu.features.settings.model @@ -22,7 +23,8 @@ object Settings { SECTION_INPUT_PLAYER_SEVEN, SECTION_INPUT_PLAYER_EIGHT, SECTION_THEME(R.string.preferences_theme), - SECTION_DEBUG(R.string.preferences_debug); + SECTION_DEBUG(R.string.preferences_debug), + SECTION_ZEP_ZONE(R.string.preferences_zep_zone); } fun getPlayerString(player: Int): String = diff --git a/src/android/app/src/main/java/org/citron/citron_emu/features/settings/model/view/SettingsItem.kt b/src/android/app/src/main/java/org/citron/citron_emu/features/settings/model/view/SettingsItem.kt index 26991b059..922d63dd3 100644 --- a/src/android/app/src/main/java/org/citron/citron_emu/features/settings/model/view/SettingsItem.kt +++ b/src/android/app/src/main/java/org/citron/citron_emu/features/settings/model/view/SettingsItem.kt @@ -1,4 +1,5 @@ // SPDX-FileCopyrightText: 2023 yuzu Emulator Project +// SPDX-FileCopyrightText: 2025 citron Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later package org.citron.citron_emu.features.settings.model.view @@ -386,6 +387,53 @@ abstract class SettingsItem( override fun reset() = setBoolean(defaultValue) } put(SwitchSetting(fastmem, R.string.fastmem)) + + // Zep Zone Settings + put( + SingleChoiceSetting( + IntSetting.MEMORY_LAYOUT_MODE, + titleId = R.string.memory_layout_mode, + descriptionId = R.string.memory_layout_mode_description, + choicesId = R.array.memoryLayoutNames, + valuesId = R.array.memoryLayoutValues + ) + ) + put( + SingleChoiceSetting( + IntSetting.ASTC_DECODE_MODE, + titleId = R.string.astc_decode_mode, + descriptionId = R.string.astc_decode_mode_description, + choicesId = R.array.astcDecodeModeNames, + valuesId = R.array.astcDecodeModeValues + ) + ) + put( + SingleChoiceSetting( + IntSetting.ASTC_RECOMPRESSION, + titleId = R.string.astc_recompression, + descriptionId = R.string.astc_recompression_description, + choicesId = R.array.astcRecompressionNames, + valuesId = R.array.astcRecompressionValues + ) + ) + put( + SingleChoiceSetting( + IntSetting.SHADER_BACKEND, + titleId = R.string.shader_backend, + descriptionId = R.string.shader_backend_description, + choicesId = R.array.shaderBackendNames, + valuesId = R.array.shaderBackendValues + ) + ) + put( + SingleChoiceSetting( + IntSetting.VRAM_USAGE_MODE, + titleId = R.string.vram_usage_mode, + descriptionId = R.string.vram_usage_mode_description, + choicesId = R.array.vramUsageModeNames, + valuesId = R.array.vramUsageModeValues + ) + ) } } } diff --git a/src/android/app/src/main/java/org/citron/citron_emu/features/settings/ui/SettingsFragmentPresenter.kt b/src/android/app/src/main/java/org/citron/citron_emu/features/settings/ui/SettingsFragmentPresenter.kt index 79b563f3d..6b7919c34 100644 --- a/src/android/app/src/main/java/org/citron/citron_emu/features/settings/ui/SettingsFragmentPresenter.kt +++ b/src/android/app/src/main/java/org/citron/citron_emu/features/settings/ui/SettingsFragmentPresenter.kt @@ -1,4 +1,5 @@ // SPDX-FileCopyrightText: 2023 yuzu Emulator Project +// SPDX-FileCopyrightText: 2025 citron Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later package org.citron.citron_emu.features.settings.ui @@ -98,6 +99,7 @@ class SettingsFragmentPresenter( MenuTag.SECTION_INPUT_PLAYER_EIGHT -> addInputPlayer(sl, 7) MenuTag.SECTION_THEME -> addThemeSettings(sl) MenuTag.SECTION_DEBUG -> addDebugSettings(sl) + MenuTag.SECTION_ZEP_ZONE -> addZepZoneSettings(sl) } settingsList = sl adapter.submitList(settingsList) { @@ -141,6 +143,14 @@ class SettingsFragmentPresenter( menuKey = MenuTag.SECTION_DEBUG ) ) + add( + SubmenuSetting( + titleId = R.string.preferences_zep_zone, + descriptionId = R.string.preferences_zep_zone_description, + iconId = R.drawable.ic_settings, + menuKey = MenuTag.SECTION_ZEP_ZONE + ) + ) add( RunnableSetting( titleId = R.string.reset_to_default, @@ -972,4 +982,19 @@ class SettingsFragmentPresenter( add(SettingsItem.FASTMEM_COMBINED) } } + + private fun addZepZoneSettings(sl: ArrayList) { + sl.apply { + add(HeaderSetting(R.string.memory_layout_header)) + add(IntSetting.MEMORY_LAYOUT_MODE.key) + + add(HeaderSetting(R.string.astc_settings_header)) + add(IntSetting.ASTC_DECODE_MODE.key) + add(IntSetting.ASTC_RECOMPRESSION.key) + + add(HeaderSetting(R.string.advanced_graphics_header)) + add(IntSetting.SHADER_BACKEND.key) + add(IntSetting.VRAM_USAGE_MODE.key) + } + } } diff --git a/src/android/app/src/main/res/values/arrays.xml b/src/android/app/src/main/res/values/arrays.xml index 1bd6455b4..cf9c29058 100644 --- a/src/android/app/src/main/res/values/arrays.xml +++ b/src/android/app/src/main/res/values/arrays.xml @@ -303,4 +303,71 @@ 2 + + + 4GB DRAM (Default) + 6GB DRAM (Unsafe) + 8GB DRAM (Unsafe) + 10GB DRAM (Unsafe) + 12GB DRAM (Unsafe) + 14GB DRAM (Unsafe) + 16GB DRAM (Unsafe) + + + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + + + + CPU + GPU + CPU Asynchronous + + + + 0 + 1 + 2 + + + + Uncompressed + BC1 + BC3 + + + + 0 + 1 + 2 + + + + GLSL + GLASM + SPIR-V + + + + 0 + 1 + 2 + + + + Conservative + Aggressive + + + + 0 + 1 + + diff --git a/src/android/app/src/main/res/values/strings.xml b/src/android/app/src/main/res/values/strings.xml index bc8f42292..6bdf1629d 100644 --- a/src/android/app/src/main/res/values/strings.xml +++ b/src/android/app/src/main/res/values/strings.xml @@ -410,6 +410,13 @@ Theme and color Debug CPU/GPU debugging, graphics API, fastmem + Zep Zone + Advanced emulation settings + + + Memory Layout + ASTC Settings + Advanced Graphics Info @@ -1167,4 +1174,16 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + Memory Layout + Increases the amount of emulated RAM from the stock 4GB of the retail Switch to the developer kit\'s 8/6GB. It doesn\'t improve stability or performance and is intended to let big texture mods fit in emulated RAM. Enabling it will increase memory use. It is not recommended to enable unless a specific game with a texture mod needs it. + ASTC Decoding Method + Controls how ASTC textures are decoded. GPU decoding is faster but may cause issues on some devices. + ASTC Recompression Method + Controls how ASTC textures are recompressed when GPU doesn\'t support them natively. + Shader Backend + Controls which shader backend to use for rendering. + VRAM Usage Mode + Controls how aggressively VRAM is used. Conservative mode limits VRAM usage for better stability. +