hle: Stub some service calls used by the home menu. (#6675)

This commit is contained in:
Steveice10
2023-07-07 22:05:38 -07:00
committed by GitHub
parent 26e3f96983
commit 662bb9ba77
22 changed files with 187 additions and 22 deletions

View File

@@ -11,6 +11,7 @@
#include "core/file_sys/archive_extsavedata.h"
#include "core/file_sys/errors.h"
#include "core/file_sys/file_backend.h"
#include "core/hle/kernel/shared_page.h"
#include "core/hle/service/ptm/ptm.h"
#include "core/hle/service/ptm/ptm_gets.h"
#include "core/hle/service/ptm/ptm_play.h"
@@ -132,6 +133,17 @@ void Module::Interface::CheckNew3DS(Kernel::HLERequestContext& ctx) {
Service::PTM::CheckNew3DS(rb);
}
void Module::Interface::GetSystemTime(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x401, 0, 0);
auto& share_page = Core::System::GetInstance().Kernel().GetSharedPageHandler();
const u64 console_time = share_page.GetSystemTimeSince2000();
IPC::RequestBuilder rb = rp.MakeBuilder(3, 0);
rb.Push(RESULT_SUCCESS);
rb.Push(console_time);
}
static void WriteGameCoinData(GameCoin gamecoin_data) {
const std::string& nand_directory = FileUtil::GetUserPath(FileUtil::UserPath::NANDDir);
FileSys::ArchiveFactory_ExtSaveData extdata_archive_factory(nand_directory, true);

View File

@@ -137,6 +137,14 @@ public:
*/
void CheckNew3DS(Kernel::HLERequestContext& ctx);
/**
* PTM::GetSystemTime service function
* Outputs:
* 1: Result code, 0 on success, otherwise error code
* 2-3: Time since 01/01/2020.
*/
void GetSystemTime(Kernel::HLERequestContext& ctx);
protected:
std::shared_ptr<Module> ptm;
};

View File

@@ -30,7 +30,7 @@ PTM_Gets::PTM_Gets(std::shared_ptr<Module> ptm)
{IPC::MakeHeader(0x000E, 0, 0), nullptr, "GetPedometerRecordingMode"},
{IPC::MakeHeader(0x000F, 2, 4), nullptr, "GetStepHistoryAll"},
// ptm:gets
{IPC::MakeHeader(0x0401, 0, 0), nullptr, "GetSystemTime"},
{IPC::MakeHeader(0x0401, 0, 0), &PTM_Gets::GetSystemTime, "GetSystemTime"},
// clang-format on
};
RegisterHandlers(functions);