Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
6fca8a2
Update script.js
qparis Oct 16, 2018
d191fc2
Update script.js
qparis Oct 16, 2018
77fb344
Update script.js
qparis Oct 20, 2018
379cb4b
Update script.js
qparis Oct 20, 2018
84ee466
Wine plugin: add HDPI
Dec 2, 2018
7676345
Merge branch 'master' of https://github.com/qparis/scripts
Dec 2, 2018
36a6915
Retina support: Add settings entry
Dec 2, 2018
8066d58
Fixed codacy issue
Dec 2, 2018
3e1e582
Code review
Dec 2, 2018
d8794b8
Fix compatibles operating system
Dec 2, 2018
1792b42
Merge branch 'master' of https://github.com/PhoenicisOrg/scripts
Dec 30, 2018
99c8084
Merge branch 'master' of https://github.com/PhoenicisOrg/scripts
Dec 30, 2018
6256ca9
Merge branch 'master' of https://github.com/PhoenicisOrg/scripts
Dec 30, 2018
0064edd
Merge branch 'master' of https://github.com/PhoenicisOrg/scripts
Dec 30, 2018
6b39b66
GoG download support!
Dec 31, 2018
0bb6003
Reverted Uplauy scripts
Dec 31, 2018
341df9b
Reverted Uplay scripts
Dec 31, 2018
a011df3
Added javadoc
Dec 31, 2018
5930a10
Fixed codacy error. Added gdiplus which is a dependency for GoG insta…
Dec 31, 2018
775f7cf
Added remarks
Dec 31, 2018
ef08ae4
Added doc
Dec 31, 2018
ced8cda
Cleaning
Dec 31, 2018
7a39a65
Eslintrc order
Dec 31, 2018
acb8de7
Eslintrc order
Dec 31, 2018
5ad6158
Update .eslintrc.yml
plata Dec 31, 2018
536c456
Merge branch 'master' of https://github.com/PhoenicisOrg/scripts into…
Dec 31, 2018
7eac23d
Merge remote-tracking branch 'origin/GoG-support' into GoG-support
Dec 31, 2018
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
6 changes: 6 additions & 0 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@ globals:
TYPE_ID: false
CATEGORY_ID: false
APPLICATION_ID: false

# java
Bean: false

# files
ls: false
mkdir: false
Expand All @@ -47,6 +49,7 @@ globals:
writeToFile: false
createTempFile: false
chmod: false

# classes
AppResource: false
CabExtract: false
Expand All @@ -59,8 +62,10 @@ globals:
SetupWizard: false
Wine: false
WineShortcut: false

# quick scripts
CustomInstallerScript: false
GogScript: false
InstallerScript: false
LocalInstallerScript: false
OnlineInstallerScript: false
Expand All @@ -69,6 +74,7 @@ globals:
SteamScript: false
UplayScript: false
ZipScript: false

# wine
LATEST_DEVELOPMENT_VERSION: false
LATEST_STABLE_VERSION: false
Comment thread
plata marked this conversation as resolved.
Expand Down
20 changes: 20 additions & 0 deletions Applications/Games/Teenagent/GOG/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
include(["engines", "wine", "quick_script", "gog_script"]);

var installerImplementation = {
run: function () {
new GogScript()
.name("Teenagent")
.editor("")
.applicationHomepage("")
.author("Quentin PÂRIS")
.gogSetupFileName("teenagent/en1installer0")
.category("Games")
.wineVersion(LATEST_DOS_SUPPORT_VERSION)
.wineDistribution("dos_support")
.executable("TEENAGNT.EXE")
.go();
}
};

