在Linux中添加SteamOS会话,实现接近原生SteamDeck体验的SteamOS

环境介绍

  1. ArchLinux
  2. Steeam(runtime)
  3. AMD Ryzen RX 5600X
  4. AMD Radeon 6600XT

这篇文章可以帮助你在任何Linux发行版中搭建出接近原生SteamOS的游戏环境

由于NVIDIA在GNU/Linux上发布的驱动非常糟糕特别是在Wayland环境下,而且SteamDeck也是使用的AMD平台,所以不推荐使用NVIDIA使用,但是可以尝试将下文的gamescope创建在X11会话中,可能会一定程度提高使用体验.

应用场景:如果你的电脑拥已经没有多少硬盘空间,或者你的Linux已经安装了Steam,不想再浪费硬盘空间再额外安装一个SteamOS,你希望可以在任意Linux中实现脱离键鼠地游戏,且游戏体验不输Windows和一些游戏主机,实测赛博朋克2077使用这个方法比Windwos高10-20帧,比在ArchLinux KDE桌面下高5-10帧

首先需要了解一下SteamDeck的SteamOS实现的原理:其实和任何Linux发行版一样,只不过是在GNU/Linux上添加了一些具有自家特色的软件包,况且SteamOS是基于ArchLinux修改而来,添加的内容实际上可以在ArchLinux上很轻易地复刻出来.

SteamOS使用了gamescope作为桌面环境,在此环境上自动启动steam作为"桌面",大家也都知道Steam的大屏模式也只是SteamDeck修改来的.只需要加上一些启动参数就可以实现steamDeck同样的大屏幕模式steam -gamepadui -steamos3 -steampal -steamdeck,但是这样的大屏模式不具备全局FSR,不具备Steamdeck的快捷菜单,且多套了一层现有的桌面环境.这就可以通过gamescpoe来创建一个新的会话,没有wm,没有de带来的额外性能开销.Vale也将gamescope开源了,ChimeraOS就是这么来的

准备工作

确保你已经有了基本的git和gcc,以下内容会涉及到github,确保你的网络可以连接到github

开源项目:

gamescope-session 可以实现任意创建Wayland会话

gamescope-session-steam 已经配置完成的steam会话

安装

需要先安装Steam,

ArchLinux需要向开启multilib仓库

# /etc/pacman.conf
# 将以下内容取消注释
[multilib]
Include = /etc/pacman.d/mirrorlist

使用pacman安装

# shell
sudo pacman -S steam-runtime

Debian/Ubuntu或者任意Debian系使用apt来安装

# shell
sudo apt install steam-installer

其它发行版我还没有研究过

安装GameScopeSession

GitHub中有安装指导,很简单,就是把仓库中的文件复制到/usr中,我做了一个脚本可以一个命令实现安装,在我的zsh中运行良好,不知道bash能不能好好运行.如果有人试过bash不可以麻烦告诉我,谢谢您的支持.

curl -Ls https://raw.githubusercontent.com/Apiclo/Apiclo.github.io/master/shells/gamescope.sh | bash

或者拷贝下面的内容,自己新建一个.gamescope.sh脚本

# 1.你需要运行以下命令
touch ~/gamescope.sh
chmod +x ~/gamescope.sh
# 2.你现在需要使用任意文本编辑工具将下方代码片粘贴到~/gamescope.sh中
# 3.继续使用命令行运行
./gamescope.sh
#! /bin/bash
RED='\033[1;31m'
GREEN='\033[1;32m'
YELLOW='\033[1;33m'
BLUE='\033[1;34m'
NC='\033[0m'
reset_terminal=$(tput sgr0)
clear
function checkDir() {
	cd ~/
	if [ -d "gamescope" ]; then
		cd ~/gamescope
	else
		mkdir ~/gamescope && cd ~/gamescope
	fi
}

function checkGit() {
	git_scope="https://github.com/ChimeraOS/gamescope-session.git"
	git_steam="https://github.com/ChimeraOS/gamescope-session-steam.git"
	dir_scope="gamescope-session"
	dir_steam="gamescope-session-steam"
    function reclone() {
        echo -ne "${YELLOW}文件${1}需要克隆,继续吗? (y/n): ${NC}" && read reclone && is_reclone=${reclone:-y}
        if [ "is_$reclone" = "y" ]; then
            cd ~/gamescope
            rm -rf ${dir_scope} ${dir_steam} &> /dev/null
            git clone $git_scope
            git clone $git_steam
            if [ $?=0 ]; then
				git_status="full"
			else
				git_status="broken"
			fi
        else
            echo "取消克隆"
            return 1
        fi
    }
	echo -e "${BLUE}获取安装内容...${NC}"
    if [ -d "$dir_scope" ] && [ -d "$dir_steam" ]; then
        echo -e "${GREEN}源码已就绪${NC}" && git_status="full"

    elif [ -d "$dir_scope" ]; then
		reclone "${dir_steam}"
    elif [ -d "$dir_steam" ]; then
        reclone "${YELLOW}${dir_scope}"
    else
        reclone "全部"
    fi
    cd ~/gamescope
}
function copyFiles() {

	steam_session="/usr/share/wayland-sessions/gamescope-session-steam.desktop"
	echo -e "${BLUE}需要sudo密码才能继续安装${NC}"
	sudo cp -r ~/gamescope/${dir_scope}/usr/* /usr/
	sudo cp -r ~/gamescope/${dir_steam}/usr/* /usr/
	if [ -f $steam_session ]; then
		sudo sed -i "s/^Name=.*/Name=SteamOS/" "$steam_session"
		sudo chmod +x $steam_session
		sudo sed -i "s/^Comment=.*/Comment=进入SteamDeck下的大屏幕模式/" "$steam_session"
		echo -e "${GREEN}安装完毕了!${NC}"
		echo -e "${BLUE}注销后在会话管理中即可进入SteamOS${NC}"
	else
		echo -e "${RED}1.安装失败,请手动将~/gamescope/${dir_scope}复制到/usr${NC}"
		echo -e "${RED}2.安装失败,请手动将~/gamescope/${dir_steam}复制到/usr${NC}"
	fi
}
function cleanDir() {
	echo -e "${YELLOW}需要执行清理吗?(n/y)${NC}" && read is_clean && is_clean=${is_clean:-n}
	if [ "$is_clean" = "y" ]; then
		rm -rf ~/gamescope
		echo -e "${GREEN}清理完毕${NC}"
	else
		echo -e "${BLUE}取消清理${NC}"
	fi

}
function main() {
	checkDir
	checkGit
	if [ "${git_status}" = "full" ]; then
		copyFiles
	else
		echo -e "${RED}安装文件不完整,停止运行${NC}"
	fi
	if [ -d ~/gamescope ]; then
		cleanDir
	else
		echo -e "${BLUE}无残留文件,跳过安装后清理${NC}"
	fi
}
main

重新登陆即可享受SteamOS同款的Steam界面

注意!

由于Steam默认是安装的steam-runtime包,steam会在一个自己的兼容层中运行,而且由于Steam的前端是基于Chromium的,和后端通信是基于Steam自己的环回网络,有几率会出现点非常卡顿的问题,可以尝试通过host解析steam环回网络到127.0.0.1,或者通过/etcc/resolve.conf添加steam环回网络的规则

这个方法搭建的Steam界面无法使用Steam的性能监视器,我看日志说的是找不到0号显示器,估计是套了Wayland的原因,有能力的可以尝试自己修复下,不过别担心,全局FSR是完全可以用的.而且是可以正常使用Decky的

  • 9
    点赞
  • 23
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值