summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorMorph <39850852+Morph1984@users.noreply.github.com>2020-08-27 07:21:48 +0200
committerMorph <39850852+Morph1984@users.noreply.github.com>2020-09-04 18:23:25 +0200
commit5ce3015945e327751a053f7a5a1331a33f07819e (patch)
treed12f57a8b573e466c2b5a18bf0a40a019782219a /src/core
parentProject Mjölnir: Part 2 - Controller Applet (diff)
downloadyuzu-5ce3015945e327751a053f7a5a1331a33f07819e.tar
yuzu-5ce3015945e327751a053f7a5a1331a33f07819e.tar.gz
yuzu-5ce3015945e327751a053f7a5a1331a33f07819e.tar.bz2
yuzu-5ce3015945e327751a053f7a5a1331a33f07819e.tar.lz
yuzu-5ce3015945e327751a053f7a5a1331a33f07819e.tar.xz
yuzu-5ce3015945e327751a053f7a5a1331a33f07819e.tar.zst
yuzu-5ce3015945e327751a053f7a5a1331a33f07819e.zip
Diffstat (limited to 'src/core')
-rw-r--r--src/core/frontend/applets/controller.h3
-rw-r--r--src/core/hle/service/am/applets/controller.cpp37
-rw-r--r--src/core/hle/service/am/applets/controller.h5
3 files changed, 29 insertions, 16 deletions
diff --git a/src/core/frontend/applets/controller.h b/src/core/frontend/applets/controller.h
index 0908f2b69..a227f15cd 100644
--- a/src/core/frontend/applets/controller.h
+++ b/src/core/frontend/applets/controller.h
@@ -11,6 +11,7 @@
namespace Core::Frontend {
using BorderColor = std::array<u8, 4>;
+using ExplainText = std::array<char, 0x81>;
struct ControllerParameters {
s8 min_players{};
@@ -19,6 +20,8 @@ struct ControllerParameters {
bool enable_single_mode{};
bool enable_border_color{};
std::vector<BorderColor> border_colors{};
+ bool enable_explain_text{};
+ std::vector<ExplainText> explain_text{};
bool allow_pro_controller{};
bool allow_handheld{};
bool allow_dual_joycons{};
diff --git a/src/core/hle/service/am/applets/controller.cpp b/src/core/hle/service/am/applets/controller.cpp
index 2a45a388f..63c85256d 100644
--- a/src/core/hle/service/am/applets/controller.cpp
+++ b/src/core/hle/service/am/applets/controller.cpp
@@ -19,8 +19,8 @@ namespace Service::AM::Applets {
[[maybe_unused]] constexpr ResultCode ERR_CONTROLLER_APPLET_3102{ErrorModule::HID, 3102};
static Core::Frontend::ControllerParameters ConvertToFrontendParameters(
- ControllerSupportArgPrivate private_arg, ControllerSupportArgHeader header,
- std::vector<IdentificationColor> identification_colors) {
+ ControllerSupportArgPrivate private_arg, ControllerSupportArgHeader header, bool enable_text,
+ std::vector<IdentificationColor> identification_colors, std::vector<ExplainText> text) {
HID::Controller_NPad::NPadType npad_style_set;
npad_style_set.raw = private_arg.style_set;
@@ -31,6 +31,8 @@ static Core::Frontend::ControllerParameters ConvertToFrontendParameters(
.enable_single_mode = header.enable_single_mode,
.enable_border_color = header.enable_identification_color,
.border_colors = identification_colors,
+ .enable_explain_text = enable_text,
+ .explain_text = text,
.allow_pro_controller = npad_style_set.pro_controller == 1,
.allow_handheld = npad_style_set.handheld == 1,
.allow_dual_joycons = npad_style_set.joycon_dual == 1,
@@ -126,31 +128,38 @@ void Controller::Execute() {
case LibraryAppletVersion::Version5:
return ConvertToFrontendParameters(
controller_private_arg, controller_user_arg_old.header,
+ controller_user_arg_old.enable_explain_text,
std::vector<IdentificationColor>(
controller_user_arg_old.identification_colors.begin(),
- controller_user_arg_old.identification_colors.end()));
+ controller_user_arg_old.identification_colors.end()),
+ std::vector<ExplainText>(controller_user_arg_old.explain_text.begin(),
+ controller_user_arg_old.explain_text.end()));
case LibraryAppletVersion::Version7:
default:
return ConvertToFrontendParameters(
controller_private_arg, controller_user_arg_new.header,
+ controller_user_arg_new.enable_explain_text,
std::vector<IdentificationColor>(
controller_user_arg_new.identification_colors.begin(),
- controller_user_arg_new.identification_colors.end()));
+ controller_user_arg_new.identification_colors.end()),
+ std::vector<ExplainText>(controller_user_arg_new.explain_text.begin(),
+ controller_user_arg_new.explain_text.end()));
}
}();
is_single_mode = parameters.enable_single_mode;
- LOG_DEBUG(
- Service_HID,
- "Controller Parameters: min_players={}, max_players={}, keep_controllers_connected={}, "
- "enable_single_mode={}, enable_border_color={}, allow_pro_controller={}, "
- "allow_handheld={}, allow_dual_joycons={}, allow_left_joycon={}, allow_right_joycon={}",
- parameters.min_players, parameters.max_players, parameters.keep_controllers_connected,
- parameters.enable_single_mode, parameters.enable_border_color,
- parameters.allow_pro_controller, parameters.allow_handheld,
- parameters.allow_dual_joycons, parameters.allow_left_joycon,
- parameters.allow_right_joycon);
+ LOG_DEBUG(Service_HID,
+ "Controller Parameters: min_players={}, max_players={}, "
+ "keep_controllers_connected={}, enable_single_mode={}, enable_border_color={}, "
+ "enable_explain_text={}, allow_pro_controller={}, allow_handheld={}, "
+ "allow_dual_joycons={}, allow_left_joycon={}, allow_right_joycon={}",
+ parameters.min_players, parameters.max_players,
+ parameters.keep_controllers_connected, parameters.enable_single_mode,
+ parameters.enable_border_color, parameters.enable_explain_text,
+ parameters.allow_pro_controller, parameters.allow_handheld,
+ parameters.allow_dual_joycons, parameters.allow_left_joycon,
+ parameters.allow_right_joycon);
frontend.ReconfigureControllers([this] { ConfigurationComplete(); }, parameters);
break;
diff --git a/src/core/hle/service/am/applets/controller.h b/src/core/hle/service/am/applets/controller.h
index 90a78d508..31ba2af4f 100644
--- a/src/core/hle/service/am/applets/controller.h
+++ b/src/core/hle/service/am/applets/controller.h
@@ -16,6 +16,7 @@ class System;
namespace Service::AM::Applets {
using IdentificationColor = std::array<u8, 4>;
+using ExplainText = std::array<char, 0x81>;
enum class LibraryAppletVersion : u32_le {
Version3 = 0x3, // 1.0.0 - 2.3.0
@@ -65,7 +66,7 @@ struct ControllerSupportArgOld {
ControllerSupportArgHeader header{};
std::array<IdentificationColor, 4> identification_colors{};
bool enable_explain_text{};
- std::array<std::array<char, 0x81>, 4> explain_text{};
+ std::array<ExplainText, 4> explain_text{};
};
static_assert(sizeof(ControllerSupportArgOld) == 0x21C,
"ControllerSupportArgOld has incorrect size.");
@@ -75,7 +76,7 @@ struct ControllerSupportArgNew {
ControllerSupportArgHeader header{};
std::array<IdentificationColor, 8> identification_colors{};
bool enable_explain_text{};
- std::array<std::array<char, 0x81>, 8> explain_text{};
+ std::array<ExplainText, 8> explain_text{};
};
static_assert(sizeof(ControllerSupportArgNew) == 0x430,
"ControllerSupportArgNew has incorrect size.");