Skip to content

Conversation

@ImperatorS79
Copy link
Contributor

@ImperatorS79 ImperatorS79 commented Mar 19, 2018

This is currently needed for every program that want to use vulkan on Wine 3.3 and greater(see https://github.com/roderickc/wine-vulkan/blob/master/README.md) (DOOM 2016 can then be updated to latest wine). However, I do not manage to create the right registry keys. the "\" does not appear, neither I use \ nor \\ in the .js

@plata
Copy link
Collaborator

plata commented Mar 20, 2018

Try a registry file as described in the wiki.

@plata plata mentioned this pull request Mar 20, 2018
@madoar
Copy link
Collaborator

madoar commented Mar 20, 2018

@plata maybe we can provide some kind of builder class/instance, that allows an easier building of registry files?

@plata
Copy link
Collaborator

plata commented Mar 20, 2018

@madoar if you have an idea how this could look like, feel free to describe it in a new issue (we should not discuss this here).

@ImperatorS79
Copy link
Contributor Author

I get this error now

javax.script.ScriptException: TypeError: null has no such function "getClass" in [Engines, Wine, Engine, Object] at line number 610
	at jdk.nashorn.api.scripting.NashornScriptEngine.throwAsScriptException(NashornScriptEngine.java:470)
	at jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:454)
	at jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:406)
	at jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:402)
	at jdk.nashorn.api.scripting.NashornScriptEngine.eval(NashornScriptEngine.java:155)
	at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:264)
	at org.phoenicis.scripts.nashorn.NashornEngine.eval(NashornEngine.java:50)
	at org.phoenicis.scripts.nashorn.NashornScriptInterpreter.runScript(NashornScriptInterpreter.java:35)
	at org.phoenicis.scripts.interpreter.BackgroundScriptInterpreter.lambda$runScript$0(BackgroundScriptInterpreter.java:35)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
Caused by: [Engines, Wine, Engine, Object]:610 TypeError: null has no such function "getClass"
	at jdk.nashorn.internal.runtime.ECMAErrors.error(ECMAErrors.java:57)
	at jdk.nashorn.internal.runtime.ECMAErrors.typeError(ECMAErrors.java:213)
	at jdk.nashorn.internal.runtime.ECMAErrors.typeError(ECMAErrors.java:185)
	at jdk.nashorn.internal.runtime.ECMAErrors.typeError(ECMAErrors.java:172)
	at jdk.nashorn.internal.runtime.linker.NashornBottomLinker.linkNull(NashornBottomLinker.java:180)
	at jdk.nashorn.internal.runtime.linker.NashornBottomLinker.getGuardedInvocation(NashornBottomLinker.java:66)
	at jdk.internal.dynalink.support.CompositeGuardingDynamicLinker.getGuardedInvocation(CompositeGuardingDynamicLinker.java:124)
	at jdk.internal.dynalink.support.LinkerServicesImpl.getGuardedInvocation(LinkerServicesImpl.java:154)
	at jdk.internal.dynalink.DynamicLinker.relink(DynamicLinker.java:253)
	at jdk.nashorn.internal.scripts.Script$Recompilation$200$16297A$\^eval\_.regedit#patch([Engines, Wine, Engine, Object]:610)
	at jdk.nashorn.internal.scripts.Script$Recompilation$194$476$\^eval\_.vulkanSDK([Engines, Wine, Verbs, vulkanSDK]:36)
	at jdk.nashorn.internal.scripts.Script$Recompilation$193$745AA$\^eval\_.L:18(<eval>:19)
	at jdk.nashorn.internal.scripts.Script$Recompilation$149$560$\^eval\_.go([Engines, Wine, QuickScript, InstallerScript]:79)
	at jdk.nashorn.internal.scripts.Script$123$\^eval\_.:program(<eval>:8)
	at jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:637)
	at jdk.nashorn.internal.runtime.ScriptFunction.invoke(ScriptFunction.java:494)
	at jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:393)
	at jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:449)
	... 10 more

@plata
Copy link
Collaborator

plata commented Mar 21, 2018

Sorry, my bad: that approach works only for applications.

Have a look at the dotnet40 verb:

this.run("reg", ["add", "HKLM\Software\Microsoft\NET Framework Setup\NDP\v4\Full", "/v", "Install", "/t", "REG_DWORD", "/d", "0001", "/f"])
        .wait(tr("Please wait ..."));

@ImperatorS79
Copy link
Contributor Author

I do not manage to create the key with this method

@plata
Copy link
Collaborator

plata commented Mar 22, 2018

Any idea what's going wrong (I actually never tried this myself).

@madoar
Copy link
Collaborator

madoar commented Mar 24, 2018

