diff --git a/app/src/main/cpp/skyline/common.h b/app/src/main/cpp/skyline/common.h index a4d95bb0..c2414c41 100644 --- a/app/src/main/cpp/skyline/common.h +++ b/app/src/main/cpp/skyline/common.h @@ -361,6 +361,9 @@ namespace skyline { namespace audio { class Audio; } + namespace loader { + class Loader; + } /** * @brief This struct is used to hold the state of a device @@ -375,6 +378,7 @@ namespace skyline { std::shared_ptr nce; //!< This holds a reference to the NCE class std::shared_ptr gpu; //!< This holds a reference to the GPU class std::shared_ptr audio; //!< This holds a reference to the Audio class + std::shared_ptr loader; //!< This holds a reference to the Loader class std::shared_ptr jvm; //!< This holds a reference to the JvmManager class std::shared_ptr settings; //!< This holds a reference to the Settings class std::shared_ptr logger; //!< This holds a reference to the Logger class diff --git a/app/src/main/cpp/skyline/os.cpp b/app/src/main/cpp/skyline/os.cpp index 872cdbbd..045a768b 100644 --- a/app/src/main/cpp/skyline/os.cpp +++ b/app/src/main/cpp/skyline/os.cpp @@ -10,16 +10,15 @@ namespace skyline::kernel { OS::OS(std::shared_ptr &jvmManager, std::shared_ptr &logger, std::shared_ptr &settings) : state(this, process, jvmManager, settings, logger), memory(state), serviceManager(state) {} void OS::Execute(int romFd, loader::RomFormat romType) { - std::shared_ptr loader; auto romFile = std::make_shared(romFd); if (romType == loader::RomFormat::NRO) { - loader = std::make_shared(romFile); + state.loader = std::make_shared(romFile); } else throw exception("Unsupported ROM extension."); auto process = CreateProcess(constant::BaseAddress, 0, constant::DefStackSize); - loader->LoadProcessData(process, state); + state.loader->LoadProcessData(process, state); process->InitializeMemory(); process->threads.at(process->pid)->Start(); // The kernel itself is responsible for starting the main thread