summaryrefslogtreecommitdiffstats
path: root/src/core/hle/applets
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/hle/applets')
-rw-r--r--src/core/hle/applets/applet.cpp32
-rw-r--r--src/core/hle/applets/applet.h9
-rw-r--r--src/core/hle/applets/erreula.cpp12
-rw-r--r--src/core/hle/applets/erreula.h11
-rw-r--r--src/core/hle/applets/mii_selector.cpp16
-rw-r--r--src/core/hle/applets/mii_selector.h39
-rw-r--r--src/core/hle/applets/swkbd.cpp20
-rw-r--r--src/core/hle/applets/swkbd.h13
8 files changed, 88 insertions, 64 deletions
diff --git a/src/core/hle/applets/applet.cpp b/src/core/hle/applets/applet.cpp
index ccf35fa07..2b4bd939d 100644
--- a/src/core/hle/applets/applet.cpp
+++ b/src/core/hle/applets/applet.cpp
@@ -23,23 +23,24 @@
// Specializes std::hash for AppletId, so that we can use it in std::unordered_map.
// Workaround for libstdc++ bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60970
namespace std {
- template <>
- struct hash<Service::APT::AppletId> {
- typedef Service::APT::AppletId argument_type;
- typedef std::size_t result_type;
-
- result_type operator()(const argument_type& id_code) const {
- typedef std::underlying_type<argument_type>::type Type;
- return std::hash<Type>()(static_cast<Type>(id_code));
- }
- };
+template <>
+struct hash<Service::APT::AppletId> {
+ typedef Service::APT::AppletId argument_type;
+ typedef std::size_t result_type;
+
+ result_type operator()(const argument_type& id_code) const {
+ typedef std::underlying_type<argument_type>::type Type;
+ return std::hash<Type>()(static_cast<Type>(id_code));
+ }
+};
}
namespace HLE {
namespace Applets {
static std::unordered_map<Service::APT::AppletId, std::shared_ptr<Applet>> applets;
-static u32 applet_update_event = -1; ///< The CoreTiming event identifier for the Applet update callback.
+static u32 applet_update_event =
+ -1; ///< The CoreTiming event identifier for the Applet update callback.
/// The interval at which the Applet update callback will be called, 16.6ms
static const u64 applet_update_interval_us = 16666;
@@ -60,7 +61,8 @@ ResultCode Applet::Create(Service::APT::AppletId id) {
default:
LOG_ERROR(Service_APT, "Could not create applet %u", id);
// TODO(Subv): Find the right error code
- return ResultCode(ErrorDescription::NotFound, ErrorModule::Applet, ErrorSummary::NotSupported, ErrorLevel::Permanent);
+ return ResultCode(ErrorDescription::NotFound, ErrorModule::Applet,
+ ErrorSummary::NotSupported, ErrorLevel::Permanent);
}
return RESULT_SUCCESS;
@@ -84,7 +86,7 @@ static void AppletUpdateEvent(u64 applet_id, int cycles_late) {
// If the applet is still running after the last update, reschedule the event
if (applet->IsRunning()) {
CoreTiming::ScheduleEvent(usToCycles(applet_update_interval_us) - cycles_late,
- applet_update_event, applet_id);
+ applet_update_event, applet_id);
} else {
// Otherwise the applet has terminated, in which case we should clean it up
applets[id] = nullptr;
@@ -96,7 +98,8 @@ ResultCode Applet::Start(const Service::APT::AppletStartupParameter& parameter)
if (result.IsError())
return result;
// Schedule the update event
- CoreTiming::ScheduleEvent(usToCycles(applet_update_interval_us), applet_update_event, static_cast<u64>(id));
+ CoreTiming::ScheduleEvent(usToCycles(applet_update_interval_us), applet_update_event,
+ static_cast<u64>(id));
return result;
}
@@ -116,6 +119,5 @@ void Init() {
void Shutdown() {
CoreTiming::RemoveEvent(applet_update_event);
}
-
}
} // namespace
diff --git a/src/core/hle/applets/applet.h b/src/core/hle/applets/applet.h
index 754c6f7db..350a58594 100644
--- a/src/core/hle/applets/applet.h
+++ b/src/core/hle/applets/applet.h
@@ -14,8 +14,10 @@ namespace Applets {
class Applet {
public:
- virtual ~Applet() { }
- Applet(Service::APT::AppletId id) : id(id) { }
+ virtual ~Applet() {
+ }
+ Applet(Service::APT::AppletId id) : id(id) {
+ }
/**
* Creates an instance of the Applet subclass identified by the parameter.
@@ -64,7 +66,7 @@ protected:
*/
virtual ResultCode StartImpl(const Service::APT::AppletStartupParameter& parameter) = 0;
- Service::APT::AppletId id; ///< Id of this Applet
+ Service::APT::AppletId id; ///< Id of this Applet
std::shared_ptr<std::vector<u8>> heap_memory; ///< Heap memory for this Applet
};
@@ -76,6 +78,5 @@ void Init();
/// Shuts down the HLE applets
void Shutdown();
-
}
} // namespace
diff --git a/src/core/hle/applets/erreula.cpp b/src/core/hle/applets/erreula.cpp
index 92a4b2323..144d6a152 100644
--- a/src/core/hle/applets/erreula.cpp
+++ b/src/core/hle/applets/erreula.cpp
@@ -18,7 +18,8 @@ ResultCode ErrEula::ReceiveParameter(const Service::APT::MessageParameter& param
return ResultCode(-1);
}
- // The LibAppJustStarted message contains a buffer with the size of the framebuffer shared memory.
+ // The LibAppJustStarted message contains a buffer with the size of the framebuffer shared
+ // memory.
// Create the SharedMemory that will hold the framebuffer data
Service::APT::CaptureBufferInfo capture_info;
ASSERT(sizeof(capture_info) == parameter.buffer.size());
@@ -30,9 +31,9 @@ ResultCode ErrEula::ReceiveParameter(const Service::APT::MessageParameter& param
// Allocate a heap block of the required size for this applet.
heap_memory = std::make_shared<std::vector<u8>>(capture_info.size);
// Create a SharedMemory that directly points to this heap block.
- framebuffer_memory = Kernel::SharedMemory::CreateForApplet(heap_memory, 0, heap_memory->size(),
- MemoryPermission::ReadWrite, MemoryPermission::ReadWrite,
- "ErrEula Memory");
+ framebuffer_memory = Kernel::SharedMemory::CreateForApplet(
+ heap_memory, 0, heap_memory->size(), MemoryPermission::ReadWrite,
+ MemoryPermission::ReadWrite, "ErrEula Memory");
// Send the response message with the newly created SharedMemory
Service::APT::MessageParameter result;
@@ -49,7 +50,8 @@ ResultCode ErrEula::ReceiveParameter(const Service::APT::MessageParameter& param
ResultCode ErrEula::StartImpl(const Service::APT::AppletStartupParameter& parameter) {
started = true;
- // TODO(Subv): Set the expected fields in the response buffer before resending it to the application.
+ // TODO(Subv): Set the expected fields in the response buffer before resending it to the
+ // application.
// TODO(Subv): Reverse the parameter format for the ErrEula applet
// Let the application know that we're closing
diff --git a/src/core/hle/applets/erreula.h b/src/core/hle/applets/erreula.h
index 9fe72ae07..dd1d1aee4 100644
--- a/src/core/hle/applets/erreula.h
+++ b/src/core/hle/applets/erreula.h
@@ -12,16 +12,21 @@ namespace Applets {
class ErrEula final : public Applet {
public:
- explicit ErrEula(Service::APT::AppletId id): Applet(id) { }
+ explicit ErrEula(Service::APT::AppletId id) : Applet(id) {
+ }
ResultCode ReceiveParameter(const Service::APT::MessageParameter& parameter) override;
ResultCode StartImpl(const Service::APT::AppletStartupParameter& parameter) override;
void Update() override;
- bool IsRunning() const override { return started; }
+ bool IsRunning() const override {
+ return started;
+ }
/// This SharedMemory will be created when we receive the LibAppJustStarted message.
- /// It holds the framebuffer info retrieved by the application with GSPGPU::ImportDisplayCaptureInfo
+ /// It holds the framebuffer info retrieved by the application with
+ /// GSPGPU::ImportDisplayCaptureInfo
Kernel::SharedPtr<Kernel::SharedMemory> framebuffer_memory;
+
private:
/// Whether this applet is currently running instead of the host application or not.
bool started = false;
diff --git a/src/core/hle/applets/mii_selector.cpp b/src/core/hle/applets/mii_selector.cpp
index 77f01d208..19e603eda 100644
--- a/src/core/hle/applets/mii_selector.cpp
+++ b/src/core/hle/applets/mii_selector.cpp
@@ -29,7 +29,8 @@ ResultCode MiiSelector::ReceiveParameter(const Service::APT::MessageParameter& p
return ResultCode(-1);
}
- // The LibAppJustStarted message contains a buffer with the size of the framebuffer shared memory.
+ // The LibAppJustStarted message contains a buffer with the size of the framebuffer shared
+ // memory.
// Create the SharedMemory that will hold the framebuffer data
Service::APT::CaptureBufferInfo capture_info;
ASSERT(sizeof(capture_info) == parameter.buffer.size());
@@ -40,9 +41,9 @@ ResultCode MiiSelector::ReceiveParameter(const Service::APT::MessageParameter& p
// Allocate a heap block of the required size for this applet.
heap_memory = std::make_shared<std::vector<u8>>(capture_info.size);
// Create a SharedMemory that directly points to this heap block.
- framebuffer_memory = Kernel::SharedMemory::CreateForApplet(heap_memory, 0, heap_memory->size(),
- MemoryPermission::ReadWrite, MemoryPermission::ReadWrite,
- "MiiSelector Memory");
+ framebuffer_memory = Kernel::SharedMemory::CreateForApplet(
+ heap_memory, 0, heap_memory->size(), MemoryPermission::ReadWrite,
+ MemoryPermission::ReadWrite, "MiiSelector Memory");
// Send the response message with the newly created SharedMemory
Service::APT::MessageParameter result;
@@ -59,12 +60,14 @@ ResultCode MiiSelector::ReceiveParameter(const Service::APT::MessageParameter& p
ResultCode MiiSelector::StartImpl(const Service::APT::AppletStartupParameter& parameter) {
started = true;
- // TODO(Subv): Set the expected fields in the response buffer before resending it to the application.
+ // TODO(Subv): Set the expected fields in the response buffer before resending it to the
+ // application.
// TODO(Subv): Reverse the parameter format for the Mii Selector
memcpy(&config, parameter.buffer.data(), parameter.buffer.size());
- // TODO(Subv): Find more about this structure, result code 0 is enough to let most games continue.
+ // TODO(Subv): Find more about this structure, result code 0 is enough to let most games
+ // continue.
MiiResult result;
memset(&result, 0, sizeof(result));
result.result_code = 0;
@@ -84,6 +87,5 @@ ResultCode MiiSelector::StartImpl(const Service::APT::AppletStartupParameter& pa
void MiiSelector::Update() {
}
-
}
} // namespace
diff --git a/src/core/hle/applets/mii_selector.h b/src/core/hle/applets/mii_selector.h
index 24e8e721d..dba4abc8d 100644
--- a/src/core/hle/applets/mii_selector.h
+++ b/src/core/hle/applets/mii_selector.h
@@ -4,8 +4,8 @@
#pragma once
-#include "common/common_types.h"
#include "common/common_funcs.h"
+#include "common/common_types.h"
#include "core/hle/applets/applet.h"
#include "core/hle/kernel/kernel.h"
@@ -17,28 +17,30 @@ namespace HLE {
namespace Applets {
struct MiiConfig {
- u8 unk_000;
- u8 unk_001;
- u8 unk_002;
- u8 unk_003;
- u8 unk_004;
+ u8 unk_000;
+ u8 unk_001;
+ u8 unk_002;
+ u8 unk_003;
+ u8 unk_004;
INSERT_PADDING_BYTES(3);
u16 unk_008;
INSERT_PADDING_BYTES(0x82);
- u8 unk_08C;
+ u8 unk_08C;
INSERT_PADDING_BYTES(3);
u16 unk_090;
INSERT_PADDING_BYTES(2);
u32 unk_094;
u16 unk_098;
- u8 unk_09A[0x64];
- u8 unk_0FE;
- u8 unk_0FF;
+ u8 unk_09A[0x64];
+ u8 unk_0FE;
+ u8 unk_0FF;
u32 unk_100;
};
static_assert(sizeof(MiiConfig) == 0x104, "MiiConfig structure has incorrect size");
-#define ASSERT_REG_POSITION(field_name, position) static_assert(offsetof(MiiConfig, field_name) == position, "Field "#field_name" has invalid position")
+#define ASSERT_REG_POSITION(field_name, position) \
+ static_assert(offsetof(MiiConfig, field_name) == position, \
+ "Field " #field_name " has invalid position")
ASSERT_REG_POSITION(unk_008, 0x08);
ASSERT_REG_POSITION(unk_08C, 0x8C);
ASSERT_REG_POSITION(unk_090, 0x90);
@@ -55,22 +57,28 @@ struct MiiResult {
INSERT_PADDING_BYTES(2);
};
static_assert(sizeof(MiiResult) == 0x84, "MiiResult structure has incorrect size");
-#define ASSERT_REG_POSITION(field_name, position) static_assert(offsetof(MiiResult, field_name) == position, "Field "#field_name" has invalid position")
+#define ASSERT_REG_POSITION(field_name, position) \
+ static_assert(offsetof(MiiResult, field_name) == position, \
+ "Field " #field_name " has invalid position")
ASSERT_REG_POSITION(unk_0C, 0x0C);
ASSERT_REG_POSITION(unk_6C, 0x6C);
#undef ASSERT_REG_POSITION
class MiiSelector final : public Applet {
public:
- MiiSelector(Service::APT::AppletId id) : Applet(id), started(false) { }
+ MiiSelector(Service::APT::AppletId id) : Applet(id), started(false) {
+ }
ResultCode ReceiveParameter(const Service::APT::MessageParameter& parameter) override;
ResultCode StartImpl(const Service::APT::AppletStartupParameter& parameter) override;
void Update() override;
- bool IsRunning() const override { return started; }
+ bool IsRunning() const override {
+ return started;
+ }
/// This SharedMemory will be created when we receive the LibAppJustStarted message.
- /// It holds the framebuffer info retrieved by the application with GSPGPU::ImportDisplayCaptureInfo
+ /// It holds the framebuffer info retrieved by the application with
+ /// GSPGPU::ImportDisplayCaptureInfo
Kernel::SharedPtr<Kernel::SharedMemory> framebuffer_memory;
/// Whether this applet is currently running instead of the host application or not.
@@ -78,6 +86,5 @@ public:
MiiConfig config;
};
-
}
} // namespace
diff --git a/src/core/hle/applets/swkbd.cpp b/src/core/hle/applets/swkbd.cpp
index d87bf3d57..cf2775968 100644
--- a/src/core/hle/applets/swkbd.cpp
+++ b/src/core/hle/applets/swkbd.cpp
@@ -12,9 +12,9 @@
#include "core/hle/applets/swkbd.h"
#include "core/hle/kernel/kernel.h"
#include "core/hle/kernel/shared_memory.h"
-#include "core/hle/service/hid/hid.h"
-#include "core/hle/service/gsp_gpu.h"
#include "core/hle/result.h"
+#include "core/hle/service/gsp_gpu.h"
+#include "core/hle/service/hid/hid.h"
#include "core/memory.h"
#include "video_core/video_core.h"
@@ -32,7 +32,8 @@ ResultCode SoftwareKeyboard::ReceiveParameter(Service::APT::MessageParameter con
return ResultCode(-1);
}
- // The LibAppJustStarted message contains a buffer with the size of the framebuffer shared memory.
+ // The LibAppJustStarted message contains a buffer with the size of the framebuffer shared
+ // memory.
// Create the SharedMemory that will hold the framebuffer data
Service::APT::CaptureBufferInfo capture_info;
ASSERT(sizeof(capture_info) == parameter.buffer.size());
@@ -43,9 +44,9 @@ ResultCode SoftwareKeyboard::ReceiveParameter(Service::APT::MessageParameter con
// Allocate a heap block of the required size for this applet.
heap_memory = std::make_shared<std::vector<u8>>(capture_info.size);
// Create a SharedMemory that directly points to this heap block.
- framebuffer_memory = Kernel::SharedMemory::CreateForApplet(heap_memory, 0, heap_memory->size(),
- MemoryPermission::ReadWrite, MemoryPermission::ReadWrite,
- "SoftwareKeyboard Memory");
+ framebuffer_memory = Kernel::SharedMemory::CreateForApplet(
+ heap_memory, 0, heap_memory->size(), MemoryPermission::ReadWrite,
+ MemoryPermission::ReadWrite, "SoftwareKeyboard Memory");
// Send the response message with the newly created SharedMemory
Service::APT::MessageParameter result;
@@ -60,10 +61,12 @@ ResultCode SoftwareKeyboard::ReceiveParameter(Service::APT::MessageParameter con
}
ResultCode SoftwareKeyboard::StartImpl(Service::APT::AppletStartupParameter const& parameter) {
- ASSERT_MSG(parameter.buffer.size() == sizeof(config), "The size of the parameter (SoftwareKeyboardConfig) is wrong");
+ ASSERT_MSG(parameter.buffer.size() == sizeof(config),
+ "The size of the parameter (SoftwareKeyboardConfig) is wrong");
memcpy(&config, parameter.buffer.data(), parameter.buffer.size());
- text_memory = boost::static_pointer_cast<Kernel::SharedMemory, Kernel::Object>(parameter.object);
+ text_memory =
+ boost::static_pointer_cast<Kernel::SharedMemory, Kernel::Object>(parameter.object);
// TODO(Subv): Verify if this is the correct behavior
memset(text_memory->GetPointer(), 0, text_memory->size);
@@ -115,6 +118,5 @@ void SoftwareKeyboard::Finalize() {
started = false;
}
-
}
} // namespace
diff --git a/src/core/hle/applets/swkbd.h b/src/core/hle/applets/swkbd.h
index cf26a8fb7..f50673912 100644
--- a/src/core/hle/applets/swkbd.h
+++ b/src/core/hle/applets/swkbd.h
@@ -4,8 +4,8 @@
#pragma once
-#include "common/common_types.h"
#include "common/common_funcs.h"
+#include "common/common_types.h"
#include "core/hle/applets/applet.h"
#include "core/hle/kernel/kernel.h"
@@ -53,12 +53,15 @@ static_assert(sizeof(SoftwareKeyboardConfig) == 0x400, "Software Keyboard Config
class SoftwareKeyboard final : public Applet {
public:
- SoftwareKeyboard(Service::APT::AppletId id) : Applet(id), started(false) { }
+ SoftwareKeyboard(Service::APT::AppletId id) : Applet(id), started(false) {
+ }
ResultCode ReceiveParameter(const Service::APT::MessageParameter& parameter) override;
ResultCode StartImpl(const Service::APT::AppletStartupParameter& parameter) override;
void Update() override;
- bool IsRunning() const override { return started; }
+ bool IsRunning() const override {
+ return started;
+ }
/**
* Draws a keyboard to the current bottom screen framebuffer.
@@ -72,7 +75,8 @@ public:
void Finalize();
/// This SharedMemory will be created when we receive the LibAppJustStarted message.
- /// It holds the framebuffer info retrieved by the application with GSPGPU::ImportDisplayCaptureInfo
+ /// It holds the framebuffer info retrieved by the application with
+ /// GSPGPU::ImportDisplayCaptureInfo
Kernel::SharedPtr<Kernel::SharedMemory> framebuffer_memory;
/// SharedMemory where the output text will be stored
@@ -84,6 +88,5 @@ public:
/// Whether this applet is currently running instead of the host application or not.
bool started;
};
-
}
} // namespace