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

Rework installation of windows games #624

Merged
merged 10 commits into from
Dec 10, 2024

Conversation

GB609
Copy link
Collaborator

@GB609 GB609 commented Dec 2, 2024

Description

This PR offers a complete rework of the installer.py:extract_windows installation method for windows games.

  1. There is no temporary directory involved anymore.
  2. Thus, no linking of an additional dosdevice to temp, paths remain constant throughout the entire lifetime of the game install
  3. The game installation path within the wine prefix will be set (and assumed to be) c:\game. Removing the temporary directory and using a fixed path will avoid any issues with registry keys created during installation.
  4. The installer tries the windows installation with 2 sets of arguments. First fully unattended. When this fails, it will try to open the manual installation dialog, but preconfigured with c:\game as target dir. Potential TODO: Show an additional dialog in the fallback situation to ask users not to change the directory name. The fallback is necessary as some installer seem to reject the /SILENT argument. I've had this with 'Lethis - Path of progress' and 'Record of Agarest War'. Maybe there is a GOG Galaxy api we could use to get the required args and fix this for good without fallback.
  5. During game installation, winemenubuilder is disabled to prevent wine from creating desktop shortcuts outside of Minigalaxy's control.
  6. Shortcut creation done by Minigalaxy was changed to correctly include the command prefix 'env ...'. Commands placed in the Exec property are now correctly and fully shell-style quoted by shlex, instead of manual escaping.

The changes to the installer and how wine environment variables are handled made it also necessary to touch the launcher to correctly configure wine prefixes on launch.
Wherever necessary and possible, wine commands now use 'env' as prefix for configuration, Minigalaxy will not modify its own environment any longer.

I have also used shlex for parsing and command generation to improve handling of quotes and spaces. This makes it possible to use env variables or arguments containing spaces in the game properties (if quoted correctly).

installer.py:_exe_cmd was also reworked to use poll() and readline instead of communicate(). The reason for that is that wine can be very verbose with its stdout and i'm trying to prevent process buffers from filling up and thus effectively halting an installation. I think i've had this with a game that also installed directx afterwards where using communicate would never return because the directx installation was apparently frozen.

