Skip to content

Instantly share code, notes, and snippets.

@Centzilius
Last active April 23, 2024 16:18
Show Gist options
  • Save Centzilius/57892e5d1aaea51b3f389e6f1d587c97 to your computer and use it in GitHub Desktop.
Save Centzilius/57892e5d1aaea51b3f389e6f1d587c97 to your computer and use it in GitHub Desktop.
""" Game fix for FFXIV
"""
#pylint: disable=C0103
from protonfixes import util
import os
from subprocess import call
import sys
def main():
""" for FFXIV skip intro cutscene to allow game to work.
"""
util.protontricks('hidewineexports=enable')
# disable new character intro cutscene to prevent black screen loop
configpath = os.path.join(util.protonprefix(), 'drive_c/users/steamuser/Documents/My Games/FINAL FANTASY XIV - A Realm Reborn')
if not os.path.exists(configpath):
os.makedirs(configpath)
configgame = os.path.join(configpath, 'FFXIV.cfg')
if not os.path.isfile(configgame):
f = open(configgame,"w+")
f.write("<FINAL FANTASY XIV Config File>\n\n<Cutscene Settings>\nCutsceneMovieOpening 1")
f.close
configpath = os.path.join(util.protonprefix(), 'drive_c/users/steamuser/Documents/My Games/FINAL FANTASY XIV - A Realm Reborn')
if not os.path.exists(configpath):
os.makedirs(configpath)
configgame = os.path.join(configpath, 'FFXIV_BOOT.cfg')
if not os.path.isfile(configgame):
f = open(configgame,"w+")
f.write("<FINAL FANTASY XIV Boot Config File>\n\n<Version>\nBrowser 1\nStartupCompleted 1")
f.close
# Fixes the startup process.
if 'NOSTEAM' in os.environ:
util.replace_command('-issteam', '')
if 'XL_WINEONLINUX' in os.environ:
try:
util.install_dotnet('dotnet48')
except AttributeError:
util.protontricks_proton_5('dotnet48')
util.protontricks('vcrun2019')
util.replace_command('-issteam', '')
launcherpath = os.path.join(util.protonprefix(), 'drive_c/users/steamuser/AppData/Local/XIVLauncher/XIVLauncher.exe')
if not os.path.exists(launcherpath):
call(
[
"curl",
"https://kamori.goats.dev/Proxy/Update/Release/Setup.exe",
"-L",
"-o",
os.path.join(
util.get_game_install_path(),
"boot/Setup.exe"
)
]
)
util.replace_command('ffxivboot.exe', 'Setup.exe')
else:
original_launcher = os.path.join(
util.get_game_install_path(),
"boot/ffxivboot.exe"
)
util.replace_command(original_launcher, launcherpath)

Final Fantasy XIV on Steam after the Steam Account Linking incident

In order to get FFXIV to work you need to link your account first. Sadly this is (so far) the only step we can't do from linux. For everything else follow along.

Dependencies

Make sure you have curl installed. Also install Proton 5.0 from the tool section of Steam in the same gamelibrary as your Final Fantasy XIV.

Your old prefix

If you played the game earlier via steam or if you have tinkered with it in any way I recommend that you put it somewhere else. Your prefix (from steam) is usually located at

$HOME/.steam/steam/steamapps/compatdata/39210

Get GE Proton

I tested this setup with Proton-6.21-GE-2. You can get that here. TLDR:

cd $HOME/.steam/steam/compatibilitytools.d
curl -L https://github.com/GloriousEggroll/proton-ge-custom/releases/download/6.21-GE-2/Proton-6.21-GE-2.tar.gz | tar xz

Update winetricks of that Proton installation

cd $HOME/.steam/steam/compatibilitytools.d/Proton-6.21-GE-2/protonfixes
./winetricks --self-update

Patch the Proton version

This gist has another file. Replace the file located at $HOME/.steam/steam/compatibilitytools.d/Proton-6.21-GE-2/protonfixes/gamefixes/39210.py with it.

Creating a new prefix

  • Right click on ffxiv in your library
  • click on Preferences
  • Click on compatibility
  • Set the checkmark for "Force the use of a specific Steam Play compatibility tool"
  • Select "Proton 6.3-8"
  • Start the game
  • Close the defunct launcher/game

