Frontend method calling order

Dear developers, I had one question about the frontend method calling order. I am talking about 2 methods only: _init and _get_env Now, RetroArch code run first: method _init and only then method _get_env

The problem is that for example on PlayStation2, arguments (basically argv[1] ) contain information that is needed for proper initialization (basically filesystem mount point information).

But we cannot access argv[1] on the _init stage so we are forced to do part of the initialization inside method _get_env (where we can parse argv[1]).

So the question is: if it will be possible to change method order - so _get_env is called earlier than _init. So we extract all info from arguments and then parse it at the initialization stage.

After talking to some folks in discord, there doesn’t appear to be an easy answer. That is, changing the order isn’t going to happen, as it’s pretty crucial to the API. But perhaps there’s some other way around what you’re trying to accomplish?

Do you have any more concrete examples of what sort of information you need to pass and where it comes from?

Some Playstation 2 has an internal HDD that uses an APA partition scheme. That means that HDD consists of numerous partitions with some names. Each partition can be mounted at entrypoints: pfs0:/, pfs1:/, pfs2:/ etc - up to 10. The problem is that when we launch another program, argv[0] will contain the file path starting from entrypoint: pfs0:/path/to/app, and information about the actual partition name is lost. To keep that information, partition name and blockdevice number are passed via argv[1]: for example hdd0:__common:pfs::/path/to/app If the next app wants to initialize HDD partition from where it is booted from, it has to extract mountpoint info from argv[1].

Now there are few workarounds. The first workaround (used now), we can just initialize part of the system in _get_env method.

It is also possible to change _init method so it can parse arguments. BTW now there is a trick for accessing argv[0] by calling getcwd() inside _init., but I don’t know how to get argv[1] there.

And of course, changing method calling order. I understand that this can break things, cause probably some systems do many things assuming that all filesystems are ready (file loggers or maybe more complex things)

Ohhh, I see what you’re saying. Okay, I’ll try to get some eyes on this.