/* exported Installer */
var Installer = Java.extend(org.phoenicis.scripts.Installer, installerImplementation);
11 changes: 11 additions & 0 deletions Applications/Games/Teenagent/GOG/script.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"scriptName" : "GOG",
"id" : "gog",
"compatibleOperatingSystems" : [
"MACOSX",
"LINUX"
],
"testingOperatingSystems" : [],
"free" : true,
"requiresPatch" : false
}
5 changes: 5 additions & 0 deletions Applications/Games/Teenagent/application.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name" : "Teenagent",
"id" : "teenagent",
"description" : "Teenagent is a 1995 point-and-click adventure game developed by Polish developer Metropolis Software House. It was released for Amiga and MS-DOS. The player controls teenage boy Mark Hopper who wants to be a secret agent. The CD version was the first game to be released on CD-ROM in Poland."
}
Binary file added Applications/Games/Teenagent/miniatures/main.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
77 changes: 77 additions & 0 deletions Engines/Wine/QuickScript/GoG Script/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
include(["engines", "wine", "quick_script", "quick_script"]);
include(["utils", "functions", "net", "download"]);
include(["engines", "wine", "engine", "object"]);
include(["engines", "wine", "verbs", "gdiplus"]);

function GogScript() {
QuickScript.call(this);
}

GogScript.prototype = Object.create(QuickScript.prototype);

GogScript.prototype.constructor = GogScript;
Comment thread
madoar marked this conversation as resolved.

/**
* Sets the setup file name so that the script can fetch it from gog.com
* @param {string} setupFileName The setup file name
* @returns {GogScript} This
*/
GogScript.prototype.gogSetupFileName = function (setupFileName) {
this._setupFileName = setupFileName;
return this;
}

/**
* Presents a Gog.com login window to the user, login to its account and return a token that can be used later.
* Stores the tocken in a parameter
* @param {SetupWizard} setupWizard The setupWizard to use
* @returns {GogScript} This
*/
GogScript.prototype.loginToGog = function (setupWizard) {
var browserWindow = setupWizard.createBrowser(tr("Please login to your GoG.com account so that we can download the game for you:"));
browserWindow.goToUrl("https://auth.gog.com/auth?client_id=46899977096215655&redirect_uri=https%3A%2F%2Fembed.gog.com%2Fon_login_success%3Forigin%3Dclient&response_type=code&layout=client2");
Comment thread
madoar marked this conversation as resolved.
browserWindow.waitForUrl("https://embed.gog.com/*");
var currentUrl = browserWindow.getCurrentUrl();
var code = currentUrl.split("code=")[1].split("&")[0];

var tokenUrl = "https://auth.gog.com/token?client_id=46899977096215655&client_secret=9d85c43b1482497dbbce61f6e4aa173a433796eeae2ca8c5f6129f2dc4de46d9&grant_type=authorization_code&code="+code+"&redirect_uri=https%3A%2F%2Fembed.gog.com%2Fon_login_success%3Forigin%3Dclient";
Comment thread
madoar marked this conversation as resolved.
this._token = new Downloader().url(tokenUrl).json();
return this;
}

GogScript.prototype.download = function (setupWizard) {
this._setupFile = createTempFile("exe");
Comment thread
madoar marked this conversation as resolved.

new Downloader()
.url("https://www.gog.com/downloads/" + this._setupFileName)
.wizard(setupWizard)
.to(this._setupFile)
.headers({"Authorization": "Bearer " + this._token["access_token"]})
.get()
}

GogScript.prototype.go = function () {
var setupWizard = SetupWizard(InstallationType.APPS, this._name, this.miniature());

setupWizard.presentation(this._name, this._editor, this._applicationHomepage, this._author);

this.loginToGog(setupWizard);
this.download(setupWizard);

var wine = new Wine()
.wizard(setupWizard)
.prefix(this._name, this._wineDistribution, this._wineArchitecture, this._wineVersion)
.create()
.wait();

this._preInstall(wine, setupWizard);

wine.gdiplus();
wine.run(this._setupFile, [], wine.prefixDirectory() + "/drive_c/", true, true);

this._postInstall(wine, setupWizard);

this._createShortcut(wine.prefix());

setupWizard.close();
}
11 changes: 11 additions & 0 deletions Engines/Wine/QuickScript/GoG Script/script.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"scriptName" : "GoG Script",
"id" : "gog_script",
"compatibleOperatingSystems" : [
"MACOSX",
"LINUX"
],
"testingOperatingSystems" : [],
"free" : true,
"requiresPatch" : false
}
46 changes: 46 additions & 0 deletions Engines/Wine/Verbs/gdiplus/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
include(["engines", "wine", "engine", "object"]);
include(["utils", "functions", "net", "resource"]);
include(["utils", "functions", "filesystem", "files"]);
include(["engines", "wine", "plugins", "override_dll"]);

