borisbabic / hearthstone_hdt_linux

Contains instructions and code to get hearthstone with hdt running on linux
Apache License 2.0
40 stars 9 forks source link

Hearthstone + HDT steps in wine

These instructions assume a clean wine prefix, and will use ~/.wine.hearthstone as the prefix in example commands. If you already have such a prefix please either clean it or use a different one.

Prerequisites

Any distro

Installation

0. Grab HDT oauth from windows

NOTE: If you are running a sufficiently new version of wine (lowest tested was 5.0 staging) you don't need a working windows install and can just login to hsreplay normally without copying the auth over from windows.

If you aren't going to login to hsreplay in HDT you can skip this.

HDT works on linux, however you can't login to hsreplay. However you can grab the login info from a working windows install and then use that on linux.

First ensure that HDT is not running on windows. Next download the hdte.exe file from this repository to your Downloads folder on windows. Then open the command prompt and run the following:

Downloads\hdte.exe decrypt %AppData%\HearthstoneDeckTracker\hsreplay_oauth Downloads\hsreplay_oauth.decrypted

You will have to transfer that hsreplay_oauth.decrypted from Downloads to Linux (I'll assume it's in ~/Downloads on linux later on when installing HDT)

1. Setup the prefix

WINEPREFIX=~/.wine.hearthstone WINEARCH=win32 wine wineboot # Create 32 bit wine prefix
WINEPREFIX=~/.wine.hearthstone winetricks dotnet472 # Install .NET 4.7.2
WINEPREFIX=~/.wine.hearthstone winetricks corefonts # Install fonts for Battle.net, you may not be able to login without this
WINEPREFIX=~/.wine.hearthstone winetricks nocrashdialog # Without this popup warnings appear after running Battle.net

There are also two registry keys that need to be edited. run WINEPREFIX=~/.wine.hearthstone regedit

You can automatically change these keys using the following script:

{ cat | sed 's/$/\r/' | iconv -f ascii -t UTF-16 > /tmp/hdt.reg; } <<EOF
Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Wine\X11 Driver]
"UseTakeFocus"="N"

[HKEY_CURRENT_USER\Software\Microsoft\Avalon.Graphics]
"DisableHWAcceleration"=dword:00000001
EOF

WINEPREFIX=~/.wine.hearthstone regedit /tmp/hdt.reg

2. Install HDT

Download HDT from https://hsdecktracker.net/download/ then run

WINEPREFIX=~/.wine.hearthstone wine ~/Downloads/HDT-Installer.exe # or wherever you downloaded it to

NOTE: the following is not necessary for newer versions of wine, you can just login normally. The lowest tested where it wasn't necessary was 5.0 staging

If you want to be logged in to hsreplay then download the hdte.exe file from this repository to ~/Downloads alongside the hsreplay_oauth.decrypted file from above, close HDT if it is open, and run the following

WINEPREFIX=~/.wine.hearthstone wine ~/Downloads/hdte.exe encrypt ~/Downloads/hsreplay_oauth.decrypted ~/.wine.hearthstone/drive_c/users/$USER/Application Data/HearthstoneDeckTracker/hsreplay_oauth # change ~/.wine.hearthstone to your wine prefix if you've changed it 

3. Install Hearthstone

Download hearthstone https://eu.battle.net/account/download

Run the following to install it:

WINEPREFIX=~/.wine.hearthstone wine ~/Downloads/Hearthstone-Setup.exe 

When you get to the login screen, go to settings>advanced and uncheck "Use browser hardware acceleration when available" (without this you may get a black screen instead of the launcher)

Before running Hearthstone select Hearthstone in Battle.net, go to Options->Game Settings, enable Additional command line arguments, and add the argument -force-d3d9 (without this you may get a black screen on launch).

Troubleshooting

If the below doesn't help you can create an issue or ask for help in my discord

HDT runs but the overlay doesn't appear in game

Try running the game in windowed mode. In at least KDE the overlay doesn't show above the game in fullscreen. If that doesn't work then check the overlay options in the main HDT window, in particular the "Hide in menu"" and "Hide (completely)". Try toggling the "Hide (completely)" option.

The overlay is a bit weird window wise, so it may be possible your window manager doesn't handle it the best. Please try a different window manager/desktop environment before reporting an issue if this is your problem. The following is tested as working:

awsomewm4 rules

Use the following rule to ensure the overlay is always on top:

awful.rules.rules = {
  -- ...
  -- Always show on top
  { rule_any = {
      name = {
        "HearthstoneOverlay",
      },
    },
    properties = {
      ontop = true,
    }
  },
}

Performance issues

There is a known performance drop with the overlay. Some possible workarounds are to disable some stuff, like flavor tooltips and card animations. It's also a good idea to add a shortcut to toggle the overlay for more intensive turns Options -> check Advanced Options -> Hotkeys -> Toggle overlay

If you test this in something else please add to the above list

Development

Compile using mono: mcs hdte.cs -reference:System.Security