Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Linux Bug]: Unable to launch Red Alert 2 #447

Open
Revival8697 opened this issue Feb 1, 2025 · 29 comments
Open

[Linux Bug]: Unable to launch Red Alert 2 #447

Revival8697 opened this issue Feb 1, 2025 · 29 comments
Labels
bug Something isn't working Linux Contains Linux issues

Comments

@Revival8697
Copy link

Revival8697 commented Feb 1, 2025

What happened? / Steps to reproduce

Using Steam install. Run with Wine, not Steam's Proton.
Run the client, go to Campaigns, select Red Alert 2.

Anyway, I debugged it. The problem is this commit: bd7f17e.

  • ra2.exe doesn't exist. It should be Ra2.exe since Linux is case sensitive.
  • Ra2.exe doesn't work either. game.exe works.
  • ra2mdlauncher.exe works, since it runs gamemd.exe so that part of the commit is fine.

What should have happened?

Red Alert 2 launches.

What main distro of Linux are you using?

Arch

Linux Distro Version

CachyOS, rolling release.

What version of the game are you running?

8.67.1 (I know this is not the latest version, the updater doesn't work, it doesn't matter as nothing has changed since that commit).

What branch of the game are you using?

Live

@Revival8697 Revival8697 added bug Something isn't working Linux Contains Linux issues labels Feb 1, 2025
@SadPencil
Copy link
Member

SadPencil commented Feb 3, 2025

I don't think we should simply rename the launcher file name. There are multiple legit RA2 installations, and since we don't know whether they share the same name, we can't just modify the launcher name based on a specific installation. I have a copy of these 4 installations on a computer which I can only get its access after half a month: Steam, Origin, retail CD, and First Decade CD. I'll investigate whether all of these 4 legit RA2 installation has the same file name in a case-sensitive way then.

@Revival8697
Copy link
Author

Revival8697 commented Feb 3, 2025

I don't think we should simply rename the launcher file name. There are multiple legit RA2 installations, and since we don't know whether they share the same name, we can't just modify the launcher name based on a specific installation. I have a copy of these 4 installations on a computer which I can only get its access after half a month: Steam, Origin, retail CD, and First Decade CD. I'll investigate whether all of these 4 legit RA2 installation has the same file name in a case-sensitive way then.

Yeah, I saw how you did it with https://github.com/SadPencil/ra2md-launcher.

I'm not a fan of that, actually. I would prefer if it were done via a plain text script. I tried writing a batch script, but certutil is non-functional in Wine, so I can't get the hash values.

Other than that, https://github.com/SadPencil/ra2md-launcher/blob/d84c6815934e376b14f38c27235b843faf42c895/ra2mdlauncher.lpr#L102 is wrong. My Steam install has that file.

Also, https://github.com/SadPencil/ra2md-launcher/blob/d84c6815934e376b14f38c27235b843faf42c895/ra2mdlauncher.lpr#L41 is unnecessary. I don't understand why you have to account for people modifying the file if you were checking with hashes in the first place.

@SadPencil
Copy link
Member

SadPencil commented Feb 3, 2025

Other than that, https://github.com/SadPencil/ra2md-launcher/blob/d84c6815934e376b14f38c27235b843faf42c895/ra2mdlauncher.lpr#L102 is wrong. My Steam install has that file.

isSteam is just a variable name. It actually means to launch gamemd.exe. So suppose the ra2md.exe file is missing (one can indeed make such a pirate copy), the launcher has no choice but to launch gamemd.exe file.

Also, https://github.com/SadPencil/ra2md-launcher/blob/d84c6815934e376b14f38c27235b843faf42c895/ra2mdlauncher.lpr#L41 is unnecessary. I don't understand why you have to account for people modifying the file if you were checking with hashes in the first place.

