Skip to content

Commit

Permalink
Add Faudio verb (#804)
Browse files Browse the repository at this point in the history
  • Loading branch information
ImperatorS79 committed Jan 23, 2019
1 parent 9148190 commit 8343f17
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 0 deletions.
70 changes: 70 additions & 0 deletions Engines/Wine/Verbs/FAudio/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
include(["engines", "wine", "engine", "object"]);
include(["engines", "wine", "plugins", "override_dll"]);
include(["utils", "functions", "net", "resource"]);
include(["utils", "functions", "filesystem", "files"]);

/**
* Verb to install FAudio
* see: https://github.com/Kron4ek/FAudio-Builds
* @param {String} faudioVersion version of FAudio to downlaod
* @returns {Wine} Wine object
*/
Wine.prototype.faudio = function (faudioVersion) {
if(typeof faudioVersion !== 'string')
faudioVersion = "19.01";

var setupFile = new Resource()
.wizard(this.wizard())
.url("https://github.com/Kron4ek/FAudio-Builds/releases/download/" + faudioVersion + "/faudio-" + faudioVersion + ".tar.xz")
.name("faudio-" + faudioVersion + ".tar.xz")
.get();

new Extractor()
.wizard(this.wizard())
.archive(setupFile)
.to(this.prefixDirectory() + "/FAudio/")
.extract();

var forEach = Array.prototype.forEach;
var sys32dir = this.system32directory();
var sys64dir = this.system64directory();
var faudioDir = this.prefixDirectory() + "/FAudio/faudio-" + faudioVersion;
var self = this;

forEach.call(ls(faudioDir + "/x32"), function (file) {
if (file.endsWith(".dll")) {
cp(faudioDir + "/x32/" + file, sys32dir);
self.overrideDLL()
.set("native", [file])
.do();
}
});

if (this.architecture() == "amd64")
{
forEach.call(ls(faudioDir + "/x64"), function (file) {
if (file.endsWith(".dll")) {
cp(faudioDir + "/x64/" + file, sys64dir);
}
});
}

return this;
}

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

/* exported Verb */
var Verb = Java.extend(org.phoenicis.engines.Verb, verbImplementation);
12 changes: 12 additions & 0 deletions Engines/Wine/Verbs/FAudio/script.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"scriptName" : "faudio",
"id" : "faudio",
"compatibleOperatingSystems" : [
"LINUX"
],
"testingOperatingSystems" : [
"LINUX"
],
"free" : true,
"requiresPatch" : false
}

0 comments on commit 8343f17

Please sign in to comment.