Skip to content

Instantly share code, notes, and snippets.

@atom0s
Last active March 15, 2024 08:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save atom0s/e6ddbb94408baba43e6fed5bee18ea9c to your computer and use it in GitHub Desktop.
Save atom0s/e6ddbb94408baba43e6fed5bee18ea9c to your computer and use it in GitHub Desktop.
Running FFXI On Linux (Kubuntu with Flatpak/Lutris/Winetricks)

I recently setup a virtual machine to run FFXI on Linux to track down a potential Linux-specific bug with the help of Casey (wintersolstice8). Figured it may be useful to some to share the information on how to get things setup and running just in case others wish to setup a similar environment. (The game plays rock solid 60fps in my situation on a laptop through a VM, no proxies needed etc.)

Here's the setup information in how we got it running:

  • VMWare 17.5.1 - It is HIGHLY recommended that you upgrade/update to the latest VMWare version if you are on anything 17.x.x or below. There is a nasty bug with their input handling on Linux that can cause input to just completely stop working at random.
  • Kubuntu 23.10 (Desktop - AMD64) - New versions should work fine as well; other Linux flavours should also work provided they have access to the additional things that will be mentioned below.

1. Setting Up VMWare

The first steps will be to configure VMWare for the VM. This is pretty straight forward and some of this will be up to you how you wish to configure it based on your available resources. (I needed to run extra things such as development tools, remote debuggers and some other development related things so I opt'd to give my VM some extra wiggle room.) This is how I have my VM configured for this:

  • Processors - 1 processor, 4 cores (All virtualization options disabled.)
  • Memory - 16 GB
  • Hard Disk - 120 GB (The manner you have the drive created is up to you.)
  • Display
    • Enable Accelerate 3D graphics
    • Set Graphics Memory to 8 GB (or whatever is available/recommended on your device.)

The rest of the settings can remain the defaults. After the preconfig, simply install Kubuntu as normal from its ISO.

2. Initial Kubuntu Installation

Once the VM is setup and you are installing Kubuntu there is not much you will need to do. Configure the desired location for time/date information, setup your preferred language(s) for the OS, and all the normal general install stuff. When you are prompted for installing additional packages (ie. third-party things) skip those. When asked for LVM you can also skip that unless you know what you're doing and need it.

After the initial setup has completed, restart the VM and then open a terminal. To start with some pre-installation things it's always best to upgrade/update the package manager which you can do with:

sudo apt-get update
sudo apt-get upgrade

3. VMWare Tools (Using open-vm-tools) [Optional]

Next, if you wish to have the ability to easily share your clipboard and have drag-and-drop file access, you will need to install VMWare Tools. However, you should not use the included/bundled tools with VMWare itself. Instead, the Linux variant open-vm-tools is much more up to date for this kind of setup and is the better choice. However, there are some current issues with this that will need to be done to fix some issues with the service not starting properly due to changes to systemctl.

First, you can install the tools via:

sudo apt-get install open-vm-tools open-vm-tools-desktop

Once installed, reboot again. There is now a lovely 50/50 chance that the secondary service will fail to start and the tools wont work. (This is a known bug that is not currently fixed as of the time of me writing this.) You can manually temp fix this each time you reboot by starting this script:

/usr/bin/vmware-user-suid-wrapper

However, you can also fix it fully by following the information in this GitHub issue post here: vmware/open-vm-tools#568 (comment)

Once done with this, you should also reboot. At this point the tools should be working properly again.

4. Installing Additional Packages

Next, we need to install the means to run FFXI. For this, we will be using Flatpak (to install Wine etc.), Lutris, and Winetricks.

First, we'll install Lutris:

sudo apt-get install lutris

Then we'll install Flatpak and configure it with:

sudo apt-get install flatpak

flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
flatpak install flathub net.davidotek.pupgui2

Afterward, we need to run Lutris so that it and Flatpak can be aware of each other. You can do this simply by just running lutris from a terminal or opening it from the 'start' menu. Once it runs, just close it we only needed it to run once for now.

Next, we need to prepare Wine/Proton by using Flatpak. To do that, we'll start its UI via:

flatpak run net.davidotek.pupgui2

This will open the ProtonUp-Qt - Wine/Proton Installer dialog which we can use to now install Wine. In this window we will do the following:

  • Click Add Version
  • For Compatibility tool, select Wine-GE.
  • For Version, select 6.14-GE-2. (Note: See the info below about using this version and a new fix for Ashita v4.)
  • Click Install.

Once this completes the download and install, you will want to reboot again.

Note: There is a chance that the installer will get stuck at 99% during this step. I would suggest keeping an eye on the running processes within the VM to see if things have completely haulted/stopped to ensuer that is the case. If it has stuck at 99% and nothing is running that would suggest its still doing something you can still safely reboot at this point.

Regarding the use of an older Wine version 6.14-GE-2; there is a known bug with newer versions of Wine when running retail FFXI like this that causes a constant micro-stutter not related to the known gamepad issue that XI suffers from. This is instead an issue that is likely caused by something network related. The bug report for this issue can be found here: https://bugs.winehq.org/show_bug.cgi?id=51704

If you are using Ashita v4, I have released a new plugin to fix this bug called winefix. You can safely install any version of Wine that you want to and simply load this plugin while playing to fix the stutter issue that is caused by the above commit/issue.

You can find winefix on the Ashita Discord server. You can join and find it following these steps:

If you are playing on a private server, you should be able to use a newer version but the selected version given in these notes works fine for both.

5. Installing Ashita and Final Fantasy XI

I am not going to go into major depth here with this step. Instead, I will assume you plan to use my Sandbox plugin and Ashita v4. This will allow you to skip over any extra work to 'properly' install FFXI and wait for it to update. We will instead be copying over an existing install of FFXI that is already updated and working into the VM and making use of that.

Within our VM, we want to make a new folder in our home directory which will hold our install of both Ashita and FFXI. For this guide, I will be using the following paths for example:

  • Main Folder: /home/atom0s/ffxi/
    • Ashita: /home/atom0s/ffxi/ashita/
    • PlayOnline: /home/atom0s/ffxi/PlayOnlineViewer/
    • FFXI: /home/atom0s/ffxi/FINAL FANTASY XI/

Next, we can share this main folder to other systems on the network to make copying over the game faster and easier by enabling Samba. For this we will first need to install Samba via:

sudo apt-get install samba

You should then be able to right-click the /home/atom0s/ffxi/ folder in a explorer-style window (ie. using Dolphin) and choose Properties then select the Share tab. In this tab, we can set the share name to just ffxi and then set the Everyone access to Full Control. (You can setup specific permissions if you are more comfortable doing that instead. But make sure you have write access outside of the VM!)

Lastly for this section we need to copy over an existing working game install and either copy over or freshly clone Ashita v4. If you wish to start fresh with Ashita v4, you can clone the beta repo into the Ashita folder we mentioned above. Just make sure that once cloned/extracted, that the following path is valid: /home/atom0s/ffxi/ashita/ashita-cli.exe If not, then you need to move the files you copied/cloned into the root Ashita folder instead. Make sure there are no extra sub-folders!

For the PlayOnlineViewer and FINAL FANTASY XI folders, you will want to copy over your existing installation for FFXI into the proper respective folders. Using the remote share is much faster than trying to just drag-and-drop the folders into the VM. You can find the VMs ip address with ip addr in a terminal, then connect to it using that IP address. If prompted for a login, use the same login you made when creating the VM, or if you setup additional permissions, use the desired account you made with write access to the folders.

Once everything is copied over we can move onto configuring Lutris.

6. Configure Lutris

If you have Lutris already open from a previous step, you'll want to close and restart it to ensure it sees all the new changes recently made to the system.

The first step we will want to do here is make a new folder which will hold our Wine prefix. For this, I am using the following parent folder: ~/Games/ (You should create this folder to hold your planned prefixes before continuing to the next step, otherwise you may get an error when trying to create it.)

We will now want to make a new prefix inside of Lutris. To do this we will do the following:

  • Click on the big + symbol at the top-left corner of Lutris.
  • Select Add locally installed game from the next window.
  • Under the Game Info tab:
    • Set the Name to something you prefer, such as FFXI.
    • Set the Runner to Wine (Runs Windows games)
    • Leave the rest blank unless you wish to fill it out.
  • Under the Game Options tab:
    • Set the Executable path to: /home/atom0s/ffxi/ashita/ashita-cli.exe
    • Set the Arguments to: atom0s.ini (You can rename this to your desired config name instead!)
    • Set the Working Directory to: /home/atom0s/ffxi/ashita/
    • Set the Wine Prefix to: ~/Games/ffxi (You can change this if you wish, just make sure this is new/unique to any other prefix you have/want!)
    • Set the Prefix Architecture to Auto (default)
  • Under the Runner Options tab:
    • Set the Wine Version to the version we installed using Flatpak. (ie. lutris-ge-6.14-2-x86_64 (default))
    • For all other options under this tab, disable them. We do not need/want any of those other options enabled.
  • Under the System Options tab:
    • Leave everything default.

Once this is done, you can click Save at the top-right of the window. This will create the new Wine prefix and entry under the Wine section in the Lutris window. I would suggest restarting Lutris at this point just to ensure everything is saved and good to go.

7. Installing Wine Prefix Dependencies

The next step we need to perform is installing some additional dependencies into the newly created Wine prefix we just made. For this, you can follow the below instructions. Please note, this first section to get into the Winetricks menu will be reused multiple times each time we wish to install something new. We will reference to this as 'Open the Winetricks installation window..' going forward.

To 'Open the Winetricks installation window..', we will do the following:

  • Open Lutris.
  • Click on Wine on the left side bar.
  • Click once on your newly created Wine prefix in the right list. (ie. Mine is called FFXI)
  • On the bottom of the window, click the up arrow next to the wine glass icon and select Winetricks from the menu.
  • Select the Select the default wineprefix option and click OK.

Here we will now be presented the option to install additional components, fonts, change settings, or run additional tools. We need to install a few things first.

Install Fonts

First, we will need to install some fonts into the Wine prefix to ensure that Ashita will function properly. For this, we will:

  • 'Open the Winetricks installation window..'
  • Select Install a font and click OK.
  • Select the desired fonts you wish to install, I recommend installing at least the following fonts:
    • arial
    • consolas
    • corefonts
    • tahoma
    • times
    • verdana
  • You can select multiple fonts at once, then click OK.

Install Dependencies

Next, we need to install some dependencies that we need in order to run FFXI and Ashita v4. For this, we will:

  • 'Open the Winetricks installation window..'
  • Select Install a Windows DLL or component
  • Select the following options: (You can select multiple at once.)
    • directplay
    • directshow
    • dotnet472 (Only if you need it for other apps. Not required for Ashita v4 beta or FFXI atm.)
    • vsrun2022 (Visual C++ 2015-2022 libraries)
    • Any other optional compontents you may wish to use within this prefix for other apps/etc.
  • Click OK once all your needed/wanted things are selected to install them.

Note: There is a chance that this step can fail silently in the background. Sometimes it is better to run Lutris from the terminal so that you can see error output. If things do fail to install, try installing them one by one instead. This can take a while to install everything as well. You may want to monitor the installation using a process monitor to ensure things are still going before you decide to force cancel/terminate things or reboot!

Once everything is installed the Winetricks window should reappear.

Update Winetricks (If Needed)

This is potentially optional depending on if you run into issues. You may need to update Winetricks which can be done using the following in a terminal:

sudo winetricks --self-update

8. Updating The Direct3D Video Memory Size

The last step before we configure Ashita and can play is to configure Wine to be able to see/allocate more video RAM. By defualt, Wine will only see 1MB of VRAM in this current setup through a VM. Trying to launch FFXI now will simply crash out saying it ran out of video memory. To fix this, we simply need to patch the Wine registry within our Wine prefix to tell it there is more memory available.

This can be done one of two ways, either by using the Winetricks menu option to change settings, or to manually edit the Wine prefix registry.

Using Winetricks

To use Winetricks, we'll follow the same steps above when using it:

  • 'Open the Winetricks installation window..' for your Wine prefix.
  • Select Change settings.
  • Select videomemorysize=2048
  • Click OK.

Using Wine Registry

To use the Wine registry on your Wine prefix, we'll follow the below steps:

  • Open Lutris.
  • Click on Wine on the left side bar.
  • Click once on your newly created Wine prefix in the right list. (ie. Mine is called FFXI)
  • On the bottom of the window, click the up arrow next to the wine glass icon and select Wine registry from the menu.

This will open up a Registry Editor window, similar to what is on Windows. Within this window, we will want to do the following:

  • On the left-tree, select and expand HKEY_CURRENT_USER.
  • Expand Software
  • Expand Wine
  • Expand Direct3D
    • If this key does not exist in the tree, then right-click the Wine key we just expanded and select New -> Key and name it Direct3D
  • On the right-side of the window you will see the settings options/editor.
  • Depending on if the following settings exist, you will either want to create new entries, or edit the existing ones.
  • Create a new string value by right-clicking the empty area in the right side of the window and choose New -> String value
    • Name this value DirectDrawRenderer and leave its value empty.
  • Create a new string value by right-clicking the empty area in the right side of the window and choose New -> String value
    • Name this value VideoMemorySize and set its value to 2048.

9. Setup Ashita v4 For Lutris/Wine

The last step now is just to configure Ashita v4 to work with Lutris within our Wine prefix. In a file browser (ie. Dolphin) navigate to your Ashita folder which we placed in /home/atom0s/ffxi/ashita/. Inside of the Ashita folder, open the /config/boot/ folder. Either create a new configuration file by copying either the example retail or private server configuration based on where you plan to play, or edit an existing configuration if you copied over your install from another system.

Note: I wont be going into full detail on how to set Ashita v4 here. You can do that by following the docs here: https://docs.ashitaxi.com/installation/

Open the newly created/copied or existing configuration file you plan to use in a text editor. (In my case it is atom0s.ini which we set as the Arguments when setting up the Lutris profile.) Inside of the text editor, we need to edit a few things to allow the configuration to work:

  • Under the [ashita.boot] section, update the file path to:

    • For private servers: Z:\\home\\atom0s\\ffxi\\ashita\\bootloader\\pol.exe
    • For retail: Z:\\home\\atom0s\\ffxi\\PlayOnlineViewer\\pol.exe
  • Under the [ashita.polplugins] section, ensure that Sandbox is enabled:

    • sandbox = 1
  • Under the [sandbox.paths] section, ensure the paths are setup properly:

    • pol = Z:\\home\\atom0s\\ffxi\\PlayOnlineViewer
    • ffxi = Z:\\home\\atom0s\\ffxi\\FINAL FANTASY XI

The other configurations will be up to you to handle and decide on.

10. Ready To Play!

At this point, you should be all setup and ready to run Final Fantasy XI! I would suggest completely closing everything down and rebooting first just to make sure everything is good to go. Once rebooted, then start Lutris again, click on Wine from the left menu, then select your Wine prefix in the list on the right. You should be able to just double-click and launch the game now.

Note: It is recommended that, until you are completely up and running and not running into issues, you should run Lutris from the terminal and check for any kind of errors that may be dumping out. You may need to increase the error/debug output within your Wine prefix configuration to see more useful error information!

If you need to install additional things that interact with FFXI that you just setup and installed, then you should do so into the same Wine prefix otherwise you will not be able to see the running process from another prefix!

@atom0s
Copy link
Author

atom0s commented Mar 15, 2024

Ashita v4 Plugin - winefix

Please Note: This plugin is only useful to Linux players that are using Wine version 6.16 or newer; or using a fork such as Proton!

This is a simple bugfix plugin that is intended for Linux players that play retail FFXI through Wine, version 6.16 or newer. This includes forks such as Proton which also have this bug. When Wine 6.16 was released, it included a commit that implemented a set of API poorly through the Wine NSI driver. The API in question is to query UDP connection statistics of the system. However, the current NSI implementation on Wine has a lot of hackish nonsense and is not well-written to be used in production. PlayOnline makes use of the given API calls that were added in the commit every second to monitor the systems UDP connection information among other things. Due to the manner in which the NSI driver is written, players will experience stuttering/hitching (similar to the controller stutter) each time this API is called. This plugin corrects this behavior by blocking the API call and just returning normalized data instead. This keeps PlayOnline happy and does not lose/drop the connection. (This plugin is not needed or intended for Windows users!)

You can safely install any version of Wine that you want to and simply load this plugin while playing to fix the stutter issue.
You can find winefix on the Ashita Discord server which you can join via:

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