WerWolv / libtesla

The support library for Tesla overlays
GNU General Public License v2.0
218 stars 49 forks source link

How to call accountGetPreselectedUser with the right way? #69

Closed iamcco closed 6 months ago

iamcco commented 1 year ago
        rc = accountInitialize(AccountServiceType_Administrator);
        if (R_SUCCEEDED(rc))
        {
            rc = accountGetPreselectedUser(&uid);
            if (R_FAILED(rc))
                PselUserSelectionSettings settings;
                memset(&settings, 0, sizeof(settings));

                rc = pselShowUserSelector(&uid, &settings);
            }
            accountExit();
        }

accountGetPreselectedUser and pselShowUserSelector all failed.

iamcco commented 1 year ago

call within tsl::hlp::doWithSmSession still doesn't help.

masagrator commented 1 year ago

You should provide error codes as they may be helpful.

iamcco commented 1 year ago

You should provide error codes as they may be helpful.

@masagrator error code return from accountGetPreselectedUser is 0x1159 and from pselShowUserSelector is 0xe401

masagrator commented 1 year ago

0x1159 means that account service is not initialized.

I see in libnx source that is possible to get success return from accountInitialize, but in fact it can fail. This would require debugging what exactly fails.

HookedBehemoth commented 6 months ago

That won't work as the "preselected user" is the user that launched your process. https://github.com/switchbrew/libnx/blob/master/nx/source/services/acc.c#L200 This is determined by asking applet. Tesla overlays aren't applets and not launched by a specific user. I think you are trying to do something else but I don't know if you are able to do it in this context.

iamcco commented 6 months ago

That won't work as the "preselected user" is the user that launched your process. https://github.com/switchbrew/libnx/blob/master/nx/source/services/acc.c#L200 This is determined by asking applet. Tesla overlays aren't applets and not launched by a specific user. I think you are trying to do something else but I don't know if you are able to do it in this context.

Thanks for pointing that out, make more sense now.