diff --git a/stratosphere/ams_mitm/source/rnx_mitm/rnxmitm_main.cpp b/stratosphere/ams_mitm/source/rnx_mitm/rnxmitm_main.cpp new file mode 100644 index 000000000..5d8691c29 --- /dev/null +++ b/stratosphere/ams_mitm/source/rnx_mitm/rnxmitm_main.cpp @@ -0,0 +1,10 @@ +// Just a stub to get reinx only apps launching +#include +int main(){ + // This should do nothing but hang forever + while(1){ + //Do nothing + svcSleepThread(100000000); + }; +}; + diff --git a/stratosphere/loader/source/ldr_content_management.cpp b/stratosphere/loader/source/ldr_content_management.cpp index f5f660ab2..0f6e96da7 100644 --- a/stratosphere/loader/source/ldr_content_management.cpp +++ b/stratosphere/loader/source/ldr_content_management.cpp @@ -34,11 +34,9 @@ static FsFileSystem g_HblFileSystem = {}; static std::vector g_created_titles; static bool g_has_initialized_fs_dev = false; - /* Default to Key R, hold disables override, HBL at atmosphere/hbl.nsp. */ static bool g_mounted_hbl_nsp = false; static char g_hbl_sd_path[FS_MAX_PATH+1] = "@Sdcard:/atmosphere/hbl.nsp\x00"; - static OverrideKey g_default_override_key = { .key_combination = KEY_L, .override_by_default = true @@ -105,7 +103,6 @@ Result ContentManagement::MountCode(u64 tid, FsStorageId sid) { if (R_FAILED(rc = fsldrOpenCodeFileSystem(tid, path, &g_CodeFileSystem))) { return rc; } - fsdevMountDevice("code", g_CodeFileSystem); TryMountHblNspOnSd(); return rc; @@ -419,7 +416,6 @@ static bool ShouldOverrideContents(OverrideKey *cfg) { 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); } - bool ContentManagement::ShouldOverrideContentsWithHBL(u64 tid) { if (g_mounted_hbl_nsp && tid >= TitleId_AppletStart && HasCreatedTitle(TitleId_AppletQlaunch)) { /* Return whether we should override contents with HBL. */ @@ -429,23 +425,11 @@ bool ContentManagement::ShouldOverrideContentsWithHBL(u64 tid) { return false; } } - -bool ContentManagement::ShouldOverrideContentsWithSD(u64 tid) { - if (g_has_initialized_fs_dev) { - if (tid >= TitleId_AppletStart && HasCreatedTitle(TitleId_AppletQlaunch)) { - /* Check whether we should override with non-HBL. */ - 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; - } +bool ContentManagement::ShouldOverrideContentsWithSD(u64 tid){ + // Aliases + Result rc = ContentManagement::ShouldOverrideContentsWithHBL(tid); + return rc; } - /* SetExternalContentSource extension */ ContentManagement::ExternalContentSource *ContentManagement::GetExternalContentSource(u64 tid) { auto i = g_external_content_sources.find(tid); diff --git a/stratosphere/loader/source/ldr_main.cpp b/stratosphere/loader/source/ldr_main.cpp index 5c7249989..fdc8574c9 100644 --- a/stratosphere/loader/source/ldr_main.cpp +++ b/stratosphere/loader/source/ldr_main.cpp @@ -26,7 +26,8 @@ #include "ldr_process_manager.hpp" #include "ldr_debug_monitor.hpp" #include "ldr_shell.hpp" - +// For stub rnx service +#include "ldr_rei.hpp" extern "C" { extern u32 __start__; @@ -113,6 +114,7 @@ int main(int argc, char **argv) static auto s_server_manager = WaitableManager(1); /* Add services to manager. */ + s_server_manager.AddWaitable(new ServiceServer("rnx", 1)); s_server_manager.AddWaitable(new ServiceServer("ldr:pm", 1)); s_server_manager.AddWaitable(new ServiceServer("ldr:shel", 3)); s_server_manager.AddWaitable(new ServiceServer("ldr:dmnt", 2)); diff --git a/stratosphere/loader/source/ldr_rei.cpp b/stratosphere/loader/source/ldr_rei.cpp new file mode 100644 index 000000000..b4e2a2f94 --- /dev/null +++ b/stratosphere/loader/source/ldr_rei.cpp @@ -0,0 +1,19 @@ +#include +#include +#include +#include +#include +#include "ldr_rei.hpp" +u64 HbOverrideTid = 0x010000000000100D; +Result RNXService::GetReiNXVersion(Out maj, Out 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; +} diff --git a/stratosphere/loader/source/ldr_rei.hpp b/stratosphere/loader/source/ldr_rei.hpp new file mode 100644 index 000000000..74da89a1e --- /dev/null +++ b/stratosphere/loader/source/ldr_rei.hpp @@ -0,0 +1,21 @@ +#pragma once +#include +#include +#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 maj, Out min); + Result SetHbTidForDelta(u64 tid); + public: + DEFINE_SERVICE_DISPATCH_TABLE { + MakeServiceCommandMeta(), + MakeServiceCommandMeta(), + }; +};