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:
Steveice10 2023-07-29 00:26:16 -07:00 committed by GitHub
parent 51996c54f0
commit bb364d9bc0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
31 changed files with 939 additions and 221 deletions

View file

@ -13,6 +13,7 @@
#include "common/common_types.h"
#include "common/file_util.h"
#include "core/file_sys/romfs_reader.h"
#include "core/hle/kernel/kernel.h"
#include "core/hle/kernel/object.h"
namespace Kernel {
@ -99,23 +100,36 @@ public:
virtual ResultStatus Load(std::shared_ptr<Kernel::Process>& process) = 0;
/**
* Loads the system mode that this application needs.
* This function defaults to 2 (96MB allocated to the application) if it can't read the
* Loads the core version (FIRM title ID low) that this application needs.
* This function defaults to 0x2 (NATIVE_FIRM) if it can't read the
* information.
* @returns A pair with the optional system mode, and the status.
* @returns A pair with the optional core version, and the status.
*/
virtual std::pair<std::optional<u32>, ResultStatus> LoadKernelSystemMode() {
// 96MB allocated to the application.
return std::make_pair(2, ResultStatus::Success);
virtual std::pair<std::optional<u32>, ResultStatus> LoadCoreVersion() {
return std::make_pair(0x2, ResultStatus::Success);
}
/**
* Loads the N3ds mode that this application uses.
* It defaults to 0 (O3DS default) if it can't read the information.
* @returns A pair with the optional N3ds mode, and the status.
* Loads the memory mode that this application needs.
* This function defaults to Dev1 (96MB allocated to the application) if it can't read the
* information.
* @returns A pair with the optional memory mode, and the status.
*/
virtual std::pair<std::optional<u8>, ResultStatus> LoadKernelN3dsMode() {
return std::make_pair(u8(0), ResultStatus::Success);
virtual std::pair<std::optional<Kernel::MemoryMode>, ResultStatus> LoadKernelMemoryMode() {
// 96MB allocated to the application.
return std::make_pair(Kernel::MemoryMode::Dev1, ResultStatus::Success);
}
/**
* Loads the N3DS hardware capabilities that this application uses.
* It defaults to all disabled (O3DS) if it can't read the information.
* @returns A pair with the optional N3DS hardware capabilities, and the status.
*/
virtual std::pair<std::optional<Kernel::New3dsHwCapabilities>, ResultStatus>
LoadNew3dsHwCapabilities() {
return std::make_pair(
Kernel::New3dsHwCapabilities{false, false, Kernel::New3dsMemoryMode::Legacy},
ResultStatus::Success);
}
/**