HomeWildfire Games

Add a mod installer, fixes #4027.
Concern RaisedrP21726

Description

Add a mod installer, fixes #4027.

pyrogenesis can now take a zip file (rename it to .pyromod for direct file association following r21723) and install it. It then starts the mod selector.

Patch by vladislavbelov, with contributions from Imarok, elexis and myself.
Differential Revision: https://code.wildfiregames.com/D1142

Details

Event Timeline

elexis added a subscriber: elexis.Apr 17 2018, 9:06 PM

Am I the only one getting this with gcc 6 and without-pch?

In file included from ../../../source/ps/ModInstaller.cpp:20:0:
../../../source/ps/ModInstaller.h:64:20: error: ‘CStr’ was not declared in this scope
  const std::vector<CStr>& GetInstalledMods() const;
                    ^~~~
../../../source/ps/ModInstaller.h:64:24: error: template argument 1 is invalid
  const std::vector<CStr>& GetInstalledMods() const;
                        ^
../../../source/ps/ModInstaller.h:64:24: error: template argument 2 is invalid
../../../source/ps/ModInstaller.h:79:14: error: ‘CStr’ was not declared in this scope
  std::vector<CStr> m_InstalledMods;
              ^~~~
../../../source/ps/ModInstaller.h:79:18: error: template argument 1 is invalid
  std::vector<CStr> m_InstalledMods;
                  ^
../../../source/ps/ModInstaller.h:79:18: error: template argument 2 is invalid
../../../source/ps/ModInstaller.cpp: In member function ‘CModInstaller::ModInstallationResult CModInstaller::Install(const OsPath&, const std::shared_ptr<ScriptRuntime>&, bool)’:
../../../source/ps/ModInstaller.cpp:103:18: error: request for member ‘emplace_back’ in ‘((CModInstaller*)this)->CModInstaller::m_InstalledMods’, which is of non-class type ‘int’
  m_InstalledMods.emplace_back(modName);
                  ^~~~~~~~~~~~
../../../source/ps/ModInstaller.cpp: At global scope:
../../../source/ps/ModInstaller.cpp:108:26: error: prototype for ‘const std::vector<CStr8>& CModInstaller::GetInstalledMods() const’ does not match any in class ‘CModInstaller’
 const std::vector<CStr>& CModInstaller::GetInstalledMods() const
                          ^~~~~~~~~~~~~
In file included from ../../../source/ps/ModInstaller.cpp:20:0:
../../../source/ps/ModInstaller.h:64:27: error: candidate is: const int& CModInstaller::GetInstalledMods() const
  const std::vector<CStr>& GetInstalledMods() const;
                           ^~~~~~~~~~~~~~~~
engine.make:532: recipe for target 'obj/engine_Release/ModInstaller.o' failed
make[1]: *** [obj/engine_Release/ModInstaller.o] Error 1
make[1]: *** Waiting for unfinished jobs....
Imarok added a subscriber: Imarok.EditedApr 17 2018, 11:13 PM

Am I the only one getting this with gcc 6 and without-pch?

In file included from ../../../source/ps/ModInstaller.cpp:20:0:
../../../source/ps/ModInstaller.h:64:20: error: ‘CStr’ was not declared in this scope
  const std::vector<CStr>& GetInstalledMods() const;
                    ^~~~
../../../source/ps/ModInstaller.h:64:24: error: template argument 1 is invalid
  const std::vector<CStr>& GetInstalledMods() const;
                        ^
../../../source/ps/ModInstaller.h:64:24: error: template argument 2 is invalid
../../../source/ps/ModInstaller.h:79:14: error: ‘CStr’ was not declared in this scope
  std::vector<CStr> m_InstalledMods;
              ^~~~
../../../source/ps/ModInstaller.h:79:18: error: template argument 1 is invalid
  std::vector<CStr> m_InstalledMods;
                  ^
../../../source/ps/ModInstaller.h:79:18: error: template argument 2 is invalid
../../../source/ps/ModInstaller.cpp: In member function ‘CModInstaller::ModInstallationResult CModInstaller::Install(const OsPath&, const std::shared_ptr<ScriptRuntime>&, bool)’:
../../../source/ps/ModInstaller.cpp:103:18: error: request for member ‘emplace_back’ in ‘((CModInstaller*)this)->CModInstaller::m_InstalledMods’, which is of non-class type ‘int’
  m_InstalledMods.emplace_back(modName);
                  ^~~~~~~~~~~~
../../../source/ps/ModInstaller.cpp: At global scope:
../../../source/ps/ModInstaller.cpp:108:26: error: prototype for ‘const std::vector<CStr8>& CModInstaller::GetInstalledMods() const’ does not match any in class ‘CModInstaller’
 const std::vector<CStr>& CModInstaller::GetInstalledMods() const
                          ^~~~~~~~~~~~~
In file included from ../../../source/ps/ModInstaller.cpp:20:0:
../../../source/ps/ModInstaller.h:64:27: error: candidate is: const int& CModInstaller::GetInstalledMods() const
  const std::vector<CStr>& GetInstalledMods() const;
                           ^~~~~~~~~~~~~~~~
engine.make:532: recipe for target 'obj/engine_Release/ModInstaller.o' failed
make[1]: *** [obj/engine_Release/ModInstaller.o] Error 1
make[1]: *** Waiting for unfinished jobs....

nope

Edit: see D1456

ffffffff raised a concern with this commit.May 27 2018, 9:50 PM
ffffffff added a subscriber: ffffffff.

(ubuntu 16.04, wfg ppa 0ad a 23 rc3) failes install fgod.pyromod (0ad fgod.pyromod) when ~/.cache/0ad is pointing symbolic linked to another filesystem (i was using an aufs mounted fs on /mnt but into a folder where user can write. It can actually make a fgod folder temporary inside but then moving files to correct location under ~/.local/mods/0ad/mods/fgod failes so far (ps/trunk/source/ps/ModInstaller.cpp line 83). So seems vfs issue maybe. Didn't investigate further.
Under normal conditions (fs) all goes well.

This commit now has outstanding concerns.May 27 2018, 9:50 PM
/ps/trunk/source/ps/ModInstaller.cpp
82

failes here

*.pyromod files are declared as virus on many systems on some it can't be even download. (user reported)

vladislavbelov added a subscriber: vladislavbelov.EditedMay 28 2018, 5:35 PM

*.pyromod files are declared as virus on many systems on some it can't be even download. (user reported)

I suppose it happens because antivirus thinks that the .pyromod is the hidden zip or so. Could you test (download, not install) it with replaced first bytes PK by PYROMOD in the file with a hex-editor (to disable zip file recognising)?

elexis added a comment.Dec 7 2018, 3:16 PM

Perhaps we could use a bugreport on the a24 milestone for the issue reported in previous posts, as users seem to run frequently into that.

/ps/trunk/source/ps/GameSetup/GameSetup.cpp
1083

Why does this switch to page_modmod.xml when the mod mod has a proxy page_pregame.xml already?

elexis added inline comments.Dec 7 2018, 5:56 PM
/ps/trunk/source/ps/GameSetup/GameSetup.cpp
1083

I guess it's because we want to load the mod selection page if and only if mods were installed (i.e. even if the pregame page is the one from the public mod).

(Removing the new hardcoded GUI page name were nice. It would mean switching to the pregame page and then to the mod selection page immediately, which is not so nice. But the pregame page of the mod mod does that as well. Meh.)

Stan added a subscriber: Stan.Mar 7 2019, 10:14 PM

@elexis was it fixed in rP21739 ?