Skip to content

Commit

Permalink
Android: Expose color correction settings
Browse files Browse the repository at this point in the history
  • Loading branch information
t895 committed Aug 29, 2023
1 parent f995965 commit 80b329b
Show file tree
Hide file tree
Showing 8 changed files with 109 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,18 @@ enum class BooleanSetting(
"ArbitraryMipmapDetection",
true
),
GFX_CC_CORRECT_COLOR_SPACE(
Settings.FILE_GFX,
Settings.SECTION_GFX_COLOR_CORRECTION,
"CorrectColorSpace",
false
),
GFX_CC_CORRECT_GAMMA(
Settings.FILE_GFX,
Settings.SECTION_GFX_COLOR_CORRECTION,
"CorrectGamma",
false
),
GFX_STEREO_SWAP_EYES(Settings.FILE_GFX, Settings.SECTION_STEREOSCOPY, "StereoSwapEyes", false),
GFX_HACK_EFB_ACCESS_ENABLE(
Settings.FILE_GFX,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ enum class FloatSetting(
) : 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);
MAIN_OVERCLOCK(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "Overclock", 1.0f),
GFX_CC_GAME_GAMMA(Settings.FILE_GFX, Settings.SECTION_GFX_COLOR_CORRECTION, "GameGamma", 2.35f);

override val isOverridden: Boolean
get() = NativeConfig.isOverridden(file, section, key)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,12 @@ enum class IntSetting(
"MaxAnisotropy",
0
),
GFX_CC_GAME_COLOR_SPACE(
Settings.FILE_GFX,
Settings.SECTION_GFX_COLOR_CORRECTION,
"GameColorSpace",
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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ class Settings : Closeable {
const val SECTION_LOGGER_OPTIONS = "Options"
const val SECTION_GFX_SETTINGS = "Settings"
const val SECTION_GFX_ENHANCEMENTS = "Enhancements"
const val SECTION_GFX_COLOR_CORRECTION = "ColorCorrection"
const val SECTION_GFX_HACKS = "Hacks"
const val SECTION_DEBUG = "Debug"
const val SECTION_EMULATED_USB_DEVICES = "EmulatedUSBDevices"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ class SettingsFragment : Fragment(), SettingsFragmentView {
titles[MenuTag.DEBUG] = R.string.debug_submenu
titles[MenuTag.GRAPHICS] = R.string.graphics_settings
titles[MenuTag.ENHANCEMENTS] = R.string.enhancements_submenu
titles[MenuTag.COLOR_CORRECTION] = R.string.color_correction_submenu
titles[MenuTag.STEREOSCOPY] = R.string.stereoscopy_submenu
titles[MenuTag.HACKS] = R.string.hacks_submenu
titles[MenuTag.STATISTICS] = R.string.statistics_submenu
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,8 @@ class SettingsFragmentPresenter(
&& GpuDriverHelper.supportsCustomDriverLoading()
) {
this.gpuDriver =
GpuDriverHelper.getInstalledDriverMetadata() ?: GpuDriverHelper.getSystemDriverMetadata(
context.applicationContext
)
GpuDriverHelper.getInstalledDriverMetadata()
?: GpuDriverHelper.getSystemDriverMetadata(context.applicationContext)
}
}

Expand Down Expand Up @@ -713,12 +712,12 @@ class SettingsFragmentPresenter(
)
)
sl.add(
SwitchSetting(
context,
BooleanSetting.MAIN_WII_WIILINK_ENABLE,
R.string.wii_enable_wiilink,
R.string.wii_enable_wiilink_description
)
SwitchSetting(
context,
BooleanSetting.MAIN_WII_WIILINK_ENABLE,
R.string.wii_enable_wiilink,
R.string.wii_enable_wiilink_description
)
)
sl.add(
SingleChoiceSetting(
Expand Down Expand Up @@ -1333,6 +1332,13 @@ class SettingsFragmentPresenter(
R.array.textureFilteringValues
)
)
sl.add(
SubmenuSetting(
context,
R.string.color_correction_submenu,
MenuTag.COLOR_CORRECTION
)
)

val stereoModeValue = IntSetting.GFX_STEREO_MODE.int
val anaglyphMode = 3
Expand Down Expand Up @@ -1429,6 +1435,53 @@ class SettingsFragmentPresenter(
}
}

private fun addColorCorrectionSettings(sl: ArrayList<SettingsItem>) {
sl.apply {
add(HeaderSetting(context, R.string.color_space, 0))
add(
SwitchSetting(
context,
BooleanSetting.GFX_CC_CORRECT_COLOR_SPACE,
R.string.correct_color_space,
R.string.correct_color_space_description
)
)
add(
SingleChoiceSetting(
context,
IntSetting.GFX_CC_GAME_COLOR_SPACE,
R.string.game_color_space,
0,
R.array.colorSpaceEntries,
R.array.colorSpaceValues
)
)

add(HeaderSetting(context, R.string.gamma, 0))
add(
FloatSliderSetting(
context,
FloatSetting.GFX_CC_GAME_GAMMA,
R.string.game_gamma,
R.string.game_gamma_description,
2.2f,
2.8f,
"",
0.01f,
true
)
)
add(
SwitchSetting(
context,
BooleanSetting.GFX_CC_CORRECT_GAMMA,
R.string.correct_sdr_gamma,
0
)
)
}
}

private fun addHackSettings(sl: ArrayList<SettingsItem>) {
sl.add(HeaderSetting(context, R.string.embedded_frame_buffer, 0))
sl.add(
Expand Down
11 changes: 11 additions & 0 deletions Source/Android/app/src/main/res/values/arrays.xml
Original file line number Diff line number Diff line change
Expand Up @@ -685,4 +685,15 @@
<item>21</item>
<item>22</item>
</integer-array>

<string-array name="colorSpaceEntries">
<item>@string/ntscm_space</item>
<item>@string/ntscj_space</item>
<item>@string/pal_space</item>
</string-array>
<integer-array name="colorSpaceValues">
<item>0</item>
<item>1</item>
<item>2</item>
</integer-array>
</resources>
14 changes: 14 additions & 0 deletions Source/Android/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,20 @@
<string name="disable_copy_filter_description">Disables the blending of adjacent rows when copying the EFB. This is known in some games as \"deflickering\" or \"smoothing\". Disabling the filter is usually safe, and may result in a sharper image.</string>
<string name="arbitrary_mipmap_detection">Arbitrary Mipmap Detection</string>
<string name="arbitrary_mipmap_detection_description">Enables detection of arbitrary mipmaps, which some games use for special distance-based effects.\nMay have false positives that result in blurry textures at increased internal resolution, such as in games that use very low resolution mipmaps. Disabling this can also reduce stutter in games that frequently load new textures.\n\nIf unsure, leave this checked.</string>
<string name="color_correction_submenu">Color Correction</string>
<string name="color_space">Color Space</string>
<string name="correct_color_space">Correct Color Space</string>
<string name="correct_color_space_description">Converts the colors from the color spaces that GC/Wii were meant to work with to sRGB/Rec.709.</string>
<string name="game_color_space">Game Color Space</string>
<string name="ntscm_space">NTSC-M (SMPTE 170M)</string>
<string name="ntscj_space">NTSC-J (ARUB TR-89)</string>
<string name="pal_space">PAL (EBU)</string>
<string name="gamma">Gamma</string>
<string name="game_gamma">Game Gamma</string>
<string name="game_gamma_description">NTSC-M and NTSC-J target gamma ~2.2. PAL targets gamma ~2.8.\nNone of the two were necessarily followed by games or TVs. 2.35 is a good generic value for all regions.\nIf a game allows you to chose a gamma value, match it here.</string>
<string name="correct_sdr_gamma">Correct SDR Gamma</string>
<string name="sdr_display_gamma_target">SDR Display Gamma Target</string>
<string name="custom_gamma_target">Custom Gamma Target</string>
<string name="stereoscopy_submenu">Stereoscopy</string>
<string name="stereoscopy_submenu_description">Stereoscopy allows you to get a better feeling of depth if you have the necessary hardware.\nHeavily decreases emulation speed and sometimes causes issues</string>
<string name="wide_screen_hack">Widescreen Hack</string>
Expand Down

0 comments on commit 80b329b

Please sign in to comment.