early-access version 2896

This commit is contained in:
pineappleEA
2022-08-10 05:03:38 +02:00
parent 3a1b8212aa
commit d347b68f4a
8 changed files with 41 additions and 58 deletions

View File

@@ -86,54 +86,16 @@ void EmulatedController::ReloadFromSettings() {
}
controller.colors_state.fullkey = {
.body =
{
.b = static_cast<u8>((player.body_color_left >> 16) & 0xFF),
.g = static_cast<u8>((player.body_color_left >> 8) & 0xFF),
.r = static_cast<u8>(player.body_color_left & 0xFF),
.a = 0xff,
},
.button =
{
.b = static_cast<u8>((player.button_color_left >> 16) & 0xFF),
.g = static_cast<u8>((player.button_color_left >> 8) & 0xFF),
.r = static_cast<u8>(player.button_color_left & 0xFF),
.a = 0xff,
},
.body = GetNpadColor(player.body_color_left),
.button = GetNpadColor(player.button_color_left),
};
controller.colors_state.left = {
.body =
{
.b = static_cast<u8>((player.body_color_left >> 16) & 0xFF),
.g = static_cast<u8>((player.body_color_left >> 8) & 0xFF),
.r = static_cast<u8>(player.body_color_left & 0xFF),
.a = 0xff,
},
.button =
{
.b = static_cast<u8>((player.button_color_left >> 16) & 0xFF),
.g = static_cast<u8>((player.button_color_left >> 8) & 0xFF),
.r = static_cast<u8>(player.button_color_left & 0xFF),
.a = 0xff,
},
.body = GetNpadColor(player.body_color_left),
.button = GetNpadColor(player.button_color_left),
};
controller.colors_state.right = {
.body =
{
.b = static_cast<u8>((player.body_color_right >> 16) & 0xFF),
.g = static_cast<u8>((player.body_color_right >> 8) & 0xFF),
.r = static_cast<u8>(player.body_color_right & 0xFF),
.a = 0xff,
},
.button =
{
.b = static_cast<u8>((player.button_color_right >> 16) & 0xFF),
.g = static_cast<u8>((player.button_color_right >> 8) & 0xFF),
.r = static_cast<u8>(player.button_color_right & 0xFF),
.a = 0xff,
},
controller.colors_state.left = {
.body = GetNpadColor(player.body_color_right),
.button = GetNpadColor(player.button_color_right),
};
// Other or debug controller should always be a pro controller
@@ -1386,6 +1348,15 @@ const CameraState& EmulatedController::GetCamera() const {
return controller.camera_state;
}
NpadColor EmulatedController::GetNpadColor(u32 color) {
return {
.r = static_cast<u8>((color >> 16) & 0xFF),
.g = static_cast<u8>((color >> 8) & 0xFF),
.b = static_cast<u8>(color & 0xFF),
.a = 0xff,
};
}
void EmulatedController::TriggerOnChange(ControllerTriggerType type, bool is_npad_service_update) {
std::scoped_lock lock{callback_mutex};
for (const auto& poller_pair : callback_list) {

View File

@@ -424,6 +424,13 @@ private:
*/
void SetCamera(const Common::Input::CallbackStatus& callback);
/**
* Converts a color format from bgra to rgba
* @param color in bgra format
* @return NpadColor in rgba format
*/
NpadColor GetNpadColor(u32 color);
/**
* Triggers a callback that something has changed on the controller status
* @param type Input type of the event to trigger

View File

@@ -328,9 +328,9 @@ struct TouchState {
static_assert(sizeof(TouchState) == 0x28, "Touchstate is an invalid size");
struct NpadColor {
u8 b{};
u8 g{};
u8 r{};
u8 g{};
u8 b{};
u8 a{};
};
static_assert(sizeof(NpadColor) == 4, "NpadColor is an invalid size");