Skip to content

Conversation

@Dragorn421
Copy link
Contributor

This fixes displaying Mtx holders in the object analyzer

(didn't test with several matrices, only 1, I assume it should work fine though)

example with gLinkChildDekuShieldMtx

Mtx gLinkChildDekuShieldMtx = { 
    0x0000FFFF , 0          , 0xFFFFFFFF , 0xFFFF0000 ,
    0          , 0xFFFF0000 , 0x0258FF9C , 0x00320001 ,
    0x21B4023D , 0          , 0xF136FE0A , 0x00710000 ,
    0xFD5421A5 , 0xF1140000 , 0          , 0          ,
}; 

Sources:
Matrix_MtxToMtxF in oot decomp
gSPMatrix in the sdk

Copy link
Contributor

@Thar0 Thar0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Printing Mtx as floats is a nice change, I have a couple of suggestions on the implementation.

buffer[2 * (4 * 4 + elemIndex)], buffer[2 * (4 * 4 + elemIndex) + 1],
};
float val = ArrayUtil.ReadInt32BE(bytes) / (float)0x10000;
string valStr = $"{val}";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Printing the floats only up to the precision necessary for the fixed point range should make things nicer, i.e. Matrix_CheckFloats elects to print the floats as 12.6f in printf notation, although I think it should really be 13.6 as 12.6 fails to account for negative floats with 5-digit integer part (such large numbers likely will never come up in practice however). I'm not sure what the equivalent is in C# interpolated strings.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In decimal,
the smallest positive s16.16 number is 1/0x10000 = 0.0000152587890625
the smallest s16.16 number is 0x80000000/0x10000 = -32768
and the largest is 0x7FFFFFFF/0x10000 = 32767.9999847412109375

so that's 5.16f maybe? and I don't know how it works in C# either. Microsoft probably thought it was funny to make up their own format strings

Copy link
Contributor Author

@Dragorn421 Dragorn421 Sep 19, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rereading this,

the smallest positive s16.16 number is 1/0x10000 = 0.0000152587890625

absolutely doesn't mean we need 16 digits, but only 5 (for the decimal part)

idk still about this, it's not like there isn't enough space in Z64Utils to show whatever useless digits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants