nso.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. // Copyright 2018 yuzu emulator team
  2. // Licensed under GPLv2 or any later version
  3. // Refer to the license.txt file included.
  4. #pragma once
  5. #include <optional>
  6. #include "common/common_types.h"
  7. #include "core/file_sys/patch_manager.h"
  8. #include "core/loader/linker.h"
  9. #include "core/loader/loader.h"
  10. namespace Loader {
  11. constexpr u64 NSO_ARGUMENT_DATA_ALLOCATION_SIZE = 0x9000;
  12. struct NSOArgumentHeader {
  13. u32_le allocated_size;
  14. u32_le actual_size;
  15. INSERT_PADDING_BYTES(0x18);
  16. };
  17. static_assert(sizeof(NSOArgumentHeader) == 0x20, "NSOArgumentHeader has incorrect size.");
  18. /// Loads an NSO file
  19. class AppLoader_NSO final : public AppLoader, Linker {
  20. public:
  21. explicit AppLoader_NSO(FileSys::VirtualFile file);
  22. /**
  23. * Returns the type of the file
  24. * @param file std::shared_ptr<VfsFile> open file
  25. * @return FileType found, or FileType::Error if this loader doesn't know it
  26. */
  27. static FileType IdentifyType(const FileSys::VirtualFile& file);
  28. FileType GetFileType() override {
  29. return IdentifyType(file);
  30. }
  31. static std::optional<VAddr> LoadModule(const FileSys::VfsFile& file, VAddr load_base,
  32. bool should_pass_arguments,
  33. std::optional<FileSys::PatchManager> pm = {});
  34. ResultStatus Load(Kernel::Process& process) override;
  35. };
  36. } // namespace Loader