Skip to content
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

Add Heroes of Might and Magic IV #1144

Open
wants to merge 36 commits into
base: master
Choose a base branch
from

Conversation

Zemogiter
Copy link
Contributor

@Zemogiter Zemogiter commented Dec 1, 2019

Description

When the wineprefix is created and just before the selected .exe file is launched, installation crashes with this error:

[ERROR] org.phoenicis.multithreading.ControlledThreadPoolExecutorService (l.64) - Input/Output error
	at java.base/java.io.FileInputStream.readBytes(Native Method)
	at java.base/java.io.FileInputStream.read(FileInputStream.java:257)
	at org.apache.commons.io.input.ProxyInputStream.read(ProxyInputStream.java:78)
	at org.phoenicis.win32.pe.PEReader.readDosHeader(PEReader.java:93)
	at org.phoenicis.win32.pe.PEReader.parseExecutable(PEReader.java:30)
	at org.phoenicis.tools.win32.ExeAnalyser.isArchitecture(ExeAnalyser.java:62)
	at org.phoenicis.tools.win32.ExeAnalyser.is64Bits(ExeAnalyser.java:46)
	at <js> run(Unnamed:413:15444-15490)
	at <js> run(Unnamed:171:5412-5502)
	at <js> go(Unnamed:88:3412-3493)
	at com.oracle.truffle.polyglot.ObjectProxyHandler.invoke(HostInteropReflect.java:678)
	at com.sun.proxy.$Proxy66.go(Unknown Source)
	at org.phoenicis.javafx.components.application.skin.ApplicationInformationPanelSkin.lambda$installScript$7(ApplicationInformationPanelSkin.java:237)
	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)
Caused by host exception: java.io.IOException: Błąd wejścia/wyjścia

[WARNING] 
org.graalvm.polyglot.PolyglotException: Input/Output error
    at java.io.FileInputStream.readBytes (Native Method)
    at java.io.FileInputStream.read (FileInputStream.java:257)
    at org.apache.commons.io.input.ProxyInputStream.read (ProxyInputStream.java:78)
    at org.phoenicis.win32.pe.PEReader.readDosHeader (PEReader.java:93)
    at org.phoenicis.win32.pe.PEReader.parseExecutable (PEReader.java:30)
    at org.phoenicis.tools.win32.ExeAnalyser.isArchitecture (ExeAnalyser.java:62)
    at org.phoenicis.tools.win32.ExeAnalyser.is64Bits (ExeAnalyser.java:46)
    at <js>.run (Unnamed:413)
    at <js>.run (Unnamed:171)
    at <js>.go (Unnamed:88)
    at com.oracle.truffle.polyglot.ObjectProxyHandler.invoke (HostInteropReflect.java:678)
    at com.sun.proxy.$Proxy66.go (Unknown Source)
    at org.phoenicis.javafx.components.application.skin.ApplicationInformationPanelSkin.lambda$installScript$7 (ApplicationInformationPanelSkin.java:237)
    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)

This error is caused by the setup.exe file in my cd disc being weird. Not corrupted because installation from it works in Windows. However I tried a local GOG installer and it works just fine.

The main objective is to get this game to work and install this mod:
https://equilibris.celestialheavens.com/eng/downloads.html
To fix game balance and bugs.

What works

Installation using GOG installation file and the game itself

What was not tested

Running the Equilibris mod due to the script searching for H4mod.exe file right after the game installation process ends. This file is created after the mod installation is finished. Fixed by #1170
Now it's the equi.aop file download that crashes the script:

[ERROR] org.phoenicis.multithreading.ControlledThreadPoolExecutorService (l.64) - Download of https://equilibris.celestialheavens.com/downloads/equi.aop has failed
	at org.phoenicis.tools.http.Downloader.get(Downloader.java:108)
	at org.phoenicis.tools.http.Downloader.get(Downloader.java:81)
	at <js> get(Unnamed:135-144:3540-3841)
	at <js> :=>(Unnamed:37-42:1612-1857)
	at <js> go(Unnamed:98:3725-3760)
	at com.oracle.truffle.polyglot.ObjectProxyHandler.invoke(HostInteropReflect.java:678)
	at com.sun.proxy.$Proxy68.go(Unknown Source)
	at org.phoenicis.javafx.components.application.skin.ApplicationInformationPanelSkin.lambda$installScript$7(ApplicationInformationPanelSkin.java:237)
	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)
