loader: Add accessor for game control data

This commit is contained in:
Zach Hilman 2018-12-06 20:27:50 -05:00
parent 417e1ef09c
commit 0756f29a2c
5 changed files with 14 additions and 9 deletions

View file

@ -15,6 +15,10 @@
#include "core/file_sys/control_metadata.h"
#include "core/file_sys/vfs.h"
namespace FileSys {
class NACP;
} // namespace FileSys
namespace Kernel {
struct AddressMapping;
class Process;
@ -245,11 +249,11 @@ public:
}
/**
* Get the developer of the application
* @param developer Reference to store the application developer into
* Get the control data (CNMT) of the application
* @param control Reference to store the application control data into
* @return ResultStatus result of function
*/
virtual ResultStatus ReadDeveloper(std::string& developer) {
virtual ResultStatus ReadControlData(FileSys::NACP& control) {
return ResultStatus::ErrorNotImplemented;
}

View file

@ -152,10 +152,10 @@ ResultStatus AppLoader_NSP::ReadTitle(std::string& title) {
return ResultStatus::Success;
}
ResultStatus AppLoader_NSP::ReadDeveloper(std::string& developer) {
ResultStatus AppLoader_NSP::ReadControlData(FileSys::NACP& nacp) {
if (nacp_file == nullptr)
return ResultStatus::ErrorNoControl;
developer = nacp_file->GetDeveloperName();
nacp = *nacp_file;
return ResultStatus::Success;
}
} // namespace Loader

View file

@ -43,7 +43,7 @@ public:
ResultStatus ReadProgramId(u64& out_program_id) override;
ResultStatus ReadIcon(std::vector<u8>& buffer) override;
ResultStatus ReadTitle(std::string& title) override;
ResultStatus ReadDeveloper(std::string& developer) override;
ResultStatus ReadControlData(FileSys::NACP& nacp) override;
private:
std::unique_ptr<FileSys::NSP> nsp;

View file

@ -121,10 +121,11 @@ ResultStatus AppLoader_XCI::ReadTitle(std::string& title) {
return ResultStatus::Success;
}
ResultStatus AppLoader_XCI::ReadDeveloper(std::string& developer) {
ResultStatus AppLoader_XCI::ReadControlData(FileSys::NACP& control) {
if (nacp_file == nullptr)
return ResultStatus::ErrorNoControl;
developer = nacp_file->GetDeveloperName();
control = *nacp_file;
return ResultStatus::Success;
}
} // namespace Loader

View file

@ -43,7 +43,7 @@ public:
ResultStatus ReadProgramId(u64& out_program_id) override;
ResultStatus ReadIcon(std::vector<u8>& buffer) override;
ResultStatus ReadTitle(std::string& title) override;
ResultStatus ReadDeveloper(std::string& developer) override;
ResultStatus ReadControlData(FileSys::NACP& control) override;
private:
std::unique_ptr<FileSys::XCI> xci;