Total War: SHOGUN 2
Недостаточно оценок
Fixing DX11 and crashes under Linux
От Denolven
This guide helps you to make Shogun 2 run under Linux, with DX11, and whithout post battle crashes. Plus the game will run significantly smoother AND prettier.
4
   
Наградить
В избранное
В избранном
Удалить
Intro
Under Linux (I'm using Manjaro) there seems to be a few issues that make the game more or less unplayable. The game can only be started in DX9 mode, and it crashes after battles (autoresolve works). From what I've seen, these issues are widespread and affect pretty much everyone who uses Linux of some variation.

I fixed these issues, and I'll describe how. I did it twice, albeit not knowing exactly why those steps worked, because some seemingly random "computer voodoo magic" is involved. Don't worry though, you don't need any special technical skills to do it. But you DO need basic knowledge of how to install a program on your operating system, how to navigate the file system and how to open files in a text editor.

Feel free to discuss the content here https://steamcommunity.com/app/34330/discussions/0/3712685279008395434/
and consider sharing the knowledge, if you find errors or if you know things that may help people (including me) to get a better understanding of Proton and Wine.
Summary
We will make the game run with DX11. That will solve the post battle crashing. The game will also run significantly smoother AND look better under DX11. To achieve that, we need to do some compatibility configuration. You should bring patience and time, it's a bit fiddly.
Expected results
Game will not start in DX11 at all -> game will start with DX11, but only show a black screen and won't load the game intro -> game will load normally and everything should work like it's supposed to.
Required preparations
  1. The game must be set to run in compatibility mode (Proton). You can check that by right-clicking the game in your steam library, then properties -> compatibility. Make sure that the compatibility mode (Proton) is turned ON. This might cause the game to re-download.
  2. Start Shogun 2 with dx9 and check whether the game saves your graphics settings across the restart of the game. If it doesn't, that means your operating system is preventing the game from modifying its own setting files. You can fix that by either changing the corresponding file restrictions (only do that if you know what it means), or by telling steam to put the steam library to a place where it is allowed to change the files. The easiest way to do that is by moving your steam library to your home folder via steam settings: Steam -> Settings -> Download (click the button "steam library folder" to change how and where Steam puts your steam library).
  3. You will need to change some compatibility settings that are not accessible via Steam itself. To be able to do that, you need to install the tool Protontricks. It allows you to change Proton/Wine settings for specific Steam games (Proton is Steam's compatibility mode, Wine is a linux program that emulates Windows - Proton is using Wine to make the game run).
The procedure
Note: Protontricks will edit steam files, so make sure that steam is not running before you change settings via Protontricks (access this guide via web browser, or copy it to a file). Not doing so won't break anything, but depending on when/how Steam loads its settings, the changes you make might not be in effect until you restarted Steam.

1. Enable Proton/Wine to use DX11 for Shogun 2
Open Protontricks and select Shogun 2 (it also shows the steam ID of the game). There might be a warning regarding 64/32 bit issues. If you are not sure what it means, just ignore it whenever it shows up - it's not relevant to you.
In the menu that opens, choose standard wineprefix. This enters the compatibility configuration for your Shogun 2 installation, which is called a Wine prefix.
Another menu will open that allows you to install Windows DLLs, start some programs, open a folder etc. This is your main menu for the whole compatibility configuration. From here, you will do all the settings changes, so I'll call it the "base menu" from now on.

First, install Windows DLLs. The ones you need are d3dcompiler_(version number) and d3dx11_(version number). Install the latest (= highest number) version of each.
Note: the different versions are involved in some of the voodoo I don't understand. More on that later.
Click OK to apply the changes and go back to the base menu.

2. Verify your changes
Open the log file: go to the base menu and choose to browse the folder. That will open a file browser in the correct subfolder of your Wine settings. The file we are looking for is winetricks.log.
If you don't find that, you can access the file in your file system (you need to know the steam library installation folder and the game ID):
.../SteamLibrary/steamapps/compatdata/"yourGameID"/pfx/winetricks.log
where "yourGameID" must be replaced with whatever ID Steam has given your Shogun 2 installation.

The file should contain two entries, corresponding to the two DLL files you have installed. In my case it shows:
d3dx11_43 d3dcompiler_47

3. Check the game
This is all that SHOULD be needed. But for unknown reasons it's not, at least not for me. Close Protontricks and start Shogun 2 in dx11 to see if it works. If it does, the game should run without post battle crashes now and you are done - congratulations!
If it doesn't work, go back to the base menu and continue with the following steps.

4. Install a fix for the (buggy?) DLLs
This is where the voodoo part starts. From now on, nothing is 100% certain, but I know the solution is in here, because I was able to reproduce it.
According to reddit some people manage to get the game running with older versions of the DLLs, namely d3dx11_42 and d3dcompiler_43. I installed those by using "winecfg" (you can start it from the protontricks base menu), but the game still didn't run. So after fiddling around for a while, I found out that installing those two via protontricks, just the way I described in step 1, lead to a warning message that told me there are known issues with these versions. What it doesn't tell you however, is that protontricks automatically installs a workaround, which winecfg doesn't install. And that seems to be crucial.

So, long story short, install d3dx11_42 and d3dcompiler_43 in addition to the latest corresponding versions, via Protontricks as described in step 1. When you have done that, your log file should look like this:
d3dx11_43 d3dcompiler_47 w_workaround_wine_bug-24013 d3dcompiler_43 d3dx11_42

Note how the workaround has been installed. After that, go back to the base menu and see if the game runs (probably won't).

5. Fix redundancies and setup a backup plan
You now have multiple versions of dx11. I'm not sure if that's a problem or not. I tried different setups, and the only thing that worked for me is using the latest versions, plus the workaround that only gets installed secretly when you install the older versions via Protontricks.
Protontricks doesn't let you remove DLLs, so you need to use winecfg to do it: go to the protontricks base menu and start winecfg from there. A settings window will open, containing several tabs - This is Wine's configuration window (for Shogun 2, I think). Go to the "libraries" tab and remove the older versions. Also, edit the two libraries (in my case d3dx11_43 and d3dcompiler_47) to be used in "native, then builtin" mode. I assume that means Wine will try to use the native Windows files first, and if these don't work, will try custom made Wine versions of these files instead. But honestly I know nothing about Wine, so it's just a wild guess.

Ok, we have installed the latest dx11 files, an older workaround that somehow seems to be needed, and we have set up Wine to use its own files if the native ones don't work.
As far as I remember, the log file should still look the same as in step 4:
d3dx11_43 d3dcompiler_47 w_workaround_wine_bug-24013 d3dcompiler_43 d3dx11_42
Check whether the game runs now (probably still won't).

6. Tell Proton to tell Wine to specifically emulate Windows 7, and to use Vulkan for rendering.
In the Protontricks base menu, select "change Wine settings". A list of settings will open, where you enable the settings "renderer=vulkan" and "win7".
Check the log file, it should look like this:
d3dx11_43 d3dcompiler_47 w_workaround_wine_bug-24013 d3dcompiler_43 d3dx11_42 win7 renderer=vulkan
Note: If you go into protontricks wine-setting-list again, the two settings might show up as disabled. That's probably a protontricks bug in the UI. If the log file shows the entries, then protontricks has changed the settings (I think - don't know how to verify that).

Check whether the game runs now (probably still won't).

7. Check settings and try rebooting.
From the protontricks base menu, select "start winecfg" again, and in the wine configuration window that opens, see whether all the settings are like they should be:
a) libraries tab contains the two files d3dx11 and d3dcompiler in their latest version, and both are set to "native, builtin"
b) applications tab has an entry for default application setup which is set to Windows 7 (shown below the application list). It's probably better to create an application profile for Shogun 2 and then share it, but I haven't messed around with that and don't know how to do it.

Also check the winetricks.log (accessible from the protontricks base menu, select browse folder). It should have the following entries:
d3dx11_43 d3dcompiler_47 w_workaround_wine_bug-24013 d3dcompiler_43 d3dx11_42 win7 renderer=vulkan
The file logs the changes you applied via protontricks. So if you messed around with the settings a few times, it may show some of the entries multiple times, in chronological order I think, which makes sense, since it's just a log file, not a settings file.

After making sure the settings are correct, reboot Steam. If the game still doesn't run properly, reboot your system. Although it SHOULDN'T matter, it did for me.
More computer voodoo magic?
I'm 95% sure that these are the only settings I messed with. And as I said, I was able to produce a working Shogun 2 on two computers (both computers run Manjaro). However, just setting up the end result on the second machine (latest DLLs, Win7, Vulkan) did NOT work - apparently the secretly installed workaround for the older versions of the DLLs matters somehow. Or maybe it doesn't, and it was just a coincidence with the other settings, who knows. Also, at some point, rebooting was the only thing that magically improved game loading, which baffles me.

If the game still doesn't run properly after walking through the whole procedure described above, you can try messing around with the mentioned settings and try to figure out what exactly is required. I'm 100% sure that it's "only" a matter of configuring Wine and Proton properly. The game WILL work like it's supposed to, once you got the configuration right (which should have been done by the developer/publisher).
Also, I have no idea how to disable protontrick's wine settings because of the UI bug that always shows all settings as disabled. So I don't know how to switch single variables on/off to test properly which combination of Proton/Wine settings is the one that actually made the whole thing work.

If you find out any additional info that narrows down the procedure, please share the knowledge (you find the discussion here). And if it worked for you, enjoy the game :)
Комментариев: 6
wangjangle 6 апр. 2024 г. в 13:35 
Thanks, this worked. You saved me a huge headache.
웃 Ace Fish 5 апр. 2024 г. в 6:38 
It works ! Thanks a lot.
Kenny 31 авг. 2023 г. в 14:10 
Ok! An update. Got everything to work on the Steam Deck. To my surprise, I only had to go up to step 5. Before my fixes: starting the game in dx11 wouldn't launch the game, and in dx9, a battle ending will crash the game. However, I can now launch the game and complete battles in dx11!

Some things to note, for some reason, w_workaround_wine_bug never showed up in winetricks.log, so I'm assuming that never was actually installed on system. This leads me to believe that enabling d3dx11_43 and d3dcompiler_47 to be used in "native, then builtin" mode is what ultimately fixed it. Thanks for the guide! :SlyNinja:
Kenny 18 авг. 2023 г. в 20:32 
Exact same crashing problem on the steam deck, I will try this fix on it and see if it works.
🅾️rder💲 7 фев. 2023 г. в 4:29 
⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣤⡶⢶⣦⡀
⠀⠀⠀⣴⡿⠟⠷⠆⣠⠋⠀⠀⠀⢸⣿
⠀⠀⠀⣿⡄⠀⠀⠀⠈⠀⠀⠀⠀⣾⡿
⠀⠀⠀⠹⣿⣦⡀⠀⠀⠀⠀⢀⣾⣿
⠀⠀⠀⠀⠈⠻⣿⣷⣦⣀⣠⣾⡿ ㅤㅤ Rated :heart_me:
⠀⠀⠀⠀⠀⠀⠀⠉⠻⢿⡿⠟
Bilskirnir 21 янв. 2023 г. в 18:33 
Thanks for guide. Got Shogun 2 working on my Ubuntu machine with it.