GoldHEN / GoldHEN_Plugins_Repository

Custom Plugins for PS4
GNU General Public License v3.0
130 stars 13 forks source link

Plugin arguments #7

Closed KrisztianKende closed 1 year ago

KrisztianKende commented 1 year ago

The _modulestart() function has argv and args parameters, but there is no way to pass arguments to the plugins. It would be nice if we could pass args through the plugins.ini file.

[CUSAxxxxx]
/data/GoldHEN/plugins/<plugin_name>.prx <arg1> <arg2>

I've created a plugin that changes the system language detected by games, but it would be much nicer if we didn't need a separate plugin for each language. So if the system language is English, but I want the game to start in German, another in Hungarian, then it would look like this:

[CUSA12345]
/data/GoldHEN/plugins/system_language_change.prx German

[CUSA12346]
/data/GoldHEN/plugins/system_language_change.prx Hungarian

This would be especially useful for game translations. Because it is not always possible or optimal to replace the English subtitles, but some games set the subtitle according to the language of the system.

nkrapivin commented 1 year ago

Right now we don't know well how PS4 passes arguments to modules at load, so the best you can do is make your own config file in /data/GoldHEN and parse it yourself.

KrisztianKende commented 1 year ago

I think it's fine if we can't passes arguments to modules at load. We can create a function that will reparse the plugins.ini file, but currently the plugin won't load if there are any arguments. For simplicity, it would be better if arguments could be specified in the plugins.ini file. It would be more user friendly.

Currently it only works like this:

[CUSAxxxxx]
/data/GoldHEN/plugins/<plugin_name>.prx ;<arg1> <arg2>
nkrapivin commented 1 year ago

Yeah this one should be possible to implement.

KrisztianKende commented 1 year ago

OK, so I've done it this way for now, with semicolon. It's actually not that bad, it's usable, just not that pretty.

illusion0001 commented 1 year ago

You can do = for better look. ; are for comments.

illusion0001 commented 1 year ago

https://github.com/GoldHEN/GoldHEN_Plugins_Repository/blob/89d8a33f2ae9c5812a7863dc253e209403ff379b/plugin_src/plugin_loader/source/config.c#L194-L205

And you will see it here. https://github.com/GoldHEN/GoldHEN_Plugins_Repository/blob/89d8a33f2ae9c5812a7863dc253e209403ff379b/plugin_src/plugin_loader/source/config.c#L20

[CUSA12345]
/data/GoldHEN/plugins/system_language_change.prx=German

[CUSA12346]
/data/GoldHEN/plugins/system_language_change.prx=Hungarian
KrisztianKende commented 1 year ago

Thanks, that was a very good suggestion, so I modified the plugin. It's much nicer now. :-)

KrisztianKende commented 1 year ago

Thanks, this issue is resolved now.