mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-11-04 23:35:12 +01:00
Add loader to the emulator state
This will allow accessing data from the loader within other parts of the emulator, such as in fssrv for RomFS.
This commit is contained in:
parent
57b5630422
commit
b9b889fc3c
@ -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> nce; //!< This holds a reference to the NCE class
|
||||
std::shared_ptr<gpu::GPU> gpu; //!< This holds a reference to the GPU class
|
||||
std::shared_ptr<audio::Audio> audio; //!< This holds a reference to the Audio class
|
||||
std::shared_ptr<loader::Loader> loader; //!< This holds a reference to the Loader class
|
||||
std::shared_ptr<JvmManager> jvm; //!< This holds a reference to the JvmManager class
|
||||
std::shared_ptr<Settings> settings; //!< This holds a reference to the Settings class
|
||||
std::shared_ptr<Logger> logger; //!< This holds a reference to the Logger class
|
||||
|
@ -10,16 +10,15 @@ namespace skyline::kernel {
|
||||
OS::OS(std::shared_ptr<JvmManager> &jvmManager, std::shared_ptr<Logger> &logger, std::shared_ptr<Settings> &settings) : state(this, process, jvmManager, settings, logger), memory(state), serviceManager(state) {}
|
||||
|
||||
void OS::Execute(int romFd, loader::RomFormat romType) {
|
||||
std::shared_ptr<loader::Loader> loader;
|
||||
auto romFile = std::make_shared<vfs::OsBacking>(romFd);
|
||||
|
||||
if (romType == loader::RomFormat::NRO) {
|
||||
loader = std::make_shared<loader::NroLoader>(romFile);
|
||||
state.loader = std::make_shared<loader::NroLoader>(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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user