I believe the problem occurs because of the line:

var registrySettings = new AppResource().application([TYPE_ID, CATEGORY_ID, APPLICATION_ID]).get("vulkan.reg");

I believe that registrySettings is null afterwards.
I believe we need to look inside AppResource, to find out what goes wrong.
@plata I can't seem to find the location in the POL-POM repository, where we define AppResource, do you know where we do this?

@plata
Copy link
Collaborator

plata commented Mar 24, 2018

The line cannot work because TYPE_ID etc. is not set for verbs. This is why I said above that a different approach must be used.
AppResource is here: https://github.com/PhoenicisOrg/Scripts/tree/master/Utils/Functions/Apps/Resources

@madoar
Copy link
Collaborator

madoar commented Mar 24, 2018

I understand.
I guess we need a kind of injection mechanism, which injects such information during script execution.
I think this could also solve PhoenicisOrg/phoenicis#1179.

The question then is how do we want to write such a mechanism, how/where should it be called and what values need to be injected.

@plata
Copy link
Collaborator

plata commented Mar 24, 2018

The basic problem here is that a verb is simply not an application. So trying to use AppResource in the context of a verb doesn't make any sense. Moreover, the verb is called from the app script, so who should inject that information?
As e.g. dotnet40 uses the other mechanism, I think we should go with that one to solve the problem here.
Let's think about the injection somewhere else.

@madoar
Copy link
Collaborator

madoar commented Mar 24, 2018

That is not entirely true.

I think in total we have two points where we could intervene:

  1. The first point is before the entire script is executed by nashorn.
    At this point in time it's possible for us to set some global variables for the script.
    These variables should then be accessible from inside the application and from every included verb.
  2. The second point is inside the execution of the include function.
    When an include function is called from inside a script IncludeInjector#injectInto is called.
    At this point we also have the freedom to "inject" some code

You're right this may not be the location to discuss this in detail.

@ImperatorS79
Copy link
Contributor Author

ImperatorS79 commented Mar 25, 2018

I would like to add a check for the wine version. Something like if(this._wineVersion>"3.4"). Is it possible ?

Edit : BTW it should be possible to install a verb in an existing prefix (like in POL4).

@plata
Copy link
Collaborator

plata commented Mar 27, 2018

this.version() should work. However, be careful with the compare (e.g. "3.10" < "3.4").

Please open an issue for that feature request.

@ImperatorS79
Copy link
Contributor Author

ImperatorS79 commented Mar 27, 2018

I wanted to throw an error in case the user wanted to install vulkanSDK in a prefix with wine version <3.4. But it's not really necessary actually :) (and it is not in winetricks verb) so i will add a debug note.

@plata
Copy link
Collaborator

plata commented Jun 14, 2018

Can you provide the log in English?

@ImperatorS79
Copy link
Contributor Author

ImperatorS79 commented Jun 14, 2018

"Aucun fichier ou dossier de ce type" = "No file or folder of this type". Log updated.

@plata
Copy link
Collaborator

plata commented Jun 14, 2018

Are you sure that the recent master is merged correctly into your branch? The error should occur in the Wine implementation and not the object.

@ImperatorS79
Copy link
Contributor Author

Yes I am, I have just tested it right now with the default repository.

@ImperatorS79
Copy link
Contributor Author

ImperatorS79 commented Jun 14, 2018

Here is the log :

[ERROR] org.phoenicis.javafx.views.common.ErrorMessage (l.75) - java.lang.RuntimeException: java.io.IOException: Cannot run program "/home/test/.Phoenicis/engines//wine/upstream-linux-x86/3.0.1/bin/wine" (in directory "/home/test/.Phoenicis/containers/wineprefix/7-zip"): error=2, No file or folder of this type
	at org.phoenicis.engines.Engine$$NashornJavaAdapter.run(Unknown Source)
	at jdk.nashorn.internal.scripts.Script$Recompilation$197$4765AAAZZA$\^eval\_.run([engines, wine, engine, object]:168)
	at jdk.nashorn.internal.scripts.Script$Recompilation$196$251A$\^eval\_.regedit#open([engines, wine, plugins, regedit]:12)
	at jdk.nashorn.internal.scripts.Script$Recompilation$185$348$\^eval\_.luna([engines, wine, verbs, luna]:29)
	at jdk.nashorn.internal.scripts.Script$Recompilation$163$565$\^eval\_.go([engines, wine, quick_script, installer_script]:72)
	at jdk.nashorn.internal.scripts.Script$Recompilation$151$221$\^eval\_.run(<eval>:9)
	at org.phoenicis.scripts.Installer$$NashornJavaAdapter.run(Unknown Source)
	at jdk.nashorn.internal.scripts.Script$126$\^eval\_.:program(<eval>:25)
	at jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:637)
	at jdk.nashorn.internal.runtime.ScriptFunction.invoke(ScriptFunction.java:494)
	at jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:393)
	at jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:449)
	at jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:406)
	at jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:402)
	at jdk.nashorn.api.scripting.NashornScriptEngine.eval(NashornScriptEngine.java:155)
	at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:264)
	at org.phoenicis.scripts.nashorn.NashornEngine.eval(NashornEngine.java:50)
	at org.phoenicis.scripts.nashorn.NashornScriptInterpreter.runScript(NashornScriptInterpreter.java:35)
	at org.phoenicis.scripts.interpreter.BackgroundScriptInterpreter.lambda$runScript$0(BackgroundScriptInterpreter.java:35)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.io.IOException: Cannot run program "/home/test/.Phoenicis/engines//wine/upstream-linux-x86/3.0.1/bin/wine" (in directory "/home/test/.Phoenicis/containers/wineprefix/7-zip"): error=2, No file or folder of this type
	at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
	at jdk.nashorn.internal.scripts.Script$Recompilation$137$7731AAAAAA$\^eval\_.run([engines, wine, engine, implementation]:269)
	... 22 more
