Jump to content

Need to calculate CRC or MD5 of a texture


Recommended Posts

I've been trying to figure out how to get a CRC or MD5 of a texture.  I need this because I'm working on a mod to hide toolbar buttons, and the only unique data which is consistent between buttons is the texture.  There isn't anything else I can find which will uniquely identify a button.  But I can't figure out how to do this, the RawImage which is stored in the sprite seems to be hidden so deep I can't find it.

any ideas?

This id needs to be consistent between different game runs, so I can't use the object hash, since that changes every game run

Edited by linuxgurugamer
Link to comment
Share on other sites

As for getting the texture: does applicationLauncherButton.toggleButton.Image.mainTexture work? You might have to make the texture readable, before you can work with it: https://github.com/Kopernicus/Kopernicus/blob/master/Kopernicus/Kopernicus/Utility.cs#L1058-L1082

As for calculating the hash: You could export the texture into a JPEG or PNG formatted byte array, and calculate the hash from that.

Link to comment
Share on other sites

4 minutes ago, Thomas P. said:

As for getting the texture: does applicationLauncherButton.toggleButton.Image.mainTexture work? You might have to make the texture readable, before you can work with it: https://github.com/Kopernicus/Kopernicus/blob/master/Kopernicus/Kopernicus/Utility.cs#L1058-L1082

As for calculating the hash: You could export the texture into a JPEG or PNG formatted byte array, and calculate the hash from that.

thanks, that sounds like what I need

1 minute ago, linuxgurugamer said:

 

Edited by linuxgurugamer
Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. 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...