yifanlu / taiHEN

CFW framework for PS Vita
MIT License
302 stars 46 forks source link

Allow loading modules with weak imports #10

Closed TheOfficialFloW closed 7 years ago

TheOfficialFloW commented 7 years ago

Loading a suprx that is importing ScePgf for example (which isn't loaded yet either) will result in SCE_KERNEL_ERROR_MODULEMGR_NO_LIB. A workaround is to load the pgf module inside config.txt

yifanlu commented 7 years ago

I'm debating whether this should be a problem or not. The reason Sony chose to put these modules as weak imports is because they affect game load time and memory usage. If we encourage this, it may lead to plugins causing some slowdown for games. I think the workaround is find if you absolutely need to use some module.

TheOfficialFloW commented 7 years ago

I have got some thoughts about it: 1) I believe that sysmodule loads some modules with special arguments. Those can't be passed via config.txt 2) A future plugins manager wouldn't know which modules belong to which plugin in order to enable/disable correctly.

However there's another workaround which would require splitting a plugin into two suprx where the first one loads the neccessary libraries via sysmodule and the second one can finally import them.

yifanlu commented 7 years ago

The problem here is that the Vita is not designed to load suprx with weak imports (it seems to be limited to main app). Maybe I'm missing something and I will dig more into it, but it won't be easy to add without making some significant changes to modulemgr.

yifanlu commented 7 years ago

Can you test this? Manually modify the velf so in the import structure for that library, change the flags field (offset 4), set the uint16_t flags to 0x8 and see if that will work. If it does, I'll change the toolchain.

TheOfficialFloW commented 7 years ago

I can confirm that changing the flags works.

yifanlu commented 7 years ago

Cool, guess we can make a change in the toolchain.

yifanlu commented 7 years ago

This will be tracked in the toolchain https://github.com/vitasdk/vita-toolchain/issues/71 and will be closed here since no additional changes will have to be made to taiHEN to support this.