Caused by host exception: org.phoenicis.tools.http.DownloadException: Download of https://equilibris.celestialheavens.com/downloads/equi.aop has failed

[WARNING] 
org.graalvm.polyglot.PolyglotException: Download of https://equilibris.celestialheavens.com/downloads/equi.aop has failed
    at org.phoenicis.tools.http.Downloader.get (Downloader.java:108)
    at org.phoenicis.tools.http.Downloader.get (Downloader.java:81)
    at <js>.get (Unnamed:135)
    at <js>.:=> (Unnamed:37)
    at <js>.go (Unnamed:98)
    at com.oracle.truffle.polyglot.ObjectProxyHandler.invoke (HostInteropReflect.java:678)
    at com.sun.proxy.$Proxy68.go (Unknown Source)
    at org.phoenicis.javafx.components.application.skin.ApplicationInformationPanelSkin.lambda$installScript$7 (ApplicationInformationPanelSkin.java:237)
    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)

Test

  • Operating system (and linux kernel version): Ubuntu 19.10 5.3.0-23-generic
  • Hardware (GPU/CPU):
    i7-7700K, GTX1080 ti

Ready for review

  • Script tested as a regular phoenicis user and working (if you have a problem -> create as draft and ask for help).
  • json-align and eslint run according to the documentation.
  • Codacy and travis checked.

Update the fork with changes from master fork.
Merging changes to the fork
Merging updates from master fork
Merging changes from master
Updated the way virtual desktop plugin is used.
@plata
Copy link
Collaborator

plata commented Dec 4, 2019

Can you translate this:

Caused by host exception: java.io.IOException: Błąd wejścia/wyjścia

?

@Zemogiter
Copy link
Contributor Author

Input/output error

@madoar
Copy link
Collaborator

madoar commented Dec 12, 2019

Most likely something is wrong with either the exe file itself or the handling code of it.

@Zemogiter
Copy link
Contributor Author

Zemogiter commented Dec 13, 2019