Because apart from the 4 legit gamemd.exe file, there are many pirate gamemd.exe file that have been applied the no-CD patch but still needs a user launch the game from ra2md.exe file (at that time, there hasn't been such an HD icon, so I can detect them from file size). There are too many and I can't collect all the hash values. I don't have a robust way to determine such a file. It's hard to robustly tell whether the gamemd.exe file is from Steam or not. Therefore, I have to make an assumption, if one modified the icon of gamemd.exe file, he/she must want to make a perfect gamemd file as best as it can be, so the detection codes be removed as well.

@Revival8697
Copy link
Author

Revival8697 commented Feb 3, 2025

So suppose the ra2md.exe file is missing (one can indeed make such a pirate copy), the launcher has no choice but to launch gamemd.exe file.

If it is pirated from Steam, it would have that file.

It's hard to robust tell the gamemd.exe file from Steam or not.

There is only 1 though? I suggest making it like this:

if matchSteamHash run gamemd.exe
else if ra2mdExist run RA2MD.exe
    else run gamemd.exe

@SadPencil
Copy link
Member

SadPencil commented Feb 3, 2025

If it is pirated from Steam, it would have that file.

if it's pirated from Steam, it precisely matches my assumption: the gamemd file provided in Steam has removed the launching from ra2md.exe requirement

I suggest making it like this:

Negative, since I can't guarantee the Steam version does not upgrade itself. In fact, the gamemd.exe file from Steam is not the initial one when RA2 was just available on Steam.

@Revival8697
Copy link
Author

Negative, since I can't guarantee the Steam version does not upgrade itself. In fact, the gamemd.exe file from Steam is not the initial one when RA2 was just available on Steam.

Then just add the hash to the match list?

@SadPencil
Copy link
Member

SadPencil commented Feb 3, 2025

Negative, since I can't guarantee the Steam version does not upgrade itself. In fact, the gamemd.exe file from Steam is not the initial one when RA2 was just available on Steam.

Then just add the hash to the match list?

You missed the point. I use this example happened in the past to demonstrate that EA can release a new gamemd file in Steam whenever in the future.

@Revival8697
Copy link
Author

Revival8697 commented Feb 3, 2025

You missed the point. I use this example that happened in the past to demonstrate the Steam version can release a new gamemd file whenever in the future.

I don't understand? The Steam version launch though the client will always launch the CnCNet client so we can always ship updates to users. User that launch it separately like me will always be able to launch it as the previous hash won't be removed.

Also the hash for the previous gamemd.exe is 1b57b09d9912023eda3124b959d5f274e9a9bd5f. Better add that to the list to maintain backwards compability. It was only updated once.

@SadPencil
Copy link
Member

SadPencil commented Feb 3, 2025

So suppose the ra2md.exe file is missing (one can indeed make such a pirate copy), the launcher has no choice but to launch gamemd.exe file.

If it is pirated from Steam, it would have that file.

Also, this reply makes no sense. One could indeed make a pirate RA2 copy excluding ra2md.exe file, so if it is missing, the launcher have to launch gamemd.exe in the same way as if it were a Steam installation. I don't understand why did you stress that the Steam version / a pirate version made from Steam has ra2md.exe file -- the logic above handles the situation when it is missing.

@Revival8697
Copy link
Author

Revival8697 commented Feb 3, 2025

One could indeed make a pirate RA2 copy excluding ra2md.exe file, so if it is missing, the launcher have to launch gamemd.exe as if it were a Steam installation.

Eh? Is it not weird to not include all files of the game? Do they really go through to look for unneeded files to remove?

I don't understand why did you stress that the Steam version / a pirate version made from Steam has ra2md.exe file -- the logic above handles the situation when it is missing.

I included else run gamemd.exe because you said the above may happen?

@SadPencil
Copy link
Member

You missed the point. I use this example that happened in the past to demonstrate the Steam version can release a new gamemd file whenever in the future.

I don't understand? The Steam version launch though the client will always launch the CnCNet client so we can always ship updates to users. User that launch it separately like me will always be able to launch it as the previous hash won't be removed.

It's completely different. Doing so requires one upgrade the known hash as soon as Steam releases a new gamemd.exe file, otherwise a lot of user will immediately complain. Therefore we must introduce forward compatibility.

@SadPencil
Copy link
Member

SadPencil commented Feb 3, 2025

One could indeed make a pirate RA2 copy excluding ra2md.exe file, so if it is missing, the launcher have to launch gamemd.exe as if it were a Steam installation.

Eh? Is it not weird to not include all files of the game? Do they really go through to look for unneeded files to remove?

It will not be weird when RA2 is shipped with another online playing service, where the pirate version is further modified and reducted, serving primarily for their needs instead of delivering an untouched pirate copy. Some users install cncnet yr on a pirate copy provided by Rambo play (I am not saying in their copy ra2md is missing, just to stress that technically it is possible)

I don't understand why did you stress that the Steam version / a pirate version made from Steam has ra2md.exe file -- the logic above handles the situation when it is missing.

I included else run gamemd.exe because you said the above may happen?

This is not the point. Initially you said line 102 is wrong, which is why I replied that it was just a variable name and ra2md might be missing -- such a sentence is to explain why the line 102 exists and it's not wrong. So, your reply, that a pirate made from Steam has ra2md, does not introduce new information and makes no sense. Unless you can prove that all version have ra2md -- which is not true because I can make one just to act as a counter example -- just saying some versions have ra2md makes no sense.

@SadPencil
Copy link
Member

back to the topic. In Windows, clicking ra2.exe file shipped in the Steam version will correctly launch red alert 2. You said in Wine, launching ra2.exe does not work as intended, right? I would suggest you investigate such a thing and report it to Wine. If you insist on fixing such a behavior I would provide another ra2launcher.exe to conditionally launch Ra2.exe/game.exe which behaves like this ra2mdlauncher.exe

@Revival8697
Copy link
Author

Revival8697 commented Feb 3, 2025

clicking ra2.exe file shipped in the Steam version will correctly launch red alert 2

It should not since it is a Steam link. You probably have Steam installed and run on start-up if it did (yes, I did test it on Windows).

@Revival8697
Copy link
Author

Therefore we must introduce forward compatibility.

We can't? We are downstream. It is impossible to know what upstream (EA) do. We can only do backwards compatibility.

Right now, your https://github.com/SadPencil/ra2md-launcher is attempt to do forward compatibility by hoping that the file will stay unchanged (hash comparasion) or the size will remain larger than 5 MiB. But it is an attempt, not real forward compatibility (unless you work at EA and make sure one of those will always be true).

@SadPencil
Copy link
Member

SadPencil commented Feb 3, 2025

Therefore we must introduce forward compatibility.

We can't? We are downstream. It is impossible to know what upstream (EA) do. We can only do backwards compatibility.

Right now, your https://github.com/SadPencil/ra2md-launcher is attempt to do forward compatibility by hoping that the file will stay unchanged (hash comparasion) or the size will remain larger than 5 MiB. But it is an attempt, not real forward compatibility (unless you work at EA and make sure one of those will always be true).

With size assumption: as long as EA does not reduce the size of gamemd, even if a new gamemd is released, we don't have to update this launcher

Without size assumption: no matter what, every time a new gamemd is released, we have to update this launcher asap

That's the difference. It matters a lot. 90% is better than 0%, and you cannot say they are the same just because both of them are not 100%.

@Revival8697
Copy link
Author

Revival8697 commented Feb 3, 2025

With size assumption: as long as EA does not reduce the size of gamemd, even if a new gamemd is released, we don't have to update this launcher

And that is Steam only, right? Is Origin's size smaller than 5 MiB? If so, can we keep assuming things and remove the hash check entirely, only checking for size?

@pzhlkj6612
Copy link
Contributor

Hmm, is there another way to check if a game executable is from Steam? Digital signature maybe?

@SadPencil
Copy link
Member

Hmm, is there another way to check if a game executable is from Steam? Digital signature maybe?

gamemd is not signed

@SadPencil
Copy link
Member

With size assumption: as long as EA does not reduce the size of gamemd, even if a new gamemd is released, we don't have to update this launcher

And that is Steam only, right? Is Origin's size smaller than 5 MiB? If so, can we keep assuming things and remove the hash check entirely, only checking for size?

Origin’s size is indeed smaller than ~5 MB. Indeed, introducing hash check does not introduce difference to the result (before introducing the hash of gamemd file in the initial Steam release), so it would not be a matter keeping such a mechism.

@Revival8697
Copy link
Author

Revival8697 commented Feb 3, 2025

Hmm, is there another way to check if a game executable is from Steam? Digital signature maybe?

How I did not think of that? I even said it myself it was opening a Steam link.
You indeed can. Steam's Ra2.exe and RA2MD.exe is using Steam Stub v3.1.2 32-bit.

I verified it just now using https://github.com/atom0s/Steamless/blob/cd770bf9749d3e4f438d23ac643917ad1a804257/Steamless.Unpacker.Variant31.x86/Main.cs#L120.

@SadPencil
Copy link
Member

SadPencil commented Feb 4, 2025

Also the hash for the previous gamemd.exe is 1b57b09d9912023eda3124b959d5f274e9a9bd5f. Better add that to the list to maintain backwards compability. It was only updated once.

I don't have a backup for the initial Steam version. Are you pretty sure about this SHA-1 hash value? If so, I'll include it.

@Revival8697
Copy link
Author

I don't have a backup for the initial Steam version. Are you pretty sure about this SHA-1 hash value? If so, I'll include it.

You can verify it on your end. Steam allows you to download older versions with its console.

download_depot 2229850 2229851 4745855780671077199

See https://steamdb.info/depot/2229851/manifests.

@Revival8697
Copy link
Author

Revival8697 commented Feb 4, 2025

@SadPencil may I know the size different of game.exe on Steam and Origin?

@SadPencil
Copy link
Member

@SadPencil may I know the size different of Ra2.exe on Steam and Origin?

Not available on my computer. I can only fetch it after weeks.

@Revival8697
Copy link
Author

@SadPencil may I know the size different of Ra2.exe on Steam and Origin?

Not available on my computer. I can only fetch it after weeks.

I meant game.exe, sorry. I will see if I can bandaid fix this on Linux.

@SadPencil
Copy link
Member

SadPencil commented Feb 4, 2025

@SadPencil may I know the size different of Ra2.exe on Steam and Origin?

Also, it is not reliable to determine it by the file size of ra2.exe file because of the DRM introduced in the retail CD. Unlike game(md).exe, the size of ra2.exe differs a lot among different pirate copies.

Conditionally launching game.exe/ra2.exe by determining the file size of gamemd.exe should be an acceptable option. Specifically:

  1. If ra2.exe is missing
  2. If game.exe matches known hashes
  3. If gamemd.exe matches the known hashes
  4. Determine by the size of gamemd.exe

And again, I object to introducing scripts.

@SadPencil
Copy link
Member

@SadPencil may I know the size different of Ra2.exe on Steam and Origin?

Not available on my computer. I can only fetch it after weeks.

I meant game.exe, sorry. I will see if I can bandaid fix this on Linux.

For the retail CD, game.exe is of size 4,485,392 bytes. I don't have the access to the computer storing the Origin version right now. I can get the access after weeks.

@Revival8697
Copy link
Author

And again, I object to introducing scripts.

Don't worry, I won't touch your EXE, for now. 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Linux Contains Linux issues
Projects
None yet
Development

No branches or pull requests

3 participants