# Protontricks

Now that we have our flatpaks installed, we'll configure them and install our prerequisite runtimes.

## Create Wineprefix

P4G must be launched at least once so Steam can create a **wineprefix** for it.

<details>

<summary>Important Terms</summary>

* **Wineprefix:** A directory that contains a "mini-Windows" system for a program on Linux. It contains compatibility configurations and an entire filesystem that mimics a Windows setup.

</details>

* **Launch P4G** through Steam. This will create a wineprefix directory for the game.
* Once you reach the main menu, quit the game.

{% hint style="danger" %}
If for some reason you can't reach the main menu, **DO NOT CONTINUE!**

Something is wrong with your P4G game install or Steam Deck that has nothing to do with mods or this guide. You'll need to resolve that before installing mods for the game.
{% endhint %}

## Grant Filesystem Access

By default, Protontricks has limited access to your Steam Deck's filesystem.

This is great for security, but since we're modding a game we'll need to open up access to your user files and microSD card.

### Launch Flatseal

* Close **Discover** if it is still open.
* Open the application launcher and launch **Flatseal** under the **Utilities** tab.

<figure><img src="https://369712984-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZ91pfOT0FIRiQCLmZ9CH%2Fuploads%2F8PgyQt9jbhLP0BRAWmxc%2Fimage.png?alt=media&#x26;token=6bd6da1c-f38c-442b-adf0-959fef42b62e" alt=""><figcaption></figcaption></figure>

### Grant Filesystem Access

* In the small menu on the left, find and select **Protontricks**.

<figure><img src="https://369712984-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZ91pfOT0FIRiQCLmZ9CH%2Fuploads%2FV1vSVDC7TeWUlby8KjY0%2Fimage.png?alt=media&#x26;token=f28efc3f-6dee-47cb-b170-79e1f0712a11" alt=""><figcaption></figcaption></figure>

#### Grant Internal Storage Access

* In the big window on the right, scroll down through the configuration to the **Filesystem** section.
  * Enable **All user files**.

<figure><img src="https://369712984-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZ91pfOT0FIRiQCLmZ9CH%2Fuploads%2FTJTuqpabD1Q33NnVAEpp%2Fimage.png?alt=media&#x26;token=b872a7ae-f5d7-43b5-8748-73f27a689e9c" alt=""><figcaption></figcaption></figure>

This will give Protontricks access to your user files in `/home/`, including your **P4G-Mods** directory.

#### Grant microSD Card Access

{% hint style="warning" %}
**Do not skip this step**, even if P4G is not installed on your microSD card!

Protontricks will whine (pun intended) about not having access if you don't grant it.
{% endhint %}

* Under **Filesystem > Other files**, click the **Add directory** button on the right (folder with a plus sign).
  * In the empty box that appears, enter **`/run/media`**.

<figure><img src="https://369712984-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZ91pfOT0FIRiQCLmZ9CH%2Fuploads%2FYn8o09cuOhEmwlaFi3QE%2Fimage.png?alt=media&#x26;token=e0968f56-fe8b-42c3-9da6-a5d1a2e1ba0b" alt=""><figcaption></figcaption></figure>

This will give Protontricks access to your microSD card files and games.

<details>

<summary>Some scary exclamation marks appeared!</summary>

Don't worry! Those just indicate that you've made changes from the default configuration.

</details>

* When you are finished, close **Flatseal**. Your changes will automatically save.

## Show Dot Files

