Implementation of fullscreen over notch function.

This commit is contained in:
Pedro 2020-08-27 20:41:30 -03:00
parent 5f2e810879
commit b6655034ef
10 changed files with 58 additions and 0 deletions

View File

@ -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

View File

@ -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);

View File

@ -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

View File

@ -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"

View File

@ -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 */

View File

@ -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 */

View File

@ -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:

View File

@ -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"))
{

View File

@ -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),

View File

@ -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() {