Just tried launching the setup.exe in vanilla wine. I got a error screen with three rectangular symbols (usually used when something dosen't recorgnize a character) followed by 9 "file not found" messages, each appearing after the previous one was closed. The file works fine in Windows 64bit so it's a Wine issue.
UPDATE: Tried wine version 3.0.3 because it was the latest one tested in AppDB. Same error happens.

@madoar
Copy link
Collaborator

madoar commented Dec 15, 2019

By wine error you mean an error unrelated to phoenicis or is it because of something happening in phoenicis-winebuild?

@Zemogiter
Copy link
Contributor Author

Zemogiter commented Dec 17, 2019

I think it's unrelated to phoenicis because I get errors when launching setup.exe file regardless.

Added the rest of necessary files (self extracting archives, needed becuase Equilibris is chesksum-sensitive), code cleanup.
@Zemogiter
Copy link
Contributor Author

Zemogiter commented Dec 19, 2019

Tried my instalation disc in Lutris. Dosen't work there as well. Tried GOG installer and it works. But the default installation directory is different than installing from CD.
UPDATE: It seems my iso file was corrupted all along...
Because when use a physical disc the exe file starts and installation goes normally. Installation crashes with an error. I'll see if it will work on windows.
UPDATE 2: The disc works fine on windows.

@Zemogiter Zemogiter marked this pull request as ready for review December 20, 2019 10:18
@madoar madoar added the WIP Work in progress label Dec 23, 2019
@plata
Copy link
Collaborator

plata commented Dec 28, 2019

@Zemogiter you've marked this as ready for review but the PR description says that nothing is working. What's the status of this PR?

@Zemogiter
Copy link
Contributor Author

@plata op just updated

Fixed typos, using consts instead of vars.
Corrected wizard usage, using new wine version calling
@madoar
Copy link
Collaborator

madoar commented Jan 3, 2020

@Zemogiter how is the current state of this PR? Is it installable/runnable or is it still work in progress?

@Zemogiter
Copy link
Contributor Author

@madoar For some reason the script ignores the postInstall() stage and tries to look for H4mod.exe file which dosen't exist yet.

@madoar
Copy link
Collaborator

madoar commented Jan 4, 2020

... and tries to look for H4mod.exe file which dosen't exist yet.

You mean during shortcut creation?

The reason is that the postInstall hook is executed after the installation has been finished and the shortcut been created. See:

this._preInstall(wine, setupWizard);
// back to generic wait (might have been changed in preInstall)
setupWizard.wait(tr("Please wait..."));
wine.run(installationCommand.command, installationCommand.args, null, false, true);
// if no executable given, ask user
if (!this._executable) {
this._executable = fileName(
setupWizard.browse(tr("Please select the executable."), wine.prefixDirectory(), ["exe"])
);
}
this._createShortcut(wine.prefix());
this._postInstall(wine, setupWizard);

Maybe you want to use the preInstall hook instead?

@Zemogiter
Copy link
Contributor Author

Zemogiter commented Jan 4, 2020

That is not possible because the game must be installed in order to run both patch resources and mod resource.
A better option would be to swap places with this._createShortcut and this._postInstall

@madoar
Copy link
Collaborator

madoar commented Jan 4, 2020

@plata what do you think, should we swap this._createShortcut and this._postInstall?

@plata
Copy link
Collaborator

plata commented Jan 4, 2020

I have something in the back of my head that we had a reason to do it like this. I cannot remember though.

@Zemogiter
Copy link
Contributor Author

Zemogiter commented Jan 4, 2020

After the latest commit and swaping shortcut and postInstall the two patch files download and run successfully. But equi.aop crashes:

[ERROR] org.phoenicis.multithreading.ControlledThreadPoolExecutorService (l.64) - Download of https://equilibris.celestialheavens.com/downloads/equi.aop has failed
	at org.phoenicis.tools.http.Downloader.get(Downloader.java:108)
	at org.phoenicis.tools.http.Downloader.get(Downloader.java:81)
	at <js> get(Unnamed:135-144:3540-3841)
	at <js> :=>(Unnamed:37-42:1612-1857)
	at <js> go(Unnamed:98:3725-3760)
	at com.oracle.truffle.polyglot.ObjectProxyHandler.invoke(HostInteropReflect.java:678)
	at com.sun.proxy.$Proxy68.go(Unknown Source)
	at org.phoenicis.javafx.components.application.skin.ApplicationInformationPanelSkin.lambda$installScript$7(ApplicationInformationPanelSkin.java:237)
	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)
Caused by host exception: org.phoenicis.tools.http.DownloadException: Download of https://equilibris.celestialheavens.com/downloads/equi.aop has failed

[WARNING] 
org.graalvm.polyglot.PolyglotException: Download of https://equilibris.celestialheavens.com/downloads/equi.aop has failed
    at org.phoenicis.tools.http.Downloader.get (Downloader.java:108)
    at org.phoenicis.tools.http.Downloader.get (Downloader.java:81)
    at <js>.get (Unnamed:135)
    at <js>.:=> (Unnamed:37)
    at <js>.go (Unnamed:98)
    at com.oracle.truffle.polyglot.ObjectProxyHandler.invoke (HostInteropReflect.java:678)
    at com.sun.proxy.$Proxy68.go (Unknown Source)
    at org.phoenicis.javafx.components.application.skin.ApplicationInformationPanelSkin.lambda$installScript$7 (ApplicationInformationPanelSkin.java:237)
    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)

.wineVersion(getLatestDevelopmentVersion)
.executable("H4mod.exe")
.postInstall((wine) => {
const dataDirectory = wine.prefixDirectory() + "drive_c/" + wine.programFiles() + "Ubisoft/Heroes of Might & Magic IV - Złota Edycja/Data";
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this folder really correct? Heroes of Might & Magic IV - Złota Edycja looks to me like a localized (translated) string and nothing a publisher would normally use

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a default install location of my cd disc. I've set it in GOG local installer and it is correct.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@madoar is correct. This will very likely not work in other countries. Maybe you can solve it with a regular expression. So: ls for the "Ubisoft" folder and then find the "Heroes of Might & Magic IV" folder.
Could even be enough to use startsWith.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@plata the "Ubisoft" part is only there when you install from the disc. GOG installer uses "GOG.com" instead

Copy link
Collaborator

Choose a reason for hiding this comment

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

Shouldn't we have different installers then?

Adding wine.wait() so user won't get two patch windows at the same time.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
WIP Work in progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants