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

POC: Read lutris installer #788

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
include(["engines", "wine", "quick_script", "lutris_wine_steam_script"]);

var installerImplementation = {
run: function () {
new LutrisWineSteamScript()
.slug("the-elder-scrolls-iii-morrowi-steam")
.go();
}
};

/* exported Installer */
var Installer = Java.extend(org.phoenicis.scripts.Installer, installerImplementation);
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"scriptName" : "Lutris Wine Steam",
"id" : "lutris_wine_steam",
"compatibleOperatingSystems" : [
"LINUX",
"MACOSX"
],
"testingOperatingSystems" : [],
"free" : false,
"requiresPatch" : false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name" : "The Elder Scrolls III: Morrowind GOTY Edition",
"id" : "the_elder_scrolls_3_morrowind_goty_edition",
"description" : "The Elder Scrolls III: Morrowind Game of the Year Edition includes Morrowind plus all of the content from the Bloodmoon and Tribunal expansions. The original Mod Construction Set is not included in this package."
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
99 changes: 99 additions & 0 deletions Engines/Wine/QuickScript/Lutris Wine Steam Script/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
include(["engines", "wine", "quick_script", "steam_script"]);
include(["utils", "functions", "net", "download"]);
include(["engines", "wine", "engine", "object"]);

function LutrisWineSteamScript() {
SteamScript.call(this);
this.installerStepsMethods = []
}

LutrisWineSteamScript.prototype = Object.create(SteamScript.prototype);

LutrisWineSteamScript.prototype.constructor = LutrisWineSteamScript;

LutrisWineSteamScript.prototype.slug = function (slug) {
this._slug = slug;
return this;
}

LutrisWineSteamScript.prototype.fetchScript = function () {
var url = "https://lutris.net/api/installers/" + this._slug + "?format=json";
return new Downloader().url(url).json();
}

LutrisWineSteamScript.prototype._setBasicInformation = function (scriptContent) {
this.appId(scriptContent["script"]["game"]["steamid"]);
this.name(scriptContent["name"]);
this.author(scriptContent["user"]);
}

LutrisWineSteamScript.prototype._setArchitecture = function (scriptContent) {
if (scriptContent["script"]["game"]["arch"] && scriptContent["script"]["game"]["arch"] === "win64") {
this.wineArchitecture("amd64");
}
this.appId(scriptContent["script"]["game"]["steamid"]);
}

LutrisWineSteamScript.prototype._setArguments = function (scriptContent) {
if (scriptContent["script"]["game"]["args"]) {
this.arguments(scriptContent["script"]["game"]["args"].split(" "));
}
}

LutrisWineSteamScript.prototype._evalInstallerSteps = function (scriptContent) {
if (scriptContent["script"]["game"]["installer"]) {
scriptContent["script"]["game"]["installer"].forEach(function (installerStep) {
this.installerStepsMethods.add(function (wine, wizard) {
this._evalInstallerStep(installerStep, wine, wizard)
})
})
}
}

LutrisWineSteamScript.prototype._evalInstallerStep = function (installerStep, wine, wizard) {
if (installerStep["task"] && installerStep["task"]["name"] === "winetricks") {
var verb = nstallerStep["task"]["app"];

// TODO
}
}



LutrisWineSteamScript.prototype._evalOverrides = function (scriptContent) {
if (scriptContent["script"]["winesteam"]) {
var overrides = scriptContent["script"]["winesteam"]["overrides"];
if (overrides) {
Object.keys(scriptContent["script"]["winesteam"]["overrides"]).forEach(function (dll) {
var dllStatus = overrides[dll];

this.installerStepsMethods.add(function (wine, wizard) {
wine.overrideDLL()
.set(dllStatus, [dll])
.do();
})
})
}
}
}


LutrisWineSteamScript.prototype.go = function () {
var scriptContent = this.fetchScript()["results"][0];

this._setBasicInformation(scriptContent);
this._setArchitecture(scriptContent);
this._setArguments(scriptContent);
this._evalInstallerSteps(scriptContent);
this._evalOverrides(scriptContent);

this.editor("");

this.postInstall(function (wine, wizard) {
this.installerStepsMethods.forEach(function (taskMethod) {
taskMethod(wine, wizard);
})
});

SteamScript.prototype.go.call(this);
}
14 changes: 14 additions & 0 deletions Engines/Wine/QuickScript/Lutris Wine Steam Script/script.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"scriptName" : "Lutris Wine Steam Script",
"id" : "lutris_wine_steam_script",
"compatibleOperatingSystems" : [
"MACOSX",
"LINUX"
],
"testingOperatingSystems" : [
"MACOSX",
"LINUX"
],
"free" : true,
"requiresPatch" : false
}