Skip to content

Commit

Permalink
Merge pull request #44 from DaniElectra/friends-3ds-mii
Browse files Browse the repository at this point in the history
  • Loading branch information
jonbarrow authored May 18, 2024
2 parents b04c3e3 + d27856c commit 3905a17
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions friends-3ds/types/mii.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ import (
type Mii struct {
types.Structure
*types.Data
Name *types.String
Unknown2 *types.PrimitiveBool
Unknown3 *types.PrimitiveU8
MiiData *types.Buffer
Name *types.String
ProfanityFlag *types.PrimitiveBool
CharacterSet *types.PrimitiveU8
MiiData *types.Buffer
}

// WriteTo writes the Mii to the given writable
Expand All @@ -25,8 +25,8 @@ func (m *Mii) WriteTo(writable types.Writable) {
contentWritable := writable.CopyNew()

m.Name.WriteTo(contentWritable)
m.Unknown2.WriteTo(contentWritable)
m.Unknown3.WriteTo(contentWritable)
m.ProfanityFlag.WriteTo(contentWritable)
m.CharacterSet.WriteTo(contentWritable)
m.MiiData.WriteTo(contentWritable)

content := contentWritable.Bytes()
Expand Down Expand Up @@ -55,14 +55,14 @@ func (m *Mii) ExtractFrom(readable types.Readable) error {
return fmt.Errorf("Failed to extract Mii.Name. %s", err.Error())
}

err = m.Unknown2.ExtractFrom(readable)
err = m.ProfanityFlag.ExtractFrom(readable)
if err != nil {
return fmt.Errorf("Failed to extract Mii.Unknown2. %s", err.Error())
return fmt.Errorf("Failed to extract Mii.ProfanityFlag. %s", err.Error())
}

err = m.Unknown3.ExtractFrom(readable)
err = m.CharacterSet.ExtractFrom(readable)
if err != nil {
return fmt.Errorf("Failed to extract Mii.Unknown3. %s", err.Error())
return fmt.Errorf("Failed to extract Mii.CharacterSet. %s", err.Error())
}

err = m.MiiData.ExtractFrom(readable)
Expand All @@ -80,8 +80,8 @@ func (m *Mii) Copy() types.RVType {
copied.StructureVersion = m.StructureVersion
copied.Data = m.Data.Copy().(*types.Data)
copied.Name = m.Name.Copy().(*types.String)
copied.Unknown2 = m.Unknown2.Copy().(*types.PrimitiveBool)
copied.Unknown3 = m.Unknown3.Copy().(*types.PrimitiveU8)
copied.ProfanityFlag = m.ProfanityFlag.Copy().(*types.PrimitiveBool)
copied.CharacterSet = m.CharacterSet.Copy().(*types.PrimitiveU8)
copied.MiiData = m.MiiData.Copy().(*types.Buffer)

return copied
Expand All @@ -107,11 +107,11 @@ func (m *Mii) Equals(o types.RVType) bool {
return false
}

if !m.Unknown2.Equals(other.Unknown2) {
if !m.ProfanityFlag.Equals(other.ProfanityFlag) {
return false
}

if !m.Unknown3.Equals(other.Unknown3) {
if !m.CharacterSet.Equals(other.CharacterSet) {
return false
}

Expand All @@ -133,8 +133,8 @@ func (m *Mii) FormatToString(indentationLevel int) string {
b.WriteString("Mii{\n")
b.WriteString(fmt.Sprintf("%sData (parent): %s,\n", indentationValues, m.Data.FormatToString(indentationLevel+1)))
b.WriteString(fmt.Sprintf("%sName: %s,\n", indentationValues, m.Name))
b.WriteString(fmt.Sprintf("%sUnknown2: %s,\n", indentationValues, m.Unknown2))
b.WriteString(fmt.Sprintf("%sUnknown3: %s,\n", indentationValues, m.Unknown3))
b.WriteString(fmt.Sprintf("%sProfanityFlag: %s,\n", indentationValues, m.ProfanityFlag))
b.WriteString(fmt.Sprintf("%sCharacterSet: %s,\n", indentationValues, m.CharacterSet))
b.WriteString(fmt.Sprintf("%sMiiData: %s,\n", indentationValues, m.MiiData))
b.WriteString(fmt.Sprintf("%s}", indentationEnd))

Expand All @@ -144,11 +144,11 @@ func (m *Mii) FormatToString(indentationLevel int) string {
// NewMii returns a new Mii
func NewMii() *Mii {
m := &Mii{
Data: types.NewData(),
Name: types.NewString(""),
Unknown2: types.NewPrimitiveBool(false),
Unknown3: types.NewPrimitiveU8(0),
MiiData: types.NewBuffer(nil),
Data: types.NewData(),
Name: types.NewString(""),
ProfanityFlag: types.NewPrimitiveBool(false),
CharacterSet: types.NewPrimitiveU8(0),
MiiData: types.NewBuffer(nil),
}

return m
Expand Down

0 comments on commit 3905a17

Please sign in to comment.