mirror of
https://github.com/Ryubing/Ryujinx.git
synced 2025-06-19 00:17:23 +00:00
Compare commits
4 Commits
6b61d624ea
...
51c2953c8b
Author | SHA1 | Date | |
---|---|---|---|
![]() |
51c2953c8b | ||
![]() |
a23c6bf547 | ||
![]() |
0bf3191262 | ||
![]() |
7ab8ebca21 |
@ -20,4 +20,42 @@ if command -v gamemoderun > /dev/null 2>&1; then
|
|||||||
COMMAND="$COMMAND gamemoderun"
|
COMMAND="$COMMAND gamemoderun"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec $COMMAND "$SCRIPT_DIR/$RYUJINX_BIN" "$@"
|
# Check if user already has a manual Avalonia scaling override or session type is x11.
|
||||||
|
if [[ -n "${AVALONIA_GLOBAL_SCALE_FACTOR-}" || "$(echo "$XDG_SESSION_TYPE")" == "x11" ]]; then
|
||||||
|
echo "Scaling: Performed by environment, skipping." >&2
|
||||||
|
else
|
||||||
|
# Query monitor config directly (GNOME), default display only.
|
||||||
|
if [[ "$(echo "$XDG_CURRENT_DESKTOP")" == "GNOME" && -f ~/.config/monitors.xml ]] then
|
||||||
|
echo -n 'Scaling: Monitor config located, querying scale...' >&2
|
||||||
|
SCALING="$(grep '<scale' ~/.config/monitors.xml -m 1 | cut -f2 -d">"|cut -f1 -d"<")"
|
||||||
|
SCALING="${SCALING##* }"
|
||||||
|
echo "found! Factor: ${SCALING}" >&2
|
||||||
|
|
||||||
|
# Fallback to X DPI query for others.
|
||||||
|
# Plasma handles this fine, GNOME will always round up e.g. 1.25 -> 2.00.
|
||||||
|
elif command -v xrdb >/dev/null; then
|
||||||
|
echo -n 'Scaling: Attempting to get scaling from X DPI value...' >&2
|
||||||
|
dpi="$(xrdb -get Xft.dpi)"
|
||||||
|
if [[ -n "${dpi}" ]]; then
|
||||||
|
SCALING=$(echo "scale=2; ${dpi}/96" | bc)
|
||||||
|
fi
|
||||||
|
echo "found! Factor: ${SCALING}"
|
||||||
|
|
||||||
|
# Query kscreen-doctor for Plasma as a fallback.
|
||||||
|
elif [[ "$(echo "$XDG_CURRENT_DESKTOP")" == "KDE" ]] && command -v kscreen-doctor >/dev/null; then
|
||||||
|
echo -n 'Scaling: Attempting to get Plasma desktop scaling factor...' >&2
|
||||||
|
SCALING="$(kscreen-doctor --outputs | grep "Scale" -m 1)"
|
||||||
|
SCALING="${SCALING##* }"
|
||||||
|
SCALING=$(echo $SCALING | sed 's/\x1B\[[0-9;]*m//g') # Trim ANSI chars from ksd output.
|
||||||
|
echo "found! Factor: ${SCALING}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -z "${SCALING-}" || "${SCALING-}" == "0" ]]; then
|
||||||
|
echo 'Unset invalid scaling value' >&2
|
||||||
|
SCALING="1"
|
||||||
|
fi
|
||||||
|
|
||||||
|
COMMAND="$COMMAND AVALONIA_GLOBAL_SCALE_FACTOR=$SCALING"
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec $COMMAND "$SCRIPT_DIR/$RYUJINX_BIN" "$@"
|
@ -17,12 +17,12 @@ namespace Ryujinx.Ava.Systems.Configuration
|
|||||||
public static class FileTypesExtensions
|
public static class FileTypesExtensions
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the current <see cref="ConfigurationState.UISection.ShownFileTypeSettings"/> value for the correlating FileType name.
|
/// Gets the current <see cref="ShownFileTypeSettings"/> value for the correlating FileType name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="type">The name of the <see cref="ConfigurationState.UISection.ShownFileTypeSettings"/> parameter to get the value of.</param>
|
/// <param name="type">The name of the <see cref="ShownFileTypeSettings"/> parameter to get the value of.</param>
|
||||||
/// <param name="config">The config instance to get the value from.</param>
|
/// <param name="config">The config instance to get the value from.</param>
|
||||||
/// <returns>The current value of the setting. Value is <see langword="true"/> if the file type is to be shown on the games list, <see langword="false"/> otherwise.</returns>
|
/// <returns>The current value of the setting. Value is <see langword="true"/> if the file type is to be shown on the games list, <see langword="false"/> otherwise.</returns>
|
||||||
public static bool GetConfigValue(this FileTypes type, ConfigurationState.UISection.ShownFileTypeSettings config) => type switch
|
public static bool GetConfigValue(this FileTypes type, ShownFileTypeSettings config) => type switch
|
||||||
{
|
{
|
||||||
FileTypes.NSP => config.NSP.Value,
|
FileTypes.NSP => config.NSP.Value,
|
||||||
FileTypes.PFS0 => config.PFS0.Value,
|
FileTypes.PFS0 => config.PFS0.Value,
|
||||||
|
Loading…
Reference in New Issue
Block a user