-
-
Notifications
You must be signed in to change notification settings - Fork 34
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
Replace package/ra2mdlauncher executable with batch script for transparency. #450
Conversation
89deccc
to
5fe8f6a
Compare
I don't know how, but Anyway, this should only be temporary until we figure out how to detect Steam's executable properly. I will do the same thing for RA2. Someone should test this on non-Steam versions. |
|
I'm not a fan of that. I would not prefer a plain text script. The current program works well, and at most we can change the name ra2md.exe to Ra2md.exe or whatever for a case-sensitive behavior, or even better, add codes to detect the Steam Stub. |
Again, I object such a change if it merely achieves transparency, leaving a file without proper icon that might confuse a user. You can indeed write a program to robustly determine if |
set "ra2MdPath=%appPath%RA2MD.exe" | ||
set "minSize=5242880" :: 5 MiB in bytes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, I can now confirm the legit version from a retail CD has the filename Ra2md.exe
where only R
is capital. For an Origin or FD copy I don't have access right now.
Please provide a good reason changing 5000000 to 5242880.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's check for every possible case then.
I assumed the size wouldn't be smaller, so I took the exact size of Steam's RA2MD.exe. However, I prefer an exact byte number, and 5 MiB is conveniently just smaller than 5,286,208 bytes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The original 5000000 was selected because it was the median between a gamemd without HD icon and a gamemd with an HD icon. We should tolerate possible reduction of the file size so 5000000 is a good separator.
package/ra2mdlauncher.cmd
Outdated
if defined fileSize ( | ||
if "%fileSize%" GEQ "%minSize%" ( | ||
echo Launching gamemd.exe | ||
start "" "%gameMdPath%" | ||
) else ( | ||
if exist "%ra2MdPath%" ( | ||
echo Launching RA2MD.exe | ||
start "" "%ra2MdPath%" | ||
) else ( | ||
echo RA2MD.exe not found. Launching gamemd.exe instead. | ||
start "" "%gameMdPath%" | ||
) | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The original ra2mdlauncher passes through all parameters into the final exe (e.g., -SPEEDCONTROL
etc), providing a seamless replacement. Your script does not pass through parameters.
Well... I suggest you spend time on investigating how to robustly determine if ra2(md).exe is a Steam stub.
|
I don't think I want to touch HEX values for now. |
Well... then we have no good reason replacing the current launcher I suppose? I will add the hash you have provided and use "Ra2md.exe" as the filename (if FD and Origin version shares this name as the retail CD). The icon can be reworked too. |
dbd87df
to
d8de230
Compare
if defined fileSize ( | ||
if "%fileSize%" GEQ "%minSize%" ( | ||
echo Launching gamemd.exe | ||
start "" "%gameMdPath%" %* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think the Windows command line is robust enough to pass through arguments. It is hard to solve the injection attack barely using a cmd script, for example, when the parameter is &pause
(type ^& pause
when launching your script from a cmd console)
I will refrain from touching Windows's executable, for now. |
This replace executable with batch script so it is easier to maintain.
As mention in #447 (comment), the hash check is not needed.