From 48239be22ce36b0d07468f7196128e181ae9daf0 Mon Sep 17 00:00:00 2001 From: fearlessTobi Date: Tue, 27 Nov 2018 14:57:51 +0100 Subject: [PATCH] mii_selector: Use BitField where possible --- src/core/hle/applets/mii_selector.cpp | 13 ++++++---- src/core/hle/applets/mii_selector.h | 36 +++++++++++++++++++++++---- 2 files changed, 39 insertions(+), 10 deletions(-) diff --git a/src/core/hle/applets/mii_selector.cpp b/src/core/hle/applets/mii_selector.cpp index 0c333ce749..93987d3238 100644 --- a/src/core/hle/applets/mii_selector.cpp +++ b/src/core/hle/applets/mii_selector.cpp @@ -73,13 +73,16 @@ ResultCode MiiSelector::StartImpl(const Service::APT::AppletStartupParameter& pa mii_data.mii_information = 0xA600; mii_data.mii_name = {'C', 'i', 't', 'r', 'a', 0x0, 0x0, 0x0, 0x0, 0x0}; mii_data.width_height = 0x4040; - mii_data.appearance_bits1 = 0x0; - mii_data.appearance_bits2 = 0x0; + mii_data.appearance_bits1.raw = 0x0; + mii_data.appearance_bits2.raw = 0x0; mii_data.hair_style = 0x21; - mii_data.appearance_bits3 = 0x01; + mii_data.appearance_bits3.hair_color.Assign(0x1); + mii_data.appearance_bits3.flip_hair.Assign(0x0); mii_data.unknown1 = 0x02684418; - mii_data.appearance_bits4 = 0x26; - mii_data.appearance_bits5 = 0x34; + mii_data.appearance_bits4.eyebrow_style.Assign(0x6); + mii_data.appearance_bits4.eyebrow_color.Assign(0x1); + mii_data.appearance_bits5.eyebrow_scale.Assign(0x4); + mii_data.appearance_bits5.eyebrow_yscale.Assign(0x3); mii_data.appearance_bits6 = 0x4614; mii_data.unknown2 = 0x81121768; mii_data.allow_copying = 0x0D; diff --git a/src/core/hle/applets/mii_selector.h b/src/core/hle/applets/mii_selector.h index 22afc90d79..bef711f6a2 100644 --- a/src/core/hle/applets/mii_selector.h +++ b/src/core/hle/applets/mii_selector.h @@ -50,13 +50,39 @@ struct MiiData { u16_be mii_information; std::array mii_name; u16_be width_height; - u8 appearance_bits1; - u8 appearance_bits2; + union { + u8 raw; + + BitField<0, 1, u8> disable_sharing; + BitField<1, 4, u8> face_shape; + BitField<5, 3, u8> skin_color; + } appearance_bits1; + union { + u8 raw; + + BitField<0, 4, u8> wrinkles; + BitField<4, 4, u8> makeup; + } appearance_bits2; u8 hair_style; - u8 appearance_bits3; + union { + u8 raw; + + BitField<0, 3, u8> hair_color; + BitField<3, 1, u8> flip_hair; + } appearance_bits3; u32_be unknown1; - u8 appearance_bits4; - u8 appearance_bits5; + union { + u8 raw; + + BitField<0, 5, u8> eyebrow_style; + BitField<5, 3, u8> eyebrow_color; + } appearance_bits4; + union { + u8 raw; + + BitField<0, 4, u8> eyebrow_scale; + BitField<4, 3, u8> eyebrow_yscale; + } appearance_bits5; u16_be appearance_bits6; u32_be unknown2; u8 allow_copying;