Open Kreyren opened 5 years ago
We need a way to guess the main GPU on a system and a way to update the _environment variable of the QuickScript from the DXVK verb.
@ImperatorS79 Why guess? we can grab the vendor from linux environment
EDIT: Worst case scenario we force user-input
EDIT2: probably if we are unable to deduce the vendor -> force user-input
@plata How could I send the QuickScript
to the dxvk verb so that I could update the _environment
var ?
OK I have something that should work, we just have to change the prototype of preInstall
and postInstall
function:
this._preInstall(this, wine, setupWizard);
OK I have something that should work, we just have to change the prototype of
preInstall
andpostInstall
function:this._preInstall(this, wine, setupWizard);
Will you MR it?
It needs #956 first (which needs some changes in the GUI)
I think we must query the user because there might be a multi GPU setup (will the system provide the correct GPU?).
@plata That's what I am doing locally, the fix is ready, but I want your opinion about the preInstall change ^^.
Hard to tell without actually seeing it.
Just changing the prototype to this._preInstall(this, wine, setupWizard);
instead of this._preInstall(wine, setupWizard);
in any file using it so that I can access script variables.
I got that part. I'm interested in the part where you use the script variable.
I just get the script._environment
variable (in my new shortcut pr), to append to it the VK_ICD_FILENAMES
variable:
Wine.prototype.DXVK = function (quickscript, dxvkVersion) {
...
//Update environment to ensure the right GPU is loaded
var gpuType = this.wizard().menu("Please select the type of your main GPU", ["AMD", "Intel", "Nvidia"]);
var envJSON = {};
if (typeof quickscript._environment !== 'undefined'){
envJSON = JSON.parse(quickscript._environment);
}
if (gpuType.text == "Nvidia") {
envJSON["VK_ICD_FILENAMES"] = "/usr/share/vulkan/icd.d/nvidia_icd.json";
}
else if (gpuType.text == "AMD") {
if (this.architecture() == "amd64"){
envJSON["VK_ICD_FILENAMES"] = "/usr/share/vulkan/icd.d/radeon_icd.x86_64.json";
}
else{
envJSON["VK_ICD_FILENAMES"] = "/usr/share/vulkan/icd.d/radeon_icd.x86.json"; //To check
}
}
quickscript._environment = JSON.stringify(envJSON);
...
Won't this cause issues if you do not use a QuickScript?
All scripts inherit from QuickScript I think.
No. It's convenient but not required.
Which one does not inherit ? I just have to add the same logic for them.
Is there any reason why all scripts do not inherit from the same base ?
For example: https://github.com/PhoenicisOrg/scripts/blob/master/Applications/Internet/Internet%20Explorer%207.0/Online/script.js. We want to have the possibility to write completely free scripts as well.
Okay so I have to totally rethink how this could work :thinking:.
I fear so, yes. I also have no great idea right now.
Except: Can you not simply return the environment from the function?
Yes, I could the json string or object! But I still need the modification of .preInstall
^^.
Why? Once you are in the preInstall
, you should be able to access a variable in the script. A bit like here: https://github.com/PhoenicisOrg/scripts/blob/master/Applications/Games/Rocksmith%202014/Steam/script.js
In my implementation, the environment variables are stored in a variable of QuickScript
(and set with .environment()
function of QuickScript
). Since DXVK is executed in the preInstall, how could I modify that "private" variable without this ?
Can't you just call .environment()
after .preInstall()
?
But how do I recover the variables outputted by DXVK inside the .preInstall
?
Untested but can't you:
include("engines.wine.quick_script.steam_script");
var env = "";
var installerImplementation = {
run: function () {
new SteamScript()
.preInstall(function (wine, wizard) {
env =wine.DXVK();
})
.environment(env)
.go();
}
};
That seems really weird but worth trying.
EDIT: this will not work since .preInstall
only store the function which is executed in .go()
What if environment()
could also receive a function, like:
.environment(getDxvkEnvironment)
?
That sounds like a beautiful solution!
Works now -> DXVK verb update is required
Originally posted by @Kreyren in https://github.com/PhoenicisOrg/scripts/pull/965#issuecomment-499448221
VK_ICD_FILENAMES
variable has to be set depending on end-user system for games to work.