mirror of
https://github.com/PabloMK7/citra.git
synced 2025-10-11 20:10:03 +00:00
service/apt: Add and implement more service commands. (#6721)
* service/apt: Add and implement more service commands. * service/apt: Implement power button. * Address review comments and fix GetApplicationRunningMode bug.
This commit is contained in:
parent
51996c54f0
commit
bb364d9bc0
31 changed files with 939 additions and 221 deletions
|
@ -672,30 +672,23 @@ void FS_USER::GetFormatInfo(Kernel::HLERequestContext& ctx) {
|
|||
|
||||
void FS_USER::GetProgramLaunchInfo(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp(ctx);
|
||||
|
||||
u32 process_id = rp.Pop<u32>();
|
||||
const auto process_id = rp.Pop<u32>();
|
||||
|
||||
LOG_DEBUG(Service_FS, "process_id={}", process_id);
|
||||
|
||||
auto program_info = program_info_map.find(process_id);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(5, 0);
|
||||
|
||||
if (program_info == program_info_map.end()) {
|
||||
auto program_info_result = GetProgramLaunchInfo(process_id);
|
||||
if (program_info_result.Failed()) {
|
||||
// Note: In this case, the rest of the parameters are not changed but the command header
|
||||
// remains the same.
|
||||
rb.Push(ResultCode(FileSys::ErrCodes::ArchiveNotMounted, ErrorModule::FS,
|
||||
ErrorSummary::NotFound, ErrorLevel::Status));
|
||||
rb.Push(program_info_result.Code());
|
||||
rb.Skip(4, false);
|
||||
return;
|
||||
}
|
||||
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(program_info->second.program_id);
|
||||
rb.Push(static_cast<u8>(program_info->second.media_type));
|
||||
|
||||
// TODO(Subv): Find out what this value means.
|
||||
rb.Push<u32>(0);
|
||||
rb.PushRaw(program_info_result.Unwrap());
|
||||
}
|
||||
|
||||
void FS_USER::ObsoletedCreateExtSaveData(Kernel::HLERequestContext& ctx) {
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include <unordered_map>
|
||||
#include <boost/serialization/base_object.hpp>
|
||||
#include "common/common_types.h"
|
||||
#include "core/file_sys/errors.h"
|
||||
#include "core/hle/service/service.h"
|
||||
|
||||
namespace Core {
|
||||
|
@ -17,6 +18,13 @@ namespace Service::FS {
|
|||
|
||||
class ArchiveManager;
|
||||
|
||||
struct ProgramInfo {
|
||||
u64 program_id;
|
||||
MediaType media_type;
|
||||
INSERT_PADDING_BYTES(4);
|
||||
};
|
||||
static_assert(sizeof(ProgramInfo) == 0x10, "ProgramInfo struct has incorrect size");
|
||||
|
||||
struct ClientSlot : public Kernel::SessionRequestHandler::SessionDataBase {
|
||||
// We retrieves program ID for client process on FS::Initialize(WithSDKVersion)
|
||||
// Real 3DS matches program ID and process ID based on data registered by loader via fs:REG, so
|
||||
|
@ -45,6 +53,17 @@ public:
|
|||
|
||||
std::string GetCurrentGamecardPath() const;
|
||||
|
||||
/// Gets the registered program info of a process.
|
||||
ResultVal<ProgramInfo> GetProgramLaunchInfo(u32 process_id) const {
|
||||
auto info = program_info_map.find(process_id);
|
||||
if (info != program_info_map.end()) {
|
||||
return info->second;
|
||||
} else {
|
||||
return ResultCode(FileSys::ErrCodes::ArchiveNotMounted, ErrorModule::FS,
|
||||
ErrorSummary::NotFound, ErrorLevel::Status);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
void Initialize(Kernel::HLERequestContext& ctx);
|
||||
|
||||
|
@ -602,11 +621,6 @@ private:
|
|||
static ResultVal<u16> GetSpecialContentIndexFromTMD(MediaType media_type, u64 title_id,
|
||||
SpecialContentType type);
|
||||
|
||||
struct ProgramInfo {
|
||||
u64 program_id;
|
||||
MediaType media_type;
|
||||
};
|
||||
|
||||
std::unordered_map<u32, ProgramInfo> program_info_map;
|
||||
std::string current_gamecard_path;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue