mirror of
https://github.com/switchbrew/libnx.git
synced 2025-06-21 20:42:44 +02:00
lr: fix 9.x RedirectApplication* commands (#326)
* lr: fix 9.x RedirectApplication* commands * lr: correct LegalInformation->ApplicationLegalInformation
This commit is contained in:
parent
9d632b856d
commit
c55383c973
@ -31,10 +31,10 @@ Result lrLrRedirectProgramPath(LrLocationResolver* lr, u64 tid, const char *path
|
|||||||
Result lrLrResolveApplicationControlPath(LrLocationResolver* lr, u64 tid, char *out);
|
Result lrLrResolveApplicationControlPath(LrLocationResolver* lr, u64 tid, char *out);
|
||||||
Result lrLrResolveApplicationHtmlDocumentPath(LrLocationResolver* lr, u64 tid, char *out);
|
Result lrLrResolveApplicationHtmlDocumentPath(LrLocationResolver* lr, u64 tid, char *out);
|
||||||
Result lrLrResolveDataPath(LrLocationResolver* lr, u64 tid, char *out);
|
Result lrLrResolveDataPath(LrLocationResolver* lr, u64 tid, char *out);
|
||||||
Result lrLrRedirectApplicationControlPath(LrLocationResolver* lr, u64 tid, const char *path);
|
Result lrLrRedirectApplicationControlPath(LrLocationResolver* lr, u64 tid, u64 tid2, const char *path);
|
||||||
Result lrLrRedirectApplicationHtmlDocumentPath(LrLocationResolver* lr, u64 tid, const char *path);
|
Result lrLrRedirectApplicationHtmlDocumentPath(LrLocationResolver* lr, u64 tid, u64 tid2, const char *path);
|
||||||
Result lrLrResolveLegalInformationPath(LrLocationResolver* lr, u64 tid, char *out);
|
Result lrLrResolveApplicationLegalInformationPath(LrLocationResolver* lr, u64 tid, char *out);
|
||||||
Result lrLrRedirectLegalInformationPath(LrLocationResolver* lr, u64 tid, const char *path);
|
Result lrLrRedirectApplicationLegalInformationPath(LrLocationResolver* lr, u64 tid, u64 tid2, const char *path);
|
||||||
Result lrLrRefresh(LrLocationResolver* lr);
|
Result lrLrRefresh(LrLocationResolver* lr);
|
||||||
|
|
||||||
// IRegisteredLocationResolver
|
// IRegisteredLocationResolver
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#include "services/lr.h"
|
#include "services/lr.h"
|
||||||
#include "services/fs.h"
|
#include "services/fs.h"
|
||||||
#include "services/sm.h"
|
#include "services/sm.h"
|
||||||
|
#include "runtime/hosversion.h"
|
||||||
|
|
||||||
static Service g_managerSrv;
|
static Service g_managerSrv;
|
||||||
static u64 g_managerRefCnt;
|
static u64 g_managerRefCnt;
|
||||||
@ -182,6 +183,51 @@ static Result _lrRedirectPath(Service* s, u64 cmd_id, u64 tid, const char *path)
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
In 9.0.0, "RedirectApplication" commands began taking in a second tid argument.
|
||||||
|
This is a helper function to perform the work for those funcs, given a command ID.
|
||||||
|
*/
|
||||||
|
static Result _lrRedirectApplicationPath(Service* s, u64 cmd_id, u64 tid, u64 tid2, const char *path) {
|
||||||
|
// On < 9.0.0, call the original redirection helper.
|
||||||
|
if (hosversionBefore(9,0,0)) {
|
||||||
|
return _lrRedirectPath(s, cmd_id, tid, path);
|
||||||
|
}
|
||||||
|
|
||||||
|
char send_path[FS_MAX_PATH+1] = {0};
|
||||||
|
IpcCommand c;
|
||||||
|
ipcInitialize(&c);
|
||||||
|
ipcAddSendStatic(&c, send_path, FS_MAX_PATH, 0);
|
||||||
|
|
||||||
|
struct {
|
||||||
|
u64 magic;
|
||||||
|
u64 cmd_id;
|
||||||
|
u64 tid;
|
||||||
|
u64 tid2;
|
||||||
|
} *raw;
|
||||||
|
|
||||||
|
raw = ipcPrepareHeader(&c, sizeof(*raw));
|
||||||
|
raw->magic = SFCI_MAGIC;
|
||||||
|
raw->cmd_id = cmd_id;
|
||||||
|
raw->tid = tid;
|
||||||
|
raw->tid = tid2;
|
||||||
|
|
||||||
|
strncpy(send_path, path, FS_MAX_PATH);
|
||||||
|
Result rc = serviceIpcDispatch(s);
|
||||||
|
|
||||||
|
if (R_SUCCEEDED(rc)) {
|
||||||
|
IpcParsedCommand r;
|
||||||
|
ipcParse(&r);
|
||||||
|
|
||||||
|
struct {
|
||||||
|
u64 magic;
|
||||||
|
u64 result;
|
||||||
|
} *resp = r.Raw;
|
||||||
|
|
||||||
|
rc = resp->result;
|
||||||
|
}
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
Result lrLrResolveProgramPath(LrLocationResolver* lr, u64 tid, char *out) {
|
Result lrLrResolveProgramPath(LrLocationResolver* lr, u64 tid, char *out) {
|
||||||
return _lrResolvePath(&lr->s, 0, tid, out);
|
return _lrResolvePath(&lr->s, 0, tid, out);
|
||||||
@ -203,20 +249,20 @@ Result lrLrResolveDataPath(LrLocationResolver* lr, u64 tid, char *out) {
|
|||||||
return _lrResolvePath(&lr->s, 4, tid, out);
|
return _lrResolvePath(&lr->s, 4, tid, out);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result lrLrRedirectApplicationControlPath(LrLocationResolver* lr, u64 tid, const char *path) {
|
Result lrLrRedirectApplicationControlPath(LrLocationResolver* lr, u64 tid, u64 tid2, const char *path) {
|
||||||
return _lrRedirectPath(&lr->s, 5, tid, path);
|
return _lrRedirectApplicationPath(&lr->s, 5, tid, tid2, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result lrLrRedirectApplicationHtmlDocumentPath(LrLocationResolver* lr, u64 tid, const char *path) {
|
Result lrLrRedirectApplicationHtmlDocumentPath(LrLocationResolver* lr, u64 tid, u64 tid2, const char *path) {
|
||||||
return _lrRedirectPath(&lr->s, 6, tid, path);
|
return _lrRedirectApplicationPath(&lr->s, 6, tid, tid2, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result lrLrResolveLegalInformationPath(LrLocationResolver* lr, u64 tid, char *out) {
|
Result lrLrResolveApplicationLegalInformationPath(LrLocationResolver* lr, u64 tid, char *out) {
|
||||||
return _lrResolvePath(&lr->s, 7, tid, out);
|
return _lrResolvePath(&lr->s, 7, tid, out);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result lrLrRedirectLegalInformationPath(LrLocationResolver* lr, u64 tid, const char *path) {
|
Result lrLrRedirectApplicationLegalInformationPath(LrLocationResolver* lr, u64 tid, u64 tid2, const char *path) {
|
||||||
return _lrRedirectPath(&lr->s, 8, tid, path);
|
return _lrRedirectApplicationPath(&lr->s, 8, tid, tid2, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result lrLrRefresh(LrLocationResolver* lr) {
|
Result lrLrRefresh(LrLocationResolver* lr) {
|
||||||
|
Loading…
Reference in New Issue
Block a user