On Linux, you can hide a file or directory by adding a "dot" to the start of its name (eg {`.hidden`").

We're going to be accessing hidden directories as part of the modding process, so we'll configure Protontricks to show "dot files."

<details>

<summary>Important Terms</summary>

* **Runtime:** A library of functions and instructions that your PC executes while a program is running. Many games and programs share the same common runtimes.
* [**Visual C++**](https://docs.microsoft.com/en-us/cpp/overview/visual-cpp-in-visual-studio?view=msvc-170): Microsoft's version of the C++ programming language.
* [**.NET**](https://dotnet.microsoft.com)**:** A free cross-platform software framework by Microsoft.

</details>

### Launch Protontricks

* Open the application launcher and launch **Protontricks** under the **Utilities** tab.

<figure><img src="https://369712984-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZ91pfOT0FIRiQCLmZ9CH%2Fuploads%2FtdAo3I7bQOnkMa44PXms%2Fimage.png?alt=media&#x26;token=96619aca-8c53-453d-acc8-f1ca1011a9e8" alt=""><figcaption></figcaption></figure>

* A list of your installed Steam games will appear. Select **Persona 4 Golden** and click **OK**.

{% hint style="info" %}
If you can't find **Persona 4 Golden** in the list, you forgot to [**run the game**](#create-wineprefix) earlier!
{% endhint %}

<figure><img src="https://369712984-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZ91pfOT0FIRiQCLmZ9CH%2Fuploads%2FNOxerKmgI7U6pnJoglH4%2Fp4g-1.jpg?alt=media&#x26;token=27e71528-2656-4dcf-9250-60e11bfe2482" alt=""><figcaption><p>Thanks to <strong>rudiger</strong> for this image.</p></figcaption></figure>

### Enable Dot Files

You'll now be in the **Winetricks** menu for P4G. It might take a few seconds to open.

#### Open Winecfg

* In the first menu, click **Select the default prefix**, then click **OK**.

<figure><img src="https://369712984-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZ91pfOT0FIRiQCLmZ9CH%2Fuploads%2FPLbFvwANpqyiU2HLQsEF%2Fimage.png?alt=media&#x26;token=8e38f609-0aae-4396-8a52-bb927d653f74" alt=""><figcaption></figcaption></figure>

* In the second menu, click **Run winecfg**, then click **OK**.&#x20;

<figure><img src="https://369712984-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZ91pfOT0FIRiQCLmZ9CH%2Fuploads%2FDkvHAjhSuDyB4EIK3007%2Fimage.png?alt=media&#x26;token=f7428ebb-6781-4829-93ef-12abc4560e2c" alt=""><figcaption></figcaption></figure>

#### Configure Wine

You'll now be in the **Wine configuration** menu for P4G. We're nearly done here!

* Select the **Drives** tab at the top of the window.
* Enable **Show dot files** in the bottom left of the window.
* Click **Apply**, then **OK**.

<figure><img src="https://369712984-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZ91pfOT0FIRiQCLmZ9CH%2Fuploads%2FwyDPKEHM5SqOK8gxK6KQ%2F7.png?alt=media&#x26;token=43787b02-4ea6-4e03-a0dd-f98505db9452" alt=""><figcaption><p>Thanks to <strong>rudiger</strong> for this image.</p></figcaption></figure>

Whew, we're all done here!

* Go ahead and close the **Wine configuration** window,
  * then close the **Winetricks** window that appears,
    * and finally close the **Protontricks** window that appears after that.

## Install Prerequisite Runtimes

Remember those prerequisite runtimes you downloaded a while ago? It's time to install them!

<details>

<summary>Important Terms</summary>

* **Runtime:** A library of functions and instructions that your PC executes while a program is running. Many games and programs share the same common runtimes.
* [**Visual C++**](https://docs.microsoft.com/en-us/cpp/overview/visual-cpp-in-visual-studio?view=msvc-170): Microsoft's version of the C++ programming language.
* [**.NET**](https://dotnet.microsoft.com)**:** A free cross-platform software framework by Microsoft.

</details>

### Install First Prerequisite

#### Launch Prerequisite Installer

* Open your **/P4G-Mods/Setup/** directory.
* **Right-click** the Visual C++ (x64) Redistributable (`vc_redist.x64.exe)` and select **Open with Protontricks Launcher**.

{% hint style="info" %}
If you don't see **Open with Protontricks Launcher**, select **Open With** and manually select **Utilities > Protontricks** from the menu that appears.
{% endhint %}

<figure><img src="https://369712984-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZ91pfOT0FIRiQCLmZ9CH%2Fuploads%2FQlkPPabONKQasl2DPguw%2Fimage.png?alt=media&#x26;token=36e8c97c-0a7e-49c6-89e4-4f764e199fa4" alt=""><figcaption></figcaption></figure>

* In the Protontricks window, select **Persona 4 Golden** and click **OK**.

<figure><img src="https://369712984-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZ91pfOT0FIRiQCLmZ9CH%2Fuploads%2FNOxerKmgI7U6pnJoglH4%2Fp4g-1.jpg?alt=media&#x26;token=27e71528-2656-4dcf-9250-60e11bfe2482" alt=""><figcaption><p>Thanks to <strong>rudiger</strong> for this image.</p></figcaption></figure>

#### Install Prerequisite

* Once the installer window appears (it may take a few seconds), follow the instructions on-screen to install the runtime to your P4G wineprefix.

<figure><img src="https://369712984-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZ91pfOT0FIRiQCLmZ9CH%2Fuploads%2FJ7legR1R08r0wO9dDeFJ%2Fimage.png?alt=media&#x26;token=6806ad37-0a60-4075-ab89-61137d6d6bc1" alt=""><figcaption></figcaption></figure>

### Install Remaining Prerequisites

* Repeat the above instructions for the rest the prerequisites in the **Setup** folder:
  * **Visual C++ Redistributable (x86)**
  * **.NET 8 Desktop Runtime (x64)**
  * **.NET 8 Desktop Runtime (x86)**

Once all four prerequisites are installed to your P4G wineprefix, you're ready to move on.

## Moving On

{% content-ref url="reloaded-ii" %}
[reloaded-ii](https://p4g-deck.cep.one/install/reloaded-ii)
{% endcontent-ref %}
