Skip to content
Open
Changes from 2 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
25 changes: 13 additions & 12 deletions Applications/Games/Subnautica/Steam/script.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const SteamScript = include("engines.wine.quick_script.steam_script");
const { getLatestStableVersion } = include("engines.wine.engine.versions");

const { getLatestDevelopmentVersion } = include("engines.wine.engine.versions");
const OverrideDLL = include("engines.wine.plugins.override_dll");
const { touch, writeToFile } = include("utils.functions.filesystem.files");
const VirtualDesktop = include("engines.wine.plugins.virtual_desktop");
const Vcrun2013 = include("engines.wine.verbs.vcrun2013");
const Corefonts = include("engines.wine.verbs.corefonts");
Expand All @@ -12,29 +13,29 @@ new SteamScript()
.author("Zemogiter")
.applicationHomepage("https://unknownworlds.com/subnautica/")
.wineDistribution("upstream")
.wineVersion(getLatestStableVersion)
.wineVersion(getLatestDevelopmentVersion)
.wineArchitecture("amd64")
.appId(264710)
.preInstall((wine) => {
const wizard = wine.wizard();

wizard.message(
tr("You can make the game smoother by using this: https://github.com/lutris/lutris/wiki/How-to:-Esync")
);

new Vcrun2013(wine).go();
new Corefonts(wine).go();
new DXVK(wine).go();

new OverrideDLL(wine)
.withMode("disabled", ["nvapi", "nvapi64"])
.go();
new VirtualDesktop(wine).go();
const dxvkConfigFile = wine.prefixDirectory() + "/drive_c/dxvk.conf";
touch(dxvkConfigFile);
writeToFile(dxvkConfigFile, "dxgi.nvapiHack = False");
})
.postInstall((wine) => {
const wizard = wine.wizard();

wizard.message(
tr(
"Due to a potential conflict with Vulkan, shader mods break the game (the executable file works but no window is displayed)."
"Due to a potential conflict with Vulkan, shader mods may break the game (the executable file works but no window is displayed)."
)
);
})
.gameOverlay(false);
.gameOverlay(false)
.environment('{"DXVK_CONFIG_FILE": "dxvkConfigFile", "STAGING_SHARED_MEMORY": "0", "WINEESYNC": "1"}')
Copy link
Copy Markdown
Contributor

@ImperatorS79 ImperatorS79 Jan 13, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will simply put the string dxvkConfigFile in the environment variable. Even with the right syntax, there is no dxvkConfigFile variable defined. The variable is only present in the lambda function code you pass to .postInstall. This will not work.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should I change it to wine.prefixDirectory() + "/drive_c/dxvk.conf"?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You cannot access wine is .environment since it is not defined. The best would be to modify .environment() function to get a lambda (wine) => {} so that .environment could call that lambda by sending it the wine object and get the string for the environment.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like this?

    environment(environment) {
        this._environment = environment;
        lambda(wine) => {};
        return this;
    }

Copy link
Copy Markdown
Contributor

@ImperatorS79 ImperatorS79 Jan 13, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something like this:

 environment(environmentFunc) {
        this._environment = environmentFunc(this.wine());
        return this;
    }

and you would call it like this

.environtment((wine) => {
    //do things to obtain the jsonString
    return jsonString;
})

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK now I get this error:

Error: The argument of environment() should be a function !
	at <js> environment(Unnamed:139:3777-3845)
	at <js> :program(Unnamed:14-45:689-1859)
	at org.graalvm.polyglot.Context.eval(Context.java:370)
	at org.phoenicis.scripts.engine.implementation.PolyglotScriptEngine.evalAndReturn(PolyglotScriptEngine.java:73)
	at org.phoenicis.scripts.session.PhoenicisInteractiveScriptSession.eval(PhoenicisInteractiveScriptSession.java:35)
	at 
org.phoenicis.scripts.interpreter.BackgroundScriptInterpreter.lambda$createInteractiveSession$1(BackgroundScriptInterpreter.java:45)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:834)
[ERROR] org.phoenicis.multithreading.ControlledThreadPoolExecutorService (l.64) - java.lang.ClassCastException: class java.lang.String cannot be cast to class org.graalvm.polyglot.Value (java.lang.String is in module java.base of loader 'bootstrap'; org.graalvm.polyglot.Value is in unnamed module of loader java.net.URLClassLoader @76c548f)
	at org.phoenicis.javafx.components.application.skin.ApplicationInformationPanelSkin.lambda$installScript$7(ApplicationInformationPanelSkin.java:235)
	at org.phoenicis.scripts.session.PhoenicisInteractiveScriptSession.eval(PhoenicisInteractiveScriptSession.java:35)
	at org.phoenicis.scripts.interpreter.BackgroundScriptInterpreter.lambda$createInteractiveSession$1(BackgroundScriptInterpreter.java:45)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:834)

[WARNING] 
java.lang.ClassCastException: class java.lang.String cannot be cast to class org.graalvm.polyglot.Value (java.lang.String is in module java.base of loader 'bootstrap'; org.graalvm.polyglot.Value is in unnamed module of loader java.net.URLClassLoader @76c548f)
    at org.phoenicis.javafx.components.application.skin.ApplicationInformationPanelSkin.lambda$installScript$7 (ApplicationInformationPanelSkin.java:235)
    at org.phoenicis.scripts.session.PhoenicisInteractiveScriptSession.eval (PhoenicisInteractiveScriptSession.java:35)
    at org.phoenicis.scripts.interpreter.BackgroundScriptInterpreter.lambda$createInteractiveSession$1 (BackgroundScriptInterpreter.java:45)
    at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1128)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:628)
    at java.lang.Thread.run (Thread.java:834)
Error: The argument of environment() should be a function !
	at <js> environment(Unnamed:139:3777-3845)
	at <js> :program(Unnamed:14-45:689-1859)
	at org.graalvm.polyglot.Context.eval(Context.java:370)
	at org.phoenicis.scripts.engine.implementation.PolyglotScriptEngine.evalAndReturn(PolyglotScriptEngine.java:73)
	at org.phoenicis.scripts.session.PhoenicisInteractiveScriptSession.eval(PhoenicisInteractiveScriptSession.java:35)
	at org.phoenicis.scripts.interpreter.BackgroundScriptInterpreter.lambda$createInteractiveSession$1(BackgroundScriptInterpreter.java:45)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:834)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the argument of environment in your script ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ImperatorS79 '{"DXVK_CONFIG_FILE": "dxvkConfigFile", "STAGING_SHARED_MEMORY": "0", "WINEESYNC": "1"}'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be:

.environment((wine) => {
    const dxvkConfigFile = wine.prefixDirectory() + "/drive_c/dxvk.conf";

    return  '{"DXVK_CONFIG_FILE": "${dxvkConfigFile}", "STAGING_SHARED_MEMORY": "0", "WINEESYNC": "1"}';
})

or something like this for the template string.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's done but wine.log still shows info: DXGI: NvAPI workaround enabled, reporting AMD GPU