summaryrefslogtreecommitdiff
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.cpp34
-rw-r--r--src/core/hle/applets/applet.h8
-rw-r--r--src/core/hle/applets/erreula.cpp16
-rw-r--r--src/core/hle/applets/erreula.h10
-rw-r--r--src/core/hle/applets/mii_selector.cpp22
-rw-r--r--src/core/hle/applets/mii_selector.h39
-rw-r--r--src/core/hle/applets/swkbd.cpp23
-rw-r--r--src/core/hle/applets/swkbd.h13
8 files changed, 85 insertions, 80 deletions
diff --git a/src/core/hle/applets/applet.cpp b/src/core/hle/applets/applet.cpp
index ccf35fa07..4311d9897 100644
--- a/src/core/hle/applets/applet.cpp
+++ b/src/core/hle/applets/applet.cpp
@@ -6,10 +6,8 @@
#include <memory>
#include <type_traits>
#include <unordered_map>
-
#include "common/assert.h"
#include "common/common_types.h"
-
#include "core/core_timing.h"
#include "core/hle/applets/applet.h"
#include "core/hle/applets/erreula.h"
@@ -23,23 +21,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 +59,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 +84,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 +96,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 +117,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..bfdcad126 100644
--- a/src/core/hle/applets/applet.h
+++ b/src/core/hle/applets/applet.h
@@ -5,7 +5,6 @@
#pragma once
#include <memory>
-
#include "core/hle/result.h"
#include "core/hle/service/apt/apt.h"
@@ -14,8 +13,8 @@ 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 +63,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 +75,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..14964427b 100644
--- a/src/core/hle/applets/erreula.cpp
+++ b/src/core/hle/applets/erreula.cpp
@@ -3,7 +3,6 @@
// Refer to the license.txt file included.
#include "common/string_util.h"
-
#include "core/hle/applets/erreula.h"
#include "core/hle/service/apt/apt.h"
@@ -18,7 +17,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 +30,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 +49,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
@@ -65,8 +66,7 @@ ResultCode ErrEula::StartImpl(const Service::APT::AppletStartupParameter& parame
return RESULT_SUCCESS;
}
-void ErrEula::Update() {
-}
+void ErrEula::Update() {}
} // namespace Applets
} // namespace HLE
diff --git a/src/core/hle/applets/erreula.h b/src/core/hle/applets/erreula.h
index 9fe72ae07..a7ec7ec01 100644
--- a/src/core/hle/applets/erreula.h
+++ b/src/core/hle/applets/erreula.h
@@ -12,16 +12,20 @@ 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..53a8683a4 100644
--- a/src/core/hle/applets/mii_selector.cpp
+++ b/src/core/hle/applets/mii_selector.cpp
@@ -4,16 +4,13 @@
#include <cstring>
#include <string>
-
#include "common/assert.h"
#include "common/logging/log.h"
#include "common/string_util.h"
-
#include "core/hle/applets/mii_selector.h"
#include "core/hle/kernel/kernel.h"
#include "core/hle/kernel/shared_memory.h"
#include "core/hle/result.h"
-
#include "video_core/video_core.h"
////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -29,7 +26,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 +38,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 +57,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;
@@ -82,8 +82,6 @@ ResultCode MiiSelector::StartImpl(const Service::APT::AppletStartupParameter& pa
return RESULT_SUCCESS;
}
-void MiiSelector::Update() {
-}
-
+void MiiSelector::Update() {}
}
} // namespace
diff --git a/src/core/hle/applets/mii_selector.h b/src/core/hle/applets/mii_selector.h
index 24e8e721d..e3ab9f0cd 100644
--- a/src/core/hle/applets/mii_selector.h
+++ b/src/core/hle/applets/mii_selector.h
@@ -4,9 +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"
#include "core/hle/kernel/shared_memory.h"
@@ -17,28 +16,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 +56,27 @@ 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 +84,5 @@ public:
MiiConfig config;
};
-
}
} // namespace
diff --git a/src/core/hle/applets/swkbd.cpp b/src/core/hle/applets/swkbd.cpp
index d87bf3d57..06ddf538b 100644
--- a/src/core/hle/applets/swkbd.cpp
+++ b/src/core/hle/applets/swkbd.cpp
@@ -4,19 +4,16 @@
#include <cstring>
#include <string>
-
#include "common/assert.h"
#include "common/logging/log.h"
#include "common/string_util.h"
-
#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 +29,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 +41,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 +58,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 +115,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..ea0b1fba9 100644
--- a/src/core/hle/applets/swkbd.h
+++ b/src/core/hle/applets/swkbd.h
@@ -4,9 +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"
#include "core/hle/kernel/shared_memory.h"
@@ -53,12 +52,14 @@ 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 +73,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 +86,5 @@ public:
/// Whether this applet is currently running instead of the host application or not.
bool started;
};
-
}
} // namespace