Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
841f079
New Crowdin translations (#889)
PhoenicisBot Sep 14, 2019
6d2b580
Refactor the Steam Quick Script (#1129)
madoar Sep 15, 2019
107aa28
Update translations
Sep 15, 2019
1d41ee8
Update JSDoc
Sep 15, 2019
2b0ea33
Update gdiplus and msxml6 verb (#1127)
ImperatorS79 Sep 15, 2019
95ce824
Update translations
Sep 15, 2019
1495f2d
Update JSDoc
Sep 15, 2019
9b750d9
Update Wine LATEST_DEVELOPMENT_VERSION and LATEST_STAGING_VERSION to …
plata Sep 23, 2019
cc2a3c0
Update Wine LATEST_DEVELOPMENT_VERSION and LATEST_STAGING_VERSION to …
plata Oct 1, 2019
b9973a7
Change Plugins to use the Module System (#1131)
madoar Oct 3, 2019
cf9cd0f
Update translations
Oct 3, 2019
32518a3
Update JSDoc
Oct 3, 2019
7937fa5
Replace hardcoded version list by git-fetched version list (#1134)
ImperatorS79 Oct 5, 2019
03e14c0
Update translations
Oct 5, 2019
dc1a3d6
Update JSDoc
Oct 5, 2019
8a6b5f2
Add property to (not) use Wine runtime (#1133)
plata Oct 5, 2019
c593cfb
Update translations
Oct 5, 2019
3f730b2
Update JSDoc
Oct 5, 2019
90d3367
Update Subnautica (fix typo) (#1136)
plata Oct 10, 2019
6e23310
Update translations
Oct 10, 2019
47fb061
Update Space Engineers (fix typo) (#1135)
plata Oct 10, 2019
354444a
Update translations
Oct 10, 2019
b5c399d
Update Wine LATEST_DEVELOPMENT_VERSION and LATEST_STAGING_VERSION to …
plata Nov 3, 2019
0958ff2
Update SteamScript (remove winxp overrides) (#1140)
Zemogiter Nov 16, 2019
f22b3f6
Update translations
Nov 16, 2019
4dc7843
Update JSDoc
Nov 16, 2019
0015ebb
Update Wine LATEST_DEVELOPMENT_VERSION and LATEST_STAGING_VERSION to …
plata Nov 25, 2019
9f5532e
New Crowdin translations (#1128)
PhoenicisBot Nov 25, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Refactor the Steam Quick Script (PhoenicisOrg#1129)
- refactor the steam quick script
- fix eslint issues
  • Loading branch information
madoar authored Sep 15, 2019
commit 6d2b580f0944bb46c875f3a05e9741a99c9bd259
83 changes: 57 additions & 26 deletions Engines/Wine/QuickScript/Steam Script/script.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
const QuickScript = include("engines.wine.quick_script.quick_script");
const Downloader = include("utils.functions.net.download");
const Wine = include("engines.wine.engine.object");
const {cat, fileExists, writeToFile, createTempFile} = include("utils.functions.filesystem.files");
const { cat, fileExists, writeToFile, createTempFile } = include("utils.functions.filesystem.files");

const Luna = include("engines.wine.verbs.luna");
const Corefonts = include("engines.wine.verbs.corefonts");
include("engines.wine.plugins.override_dll");
include("engines.wine.plugins.windows_version");

const Thread = Java.type("java.lang.Thread");

module.default = class SteamScript extends QuickScript {
constructor() {
super();
Expand Down Expand Up @@ -36,61 +38,77 @@ module.default = class SteamScript extends QuickScript {
manifest(wine) {
if (!this._manifest) {
// cache manifest path (will not change during the installation)
this._manifest = wine.prefixDirectory() + "/drive_c/" + wine.programFiles() + "/Steam/steamapps/appmanifest_" + this._appId + ".acf";
this._manifest = `${wine.prefixDirectory()}/drive_c/${wine.programFiles()}/Steam/steamapps/appmanifest_${this._appId}.acf`;
}

return this._manifest;
}

/**
* Checks whether the software download has started
*
* @param {Wine} wine The wine engine object
* @returns {boolean} True if the download has started, false otherwise
*/
downloadStarted(wine) {
if (fileExists(this.manifest(wine))) {
const manifest = cat(this.manifest(wine));
const state = Number(manifest.match(/\"StateFlags\"\s+\"(\d+)\"/)[1]);
const state = parseInt(manifest.match(/"StateFlags"\s+"(\d+)"/)[1], 10);

return state == 1026 || state == 1042 || state == 1062 || state == 1030;
}
else {
} else {
return false;
}
}

/**
* Checks whether the software download has finished.
* To get a valid result with this method `downloadStarted(wine)` needs to return `true` first
*
* @param {Wine} wine The wine engine object
* @returns {boolean} True if the download has finished, false otherwise
*/
downloadFinished(wine) {
// check if download already finished (download folder has been deleted)
if (fileExists(this.manifest(wine))) {
const manifest = cat(this.manifest(wine));
const state = Number(manifest.match(/\"StateFlags\"\s+\"(\d+)\"/)[1]);
const state = parseInt(manifest.match(/"StateFlags"\s+"(\d+)"/)[1], 10);

return state != 1026 && state != 1042 && state != 1062 && state != 1030;
}
else {
} else {
return false;
}
}

configVdf(wine) {
if (!this._configVdf) {
// cache config.vdf path (will not change during the installation)
this._configVdf = wine.prefixDirectory() + "/drive_c/" + wine.programFiles() + "/Steam/config/config.vdf";
this._configVdf = `${wine.prefixDirectory()}/drive_c/${wine.programFiles()}/Steam/config/config.vdf`;
}

return this._configVdf;
}

// Fix for the "content server unavailable" error (Wine bug 45329)
fixCertificateIssue(wine) {
const steamConfigFile = this.configVdf(wine);
const steamConfig = cat(steamConfigFile);
const cmPos = steamConfig.indexOf("\"CM\"");
const csConfig = "\"CS\" \"valve511.steamcontent.com;valve501.steamcontent.com;valve517.steamcontent.com;valve557.steamcontent.com;valve513.steamcontent.com;valve535.steamcontent.com;valve546.steamcontent.com;valve538.steamcontent.com;valve536.steamcontent.com;valve530.steamcontent.com;valve559.steamcontent.com;valve545.steamcontent.com;valve518.steamcontent.com;valve548.steamcontent.com;valve555.steamcontent.com;valve556.steamcontent.com;valve506.steamcontent.com;valve544.steamcontent.com;valve525.steamcontent.com;valve567.steamcontent.com;valve521.steamcontent.com;valve510.steamcontent.com;valve542.steamcontent.com;valve519.steamcontent.com;valve526.steamcontent.com;valve504.steamcontent.com;valve500.steamcontent.com;valve554.steamcontent.com;valve562.steamcontent.com;valve524.steamcontent.com;valve502.steamcontent.com;valve505.steamcontent.com;valve547.steamcontent.com;valve560.steamcontent.com;valve503.steamcontent.com;valve507.steamcontent.com;valve553.steamcontent.com;valve520.steamcontent.com;valve550.steamcontent.com;valve531.steamcontent.com;valve558.steamcontent.com;valve552.steamcontent.com;valve563.steamcontent.com;valve540.steamcontent.com;valve541.steamcontent.com;valve537.steamcontent.com;valve528.steamcontent.com;valve523.steamcontent.com;valve512.steamcontent.com;valve532.steamcontent.com;valve561.steamcontent.com;valve549.steamcontent.com;valve522.steamcontent.com;valve514.steamcontent.com;valve551.steamcontent.com;valve564.steamcontent.com;valve543.steamcontent.com;valve565.steamcontent.com;valve529.steamcontent.com;valve539.steamcontent.com;valve566.steamcontent.com;valve165.steamcontent.com;valve959.steamcontent.com;valve164.steamcontent.com;valve1611.steamcontent.com;valve1601.steamcontent.com;valve1617.steamcontent.com;valve1603.steamcontent.com;valve1602.steamcontent.com;valve1610.steamcontent.com;valve1615.steamcontent.com;valve909.steamcontent.com;valve900.steamcontent.com;valve905.steamcontent.com;valve954.steamcontent.com;valve955.steamcontent.com;valve1612.steamcontent.com;valve1607.steamcontent.com;valve1608.steamcontent.com;valve1618.steamcontent.com;valve1619.steamcontent.com;valve1606.steamcontent.com;valve1605.steamcontent.com;valve1609.steamcontent.com;valve907.steamcontent.com;valve901.steamcontent.com;valve902.steamcontent.com;valve1604.steamcontent.com;valve908.steamcontent.com;valve950.steamcontent.com;valve957.steamcontent.com;valve903.steamcontent.com;valve1614.steamcontent.com;valve904.steamcontent.com;valve952.steamcontent.com;valve1616.steamcontent.com;valve1613.steamcontent.com;valve958.steamcontent.com;valve956.steamcontent.com;valve906.steamcontent.com\"\n";
const cmPos = steamConfig.indexOf(`"CM"`);
const csConfig = `"CS" "valve511.steamcontent.com;valve501.steamcontent.com;valve517.steamcontent.com;valve557.steamcontent.com;valve513.steamcontent.com;valve535.steamcontent.com;valve546.steamcontent.com;valve538.steamcontent.com;valve536.steamcontent.com;valve530.steamcontent.com;valve559.steamcontent.com;valve545.steamcontent.com;valve518.steamcontent.com;valve548.steamcontent.com;valve555.steamcontent.com;valve556.steamcontent.com;valve506.steamcontent.com;valve544.steamcontent.com;valve525.steamcontent.com;valve567.steamcontent.com;valve521.steamcontent.com;valve510.steamcontent.com;valve542.steamcontent.com;valve519.steamcontent.com;valve526.steamcontent.com;valve504.steamcontent.com;valve500.steamcontent.com;valve554.steamcontent.com;valve562.steamcontent.com;valve524.steamcontent.com;valve502.steamcontent.com;valve505.steamcontent.com;valve547.steamcontent.com;valve560.steamcontent.com;valve503.steamcontent.com;valve507.steamcontent.com;valve553.steamcontent.com;valve520.steamcontent.com;valve550.steamcontent.com;valve531.steamcontent.com;valve558.steamcontent.com;valve552.steamcontent.com;valve563.steamcontent.com;valve540.steamcontent.com;valve541.steamcontent.com;valve537.steamcontent.com;valve528.steamcontent.com;valve523.steamcontent.com;valve512.steamcontent.com;valve532.steamcontent.com;valve561.steamcontent.com;valve549.steamcontent.com;valve522.steamcontent.com;valve514.steamcontent.com;valve551.steamcontent.com;valve564.steamcontent.com;valve543.steamcontent.com;valve565.steamcontent.com;valve529.steamcontent.com;valve539.steamcontent.com;valve566.steamcontent.com;valve165.steamcontent.com;valve959.steamcontent.com;valve164.steamcontent.com;valve1611.steamcontent.com;valve1601.steamcontent.com;valve1617.steamcontent.com;valve1603.steamcontent.com;valve1602.steamcontent.com;valve1610.steamcontent.com;valve1615.steamcontent.com;valve909.steamcontent.com;valve900.steamcontent.com;valve905.steamcontent.com;valve954.steamcontent.com;valve955.steamcontent.com;valve1612.steamcontent.com;valve1607.steamcontent.com;valve1608.steamcontent.com;valve1618.steamcontent.com;valve1619.steamcontent.com;valve1606.steamcontent.com;valve1605.steamcontent.com;valve1609.steamcontent.com;valve907.steamcontent.com;valve901.steamcontent.com;valve902.steamcontent.com;valve1604.steamcontent.com;valve908.steamcontent.com;valve950.steamcontent.com;valve957.steamcontent.com;valve903.steamcontent.com;valve1614.steamcontent.com;valve904.steamcontent.com;valve952.steamcontent.com;valve1616.steamcontent.com;valve1613.steamcontent.com;valve958.steamcontent.com;valve956.steamcontent.com;valve906.steamcontent.com"\n`;
const newSteamConfig = steamConfig.slice(0, cmPos) + csConfig + steamConfig.slice(cmPos);
writeToFile(steamConfigFile, newSteamConfig)

writeToFile(steamConfigFile, newSteamConfig);
}

go() {
// default application homepage if not specified
if (!this._applicationHomepage) {
this._applicationHomepage = "https://store.steampowered.com/app/" + this._appId;
this._applicationHomepage = `https://store.steampowered.com/app/${this._appId}`;
}

// default executable args if not specified
if (!this._executableArgs) {
this._executableArgs = ["-no-cef-sandbox", "-silent", "-applaunch", this._appId];
this._executableArgs = ["-no-cef-sandbox", "-silent", "-applaunch", `${this._appId}`];
}

const setupWizard = SetupWizard(InstallationType.APPS, this._name, this.miniature());
Expand All @@ -114,23 +132,36 @@ module.default = class SteamScript extends QuickScript {
new Corefonts(wine).go();

// Steam must be started once such that config.vdf is created (see fixCertificateIssue())
setupWizard.wait(tr("Please follow the steps of the Steam setup. Then, wait until Steam is updated, log in and finally close Steam completely so the installation of \"{0}\" can continue.", this._name));
setupWizard.wait(
tr(
'Please follow the steps of the Steam setup. Then, wait until Steam is updated, log in and finally close Steam completely so the installation of "{0}" can continue.',
this._name
)
);
wine.run(tempFile, [], null, false, true);

// Set windows environment for executable that needs it
wine.setOsForApplication().set("steam.exe", "winxp").do();
wine.setOsForApplication().set("steamwebhelper.exe", "winxp").do();
wine.setOsForApplication()
.set("steam.exe", "winxp")
.do();
wine.setOsForApplication()
.set("steamwebhelper.exe", "winxp")
.do();

// Fix for Uplay games that are executed on steam
wine.setOsForApplication().set("upc.exe", "winvista").do();
wine.setOsForApplication().set("UbisoftGameLauncher.exe", "winvista").do();
wine.setOsForApplication()
.set("upc.exe", "winvista")
.do();
wine.setOsForApplication()
.set("UbisoftGameLauncher.exe", "winvista")
.do();

// ensure that Steam is running (user might have unchecked "run Steam after installation finished")
wine.runInsidePrefix(wine.programFiles() + "/Steam/Steam.exe", ["steam://nav/games"], false);
wine.runInsidePrefix(`${wine.programFiles()}/Steam/Steam.exe`, ["steam://nav/games"], false);

// wait until config.vdf exists
while (!fileExists(this.configVdf(wine))) {
java.lang.Thread.sleep(1000);
Thread.sleep(1000);
}

// wait until Steam and Wine are closed
Expand All @@ -146,22 +177,22 @@ module.default = class SteamScript extends QuickScript {
// back to generic wait (might have been changed in preInstall)
setupWizard.wait(tr("Please wait..."));

wine.runInsidePrefix(wine.programFiles() + "/Steam/Steam.exe", ["steam://install/" + this._appId], false);
wine.runInsidePrefix(`${wine.programFiles()}/Steam/Steam.exe`, [`steam://install/${this._appId}`], false);

setupWizard.wait(tr("Please wait until Steam has finished the download..."));

// wait until download started
while (!this.downloadStarted(wine)) {
java.lang.Thread.sleep(100);
Thread.sleep(100);
}

// make sure download is finished
while (!this.downloadFinished(wine)) {
java.lang.Thread.sleep(1000);
Thread.sleep(1000);
}

// close Steam
wine.runInsidePrefix(wine.programFiles() + "/Steam/Steam.exe", "-shutdown", true);
wine.runInsidePrefix(`${wine.programFiles()}/Steam/Steam.exe`, "-shutdown", true);

// back to generic wait
setupWizard.wait(tr("Please wait..."));
Expand All @@ -183,4 +214,4 @@ module.default = class SteamScript extends QuickScript {

setupWizard.close();
}
}
};
2 changes: 1 addition & 1 deletion Engines/Wine/Verbs/D9VK/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class D9VK {
const wizard = this.wine.wizard();
const prefixDirectory = this.wine.prefixDirectory();
const system32directory = this.wine.system32directory();
const architecture = this.wine.architecture():
const architecture = this.wine.architecture();

print("NOTE: Wine version should be greater or equal to 3.10");

Expand Down
16 changes: 8 additions & 8 deletions Engines/Wine/Verbs/gdiplus/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,31 +27,31 @@ class GDIPlus {
.checksum("c3516bc5c9e69fee6d9ac4f981f5b95977a8a2fa")
.name("windows6.1-KB976932-X86.exe")
.get();

new CabExtract()
.archive(setupFile)
.wizard(wizard)
.wizard(wizard)
.to(`${prefixDirectory}/drive_c/gdiplus/`)
.extract(["-L", "-F", "x86_microsoft.windows.gdiplus_6595b64144ccf1df_1.1.7601.17514_none_72d18a4386696c80/gdiplus.dll"]);

cp(`${prefixDirectory}/drive_c/gdiplus/x86_microsoft.windows.gdiplus_6595b64144ccf1df_1.1.7601.17514_none_72d18a4386696c80/gdiplus.dll`, system32directory);

if (architecture == "amd64") {
const system64directory = this.wine.system64directory();
const system64directory = this.wine.system64directory();

const setupFile64 = new Resource()
.wizard(wizard)
.url("https://download.microsoft.com/download/0/A/F/0AFB5316-3062-494A-AB78-7FB0D4461357/windows6.1-KB976932-X64.exe")
.checksum("74865ef2562006e51d7f9333b4a8d45b7a749dab")
.name("windows6.1-KB976932-X64.exe")
.get();

new CabExtract()
.archive(setupFile64)
.wizard(wizard)
.wizard(wizard)
.to(`${prefixDirectory}/drive_c/gdiplus/`)
.extract(["-L", "-F", "amd64_microsoft.windows.gdiplus_6595b64144ccf1df_1.1.7601.17514_none_2b24536c71ed437a/gdiplus.dll"]);

cp(`${prefixDirectory}/drive_c/gdiplus/amd64_microsoft.windows.gdiplus_6595b64144ccf1df_1.1.7601.17514_none_2b24536c71ed437a/gdiplus.dll`, system64directory);
}

Expand Down
14 changes: 7 additions & 7 deletions Engines/Wine/Verbs/gdiplus_winxp/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,22 @@ class GDIPlusWinXP {
.checksum("6113cd89d77525958295ccbd73b5fb8b89abd0aa")
.name("NDP1.0sp2-KB830348-X86-Enu.exe")
.get();

new CabExtract()
.archive(setupFile)
.wizard(wizard)
.wizard(wizard)
.to(`${prefixDirectory}/drive_c/gdiplus/`)
.extract(["-F", "FL_gdiplus_dll_____X86.3643236F_FC70_11D3_A536_0090278A1BB8"]);

new CabExtract()
.archive(setupFile)
.wizard(wizard)
.wizard(wizard)
.to(`${prefixDirectory}/drive_c/gdiplus/`)
.extract(["-L", "-F", "x86_microsoft.windows.gdiplus_6595b64144ccf1df_1.1.7601.17514_none_72d18a4386696c80/gdiplus.dll"]);

const content = cat(`${prefixDirectory}/drive_c/gdiplus/drive_c/gdiplus/FL_gdiplus_dll_____X86.3643236F_FC70_11D3_A536_0090278A1BB8`);
writeToFile(`${system32directory}/gdiplus.dll`, content);

remove(`${prefixDirectory}/drive_c/gdiplus/`);

this.wine
Expand All @@ -65,4 +65,4 @@ class GDIPlusWinXP {
}
}

module.default = GDIPlusWindowsXP;
module.default = GDIPlusWinXP;
2 changes: 1 addition & 1 deletion Engines/Wine/Verbs/xact/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ class Xact {

if (architecture == "amd64") {
const system64directory = this.wine.system64directory();

//---------------------------------------------------------Extract xactengine*.dll (x64)--------------------------------------------
new CabExtract()
.wizard(wizard)
Expand Down