ValveSoftware / Proton

Compatibility tool for Steam Play based on Wine and additional components
Other
24.28k stars 1.06k forks source link

Arma: Cold War Assault (bad serial number in setup) (65790) #767

Open Zelete opened 6 years ago

Zelete commented 6 years ago

Your system information

Please describe your issue in as much detail as possible:

Arma: Cold War Assault doesn't detect the game's CD-key. Steam starts the game, I get a split second of the Bohemia Interactive logo to show up and lastly a popup windows is shown with "Bad serial number is given in Setup".

crop

Steps for reproducing this issue:

  1. Just start the game in Steam with Steam Play in Linux.

More information:

I tried validating game files, but the error remains.

After some research it seems the game stores the CD-key in the registry: HKEY_LOCAL_MACHINE\SOFTWARE\Codemasters, but there is no way that I know to enter the key somewhere.

1heghost commented 6 years ago

Um, we have a native port for this game: https://store.steampowered.com/app/594550/

Zelete commented 6 years ago

@1heghost You are correct, thank you for linking the store page.

I did not know about that since it is not in my library, however:

Zelete commented 6 years ago

I fixed this by doing the following:

  1. Edit /mnt/sdb1/Steam Library/steamapps/compatdata/65790/pfx/system.reg
  2. In your favorite text editor type ctrl-f to find "Bohemia"
  3. You should see a line like this:

[Software\Wow6432Node\bohemia interactive studio\coldwarassault] 1535396194

time=1d43e37aceb57e2

"main"="Z:\mnt\sdb1\Steam Library\steamapps\common\ARMA Cold War Assault"

  1. Edit the line to include your CD-key:

[Software\Wow6432Node\bohemia interactive studio\coldwarassault] 1535396194

time=1d43e37aceb57e2

"KEY"=hex:62,aa,38,3f,bc,fd,30,76,5e,60,f8,ab,cd,ef,gh "main"="Z:\mnt\sdb1\Steam Library\steamapps\common\ARMA Cold War Assault"

Note: The CD-key is in binary, I also changed most of the CD-key values here so people cannot use it.

veikk0 commented 6 years ago

Possibly related: https://github.com/ValveSoftware/steam-for-linux/issues/212

maciejmrozinski commented 5 years ago

@Zelete Can You describe exactly how did You convert normal CD-key to this binary one? I tried many possible ways without success.

Zelete commented 5 years ago

@maciejmrozinski Sorry for the delayed answer.

My guess I ran it through this converter: https://www.binaryhexconverter.com/hex-to-decimal-converter

I searched my history but since its a while ago. Also be sure to use the same formatting as above.

maciejmrozinski commented 5 years ago

I'm sorry, but I really don't understand how to do this.

I'm copying key presented by Steam as ARMA: Cold War Crisis game key (in Steam app). Lets say it looks like this: AB5R-P3MRA-2WXCQ-I7ENC-URWMS (key is not real, but the format and characters are used by my key - uppercase letters, numbers, 4-5-5-5-5 format). I tried to decode letters to ASCII codes (uppercase, lowercase, stripping '-' sign, leave it). Then I tried to convert this codes to hex form. It's all not working. I have correct registry key value, because I was able to install this game on Windows machine and copy it, but I want to know if it's so simple transformation or not. I'm closer to conclusion that serial cannot be simply converted to registry key, but game (or Steam) is doing some magic work on it, before entering to registry.

Correct me if I'm wrong.

bazarassa commented 5 years ago

@maciejmrozinski you can install the original OFP:CWC game in wine and get the hexed CD-KEY at [hkey_local_machine/software/codemasters/operation flashpoint/KEY] value. Use "Export" feature in wine regedit, and try to insert it into steamapp registry.

MKZY commented 5 years ago

OK, so I managed to find how to convert the CD-key into a Hex-Key to put in the registry as described by another comment above. User Gator96100 posted on https://www.unknowncheats.me/forum/arma-2-a/99874-release-multithreaded-key-checker.html a program with source code that could convert a CD-key into Hex for the ARMA series.

I did not manage to make the program run on my Ubuntu under Wine, but it worked fine on a Windows session and gave me the right key (same as an installation gave via Windows Steam, confirmed this by pasting the key in my Ubuntu ARMA Cold War Assault registry and managed to start and play without any issues).

The program is written in C#, which I have no experience in. If I can, I'll try and convert the script into something useful that can be run in the terminal on a Linux system, but I am a poor programmer. I will post the relevant part of the C# code below so others may help.

using System; using System.Linq; using System.Security.Cryptography; using System.Text; using System.Windows.Forms;

public class KeyConverter {
    private static readonly String szTemplate = "0123456789ABCDEFGHJKLMNPRSTVWXYZ";

    public String getHexKey(String arma2key) {
        var upperkey = arma2key.Trim().ToUpper().Replace('O', '0').Replace('I', '1').Replace("-", "");
        var bResult = new Byte[15];
        if (upperkey.Length != 24)
            throw new Exception("Invalid key length");

        for (var i = 0; i < 3; ++i) {
            UInt64 qwResult = 0;
            for (var j = 0; j < 8; ++j) {
                var cChar = upperkey[i * 8 + j];
                var szPos = szTemplate.IndexOf(cChar);
                qwResult |= (UInt64)szPos << (j * 5);
            }
            for (var j = 0; j < 5; ++j) {
                bResult[i * 5 + 5 - 1 - j] = (Byte)(qwResult & 0xFF);
                qwResult >>= 8;
            }
        }

        return BitConverter.ToString(bResult); ;
    }
MKZY commented 5 years ago

@maciejmrozinski Forgot to mention you since you where asking about the magic work being done on the hex

liskin commented 5 years ago

Here's a shorter version of the "magic" that doesn't require C#:

echo 1234-56789-ABCDE-FGHIJ-KLMNO | perl -ne 's/-//g; tr/IO/10/; for $i (0..2) { $res = 0; for $j (0..7) { $res += index("0123456789ABCDEFGHJKLMNPRSTVWXYZ", substr($_, $i * 8 + $j, 1)) << (5 * $j); }; printf("%010x", $res); }; print("\n");'

I successfully used this to convert my key and start the Windows/Proton version of Arma.