/**
* Verb to install gdiplus
* @returns {Wine} Wine object
*/
Wine.prototype.gdiplus = function () {
var setupFile = new Resource()
.wizard(this.wizard())
.url("http://download.microsoft.com/download/a/b/c/abc45517-97a0-4cee-a362-1957be2f24e1/WindowsXP-KB975337-x86-ENU.exe")
.checksum("b9a84bc3de92863bba1f5eb1d598446567fbc646")
.name("WindowsXP-KB975337-x86-ENU.exe")
.get();

this.wizard().wait(tr("Please wait while {0} is installed ...", "GDI+"));
this.run(setupFile, ["/extract:C:\\Tmp", "/q"], null, true, true);

this.overrideDLL()
.set("native", ["gdiplus"])
.do();

cp(this.prefixDirectory() + "/drive_c/Tmp/asms/10/msft/windows/gdiplus/gdiplus.dll", this.system32directory());

return this;
};

/**
* Verb to install gdiplus
*/
var verbImplementation = {
install: function (container) {
var wine = new Wine();
wine.prefix(container);
var wizard = SetupWizard(InstallationType.VERBS, "gdiplus", java.util.Optional.empty());
wine.wizard(wizard);
wine.gdiplus();
wizard.close();
}
};

/* exported Verb */
var Verb = Java.extend(org.phoenicis.engines.Verb, verbImplementation);

11 changes: 11 additions & 0 deletions Engines/Wine/Verbs/gdiplus/script.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"scriptName" : "gdiplus",
"id" : "gdiplus",
"compatibleOperatingSystems" : [
"MACOSX",
"LINUX"
],
"testingOperatingSystems" : [],
"free" : true,
"requiresPatch" : false
}
33 changes: 26 additions & 7 deletions Utils/Functions/Net/Download/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ include(["utils", "functions", "filesystem", "files"]);
function Downloader() {
this._downloader = Bean("downloader");
this._algorithm = "SHA";
this._headers = {};
}

/**
Expand Down Expand Up @@ -59,15 +60,25 @@ Downloader.prototype.checksum = function (checksum) {
}

/**
* sets message text
* @param {string} message download message
* @returns {Downloader} Downloader object
*/
* sets message text
* @param {string} message download message
* @returns {Downloader} Downloader object
*/
Downloader.prototype.message = function (message) {
this._message = message;
return this;
}

/**
* sets http headers
* @param {{}} headers headers
* @returns {Downloader} Downloader object
*/
Downloader.prototype.headers = function (headers) {
this._headers = headers;
return this;
}

/**
* sets destination
* @param {string} localFile destination of the download
Expand All @@ -86,7 +97,7 @@ Downloader.prototype.to = function (localFile) {
Downloader.prototype.onlyIfUpdateAvailable = function (onlyIfUpdateAvailable) {
this._onlyIfUpdateAvailable = onlyIfUpdateAvailable;
return this;
}
};
Comment thread
qparis marked this conversation as resolved.

/**
* returns downloaded file
Expand All @@ -109,7 +120,7 @@ Downloader.prototype.get = function () {
}

if (this._localFile) {
this._downloader.get(this._url, this._localFile, function (progressEntity) {
this._downloader.get(this._url, this._localFile, this._headers, function (progressEntity) {
if (progressBar) {
progressBar.accept(progressEntity);
}
Expand All @@ -134,10 +145,18 @@ Downloader.prototype.get = function () {
}
}
} else {
return this._downloader.get(this._url, function (progressEntity) {
return this._downloader.get(this._url, this._headers, function (progressEntity) {
if (progressBar) {
progressBar.accept(progressEntity);
}
});
}
}

/**
* Gets the content and parse the JSON value
* @returns {any} The json content
*/
Downloader.prototype.json = function () {
return JSON.parse(this.get());
}