Edit the launch arguments on steam

  • Right click on ffxiv in your library
  • click on Preferences
  • Click on compatibility
  • Select "Proton-6.21-GE-2"
  • put the following string into the launch arguments XL_NO_SPACE_REQUIREMENTS=true XL_WINEONLINUX=true DSSENH=n %command%

Launch the game

The first launch will take forever and there will be one pop up that something is not working. Click on no and soon after XIVLauncher Setup should start.

Play the game

Troubleshooting

  • I was not able to test this setup on every possible combination of things. My latest changes to this guide was after doing it on a clean Ubuntu 20.04 LTS installation with steam installed via the Ubuntu Software Center and I selected to install 3rd party drivers in the Ubuntu installation. (Not that I recommend Ubuntu personally... I was just testing something that is different to my personal setup).
  • You might also want to have a look at this page: https://github.com/GloriousEggroll/proton-ge-custom/tree/6.21-GE-2#installation .
  • In order to get some logs it helps starting steam in a terminal. It is also helpful to execute the following command which will result in a log file being written in $HOME/steam-39210.log.
cp $HOME/.steam/steam/compatibilitytools.d/Proton-6.21-GE-2/user_settings.sample.py $HOME/.steam/steam/compatibilitytools.d/Proton-6.21-GE-2/user_settings.py
  • Starting over and trying again is "as simple as" deleting your prefix and starting the guide from "Creating a new Prefix"

"I get a write free space error when trying to get XIVLauncher to download FFXIV"

  • Please add XL_NO_SPACE_REQUIREMENTS=true to your launcher arguments in Steam to disable XIVLauncher's disk space checks.
    **NOTE:**You will be responsible for ensuring you have enough space on your own.
@TheEnbyWitch
Copy link

TheEnbyWitch commented Mar 29, 2022

The first launch will take forever
How long does that forever take? Been wondering since steam shows that its running for a bit then it doesnt, and i also cant see the wine processes running.
I'm trying this on a Steam Deck btw.

EDIT:
also whenever I try to do anything with winetricks, I get this

------------------------------------------------------
warning: wineserver not found!
------------------------------------------------------

@N4tus
Copy link

N4tus commented Mar 30, 2022

now about 7h, but there seems to be something just broken in my setup, or there are some other issues. If i try to install vcrun2019 it states that it is already installed, if i try to install dotnet48 the same error appears as posted above.
Do the ff14 devs working on this problem?

@TheEnbyWitch
Copy link

Okay, I managed to get dotnet48 installing with the Protontricks app available in the Discover app in SteamOS, will report if I got the game to work.

@Yowlen
Copy link

Yowlen commented Mar 30, 2022

The launcher will freeze on the first run because .NET Framework isn't being properly installed. As I said twice now, this script isn't properly installing it. You'll have to manually close the launcher via whatever task manager your distro has, then manually install dotnet48 via winetricks/protontricks.

@LunaRyuko Are you setting the appropriate WINEPREFIX= variable and pointing it to the appropriate version of wine? The full command should look something like this:
WINEPREFIX=/home/username/.local/steam/steamapps/compatdata/39210/pfx /home/username/.local/steam/compatibilitytools.d/Proton-6.21-GE-2/files/bin/wine64 winetricks dotnet48
It's long and unwieldy, but for winetricks, that's how it has to be done. If you're using protontricks instead, the command should simply be:
protontricks 39210 dotnet48

I don't have any idea what could be the issue you're experiencing, @N4tus, so I can't help any further there. Make sure nothing else is running in the prefix when doing the dotnet48 install. If XIV Launcher is running, it can't fake the restart like it needs to.

As for whether or not FF14's devs are working on it, they don't care. The whole reason we have to do this workaround to get a 3rd-party launcher working is because they're forcing the new launcher which is known to not work in Wine/Proton due to lack of MSHTML support. Square's devs aren't likely to do shit since they knew leading up to the change that it'd break compatibility like this. We're on our own out here, though at least knowing how Gabe Newell is known to play FF14 on his Steam Deck, we can bet we have Valve working hard to get MSHTML support going so that the official launcher can one day work and none of this will be necessary at some point.

@TheEnbyWitch
Copy link