The downside of these changes is that they are not entirely free of potentially breaking backwards compatibility. Games that save directory paths to registry and were installed through wine before this PR might break (although it is more likely they didn't work before).
I've tried to keep the effects as small as possible, by adding a few lines of code in launcher.py which try to restore the c:\game link on game launching. Desktop shortcuts are not regenerated and launching over shortcuts won't apply the fix.

But i've also added a note in the readme about this. If that is not the right place, just tell me where and what i shall add instead.

The initial change to the installation is also included in #622, but with some enhancements to also handle umu. The fallback solution is new to this branch.

Checklist

  • CHANGELOG.md was updated (format: - Change made (thanks to github_username))

Edit: Adding TODOs from discussion here for easier tracking:

2516779478:

  • install game with inno and test for working c:\game link

2516801895:

  • manual test installation with inno success for temp_dir cleanup and NOT wine fallback
  • manual test installation with inno extract ok but total failure, working wine fallback: temp_dir cleanup, usage of files from temp?

2520299969

  • double-check wine installer language
  • configure language in game launched in wine

@sharkwouter
Copy link
Owner

Thanks! I really appreciate this work. I'll review it this week, hopefully tonight.

@GB609
Copy link
Collaborator Author

GB609 commented Dec 3, 2024

@sharkwouter You're welcome. Take all the time you need.

There's more to come.
Just didn't want to put it all into one PR because that would become pretty large.
When this installer proofs to be sufficiently stable, i wanted to make the choice inno vs. wine configurable so that minigalaxy won't automatically prefer inno. This makes testing and using both much more convenient because the system packages won't need to be removed.

@sharkwouter
Copy link
Owner

Cool! It's best to keep PRs small, preferably a single feature. That makes it much easier to review. This one is fine, though, I can review this one.

minigalaxy/installer.py Outdated Show resolved Hide resolved
Copy link
Owner

@sharkwouter sharkwouter left a comment

Choose a reason for hiding this comment

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

Hey @GB609, thanks again for this PR. I found some small things, but this is looking pretty good. I added one little note for myself and some for you. This does look like a big improvement, though.

minigalaxy/installer.py Outdated Show resolved Hide resolved
minigalaxy/launcher.py Show resolved Hide resolved
minigalaxy/launcher.py Outdated Show resolved Hide resolved
minigalaxy/launcher.py Show resolved Hide resolved
minigalaxy/installer.py Outdated Show resolved Hide resolved
minigalaxy/installer.py Outdated Show resolved Hide resolved
minigalaxy/installer.py Outdated Show resolved Hide resolved
minigalaxy/installer.py Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
minigalaxy/installer.py Outdated Show resolved Hide resolved
@sharkwouter
Copy link
Owner

I think I found an issue with the shortcut fix in here:

trying to run wine command: env 'WINEPREFIX=/home/wouter/GOG Games/Fallout Classic/prefix' WINEDLLOVERRIDES=winemenubuilder.exe=d /usr/bin/wine '/home/wouter/.cache/minigalaxy/download/Fallout Classic/setup_fallout_2.1.0.18.exe' '/DIR=c:\game' '/LOG=c:\install.log' /LANG=en '/SAVEINF=c:\setup.inf' /SILENT
executing wine command: env 'WINEPREFIX=/home/wouter/GOG Games/Fallout Classic/prefix' WINEDLLOVERRIDES=winemenubuilder.exe=d /usr/bin/wine '/home/wouter/.cache/minigalaxy/download/Fallout Classic/setup_fallout_2.1.0.18.exe' '/DIR=c:\game' '/LOG=c:\install.log' /LANG=en '/SAVEINF=c:\setup.inf' /SILENT
002c:err:wineboot:process_run_key Error running cmd L"C:\\windows\\system32\\winemenubuilder.exe -a -r" (126).
007c:fixme:hid:handle_IRP_MN_QUERY_ID Unhandled type 00000005
007c:fixme:hid:handle_IRP_MN_QUERY_ID Unhandled type 00000005
007c:fixme:hid:handle_IRP_MN_QUERY_ID Unhandled type 00000005
007c:fixme:hid:handle_IRP_MN_QUERY_ID Unhandled type 00000005
0024:fixme:thread:GetThreadUILanguage : stub, returning default language.
0024:fixme:nls:RtlGetThreadPreferredUILanguages 00000038, 0054D998, 00000000 0054D9C0
0024:fixme:nls:get_dummy_preferred_ui_language (0x38 0x409 0054D998 00000000 0054D9C0) returning a dummy value (current locale)
0024:fixme:nls:RtlGetThreadPreferredUILanguages 00000038, 0054D998, 015519B0 0054D9C0
0024:fixme:nls:get_dummy_preferred_ui_language (0x38 0x409 0054D998 015519B0 0054D9C0) returning a dummy value (current locale)
0108:fixme:win:DisableProcessWindowsGhosting : stub
0108:fixme:graphics:ShutdownBlockReasonDestroy (00010094): stub
0108:fixme:graphics:ShutdownBlockReasonCreate (00010094, L"Installing"): stub
0108:fixme:rstrtmgr:RmStartSession 0050D024, 0, 0050D028 stub!
0108:fixme:graphics:ShutdownBlockReasonDestroy (00010094): stub
0108:fixme:graphics:ShutdownBlockReasonCreate (00010094, L"Installing Fallout."): stub
0108:fixme:msg:ChangeWindowMessageFilterEx 000200A2 c04e 1 00000000
0108:fixme:msg:ChangeWindowMessageFilterEx 000300A2 c04e 1 00000000
0108:fixme:msg:ChangeWindowMessageFilterEx 000100AC c04e 1 00000000
0108:fixme:msg:ChangeWindowMessageFilterEx 000200AC c04e 1 00000000
0108:fixme:shell:SHAutoComplete stub
0108:fixme:msg:ChangeWindowMessageFilterEx 000300B2 c04e 1 00000000
0108:fixme:wincodecs:jpeg_decoder_get_metadata_blocks stub
0108:fixme:gdiplus:resample_bitmap_pixel Unimplemented interpolation 6
0108:fixme:rstrtmgr:RmEndSession 3735928559 stub!
0108:fixme:graphics:ShutdownBlockReasonDestroy (00010094): stub
command finished, read remaining output (if any)
done


Unattended install failed. Try install with wizard dialog.

@sharkwouter
Copy link
Owner

I would suggest leaving out the menu shortcuts fix for now. We can figure that out later.

@sharkwouter
Copy link
Owner

This change does actually fix 1nsane, which is really cool to see.

@sharkwouter
Copy link
Owner

sharkwouter commented Dec 4, 2024

I found this: https://documentation.help/Inno-Setup/topic_setupcmdline.htm

We can actually use the /NOICONS option to make sure the installers do not create menu shortcuts.

@sharkwouter
Copy link
Owner

sharkwouter commented Dec 4, 2024

You might want to prevent Innoextract from being used for extraction honestly. It looks like with this change innoextract is being executed to extract the game and then the extracted files are fully ignored.

@sharkwouter
Copy link
Owner

I found another bug. If the innoextract installation works, it is not possible to launch the game anymore with this change, since the game files are not inside the prefix and the new code does not account for that.

@GB609
Copy link
Collaborator Author

GB609 commented Dec 4, 2024

I think I found an issue with the shortcut fix in here:

trying to run wine command: env 'WINEPREFIX=/home/wouter/GOG Games/Fallout Classic/prefix' WINEDLLOVERRIDES=winemenubuilder.exe=d /usr/bin/wine '/home/wouter/.cache/minigalaxy/download/Fallout Classic/setup_fallout_2.1.0.18.exe' '/DIR=c:\game' '/LOG=c:\install.log' /LANG=en '/SAVEINF=c:\setup.inf' /SILENT
executing wine command: env 'WINEPREFIX=/home/wouter/GOG Games/Fallout Classic/prefix' WINEDLLOVERRIDES=winemenubuilder.exe=d /usr/bin/wine '/home/wouter/.cache/minigalaxy/download/Fallout Classic/setup_fallout_2.1.0.18.exe' '/DIR=c:\game' '/LOG=c:\install.log' /LANG=en '/SAVEINF=c:\setup.inf' /SILENT
002c:err:wineboot:process_run_key Error running cmd L"C:\\windows\\system32\\winemenubuilder.exe -a -r" (126).
007c:fixme:hid:handle_IRP_MN_QUERY_ID Unhandled type 00000005
007c:fixme:hid:handle_IRP_MN_QUERY_ID Unhandled type 00000005
007c:fixme:hid:handle_IRP_MN_QUERY_ID Unhandled type 00000005
007c:fixme:hid:handle_IRP_MN_QUERY_ID Unhandled type 00000005
0024:fixme:thread:GetThreadUILanguage : stub, returning default language.
0024:fixme:nls:RtlGetThreadPreferredUILanguages 00000038, 0054D998, 00000000 0054D9C0
0024:fixme:nls:get_dummy_preferred_ui_language (0x38 0x409 0054D998 00000000 0054D9C0) returning a dummy value (current locale)
0024:fixme:nls:RtlGetThreadPreferredUILanguages 00000038, 0054D998, 015519B0 0054D9C0
0024:fixme:nls:get_dummy_preferred_ui_language (0x38 0x409 0054D998 015519B0 0054D9C0) returning a dummy value (current locale)
0108:fixme:win:DisableProcessWindowsGhosting : stub
0108:fixme:graphics:ShutdownBlockReasonDestroy (00010094): stub
0108:fixme:graphics:ShutdownBlockReasonCreate (00010094, L"Installing"): stub
0108:fixme:rstrtmgr:RmStartSession 0050D024, 0, 0050D028 stub!
0108:fixme:graphics:ShutdownBlockReasonDestroy (00010094): stub
0108:fixme:graphics:ShutdownBlockReasonCreate (00010094, L"Installing Fallout."): stub
0108:fixme:msg:ChangeWindowMessageFilterEx 000200A2 c04e 1 00000000
0108:fixme:msg:ChangeWindowMessageFilterEx 000300A2 c04e 1 00000000
0108:fixme:msg:ChangeWindowMessageFilterEx 000100AC c04e 1 00000000
0108:fixme:msg:ChangeWindowMessageFilterEx 000200AC c04e 1 00000000
0108:fixme:shell:SHAutoComplete stub
0108:fixme:msg:ChangeWindowMessageFilterEx 000300B2 c04e 1 00000000
0108:fixme:wincodecs:jpeg_decoder_get_metadata_blocks stub
0108:fixme:gdiplus:resample_bitmap_pixel Unimplemented interpolation 6
0108:fixme:rstrtmgr:RmEndSession 3735928559 stub!
0108:fixme:graphics:ShutdownBlockReasonDestroy (00010094): stub
command finished, read remaining output (if any)
done


Unattended install failed. Try install with wizard dialog.

Where is the issue with the shortcut here? This is the installer you are running.
Shortcuts come much later.
This is just the output of the first wine installation command. As commented somewhere else, wine itself is pretty verbose.

Shortcuts (=*.desktop files) are not generated for the install command, but for the game's launch command

@GB609
Copy link
Collaborator Author

GB609 commented Dec 4, 2024

I found this: https://documentation.help/Inno-Setup/topic_setupcmdline.htm

We can actually use the /NOICONS option to make sure the installers do not create menu shortcuts.

I saw this as well. But i wasn't sure how many of the installers actually support that switch (or most of the others). After i got some issues with the /SILENT switch for some games i tried to use only as few setup switches as possible. And the same effect of the 'exporting' the windows shortcuts can be achieved with winemenubuilder=d, so why bother with uncertain windows apis?

minigalaxy/installer.py Outdated Show resolved Hide resolved
@GB609
Copy link
Collaborator Author

GB609 commented Dec 4, 2024

I found another bug. If the innoextract installation works, it is not possible to launch the game anymore with this change, since the game files are not inside the prefix and the new code does not account for that.

It does.
That is what actually happens in launcher.py on lines 144 - 147 which you commented above. Here, any prefix that is run will be checked if the link install_dir/prefix/dosdevices/c:/game -> install_dir exists. If it does not, it created before the actual launch command is executed.
But i can see if there's a way to test this.

@GB609
Copy link
Collaborator Author

GB609 commented Dec 4, 2024

You might want to prevent Innoextract from being used for extraction honestly. It looks like with this change innoextract is being executed to extract the game and then the extracted files are fully ignored.

I've got another code addition that makes usage of inno configurable. Just didn't include it here to keep the changes as small as possible.

But why do you think the extracted files are ignored? I haven't changed the entry point to windows installation in installer.py

def extract_windows(game: Game, installer: str, temp_dir: str, language: str, use_innoextract: bool):
    err_msg = extract_by_innoextract(installer, temp_dir, language, use_innoextract)
    if err_msg:
        err_msg = extract_by_wine(game, installer, temp_dir)
    return err_msg

And i didn't really touch the innoextract method. If innoextract install does not create an error, it will just skip over wine. Otherwise the wine method is used.

Of course the wine installer itself can not use the temporary files extracted by innoextract because those are the actual content of the installer, not the installer itself. If i try to use the pre-extracted files directly, i might miss out on whatever the self-extracting installer does as preparation step.

But i'll try to run a manual test for that to verify that innoextract still works and wine is used as fallback if not.

There are 2 flows where i could see problems:

  1. Innoextract runs and immediately fails
  2. wine installs ok, ignoring temp.
  3. the move from temp to target has nothing to do because temp is empty
  4. temp directory is not cleaned? I haven't touched the cleanup code and just assumed that any temporary stuff will always automatically be removed after setup.
    -> This one shouldn't really be a problem, unless temp is not removed

Second variant

  1. innoextract runs and does some file extraction, but the install ultimately fails
  2. wine installs ok
  3. Temp is not empty, and thus all files in temp are also moved to install_dir
    This one might be problematic, depending on the file structure. Ideally, all relative paths are identical and stuff from temp would simply overwrite identically named files from the wine installer. Shouldn't really break stuff as the most important part about the wine installer is the additional init steps, like installing dx or registry keys.
    If there is some path mapping done in the installer itself, it is possible that the game directory contains the game 2 times after move from temp, once in install_dir directly and once in some sub-directory? This would only cause problems for the integrity in unlikely accidental path name collisions. The only 'issue' in that case would be that up to double the amount of space is used.

@GB609
Copy link
Collaborator Author

GB609 commented Dec 4, 2024

This change does actually fix 1nsane, which is really cool to see.

I tried the changes to the installer with as many games as i could without going bankrupt for now. If you followed the game test table in #622 you could see what i've tested with. Even asked for help in terms of install test reports.
I'm doing this exactly because i'm aware how impactful of a change this will be.

@GB609
Copy link
Collaborator Author

GB609 commented Dec 4, 2024

I would suggest leaving out the menu shortcuts fix for now. We can figure that out later.

If i leave it out, shortcuts created for wine games will break and not work anymore unless i let the code generate a wrapper start.sh script to use instead.
I've some code for this lying around and thought about whether that actually is worth it and a good idea. But that would make this PR more complicated again.
I consider it part of a working wine install feature that the desktop shortcut created by minigalaxy will work as well. I'd just replace one bug with another instead.

But if you really don't want that fix and have doubts about it, i can remove it again.

@sharkwouter
Copy link
Owner

sharkwouter commented Dec 5, 2024

There was one game which I tested for which innoextract did not fail and then the installer was used afterwards to do the installation. The innoextract files were not deleted. I'm sorry about not remembering which game that was.

@GB609
Copy link
Collaborator Author

GB609 commented Dec 5, 2024

There was one game which I tested for which innoextract did not fail and then the installer was used afterwards to do the installation. The innoextract files were not deleted. I'm sorry about not remembering which game that was.

No, it's fine. This part needs a rework or addition. I mostly focused on wine and don't even have inno installed.

@sharkwouter
Copy link
Owner

You should install innoextract. It is also used for determining what languages are supported by the installer. If you don't have it, you'll probably always get English, not 100% sure. It has been ages since that code was added.

@GB609
Copy link
Collaborator Author

GB609 commented Dec 5, 2024

I agree that i should also test with inno as long as both shall be supported (which still makes sense to have another fallback). Maybe it's better to reverse the current logic then. First try wine and fall back to innoextract.

From looking over the code i can't see how innoextract would not fail and the wine installer is started afterwards, unless some of the file move and remove operations in extract_by_innoextract just don't work as expected.
But even then, the return value of extract_by_innoextract would be empty in this case, which clearly evaluates to falsy in

def extract_windows(game: Game, installer: str, temp_dir: str, language: str, use_innoextract: bool):
    err_msg = extract_by_innoextract(installer, temp_dir, language, use_innoextract)
    if err_msg:
        err_msg = extract_by_wine(game, installer, temp_dir)
    return err_msg

And thus wine installer should not run. There's just no path out of extract_by_innoextract with a none-empty return that would also leave files in the temporary directory.
However, some games ask for additional installations on first launch. I've had this for games using UE4. Maybe the install with inno worked for this game for you and then you got the UE4 installer when launching after the installation?

Honestly, if the change wasn't so large, i would rewrite the entire installer.py to throw Errors instead of handling everything with returning error_messages. That would largely unclutter the code and make error handling so much easier. But i would have to change a lot of tests for that. That's just too much to do at once.

The entire language customization is done only in (and for) the innoextract installer currently. No value from extract_inno related to language is passed to the installation in wine.
I have added the parameter /LANG to the wine installer, although it appears to not work with what i've passed to it. Maybe this can be combined with the return from lang_install to get the right value. What i've found out so far is that i still have to change the language in the game, even when i changed it in the installer before. But that might also be because wine uses and passes through LC_ALL (which should be customized when launching a game). If that is set up correctly and the executables read the respective windows properties, language detection should work better.

And the installation in wine never used the extraction results from inno. Even before my change the installer in wine would simply be pointed to the temporary directory that was also used by innoextract before to install/overwrite what's in there.

@sharkwouter
Copy link
Owner

sharkwouter commented Dec 5, 2024

I don't think we need to support both if using the installer works fine honestly, but we do use Innoextract for language stuff here:

def lang_install(installer: str, language: str):
languages = []
arg = ""
process = subprocess.Popen(["innoextract", installer, "--list-languages"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout, stderr = process.communicate()
output = stdout.decode("utf-8")
for line in output.split('\n'):
if not line.startswith(' -'):
continue
languages.append(line[3:])
for lang in languages:
if "-" in lang: # lang must be like "en-US" only.
if language == lang[0:2]:
arg = "--language={}".format(lang)
break
else:
arg = "--language=en-US"
break
return arg

@GB609
Copy link
Collaborator Author

GB609 commented Dec 5, 2024

I don't think we need to support both if using the installer works fine honestly, but we do use Innoextract for language stuff here:

def lang_install(installer: str, language: str):
languages = []
arg = ""
process = subprocess.Popen(["innoextract", installer, "--list-languages"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout, stderr = process.communicate()
output = stdout.decode("utf-8")
for line in output.split('\n'):
if not line.startswith(' -'):
continue
languages.append(line[3:])
for lang in languages:
if "-" in lang: # lang must be like "en-US" only.
if language == lang[0:2]:
arg = "--language={}".format(lang)
break
else:
arg = "--language=en-US"
break
return arg

Exactly. But the method lang_install you point out is only called from extract_by_innoextract itself. There is no other occurrence yet. Maybe i can leverage that could to help search for the game language.

I'm fine with dropping innoextract for installation otherwise. Windows games must run within wine anyway. If the install already fails, successfully running a manually extracted game will always a be a bit of a gamble.

@sharkwouter
Copy link
Owner

sharkwouter commented Dec 5, 2024

I just found that /NOICONS does not work unfortunately. We might have to remove the shortcut files manually. That is unrelated to this PR, though.

@GB609
Copy link
Collaborator Author

GB609 commented Dec 5, 2024

I just found that /NOICONS does not work unfortunately. We might have to remove the shortcut files manually. That is unrelated to this PR, though.

That's why i set winemenubuilder=d for the wine command running the install. The windows shortcuts will be generated by the install and exist in the wineprefix directory, but they will NOT be exported to the linux application menu.

@sharkwouter
Copy link
Owner

I just found that /NOICONS does not work unfortunately. We might have to remove the shortcut files manually. That is unrelated to this PR, though.

That's why i set winemenubuilder=d for the wine command running the install. The windows shortcuts will be generated by the install and exist in the wineprefix directory, but they will NOT be exported to the linux application menu.

In my tests this causes wine to crash when it tries to create shortcuts, though. Does wine have an option that prevents this?

@GB609
Copy link
Collaborator Author

GB609 commented Dec 5, 2024

I just found that /NOICONS does not work unfortunately. We might have to remove the shortcut files manually. That is unrelated to this PR, though.

That's why i set winemenubuilder=d for the wine command running the install. The windows shortcuts will be generated by the install and exist in the wineprefix directory, but they will NOT be exported to the linux application menu.

In my tests this causes wine to crash when it tries to create shortcuts, though. Does wine have an option that prevents this?

Thats strange. Ok, i abbreviated the command. It must be
env 'WINEDLLOVERRIDES=winemenubuilder=d' wine some install command line
Although it suprises me that this crashes for you, as i've included it by default in the wine install command like this in my branch. This should work even for wine versions which are a bit older. I have installed 6-8 windows games with my branch with this option set and not a single crash for this reason.
How do you test, how does your command look like? Which wine version do you have installed?
If you still see shortcuts after installation, then it's those created by minigalaxy itself.

@sharkwouter
Copy link
Owner

sharkwouter commented Dec 5, 2024

Okay, my bad, seems the crash was unrelated. I got confused by the error about creating shortcuts, but it does seem to work now I did another test.

Copy link
Owner

@sharkwouter sharkwouter left a comment

Choose a reason for hiding this comment

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

Okay, I looked into it once more and did some more testing. What I found is that most of my comments were either unrelated or you clarified them.

I also created a merge request for your branch to resolve some issues with the exe_cmd function. I hope that is welcomed and helps you out.

If the left over comments are resolved, I will merge this. Then we can look into left over wine related issues. I don't think this PR is creating new ones at the moment apart from the ones by the _exe_cmd change.

tests/test_installer.py Show resolved Hide resolved
minigalaxy/launcher.py Show resolved Hide resolved
minigalaxy/launcher.py Outdated Show resolved Hide resolved
minigalaxy/installer.py Outdated Show resolved Hide resolved
minigalaxy/installer.py Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
minigalaxy/installer.py Outdated Show resolved Hide resolved
minigalaxy/installer.py Show resolved Hide resolved
@sharkwouter
Copy link
Owner

I found that the reason for a successful innoextract being seen as a failure is that the check to see if it failed only looks at if the stderr contains something. If it does it fails. This is addressed in the change I made in the PR I linked. Otherwise this seems to be a big improvement. I just wanted to clarify that.

I would also like to thank you for pushing me to take another look at this code. There are some issues in it which we are finding now because of that.

@GB609
Copy link
Collaborator Author

GB609 commented Dec 5, 2024

I found that the reason for a successful innoextract being seen as a failure is that the check to see if it failed only looks at if the stderr contains something. If it does it fails. This is addressed in the change I made in the PR I linked. Otherwise this seems to be a big improvement. I just wanted to clarify that.

I would also like to thank you for pushing me to take another look at this code. There are some issues in it which we are finding now because of that.

I was under the impression that extract_by_inno did not check any string returns from the _exe_cmd, but rather checked that the return code is != 0. The only place where i have seen any evalution of stderr output is in extract_linux that does some special exception when return code ==1 and a certain string is found in the output.
I was also wondering about what feels to me like a pretty roundabout way to check for none-0 with not in [0] that is used all over the code. Why not just use != 0 or > 0? Is that just not possible with python syntax?

Anyway, thanks for the feedback. Glad it's useful. I think it's better to fix stuff upstream if possible. Wouldn't want to maintain my own fork in the long run.
Though, when you write i was pushing you, it feels a bit as if i was being too forceful or demanding. I'm sorry if that is the case. Wasn't my intention.

About the stderr separation. Can i suggest a simpler way?
How about i keep the line buffer and readline loop of stdout and use stderr.readlines() after the process returned to consume all of stderr at once?
Buffer size should be less of a problem for error output since it usually is smaller.

I'll try to finish up the open points tonight if possible.

@sharkwouter
Copy link
Owner

I was thinking about that, since stderr output will be smaller. We could just do stderr.read at the end. I'll update my PR to your branch.

GB609 and others added 8 commits December 10, 2024 09:56
* All installations now try to use a fixed folder 'c:\game' within the wineprefix as install target.
* Wine installer tries unattended mode first and falls back to wizard dialog on failure
  The fallback will break if user changes the target directory in the wizard, but it's better then not working at all and the directory requirement can be documented.
* Adjust launcher.py to use wine-internal paths whereever possible
use env for wine when launching
* Fix _exe_cmd in installer.py

* Only print if print_output is on

* Set stdout and stderr to non-blocking in exe_cmd function
@GB609 GB609 force-pushed the feature/rework_wine_installer branch from 772d6f4 to 22de635 Compare December 10, 2024 09:56
@GB609
Copy link
Collaborator Author

GB609 commented Dec 10, 2024

I think i've got all for now. It's not as complete as i've wanted it to be, but we can do the rest in subsequent feature branches.
Installation for a lot of windows games works ok for now.
However, depending on the distribution, there still is an issue with the wine executable and it's dependencies itself, in terms of 64bit vs 32bit libraries.
I've had issues on Arch Linux with actually running some 32bit games that require some codecs for which no 32bit libraries exist (ASF). There just is no 32bit plugin for gstreamer for that.
This issue can only be tackled by the changes i've started in #622 which allow to pre-select a wine version even before the installer runs (which could be extended to include wine, wine32, wine64 and umu-run). Because changing a prefix' architecture between 64bit and 32bit is not possible.

@sharkwouter sharkwouter merged commit ba5a5c2 into sharkwouter:master Dec 10, 2024
2 checks passed
@sharkwouter
Copy link
Owner

Thanks!

@GB609 GB609 deleted the feature/rework_wine_installer branch December 10, 2024 10:27
This was referenced Dec 22, 2024
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.

2 participants