diff --git a/config.def.h b/config.def.h index c6e9845662..eeaed55ab2 100644 --- a/config.def.h +++ b/config.def.h @@ -320,6 +320,12 @@ /* On resize and fullscreen, rendering area will stay 4:3 */ #define DEFAULT_FORCE_ASPECT true +/* Only applies to Android 9.0 (API 28) and up */ +/* Choose if the screen will be able to write around the notch or not */ +static const bool video_notch_write_over_enable = false; + +#define DEFAULT_NOTCH_WRITE_OVER_ENABLE false + /* Enable use of shaders. */ #ifdef RARCH_CONSOLE #define DEFAULT_SHADER_ENABLE true diff --git a/configuration.c b/configuration.c index 39513a6d2f..021dc80aa4 100644 --- a/configuration.c +++ b/configuration.c @@ -1475,6 +1475,7 @@ static struct config_bool_setting *populate_settings_bool( SETTING_BOOL("pause_nonactive", &settings->bools.pause_nonactive, true, DEFAULT_PAUSE_NONACTIVE, false); SETTING_BOOL("video_gpu_screenshot", &settings->bools.video_gpu_screenshot, true, DEFAULT_GPU_SCREENSHOT, false); SETTING_BOOL("video_post_filter_record", &settings->bools.video_post_filter_record, true, DEFAULT_POST_FILTER_RECORD, false); + SETTING_BOOL("video_notch_write_over_enable", &settings->bools.video_notch_write_over_enable, true, DEFAULT_NOTCH_WRITE_OVER_ENABLE, false); SETTING_BOOL("keyboard_gamepad_enable", &settings->bools.input_keyboard_gamepad_enable, true, true, false); SETTING_BOOL("core_set_supports_no_game_enable", &settings->bools.set_supports_no_game_enable, true, true, false); SETTING_BOOL("audio_enable", &settings->bools.audio_enable, true, DEFAULT_AUDIO_ENABLE, false); diff --git a/configuration.h b/configuration.h index f224bc362c..d226005550 100644 --- a/configuration.h +++ b/configuration.h @@ -462,6 +462,7 @@ typedef struct settings bool video_memory_show; bool video_msg_bgcolor_enable; bool video_3ds_lcd_bottom; + bool video_notch_write_over_enable; #ifdef HAVE_VIDEO_LAYOUT bool video_layout_enable; #endif diff --git a/intl/msg_hash_lbl.h b/intl/msg_hash_lbl.h index d628cf4d21..a23d1e5c6e 100644 --- a/intl/msg_hash_lbl.h +++ b/intl/msg_hash_lbl.h @@ -3096,6 +3096,10 @@ MSG_HASH( MENU_ENUM_LABEL_VIDEO_SYNCHRONIZATION_SETTINGS, "video_synchronization_settings" ) +MSG_HASH( + MENU_ENUM_LABEL_VIDEO_NOTCH_WRITE_OVER, + "video_notch_write_over" +) MSG_HASH( MENU_ENUM_LABEL_VIDEO_OUTPUT_SETTINGS, "video_output_settings" diff --git a/intl/msg_hash_pt_br.h b/intl/msg_hash_pt_br.h index 90d6718cba..4f1f5b9ad9 100644 --- a/intl/msg_hash_pt_br.h +++ b/intl/msg_hash_pt_br.h @@ -1316,6 +1316,10 @@ MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_FILTER, "Aplica um filtro de vídeo processado pela CPU.\nNOTA: Pode vir a um alto custo de desempenho. Alguns filtros de vídeo podem funcionar apenas para núcleos que usam cores de 32 ou 16 bits." ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_NOTCH_WRITE_OVER, + "Aplica a tela cheia por cima do notch em dispositivos que o possuam." +) /* Settings > Video > CRT SwitchRes */ diff --git a/intl/msg_hash_us.h b/intl/msg_hash_us.h index 3a2ad83093..ef81644526 100644 --- a/intl/msg_hash_us.h +++ b/intl/msg_hash_us.h @@ -1360,6 +1360,10 @@ MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_FILTER, "Apply a CPU-powered video filter.\nNOTE: Might come at a high performance cost. Some video filters might only work for cores that use 32bit or 16bit color." ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_NOTCH_WRITE_OVER, + "Enable fullscreen over notch in Android devices" +) /* Settings > Video > CRT SwitchRes */ diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 94b051f095..4b88bd3490 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -5693,6 +5693,10 @@ unsigned menu_displaylist_build_list( PARSE_ONLY_PATH, false) == 0) count++; #endif + if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(list, + MENU_ENUM_LABEL_VIDEO_NOTCH_WRITE_OVER, + PARSE_ONLY_BOOL, false) == 0) + count++; } break; case DISPLAYLIST_OPTIONS_REMAPPINGS: diff --git a/menu/menu_setting.c b/menu/menu_setting.c index dbaebb22a5..cc8f150307 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -9926,6 +9926,23 @@ static bool setting_append_list( /* prevent unused function warning on unsupported builds */ (void)setting_get_string_representation_int_gpu_index; +#ifdef ANDROID + CONFIG_BOOL( + list, list_info, + &settings->bools.video_notch_write_over_enable, + MENU_ENUM_LABEL_VIDEO_NOTCH_WRITE_OVER, + MENU_ENUM_LABEL_VALUE_VIDEO_NOTCH_WRITE_OVER, + video_notch_write_over_enable, + MENU_ENUM_LABEL_VALUE_OFF, + MENU_ENUM_LABEL_VALUE_ON, + &group_info, + &subgroup_info, + parent_group, + general_write_handler, + general_read_handler, + SD_FLAG_NONE); +#endif + #ifdef HAVE_VULKAN if (string_is_equal(video_driver_get_ident(), "vulkan")) { diff --git a/msg_hash.h b/msg_hash.h index 93cc935ffd..d352ebe0ae 100644 --- a/msg_hash.h +++ b/msg_hash.h @@ -992,6 +992,8 @@ enum msg_hash_enums MENU_LABEL(VIDEO_CROP_OVERSCAN), + MENU_LABEL(VIDEO_NOTCH_WRITE_OVER), + MENU_LABEL(VIDEO_SCALE_INTEGER), MENU_LABEL(VIDEO_VIEWPORT_CUSTOM_X), MENU_LABEL(VIDEO_VIEWPORT_CUSTOM_Y), diff --git a/pkg/android/phoenix/src/com/retroarch/browser/retroactivity/RetroActivityFuture.java b/pkg/android/phoenix/src/com/retroarch/browser/retroactivity/RetroActivityFuture.java index 63b6f92989..c719876625 100644 --- a/pkg/android/phoenix/src/com/retroarch/browser/retroactivity/RetroActivityFuture.java +++ b/pkg/android/phoenix/src/com/retroarch/browser/retroactivity/RetroActivityFuture.java @@ -1,11 +1,14 @@ package com.retroarch.browser.retroactivity; +import android.util.Log; import android.view.View; import android.view.WindowManager; import android.content.Intent; import android.content.Context; import android.hardware.input.InputManager; import android.os.Build; +import com.retroarch.browser.preferences.util.ConfigFile; +import com.retroarch.browser.preferences.util.UserPreferences; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; @@ -60,6 +63,18 @@ public final class RetroActivityFuture extends RetroActivityCamera { // available then nothing will be done if (retro.hasExtra("HIDEMOUSE")) hideMouseCursor(); } + + //Checks if Android versions is above 9.0 (28) and enable the screen to write over notch if the user desires + if (Build.VERSION.SDK_INT >= 28) { + ConfigFile configFile = new ConfigFile(UserPreferences.getDefaultConfigPath(this)); + try { + if (configFile.getBoolean("video_notch_write_over_enable")) { + getWindow().getAttributes().layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES; + } + } catch (Exception e) { + Log.w("Key doesn't exist yet.", e.getMessage()); + } + } } public void hideMouseCursor() {