Caused by: java.io.IOException: error=2, No file or folder of this type
	at java.lang.UNIXProcess.forkAndExec(Native Method)
	at java.lang.UNIXProcess.<init>(UNIXProcess.java:247)
	at java.lang.ProcessImpl.start(ProcessImpl.java:134)
	at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
	... 23 more

@plata
Copy link
Collaborator

plata commented Jun 14, 2018

But you can install 7-zip without vulkanSDK?

@ImperatorS79
Copy link
Contributor Author

ImperatorS79 commented Jun 14, 2018

The last log is for the normal script of 7-zip (without vulkanSDK)

@plata
Copy link
Collaborator

plata commented Jun 14, 2018

That's weird. I just tried 7-zip on my machine without a problem. Can you try again in a clean environment and everything from current master.

@ImperatorS79
Copy link
Contributor Author

Did it, same results. I will have to test this on my main pc to see, because it seems related to my vm.

@ImperatorS79
Copy link
Contributor Author

ImperatorS79 commented Jun 15, 2018

🤦‍♂️ I did not have the dependencies to run 32 bits programs (i deleted them...)
Sorry...

Still got the error : javax.script.ScriptException: TypeError: null has no such function "getClass" in [engines, wine, plugins, regedit] at line number 17

@plata
Copy link
Collaborator

plata commented Jun 15, 2018

That error makes sense. TYPE_ID etc. refer to the application which uses the verb and not to the verb itself. You can try to use the IDs as specified in the json files. So in this case it should be:

var registrySettings32 = new AppResource().application(["engines", "wine", "verbs"]).get("vulkan.reg");

But: this would require to put the "vulkan.reg" into the "Verbs" directory directly. The reason is the currently very fixed repository structure. #543 could help here.

@ImperatorS79
Copy link
Contributor Author

It did not work that way, same error.

@plata
Copy link
Collaborator

plata commented Jun 15, 2018

What if you write the content of the reg file into the script directly (as string)?

@ImperatorS79
Copy link
Contributor Author

ImperatorS79 commented Jun 19, 2018

The problem with the string is, despite using \\, the key created is C:Windowswinevulkan.json instead of C:\Windows\winevulkan.json.

EDIT : ok it's a \\\\... Verb working.

* @returns {Wine} Wine object
*/
Wine.prototype.vulkanSDK = function () {
print("NOTE: you need a driver that support Vulkan enough to run winevulkan");
Copy link
Collaborator

Choose a reason for hiding this comment

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

"supports". Can we be more clear about the meaning of "supports Vulkan enough"?


var setupFile = new Resource()
.wizard(this.wizard())
.url("https://sdk.lunarg.com/sdk/download/1.1.73.0/windows/VulkanSDK-1.1.73.0-Installer.exe")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Use a variable for the version such that it can be changed easily later on.

include(["engines", "wine", "plugins", "regedit"]);
include(["utils", "functions", "net", "resource"]);
include(["utils", "functions", "filesystem", "files"]);
include(["utils", "functions", "apps", "resources"]);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is

include(["utils", "functions", "apps", "resources"]);

still required?

@plata plata changed the title Added vulkanSDK verb Add vulkanSDK verb Jun 26, 2018
@plata plata merged commit 69c90d5 into PhoenicisOrg:master Jun 26, 2018
@ImperatorS79 ImperatorS79 deleted the vulkanSDK branch October 19, 2018 07:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants