# 在Linux上游玩

Linux目前不受官方支持。但是，您可以通过 Proton 或是 Wine 参照本指南进行操作。在继续之前，您还应该了解一些有关 [Origin的常见问题](https://github.com/lutris/docs/blob/master/Origin.md)

## 安装步骤

### Steam (Proton)

1. 从 [国际服下载链接](https://github.com/R2Northstar/Northstar/releases) / [国服下载链接](https://github.com/R2NorthstarCN/NorthStarCNLauncherFile)中下载最新版本的Northstar/NorthstarCN
2. 解压所有文件到你的 Titanfall 2 文件目录中：
   * **Steam** - 鼠标右击 *Titanfall 2* > 打开 *属性* > 点击 *本地文件* > 点击 *浏览*\
     默认路径: `C:\Program Files (x86)\Steam\steamapps\common\Titanfall2`
3. 重命名 *Titanfall2.exe* 为其他任意文件名 ( 例如： *Titanfall2old.exe* ), 然后重命名 *NorthstarLauncher.exe* 为 *Titanfall2.exe*

现在，当您点击游玩时，Steam将会自动启动Northstar。在通过Steam启动游戏，进入主菜单后，你将会收到一条Northstar欢迎信息。

> **注意:** 目前有一个bug，游戏有时会加载原版 Titanfall 2 而不是 Northstar。目前还没有通用的解决方案，但有人报告说，将 Proton 版本更改为 *Proton 5.13* 或是 *Proton Experimental* 并且删除 Proton prefix 文件目录 (`Steam/steamapps/compatdata/1237970/`) 有助于解决此问题

> 如果您仍然受到这个bug的困扰，请尝试通过Lutris运行游戏。它似乎不会出现这个BUG

### Lutris (Wine)

1. 如果尚未下载游戏，请 [从这里](https://lutris.net/games/titanfall-2/) 安装游戏
2. 从 [国际服下载链接](https://github.com/R2Northstar/Northstar/releases) / [国服下载链接](https://github.com/R2NorthstarCN/NorthStarCNLauncherFile)中下载最新版本的Northstar/NorthstarCN
3. 解压所有文件到你的 Titanfall 2 文件目录中
4. **如果你在Lutris上安装了游戏:** 鼠标右击 *Titanfall 2* > *Configure* > *Game Options* > 设置 *Executable path* 为 *NorthstarLauncher.exe*
5. **Otherwise:** 鼠标单击左上角的 `+` 按钮 > 名称设置为任意名称，并将 *Runner* 设置为 *Wine* > 点击 *Game options* > 设置 *Executable path* 为 *NorthstarLauncher.exe* ，然后保存。

> **如果您正在从Steam移动游戏:** 设置 *Wine prefix* 为 `(your Steam directory)/steamapps/compatdata/1237970/pfx/`。这将为您免去重新下载Origin的麻烦。

现在只需通过Lutris启动游戏，当你进入主菜单时，你将会收到一条Northstar欢迎信息。

> **注意**：第一次启动时，Origin可能会提示您登录并“为将来的下载设置安装文件夹”。照做，关闭Origin，然后再次启动游戏。

> 你可能会觉得游戏在刚开始玩的第一个小时会有些卡顿。这很正常，只是DXVK正在编译着色器。你玩得越久，游戏卡顿的次数就越少。 discord上的某个人编写了一份关于最佳设置的 [深入指南](https://i.imgur.com/xzop1lQ.png) 来帮助着色器缓存。并且，**通过阻止Origin写入不必要的文件，可以提高总体性能。**\
> [泰坦陨落2着色器缓存](https://github.com/Cervoxx/DXVKCACHE/raw/master/Titanfall2-cache.tar.xz)\
> [关于Origin运行缓慢的讨论](https://github.com/ValveSoftware/Proton/issues/4001#issuecomment-647014231)

## LatencyFleX

LatencyFleX is a Linux-only input latency reduction alternative to Nvidia Reflex that is supported by Northstar. Currently, LatencyFleX requires manual installation. A full install guide and current releases [can be found on their GitHub](https://github.com/ishitatsuyuki/LatencyFleX).

Northstar only requires the [Vulkan layer](https://github.com/ishitatsuyuki/LatencyFleX#latencyflex-vulkan-layer-essential) and [Wine extensions](https://github.com/ishitatsuyuki/LatencyFleX#latencyflex-wine-extensions-required-for-proton-reflex-integration) steps to be completed.

Once installed, LatencyFleX can be enabled by doing either of the following:

* **Steam:** Add the following to your Titanfall 2 launch options: `"LFX=1 %command%"`
* **Lutris:** Right click on Titanfall 2, click 'Configure', navigate to 'System Preferences' / 'System Options' / 'Environmental Variables', and use the following:

> Key: LFX\
> Value: 1

Once in-game, LatencyFleX can be toggled off and on using the `"r_latencyflex"` console variable.

While playing with LatencyFleX, **VSync and Adaptive Super Sampling must be disabled**. If you wish to prevent tearing while using LatencyFleX, the following may be added to the end of `ns_startup_args.txt` in the root of your Titanfall 2 install:

> +fps\_max\_use\_refresh 1

## 故障处理

### 控制台无内容

此问题是由于Titanfall 2 wine prefix上缺少字体造成的。您需要 [winetricks](https://github.com/Winetricks/winetricks) 或是 [protontricks](https://github.com/Matoking/protontricks) ，具体取决于您所使用的软件。按照以下步骤安装：

1. 关闭所有 Titanfall/Origin 进程
2. 如果您使用的是 Lutris， 选择您安装的 Titanfall 2 并单击 '▲' -> Winetricks。 在Proton中，您可以使用  `protontricks 1237970 --gui`
3. '选择默认 wineprefix' -> '安装任意字体' -> 检查包 `lucida` 和 `arial`
4. 单击OK并等待所有内容安装，如果操作正确，WineTracks将再次弹出
5. 您现在可以关闭它并启动游戏

### 全屏问题

通过Linux全屏运行游戏可能会导致黑屏，并阻止您启动游戏。编辑您的 `ns_startup_args.txt` 文件，将 `-noborder -window` 包含其中；或是编辑 位于`<wineprefix>/drive_c/users/<username>/Documents/Respawn/Titanfall2/local/videoconfig.txt` 中的`"setting.fullscreen"` 和 `"setting.nowindowborder"` 来解决这个问题。

有关更多信息及其他修复，详见 [Github上的这个issue帖子](https://github.com/R2Northstar/Northstar/issues/1)

### LatencyFleX issues

Some users have reported issues with enabling LatencyFleX. If you see `"Unable to load LatencyFleX library, LatencyFleX disabled."` in your logs, try adding `latencyflex_wine.dll` to your `bin/x64_retail` folder.

### Game crashes on launch with Cause: Access Violation Data Execution Prevention (DEP) at: 0x00000000

try running with ProtonGE <https://github.com/GloriousEggroll/proton-ge-custom/>.