TheEnbyWitch commented Mar 30, 2022

@Yowlen tried this WINEPREFIX=~/.steam/steam/steamapps/compatdata/39210/pfx ~/.steam/steam/compatibilitytools.d/Proton-6.21-GE-2/files/bin/wine64 ./winetricks dotnet48 (I had the console open in the same directory the winetricks executable lived at)
All it printed is

(deck@steamdeck protonfixes)$ WINEPREFIX=~/.steam/steam/steamapps/compatdata/39210/pfx ~/.steam/steam/compatibilitytools.d/Proton-6.21-GE-2/files/bin/wine64 ./winetricks dotnet48
wineserver: using server-side synchronization.
002c:fixme:winediag:LdrInitializeThunk wine-staging 6.21 is a testing version containing experimental patches.
002c:fixme:winediag:LdrInitializeThunk Please mention your exact version when filing bug reports on winehq.org.
(deck@steamdeck protonfixes)$ ------------------------------------------------------
warning: wineserver not found!
------------------------------------------------------

Protontricks worked just fine with flatpak run com.github.Matoking.protontricks 39210 dotnet48 though (I had it installed via Discover)

Still no launcher though :(

@Yowlen
Copy link

Yowlen commented Mar 30, 2022

Assuming you've made sure that there's nothing running in the prefix when running winetricks/protontricks and it's a fresh prefix that has been created as per the instructions outlined above, the only thing I can think of is to try force installing vcrun2019 too. flatpak run com.github.Matoking.protontricks 39210 --force vcrun2019 should do it. I ran into issues where XIV Launcher wasn't finding it. (It still pops up an error about not finding it, but it makes it clear that it's for addons, not the launcher or the game itself, and so it runs fine in the end without it.)

If that doesn't work, maybe make sure all the requisite dependencies for regular Wine is installed. I recall GloriousEggroll's readme having something on that being a requirement, likely to solve some rare issues. I personally have the staging branch installed via Wine's official repos, though I'm sure any branch would work in this case so long as it's relatively up-to-date. (I'd stay away from Ubuntu's wine packages, for example.)

Likewise, making sure your graphics drivers and anything related are installed properly also might be useful. If you're on Ubuntu or a variant thereof, Valve themselves recommend using kisak-valve's PPA for AMD/Intel.

I'll also list my own steps on Xubuntu 20.04 in case it helps:

  1. Back up and delete the prefix as recommended.
  2. In Steam, set the game with no environment variables and force it to run via Proton 6.0.
  3. Close the official launcher when it opens up.
  4. Set the game to run via Proton-GE-6.21 and add the XL_WINEONLINUX=true DSSENH=n %command% launch arguments.
  5. Start it up, wait for a bit, then waited for XIV Launcher to do its updating (I verified this by browsing to steamapps/compatdata/39210/pfx/drive_c/users/steamuser/AppData/Local/XIVLauncher in my file manager to assure all the files were there)
  6. Once verified, I used my distro's task manager to force close XIV Launcher. You should be able to just hit the Stop button on Steam's window too.
  7. I used the protontricks method above to install both dotnet48 and vcrun2019. In my case, that command was protontricks 39210 --force vcrun2019 dotnet48
  8. I restarted the game and got a few errors about Rundll32 not running properly and the font was a bit messed up, but both of those only existed for that one time, I assume due to how the prefix was being set up.

XIV Launcher loaded fine either way and the game ran fine too, with the exception of the Visual C++ error I mentioned before.

I hope this helps.

Edit: I just remembered something. I think I know why the winetricks method failed for you. I think the WINEPREFIX= variable has issues using the ~ shortcut. Best to use $HOME or /home/$USER instead. But with protontricks working for you, I don't see it as much of an issue and it's not likely to be the cause of your problem. Just something to note is all.

@TheEnbyWitch
Copy link

Okay, when I forced an install for vc2019 (I pressed Repair on every dialog) it worked! Thank you for the help!!

@magalz
Copy link

magalz commented Mar 30, 2022

I successfully installed vcrun2019 doint the following steps:

  1. update the chekcsums for the installers
    sudo sed -i 's/50a3e92ade4c2d8f310a2812d46322459104039b9deadbd7fdd483b5c697c0c8/4521ed84b9b1679a706e719423d54ef5e413dc50dde1cf362232d7359d7e89c4/g' /usr/bin/winetricks

sudo sed -i 's/b1a32c71a6b7d5978904fb223763263ea5a7eb23b2c44a0d60e90d234ad99178/f299953673de262fefad9dd19bfbe6a5725a03ae733bebfec856f1306f79c9f7/g' /usr/bin/winetricks

  1. Install vcrun2019
    WINEPREFIX=/path/to/library/steamapps/compatdata/39210/pfx winetricks vcrun2019

Source: https://forum.winehq.org/viewtopic.php?f=2&t=35030

Then dalamud works and no error is produced

@N4tus
Copy link

N4tus commented Mar 31, 2022

after reinstalling winbind, dotnet48 at least opens up an installer.

  • On proton 7.0-1 it first state that is already installed, then tries again with an installation error.
  • On proton 6.3-8 it just straight gives an installation error, in the console.
  • On proton 5.13-6 the installer succeeds but then is not able to finish the installation (ls/ntdll/loader.c: fls_section" wait timed out in thread 0528, blocked by 0734, retrying (60 sec)) that goes on forever, when killing the process wine uninstaller --list shows that both dotnet48 and vcrun2019 are installed but the launcher does not launch at all (wine: could not load kernel32.dll, status c0000135).
    Switching then to proton 6.3-8 opens the launcher and hangs as usual. But switching to Proton-6.21-GE-2 shows a 'Unable to find a version of the runtime to run this application'. After that it attempts to install .NET 4.5, which after extracting some files, hangs forever during download and installation.

@N4tus
Copy link

N4tus commented Mar 31, 2022

switching back to proton 6.3-8 (after also installing win7) and then installing dotnet48 again, it tries to install it 2 times. the first one is a repair (which succeed) and the second is a install which also succeed, and also properly finishes. Switching back to Proton-6.21-GE-2 the launcher starts for the first time...... however the launcher cannot connect to steam (i have connected my account to steam on a windows installation):

System.Exception: SteamApi_Init returned false. Steam isn't running, couldn't find Steam, AppId is ureleased, Don't own AppId.
   at Steamworks.SteamClient.Init(UInt32 appid, Boolean asyncCallbacks)
   at XIVLauncher.Common.Game.Launcher.<Login>d__12.MoveNext() in D:\a\FFXIVQuickLauncher\FFXIVQuickLauncher\src\XIVLauncher.Common\Game\Launcher.cs:line 106

Restarting my pc fixed this issue magically and a new fresh install of the game is being downloaded. As launch option i use XL_WINEONLINUX=true DSSENH=n %command%. On protondb there are some suggestions to use XL_WINEONLINUX=true PROTON_USE_WINED3D=1 DSSENH=n %command%, however with the additional PROTON_USE_WINDD3D=1 option my fps are around 1.

@licentiapoetica
Copy link

I tried to follow all your steps and comments but I am not able to get it working, thanks for all your effort though, Square Enix wont see any more money from me.

@jrafaelpcruz
Copy link

Thanks for this guide/script! ❤️ Not only I can still play the game on Linux (Pop Os 21.10) but I've learned a lot about wine/proton and the os itself.

@MasterCATZ
Copy link

MasterCATZ commented Apr 11, 2022

ffdemo

using GE-Proton7-14 I keep getting this , I have wiped /home/user/.steam/steam/steamapps/compatdata/312060/pfx
a few times now and redone
WINEPREFIX=/home/user/.steam/steam/steamapps/compatdata/312060/pfx winetricks --force vcrun2019 dotnet48

312060 should be the demo version

using XL_WINEONLINUX=true DSSENH=n %command%

and put the script inside /home/user/.steam/steam/compatibilitytools.d/GE-Proton7-14/protonfixes/gamefixes/312060.py

using wine-staging 7.0-rc1

I was really looking forward to playing this over easter break

@Yowlen
Copy link

Yowlen commented Apr 11, 2022

@MasterCATZ As was stated in the script's readme, newer versions of Proton/Wine have broken the handling of permissions. Use the versions of Proton recommended in the instructions to bypass this issue.

@MasterCATZ
Copy link

MasterCATZ commented Apr 11, 2022

ok will try that did not notice anything about a regression bug for the need of an old version

WINEPREFIX=/home/aio/.steam/steam/steamapps/compatdata/312060/pfx WINESERVER=/home/aio/.steam/steam/compatibilitytools.d/Proton-6.21-GE-2/files/bin/wineserver WINE=/home/aio/.steam/steam/compatibilitytools.d/Proton-6.21-GE-2/files/bin/wine64 /home/aio/.steam/steam/compatibilitytools.d/Proton-6.21-GE-2/files/bin/wine64 winetricks dotnet48 vcrun2019

now game just exits

FileNotFoundError: [Errno 2] No such file or directory: '/ZFS3WAY/SteamLibrary/steamapps/compatdata/312060/tracked_files'

path is correct the steam folder is symlinked to another location

https://pastebin.com/72K7X28F

@MasterCATZ
Copy link

I used this and it worked first go

https://github.com/Moosatronic/LinuxFFXIVProtonFix

@aizakow
Copy link

aizakow commented Apr 15, 2022

This worked perfectly for me, in terms of getting XIVLauncher up and running. Is there any way to get this working with sd cards? I tried using the STEAM_COMPAT_MOUNTS=/path/to/sdcard %command% launch options in steam, which has worked for me to allow other wrapped windows applications to see the sd card. When I use that, XIVLauncher does see the sd card as the D: drive, but ignores my selection and just tries to install the game to internal storage anyway. I have the game installed on to the SD card via steam as well.

Unfortunately, I have the 64gb model, so until this fix can work with an sd card, I am out of luck

@Moosatronic
Copy link

Moosatronic commented Apr 15, 2022 via email

@aizakow
Copy link

aizakow commented Apr 16, 2022

Good thought, unfortunately navigating to the SD card via the Linux path behaves exactly the same, with or without that launch argument

@aizakow
Copy link

aizakow commented Apr 16, 2022

I'm a bit of a Linux idiot but I think whatever fix would have to be implemented in the python script itself so that the SD card is established as a valid path at setup time

@TiffanyNeat
Copy link

TiffanyNeat commented Apr 16, 2022

Yeah, I would totes need this myself haha as my base Steam Deck is 64GB, and with Endwalker present it now just barely exceeds 64GB on it's own within the prefix. A way to reliably install it (/work in general) on an SD Card would be great. I have my configs for controller ready and everything lol

@Centzilius
Copy link
Author

Have you checked the XIVLauncher settings for the patch download path and the game path that they are pointing to your micro sd?

@aizakow
Copy link

aizakow commented Apr 16, 2022

Yeah, that's what is a bit odd. In the initial setup I navigate to my sd card directory where the game is installed, and it lets me proceed. If I go into the settings, it shows my SD card directory. However, when I click run integrity check, it claims the game is not installed there, even though it can see the boot and data folders. Again, it lets me proceed even though it claims the directory doesn't have the game there. Then, if I start the patch process, it just ignores all of this and starts installing to the prefix c drive anyway

@aizakow
Copy link

aizakow commented Apr 19, 2022

I figured out how to get this running on Steam Deck off an SD card. It adds a couple extra steps, but it's not too bad from a setup perspective, other than one big caveat, which I'll get into below.

I wrote a guide, will post here:

Complete this process, making sure that you initially install FFXIV to the SD card, up through the part where you get the error message and click “No” to close the window. We’re going to add a couple steps before you start the custom launcher for the first time. You need to be in desktop mode for this.

The issue we’re fixing is that for whatever reason, XIVLauncher will ignore any attempts to make it use the SD card for the game directory, and install to the prefix C: drive that SteamOS creates for it. What we’re going to do is create symlinks (basically, tunnels that redirect from one directory to another) from the install directories to the SD card as a workaround.

Link the game folders

  1. Navigate to the pfx for FFXIV. Same as above, /home/.steam/steam/steamapps/compatdata/pfx/39210/
    a. Once you’re there, you are in a recognizable windows C drive. Navigate to C:\Program Files (x86)
    b. Create a new folder, called “SquareEnix.” Navigate into that folder
  2. Open a new Dolphin window. Navigate to your SD card, and find the steamapps/common/ folder. If you have installed the game, there should be a folder called “Final Fantasy XIV Online”
  3. Drag the FFXIV Online folder to the SquareEnix folder you created. A small menu should appear, with options to move, copy, or create a link. Click the third option, create link.

Link the installer cache folders

  1. In the SquareEnix folder, go up one level to Program Files (x86).
  2. In your SD card, navigate up to your root directory. Create a new folder, and call it “cache”
  3. Drag the cache folder from your SD card to the Program Files (x86) folder, and create a link again

Set up XIVLauncher

  1. Launch FFXIV via steam. Thanks to this script, XIVLauncher will start.
  2. In the initial setup wizard, you will be asked for the game directory. By default, it should be C:\Program Files (x86)\SquareEnix\Final Fantasy XIV – A Realm Reborn. Delete the last bit, changing a “ - Realm Reborn” to “Online”. When you’re done the path should be C:\Program Files (x86)\SquareEnix\Final Fantasy XIV Online.
  3. Check the box for a Steam account
  4. Click next through the rest of setup.
  5. Do not login. Instead, click the Gear icon. In the settings screen, find the tab labeled “patches”
  6. On that screen, there will be a text field to specify a special folder where XIVLauncher will download temporary patch files. Input C:\Program Files (x86)\cache
  7. Optionally, uncheck the box for asking you before downloading updates. This way it will just download updates if there are any rather than giving you a pointless dialog box to confirm.

That’s it! Now you can login and the download will begin. Here’s the big catch: this process is extremely slow. We’re talking on the order of 8 hours, even on my gigabit fiber. XIVLauncher works by downloading multiple patch files in parallel to one another and applying the patches while others are still downloading, which is faster than the official launcher under normal circumstances, but which seems to absolutely murder SD cards. It also will look like it’s frozen for stretches at a time, because the patcher is bottlenecked by the SD card moving files in the background, so downloads have to wait. If you have the game already installed and updated on another machine, I would strongly recommend finding a way to copy those files over rather than do this process. Just copy the files to the FFXIV directory on your SD card as you would any other game, and the next time you start the game XIVLauncher should see that you’re up to date and just go.

If you have a 256gb or 512gb model but want to run the game off the SD card anyway, I suspect that foregoing the second step of creating a cache folder and linking it would yield faster results. The process would temporarily use up space equivalent to the size of FFXIV, but it would be freed up after it was done.

@TiffanyNeat
Copy link

TiffanyNeat commented Apr 19, 2022

You are a god. Thank you sfm.
So, if i were to have FFXIV installed on my Arch (btw) Linux computer, using this whole script and stuff, can I just copy over the installed folder inside SquareEnix to the SD card and it'll detect it as the real deal, even if it's not entirely up to date? as long as I rename it from A Realm Reborn to just Online? Like, will it install the latest patches to it like it's some new stuff it just installed itself after having detected it in the folder it'd normally be in this way?

EDIT: Also, do i have to add the NoSpaceRequirements=true thing to my launch arguments?

@TiffanyNeat
Copy link

I tried it with the prefix backup I had on me already, and on my Linux pc it works transferring the folder over. So, I need to just create the links onto the Steam Deck? Very cool. Be looking forward to this on my Deck.

@bonesmoses
Copy link

This doesn't appear to work anymore. Either something in Steam updated, or there is some other issue, but now it doesn't look like Steam is even using the protonfixes/gamefixes/39210.py script anymore. Like, you can fill it with complete gibberish, and it will always launch the normal game launcher now.

@Centzilius
Copy link
Author

@bonesmoses Have you selected the correct compatibilitytool for ffxiv?

@bonesmoses
Copy link

Yes. In fact, I never changed it. It's still using, and has always used Proton-6.21-GE-2. Just to make sure, I blew up the existing prefix and started from scratch by using 6.3.8, letting it build a new prefix, switching to 6.21-GE-2 and adding the new launch command, and now it won't even install FFXIVLauncher at all anymore, it just goes straight to the "new" broken launcher.

I figured it was related to either patch 6.1 or some Steam update, since it worked last week and I didn't change anything.

@bonesmoses
Copy link

Alright, I can't explain this since I made sure everything running under 'steam' or 'Steam' via ps auwx was killed, but rebooting magically fixed this. I retract, but if someone else notices this issue, rebooting may fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment