mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-07-06 17:42:14 +02:00
Add rnx and rnx_mitm service
This commit is contained in:
parent
f29ab6d0f3
commit
74a64ead81
10
stratosphere/ams_mitm/source/rnx_mitm/rnxmitm_main.cpp
Normal file
10
stratosphere/ams_mitm/source/rnx_mitm/rnxmitm_main.cpp
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
// Just a stub to get reinx only apps launching
|
||||||
|
#include <svc.h>
|
||||||
|
int main(){
|
||||||
|
// This should do nothing but hang forever
|
||||||
|
while(1){
|
||||||
|
//Do nothing
|
||||||
|
svcSleepThread(100000000);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
@ -34,11 +34,9 @@ static FsFileSystem g_HblFileSystem = {};
|
|||||||
|
|
||||||
static std::vector<u64> g_created_titles;
|
static std::vector<u64> g_created_titles;
|
||||||
static bool g_has_initialized_fs_dev = false;
|
static bool g_has_initialized_fs_dev = false;
|
||||||
|
|
||||||
/* Default to Key R, hold disables override, HBL at atmosphere/hbl.nsp. */
|
/* Default to Key R, hold disables override, HBL at atmosphere/hbl.nsp. */
|
||||||
static bool g_mounted_hbl_nsp = false;
|
static bool g_mounted_hbl_nsp = false;
|
||||||
static char g_hbl_sd_path[FS_MAX_PATH+1] = "@Sdcard:/atmosphere/hbl.nsp\x00";
|
static char g_hbl_sd_path[FS_MAX_PATH+1] = "@Sdcard:/atmosphere/hbl.nsp\x00";
|
||||||
|
|
||||||
static OverrideKey g_default_override_key = {
|
static OverrideKey g_default_override_key = {
|
||||||
.key_combination = KEY_L,
|
.key_combination = KEY_L,
|
||||||
.override_by_default = true
|
.override_by_default = true
|
||||||
@ -105,7 +103,6 @@ Result ContentManagement::MountCode(u64 tid, FsStorageId sid) {
|
|||||||
if (R_FAILED(rc = fsldrOpenCodeFileSystem(tid, path, &g_CodeFileSystem))) {
|
if (R_FAILED(rc = fsldrOpenCodeFileSystem(tid, path, &g_CodeFileSystem))) {
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
fsdevMountDevice("code", g_CodeFileSystem);
|
fsdevMountDevice("code", g_CodeFileSystem);
|
||||||
TryMountHblNspOnSd();
|
TryMountHblNspOnSd();
|
||||||
return rc;
|
return rc;
|
||||||
@ -419,7 +416,6 @@ static bool ShouldOverrideContents(OverrideKey *cfg) {
|
|||||||
bool keys_triggered = (R_SUCCEEDED(HidManagement::GetKeysHeld(&kDown)) && ((kDown & cfg->key_combination) != 0));
|
bool keys_triggered = (R_SUCCEEDED(HidManagement::GetKeysHeld(&kDown)) && ((kDown & cfg->key_combination) != 0));
|
||||||
return g_has_initialized_fs_dev && (cfg->override_by_default ^ keys_triggered);
|
return g_has_initialized_fs_dev && (cfg->override_by_default ^ keys_triggered);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ContentManagement::ShouldOverrideContentsWithHBL(u64 tid) {
|
bool ContentManagement::ShouldOverrideContentsWithHBL(u64 tid) {
|
||||||
if (g_mounted_hbl_nsp && tid >= TitleId_AppletStart && HasCreatedTitle(TitleId_AppletQlaunch)) {
|
if (g_mounted_hbl_nsp && tid >= TitleId_AppletStart && HasCreatedTitle(TitleId_AppletQlaunch)) {
|
||||||
/* Return whether we should override contents with HBL. */
|
/* Return whether we should override contents with HBL. */
|
||||||
@ -429,23 +425,11 @@ bool ContentManagement::ShouldOverrideContentsWithHBL(u64 tid) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ContentManagement::ShouldOverrideContentsWithSD(u64 tid){
|
bool ContentManagement::ShouldOverrideContentsWithSD(u64 tid){
|
||||||
if (g_has_initialized_fs_dev) {
|
// Aliases
|
||||||
if (tid >= TitleId_AppletStart && HasCreatedTitle(TitleId_AppletQlaunch)) {
|
Result rc = ContentManagement::ShouldOverrideContentsWithHBL(tid);
|
||||||
/* Check whether we should override with non-HBL. */
|
return rc;
|
||||||
OverrideKey title_cfg = GetTitleOverrideKey(tid);
|
|
||||||
return ShouldOverrideContents(&title_cfg);
|
|
||||||
} else {
|
|
||||||
/* Always redirect before qlaunch. */
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
/* Never redirect before we can do so. */
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* SetExternalContentSource extension */
|
/* SetExternalContentSource extension */
|
||||||
ContentManagement::ExternalContentSource *ContentManagement::GetExternalContentSource(u64 tid) {
|
ContentManagement::ExternalContentSource *ContentManagement::GetExternalContentSource(u64 tid) {
|
||||||
auto i = g_external_content_sources.find(tid);
|
auto i = g_external_content_sources.find(tid);
|
||||||
|
@ -26,7 +26,8 @@
|
|||||||
#include "ldr_process_manager.hpp"
|
#include "ldr_process_manager.hpp"
|
||||||
#include "ldr_debug_monitor.hpp"
|
#include "ldr_debug_monitor.hpp"
|
||||||
#include "ldr_shell.hpp"
|
#include "ldr_shell.hpp"
|
||||||
|
// For stub rnx service
|
||||||
|
#include "ldr_rei.hpp"
|
||||||
extern "C" {
|
extern "C" {
|
||||||
extern u32 __start__;
|
extern u32 __start__;
|
||||||
|
|
||||||
@ -113,6 +114,7 @@ int main(int argc, char **argv)
|
|||||||
static auto s_server_manager = WaitableManager<LoaderServerOptions>(1);
|
static auto s_server_manager = WaitableManager<LoaderServerOptions>(1);
|
||||||
|
|
||||||
/* Add services to manager. */
|
/* Add services to manager. */
|
||||||
|
s_server_manager.AddWaitable(new ServiceServer<RNXService>("rnx", 1));
|
||||||
s_server_manager.AddWaitable(new ServiceServer<ProcessManagerService>("ldr:pm", 1));
|
s_server_manager.AddWaitable(new ServiceServer<ProcessManagerService>("ldr:pm", 1));
|
||||||
s_server_manager.AddWaitable(new ServiceServer<ShellService>("ldr:shel", 3));
|
s_server_manager.AddWaitable(new ServiceServer<ShellService>("ldr:shel", 3));
|
||||||
s_server_manager.AddWaitable(new ServiceServer<DebugMonitorService>("ldr:dmnt", 2));
|
s_server_manager.AddWaitable(new ServiceServer<DebugMonitorService>("ldr:dmnt", 2));
|
||||||
|
19
stratosphere/loader/source/ldr_rei.cpp
Normal file
19
stratosphere/loader/source/ldr_rei.cpp
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
#include <switch.h>
|
||||||
|
#include <stratosphere.hpp>
|
||||||
|
#include <switch.h>
|
||||||
|
#include <stratosphere.hpp>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include "ldr_rei.hpp"
|
||||||
|
u64 HbOverrideTid = 0x010000000000100D;
|
||||||
|
Result RNXService::GetReiNXVersion(Out<u32> maj, Out<u32> min) {
|
||||||
|
// PASS IN 2 and 4 to trick reinx appls. This is to trick apps into working with ams
|
||||||
|
*maj.GetPointer() = 2;
|
||||||
|
*min.GetPointer() = 4;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
// For deltalaunch
|
||||||
|
Result RNXService::SetHbTidForDelta(u64 tid) {
|
||||||
|
// Hardcode the tid
|
||||||
|
HbOverrideTid = tid;
|
||||||
|
return 0;
|
||||||
|
}
|
21
stratosphere/loader/source/ldr_rei.hpp
Normal file
21
stratosphere/loader/source/ldr_rei.hpp
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
#pragma once
|
||||||
|
#include <switch.h>
|
||||||
|
#include <stratosphere.hpp>
|
||||||
|
#include "ldr_content_management.hpp"
|
||||||
|
|
||||||
|
enum RNXServiceCmd {
|
||||||
|
RNX_CMD_GetReiNXVersion = 0,
|
||||||
|
RNX_CMD_SetHbTidForDelta = 1,
|
||||||
|
};
|
||||||
|
|
||||||
|
class RNXService final : public IServiceObject {
|
||||||
|
private:
|
||||||
|
/* Actual commands. */
|
||||||
|
Result GetReiNXVersion(Out<u32> maj, Out<u32> min);
|
||||||
|
Result SetHbTidForDelta(u64 tid);
|
||||||
|
public:
|
||||||
|
DEFINE_SERVICE_DISPATCH_TABLE {
|
||||||
|
MakeServiceCommandMeta<RNX_CMD_GetReiNXVersion, &RNXService::GetReiNXVersion>(),
|
||||||
|
MakeServiceCommandMeta<RNX_CMD_SetHbTidForDelta, &RNXService::SetHbTidForDelta>(),
|
||||||
|
};
|
||||||
|
};
|
Loading…
Reference in New Issue
Block a user