GoldHEN/GoldHEN_Plugins_Repository

Plugin arguments

KrisztianKende opened this issue · 8 comments

The module_start() 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.

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.

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>

Yeah this one should be possible to implement.

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.

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

case '=':
if (state == Key) {
state = Value;
buf[position++] = '\0';
value = buf + position;
spaces = 0;
continue;
}
default:
for(;spaces > 0; spaces--) buf[position++] = ' ';
buf[position++] = c;
break;

And you will see it here.

debug_printf("key: %s = value: %s\n", key, value);

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

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

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

Thanks, this issue is resolved now.