Service/AM: Implement GetProductCode (#3549)
* [skip ci] * [skip ci] * [skip ci] * [skip ci] * Service/AM: Implement GetProductCode * fix? * remove close * Use PushRaw * Use NCCHContainer * 2 if found * struct * fix build? * fix * remove return * fix? * 6 words
This commit is contained in:
committed by
Weiyi Wang
parent
0da3b75c9e
commit
473fd552c8
@@ -712,6 +712,32 @@ void Module::Interface::DeleteUserProgram(Kernel::HLERequestContext& ctx) {
|
||||
LOG_ERROR(Service_AM, "FileUtil::DeleteDirRecursively unexpectedly failed");
|
||||
}
|
||||
|
||||
void Module::Interface::GetProductCode(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp(ctx, 0x0005, 3, 0);
|
||||
FS::MediaType media_type = rp.PopEnum<FS::MediaType>();
|
||||
u64 title_id = rp.Pop<u64>();
|
||||
std::string path = GetTitleContentPath(media_type, title_id);
|
||||
|
||||
if (!FileUtil::Exists(path)) {
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(ResultCode(ErrorDescription::NotFound, ErrorModule::AM, ErrorSummary::InvalidState,
|
||||
ErrorLevel::Permanent));
|
||||
} else {
|
||||
struct ProductCode {
|
||||
u8 code[0x10];
|
||||
};
|
||||
|
||||
ProductCode product_code;
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(6, 0);
|
||||
FileSys::NCCHContainer ncch(path);
|
||||
ncch.Load();
|
||||
std::memcpy(&product_code.code, &ncch.ncch_header.product_code, 0x10);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.PushRaw(product_code);
|
||||
}
|
||||
}
|
||||
|
||||
void Module::Interface::GetDLCTitleInfos(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp(ctx, 0x1005, 2, 4); // 0x10050084
|
||||
|
||||
|
||||
Reference in New Issue
Block a user