Jump to content

Kit values in CREs


Recommended Posts

Posted (edited)

So I've been thinking about kit values, because why not?

 

IESDP currently states that the value is stored in a big-endian format, but unless I have really misunderstood the concept, the kit value is not big-endian. It uses a reversed word order, but the words themselves are little-endian.

 

The value 0x80000000 is stored as 00 80 00 00 in the CRE and the value 0x4005 is stored as 00 00 05 40. Were they big-endian they'd be 80 00 00 00 and 00 00 40 05.

Edited by Wisp
Posted

I'm not super proficient with this hex representations, but with try and error I was able to prepare code that read kit id from CRE file correctly:

OUTER_SET CRE_KIT_OFFSET = 0x0244 // dword

DEFINE_PATCH_FUNCTION READ_CRE_KIT
    RET kit_id
BEGIN
    READ_SHORT CRE_KIT_OFFSET kit_id_word1
    READ_SHORT (CRE_KIT_OFFSET + 0x2) kit_id_word2
    SET kit_id = (kit_id_word1 * 0x10000) + kit_id_word2
END

It is definitely something with word swapping, so 0x80000000 is stored like 0x00008000 and 0x4005 (so 0x00004005) is stored like 0x40050000. At least for my (limited) understanding.

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...