-
Notifications
You must be signed in to change notification settings - Fork 45
Add GoG support #764
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
Merged
Merged
Add GoG support #764
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
6fca8a2
Update script.js
qparis d191fc2
Update script.js
qparis 77fb344
Update script.js
qparis 379cb4b
Update script.js
qparis 84ee466
Wine plugin: add HDPI
7676345
Merge branch 'master' of https://github.com/qparis/scripts
36a6915
Retina support: Add settings entry
8066d58
Fixed codacy issue
3e1e582
Code review
d8794b8
Fix compatibles operating system
1792b42
Merge branch 'master' of https://github.com/PhoenicisOrg/scripts
99c8084
Merge branch 'master' of https://github.com/PhoenicisOrg/scripts
6256ca9
Merge branch 'master' of https://github.com/PhoenicisOrg/scripts
0064edd
Merge branch 'master' of https://github.com/PhoenicisOrg/scripts
6b39b66
GoG download support!
0bb6003
Reverted Uplauy scripts
341df9b
Reverted Uplay scripts
a011df3
Added javadoc
5930a10
Fixed codacy error. Added gdiplus which is a dependency for GoG insta…
775f7cf
Added remarks
ef08ae4
Added doc
ced8cda
Cleaning
7a39a65
Eslintrc order
acb8de7
Eslintrc order
5ad6158
Update .eslintrc.yml
plata 536c456
Merge branch 'master' of https://github.com/PhoenicisOrg/scripts into…
7eac23d
Merge remote-tracking branch 'origin/GoG-support' into GoG-support
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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." | ||
| } |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; | ||
|
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"); | ||
|
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"; | ||
|
madoar marked this conversation as resolved.
|
||
| this._token = new Downloader().url(tokenUrl).json(); | ||
| return this; | ||
| } | ||
|
|
||
| GogScript.prototype.download = function (setupWizard) { | ||
| this._setupFile = createTempFile("exe"); | ||
|
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(); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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); | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.