
Let's not pretend in 2022 that it needed things from rosalina sysmodule - it did not. This moves 3DSX loading from Rosalina to Loader, and also removes all the dependencies Loader had to other Luma3DS components (if kernel ext. is missing, a default config will be used). This means that, as long as you replace Loader to the one in here, you will be able to properly load 3DSX files. Changes: - hb:ldr is now hosted in loader - hb:ldr LoadProcess, PatchExHeaderInfo, DebugNextApplicationByForce: all removed - fix a bug where some malformed 3DSX files were not rejected - grant access to CONFIG11 registers to 3DSX homebrew - move dirty homebrew chainload (when HM. isn't loaded nor loadable) to pm - pm:dbg (ext.) PrepareToChainloadHomebrew: removed
51 lines
1.4 KiB
C
51 lines
1.4 KiB
C
// License for this file: ctrulib's license
|
|
// Copyright AuroraWright, TuxSH 2019-2020
|
|
|
|
#include <string.h>
|
|
#include <3ds/types.h>
|
|
#include <3ds/result.h>
|
|
#include <3ds/svc.h>
|
|
#include <3ds/srv.h>
|
|
#include <3ds/synchronization.h>
|
|
#include <3ds/services/pmdbg.h>
|
|
#include <3ds/ipc.h>
|
|
|
|
Result PMDBG_GetCurrentAppInfo(FS_ProgramInfo *outProgramInfo, u32 *outPid, u32 *outLaunchFlags)
|
|
{
|
|
Result ret = 0;
|
|
u32 *cmdbuf = getThreadCommandBuffer();
|
|
cmdbuf[0] = IPC_MakeHeader(0x100, 0, 0);
|
|
if(R_FAILED(ret = svcSendSyncRequest(*pmDbgGetSessionHandle()))) return ret;
|
|
|
|
memcpy(outProgramInfo, cmdbuf + 2, sizeof(FS_ProgramInfo));
|
|
*outPid = cmdbuf[6];
|
|
*outLaunchFlags = cmdbuf[7];
|
|
return cmdbuf[1];
|
|
}
|
|
|
|
Result PMDBG_DebugNextApplicationByForce(bool debug)
|
|
{
|
|
Result ret = 0;
|
|
u32 *cmdbuf = getThreadCommandBuffer();
|
|
cmdbuf[0] = IPC_MakeHeader(0x101, 1, 0);
|
|
cmdbuf[1] = (u32)debug;
|
|
|
|
if(R_FAILED(ret = svcSendSyncRequest(*pmDbgGetSessionHandle()))) return ret;
|
|
return cmdbuf[1];
|
|
}
|
|
|
|
Result PMDBG_LaunchTitleDebug(Handle *outDebug, const FS_ProgramInfo *programInfo, u32 launchFlags)
|
|
{
|
|
Result ret = 0;
|
|
u32 *cmdbuf = getThreadCommandBuffer();
|
|
|
|
cmdbuf[0] = IPC_MakeHeader(0x102, 5, 0);
|
|
memcpy(&cmdbuf[1], programInfo, sizeof(FS_ProgramInfo));
|
|
cmdbuf[5] = launchFlags;
|
|
|
|
if(R_FAILED(ret = svcSendSyncRequest(*pmDbgGetSessionHandle()))) return ret;
|
|
|
|
*outDebug = cmdbuf[3];
|
|
return (Result)cmdbuf[1];
|
|
}
|