Skip to content
This repository has been archived by the owner on Jul 20, 2023. It is now read-only.

Commit

Permalink
Merge branch 'exposefirmlocation' into 3gx-loader
Browse files Browse the repository at this point in the history
  • Loading branch information
PabloMK7 committed Jun 17, 2023
2 parents 14101be + a19e372 commit 685ec2c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
6 changes: 6 additions & 0 deletions arm9/source/patches.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@

#define K11EXT_VA 0x70000000

extern u16 launchedPath[];

u8 *getProcess9Info(u8 *pos, u32 size, u32 *process9Size, u32 *process9MemAddr)
{
u8 *temp = memsearch(pos, "NCCH", size, 4);
Expand Down Expand Up @@ -140,6 +142,8 @@ u32 installK11Extension(u8 *pos, u32 size, bool needToInitSd, u32 baseK11VA, u32

u64 autobootTwlTitleId;
u8 autobootCtrAppmemtype;

u16 launchedPath[80+1];
} info;
};

Expand Down Expand Up @@ -228,6 +232,8 @@ u32 installK11Extension(u8 *pos, u32 size, bool needToInitSd, u32 baseK11VA, u32
if(needToInitSd) info->flags |= 1 << 5;
if(isSdMode) info->flags |= 1 << 6;

memcpy(info->launchedPath, launchedPath, sizeof(info->launchedPath));

return 0;
}

Expand Down
2 changes: 2 additions & 0 deletions k11_extension/include/globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,8 @@ typedef struct CfwInfo

u64 autobootTwlTitleId;
u8 autobootCtrAppmemtype;

u16 launchedPath[80+1];
} CfwInfo;

extern CfwInfo cfwInfo;
Expand Down
9 changes: 8 additions & 1 deletion k11_extension/source/svc/GetSystemInfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,14 @@ Result GetSystemInfoHook(s64 *out, s32 type, s32 param)
{
case 0x10000:
{
switch(param)
if (param >= 0x400 && param < 0x500) {
*out = 0;
s32 offset = param - 0x400;
s32 toCopy = (s32)sizeof(cfwInfo.launchedPath) - offset;
if (toCopy > 8) toCopy = 8;
memcpy(out, (u8*)cfwInfo.launchedPath + offset, (toCopy > 0) ? toCopy : 0);
}
else switch(param)
{
// Please do not use these, except 0, 1, and 0x200
// Other types may get removed or reordered without notice
Expand Down

0 comments on commit 685ec2c

Please sign in to comment.