Author Topic: [Cross-platform] FS2 GOG/Mod installer  (Read 72165 times)

0 Members and 1 Guest are viewing this topic.

Offline Fury

  • The Curmudgeon
  • 213
Re: [Cross-platform] FS2 GOG/Mod installer
What do you think?
I think you're awesome!

 

Offline Hellzed

  • 28
Re: [Cross-platform] FS2 GOG/Mod installer
@ngld :
This is a very interesting way to deal with dependencies. I'm seeing some issues, though : let's imagine fsmod-py (including its config files) is completely uninstalled from the user's computer. We have some modified mods (duplicated parent mods because children were depending on different versions of these). Then the user re-installs fs2mod-py : when it searches for installed mods, what happens ?

If two or more versions of a mod with the same name are installed (but modified mod folder name and mod.ini), what happens with fso:// links ?

This solution also assumes different checksums for parent mod VPs mean children will not be compatible, but some children mods are actually compatible with different versions of their parent mod. How do we deal with that case ? (this is only a disk space issue, I guess we don't care that much, and if we want something as reliable as possible, we should only do what the source tells us to do...)

How does it work with updates ? The previous (planned) behaviour was that adding a new source or updating a source (as long as the mods share the the same name) would enable a mod update. I guess that would be no longer the case. Here, different versions of a mod would end up installed in parallel, nothing would be updated.
Maybe real updates (instead of parallel install) should be trigger only if the mod has no current children that cannot be update from any of the current sources.

Also, it seems to make the priority mechanism useless.

Am I getting this right ?
This is getting pretty complex. (I guess that's why big package managers out there prefer to mark packages as broken instead of rewriting paths and installing deps in parallel)


I'm currently trying to understand how wxlauncher autodetects some settings like the available screen resolutions, controllers and sound devices, and how to fill our settings menu with the presets. The settings profiles part should be straightforward.
EDIT : I think this is above my level in python for now. It needs SDL and openAl dependencies. I'm reading stuff about it, but don't expect useful code from me right now. It's around lines 1421 in /code/tabs/BasicSettingsPage.cpp in wxLauncher.

EDIT 2: what do you think about pygame ? It looks like it makes using SDL much simpler :
Code: [Select]
import pygame.display
pygame.display.init()
pygame.display.list_modes(32)
returns
Code: [Select]
[(1366, 768), (1360, 768), (1024, 768), (800, 600), (640, 480)]
It seems that wxlauncher code for getting the same piece of information is much more complex.
Do you think we can add a dependency on pygame ?

EDIT3: apparently pygame is outdated, and using pySDL2 would be better. It can detect joysticks, screen modes and sound cards. Pretty much all we need for the settings screen.

EDIT: pySDL2 doesn't seem to be in ubuntu repositories yet, so I'm experimenting with pygame.
Also, neither pygame or pySDL are able to list sound devices. But Qt does : http://qt-project.org/doc/qt-4.8/qaudiodeviceinfo.html
After trying this, i still can't list sound devices. Phonon example code returns me an empty list of sound cards (https://github.com/PySide/Examples/blob/master/examples/phonon/capabilities.py). I can't find a way to install QtMultimedia for PySide and Qt4. It's nowhere to be found in ubuntu repositories.

Anyway, I have attached my daily screenshot of the html template (not a lot of changes, except it's not broken any more in webkit based browsers, and that it should look better on wide screens).

EDIT (again) : I finally got fs2mod-py to parse fs2_open.ini, currently only the graphics part. :D
The rest will be easier. I'll need your help to integrate it with the rest of the code !

[attachment deleted by an evil time traveler]
« Last Edit: February 20, 2014, 05:50:19 am by Hellzed »

 

Offline Hellzed

  • 28
Re: [Cross-platform] FS2 GOG/Mod installer
@ngld:
You can take a look at my last commit here : https://github.com/Nepenthes/fs2mod-py/commit/6d58d7fff2e7591efdbc4b07895eefe328054935
(it's not yet windows compatible... Someone will have to deal with the registry, and I have no windows pc at home)
(also, i forgot to include it in the commit message, but there's a new Unity quicklist item opening HLP in the default browser. Later, it will be the mod catalogue)

EDIT : found a bug : if 2 or more instances of fs2mod-py are launched at the same time, the settings are wiped...
« Last Edit: February 21, 2014, 02:26:08 am by Hellzed »

 

Offline ngld

  • Administrator
  • 29
  • Knossos dev
Re: [Cross-platform] FS2 GOG/Mod installer
I think you're awesome!
Thanks!  :D

@Hellzed: I've commented on the pull request now, I made several changes to your new code (which should also fix the bug you found).
Pygame isn't really outdated. They haven't done an official release since 2009 but if you look at their page over on BitBucket you'll see that it's still being developed. It doesn't support SDL2 (yet?) but that shouldn't matter in our case because FS2 still uses SDL-1.2.
Since we only need a few SDL functions a complete binding package like pygame, pyglet or PySDL would be overkill. Instead, I added some wrappers (in clibs.py) which use ctypes to call SDL and OpenAL.

I'll implement the package management once I've got enough time, I already solved most issues but I'm not sure if it'll work.

P.S.: Sorry for the long delay, RL interfered.   :blah:

 

Offline m!m

  • 211
Re: [Cross-platform] FS2 GOG/Mod installer
It doesn't support SDL2 (yet?) but that shouldn't matter in our case because FS2 still uses SDL-1.2.
Usage of SDL2 is currently being tested and should arrive in trunk soonTM so you should consider using something like PySDL2 if you want to support the newest versions of FSO.

 

Offline ngld

  • Administrator
  • 29
  • Knossos dev
Re: [Cross-platform] FS2 GOG/Mod installer
m!m, thanks for the notice! I've added support for SDL2 to the ctypes wrapper.

 

Offline Hellzed

  • 28
Re: [Cross-platform] FS2 GOG/Mod installer
@ngld :
Everything looks good to me. The settings window works. How do you think it should integrate with the fs2mod-py main window ?
I'll look into installing python on Wine, and start working on the registry part.
Next goal is to save a different cmdline_fso.cfg for each mod.
I was also thinking about setting the LastPlayer (in fs2_open.ini) value for each mod.

 

Offline ngld

  • Administrator
  • 29
  • Knossos dev
Re: [Cross-platform] FS2 GOG/Mod installer
I guess it would make the most sense to add a "settings" button to the mod info window which opens the settings window.
The QSettings class can modify the registry. You should only need to change the line where the QSettings object is created.
Setting the LastPlayer is a great idea but how do you determine the last player? You'll have to wait until FS2 quits to read that value, don't you?

As for python on wine... You might want to look at win_build/build.sh. It can set up a wineprefix with python and all dependencies.
Code: [Select]
cd win_build
./build.sh
WINEPREFIX="$PWD/_w" wine python ../manager.py

build.sh will generate a windows build (the exe file) but will also create the _w directory which should contain everything you need to run fs2mod-py on wine.
« Last Edit: March 03, 2014, 06:55:03 pm by ngld »

 

Offline Hellzed

  • 28
Re: [Cross-platform] FS2 GOG/Mod installer
I'm getting an error with build.sh :
Code: [Select]
Building...
wine: cannot find L"C:\\windows\\system32\\python.exe"

And yes, I think we have to wait for FS2 to quit to read the value. (signals ?)
« Last Edit: March 03, 2014, 04:12:43 am by Hellzed »

 

Offline ngld

  • Administrator
  • 29
  • Knossos dev
Re: [Cross-platform] FS2 GOG/Mod installer
Did you change the installation destination of Python? The script expects it to be in C:\Python27.
If you want to try again, you have to remove the _w directory and re-run the build.sh script.

We'll have to create a new thread if we want to check when FS2 quits. I'll add a new signal (fs2_quit ?) and implement it.

  

Offline Hellzed

  • 28
Re: [Cross-platform] FS2 GOG/Mod installer
I didn't change any default path. I'm using wine 1.7.13.

 

Offline ngld

  • Administrator
  • 29
  • Knossos dev
Re: [Cross-platform] FS2 GOG/Mod installer
Weird, I'm using the same version.
Could you please run "ll _w/drive_c/windows/python.exe" in win_build?
If the symlink is missing (you get a "File or directory not found" error), you have an old _w directory. Deleting it and running build.sh again should fix that.

 

Offline Hellzed

  • 28
Re: [Cross-platform] FS2 GOG/Mod installer
That's the weird part : I just re-created _w, and I'm still getting the error.
However, I have a python.exe symlink in win_build.
If I manually move python.exe to _w/drive_c, it starts building, but I get an error with 7zip : "IOError: [Errno 2] No such file or directory: '7z.exe'"
« Last Edit: March 03, 2014, 05:45:36 pm by Hellzed »

 

Offline ngld

  • Administrator
  • 29
  • Knossos dev
Re: [Cross-platform] FS2 GOG/Mod installer
You're using Ubuntu, right? You probably need to run "bash ./build.sh".
Dash apparently doesn't support the pushd and pulld commands...

Because of the wine error build.sh didn't complete and thus didn't extract 7z. If you manually place 7z.exe (and 7z.dll) as well as SDL.dll and openal.dll in the win_build directory that error should go away.
« Last Edit: March 03, 2014, 07:12:52 pm by ngld »

 

Offline Hellzed

  • 28
Re: [Cross-platform] FS2 GOG/Mod installer
It worked with bash.

EDIT : I'm trying to run the settings window in wine, with a change to write to the registry, but I'm getting this error :
Code: [Select]
fixme:msvcrt:type_info_name_internal_method type_info_node parameter ignored
p11-kit: couldn't load module: /usr/lib/i386-linux-gnu/pkcs11/p11-kit-trust.so: /usr/lib/i386-linux-gnu/pkcs11/p11-kit-trust.so: Ne peut ouvrir le fichier d'objet partagé: Aucun fichier ou dossier de ce type
p11-kit: couldn't load module: /usr/lib/i386-linux-gnu/pkcs11/gnome-keyring-pkcs11.so: /usr/lib/i386-linux-gnu/pkcs11/gnome-keyring-pkcs11.so: Ne peut ouvrir le fichier d'objet partagé: Aucun fichier ou dossier de ce type
Traceback (most recent call last):
  File "<string>", line 45, in <module>
  File "Z:\home\loris\fs2mod-py\win_build\PyInstaller-2.1\PyInstaller\loader\pyi_importers.py", line 270, in load_module
    exec(bytecode, module.__dict__)
  File "Z:\home\loris\fs2mod-py\win_build\build\fs2mod-py\out00-PYZ.pyz\windows", line 20, in <module>
  File "Z:\home\loris\fs2mod-py\win_build\PyInstaller-2.1\PyInstaller\loader\pyi_importers.py", line 270, in load_module
    exec(bytecode, module.__dict__)
  File "Z:\home\loris\fs2mod-py\win_build\build\fs2mod-py\out00-PYZ.pyz\clibs", line 155, in <module>
  File "Z:\home\loris\fs2mod-py\win_build\build\fs2mod-py\out00-PYZ.pyz\clibs", line 52, in load_lib
Exception: libopenal.so.1.15.1 could not be found!
fixme:msvcrt:__clean_type_info_names_internal (0x130f4d0) stub
fixme:msvcrt:__clean_type_info_names_internal (0x6578cca4) stub
fixme:msvcrt:__clean_type_info_names_internal (0xd24460) stub
fixme:msvcrt:__clean_type_info_names_internal (0x3bba30) stub
fixme:msvcrt:__clean_type_info_names_internal (0xc354f0) stub
fixme:msvcrt:__clean_type_info_names_internal (0x10198e30) stub
fixme:msvcrt:__clean_type_info_names_internal (0x36a948) stub
fixme:msvcrt:__clean_type_info_names_internal (0x39ab68) stub
fixme:msvcrt:__clean_type_info_names_internal (0x6726023c) stub
fixme:msvcrt:__clean_type_info_names_internal (0x1d1b5210) stub
fixme:msvcrt:__clean_type_info_names_internal (0x1e24d188) stub

I'm not sure why a windows build of fs2mod py would be searching for "libopenal.so.1.15.1" ?
« Last Edit: March 04, 2014, 01:37:28 am by Hellzed »

 

Offline ngld

  • Administrator
  • 29
  • Knossos dev
Re: [Cross-platform] FS2 GOG/Mod installer
It's trying various names (libopenal.so.1.15.1, openal.dll and whatever gcc -lopenal would use). As long as you have a SDL.dll and openal.dll in _w/drive_c/windows or in your current directory (build.sh should have put them in win_build already).

 

Offline Hellzed

  • 28
Re: [Cross-platform] FS2 GOG/Mod installer
So, I tried to set the different registry keys. It's not as simple as we thought, because there is no equivalent for "Default" section of the config file in the registry. These values instead go at the root of "FreeSpace2" key. And an other issue is that some values in the registry are typed : some values (including some numbers) are typed as strings, and some others as binary data.

EDIT : I have fixed most of the issues.
« Last Edit: March 04, 2014, 11:59:40 am by Hellzed »

 

Offline ngld

  • Administrator
  • 29
  • Knossos dev
Re: [Cross-platform] FS2 GOG/Mod installer
Merged your changes.
Please use "git rebase" to rebase and not GitHub's pull request. This avoids all the "Merge ... rebase" commits.

I've put a "FS2 Settings" button on the FS2 tab since none of the settings are actually mod-specific.

 

Offline Hellzed

  • 28
Re: [Cross-platform] FS2 GOG/Mod installer
I'll do it for next commits !

That's true, no setting is mod specific at the moment. The only thing that will be mod specific is the command line stored in cmdline_fso.cfg. I'll make a few changes to store it in fs2mod-py data, an restore it to the dedicated file on game launch (and if no command line exists yet for a mod, it will be created from a "default" command line).

 

Offline ngld

  • Administrator
  • 29
  • Knossos dev
Re: [Cross-platform] FS2 GOG/Mod installer
Will you provide checkboxes for the most common options (like wxLauncher, YAL, ...) or will you simply show a text input?
You should probably run FS2 with "-get_flags" to generate the "flags.lch" file and read that to get a list of all available options.
I can implement that if you want...