Merge pull request #4283 from valentinvanelslande/seed-db

Implement SeedDB & Seed Crypto
This commit is contained in:
Weiyi Wang 2018-10-08 14:18:42 -04:00 committed by GitHub
commit 756a3d404a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 229 additions and 11 deletions

View file

@ -11,6 +11,7 @@
#include "common/string_util.h"
#include "core/core.h"
#include "core/file_sys/errors.h"
#include "core/file_sys/seed_db.h"
#include "core/hle/ipc.h"
#include "core/hle/ipc_helpers.h"
#include "core/hle/kernel/client_port.h"
@ -685,14 +686,18 @@ void FS_USER::ObsoletedDeleteExtSaveData(Kernel::HLERequestContext& ctx) {
}
void FS_USER::GetNumSeeds(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x87D, 0, 0);
LOG_WARNING(Service_FS, "(STUBBED) called");
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
IPC::RequestBuilder rb{ctx, 0x87D, 2, 0};
rb.Push(RESULT_SUCCESS);
rb.Push<u32>(FileSys::GetSeedCount());
}
void FS_USER::AddSeed(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp{ctx, 0x87A, 6, 0};
u64 title_id{rp.Pop<u64>()};
FileSys::Seed::Data seed{rp.PopRaw<FileSys::Seed::Data>()};
FileSys::AddSeed({title_id, seed, {}});
IPC::RequestBuilder rb{rp.MakeBuilder(1, 0)};
rb.Push(RESULT_SUCCESS);
rb.Push<u32>(0);
}
void FS_USER::SetSaveDataSecureValue(Kernel::HLERequestContext& ctx) {
@ -846,7 +851,7 @@ FS_USER::FS_USER() : ServiceFramework("fs:USER", 30) {
{0x08680000, nullptr, "GetMediaType"},
{0x08690000, nullptr, "GetNandEraseCount"},
{0x086A0082, nullptr, "ReadNandReport"},
{0x087A0180, nullptr, "AddSeed"},
{0x087A0180, &FS_USER::AddSeed, "AddSeed"},
{0x087D0000, &FS_USER::GetNumSeeds, "GetNumSeeds"},
{0x088600C0, nullptr, "CheckUpdatedDat"},
};

View file

@ -489,6 +489,18 @@ private:
*/
void GetNumSeeds(Kernel::HLERequestContext& ctx);
/**
* FS_User::AddSeed service function.
* Inputs:
* 0 : 0x087A0180
* 1-2 : u64, Title ID
* 3-6 : Seed
* Outputs:
* 0 : 0x087A0040
* 1 : Result of function, 0 on success, otherwise error code
*/
void AddSeed(Kernel::HLERequestContext& ctx);
/**
* FS_User::SetSaveDataSecureValue service function.
* Inputs: