yuzu-emu
/
yuzu
Archived
1
0
Fork 0

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

View File

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

View File

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

View File

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

View File

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