bbepis / XUnity.AutoTranslator

MIT License
2k stars 293 forks source link

Issues with Texture translation #616

Open chyzman opened 1 week ago

chyzman commented 1 week ago

I'm having issues trying to dump and then modify textures

[Error  :XUnity.AutoTranslator] An error occurred while dumping texture.
System.MissingMethodException: Method not found: 'Void UnityEngine.Texture2D..ctor(Int32, Int32)'.
   at XUnity.AutoTranslator.Plugin.Core.Extensions.ComponentExtensions.GetTextureData(Texture2D texture)
   at XUnity.AutoTranslator.Plugin.Core.TextureTranslationInfo.SetupHashAndData(Texture2D texture)
   at XUnity.AutoTranslator.Plugin.Core.TextureTranslationInfo.GetKey()
   at XUnity.AutoTranslator.Plugin.Core.AutoTranslationPlugin.DumpTexture(Object source, Texture2D texture)
   at XUnity.AutoTranslator.Plugin.Core.AutoTranslationPlugin.HandleImage(Object source, Sprite& sprite, Texture2D& texture, Boolean isPrefixHooked)

and

[Error  :XUnity.AutoTranslator] An error occurred while translating texture.
System.MissingMethodException: Method not found: 'Void UnityEngine.Texture2D..ctor(Int32, Int32)'.
   at XUnity.AutoTranslator.Plugin.Core.Extensions.ComponentExtensions.GetTextureData(Texture2D texture)
   at XUnity.AutoTranslator.Plugin.Core.TextureTranslationInfo.SetupHashAndData(Texture2D texture)
   at XUnity.AutoTranslator.Plugin.Core.TextureTranslationInfo.GetKey()
   at XUnity.AutoTranslator.Plugin.Core.AutoTranslationPlugin.TranslateTexture(Object source, Sprite& sprite, Texture2D& texture, Boolean isPrefixHooked, TextureReloadContext context)
   at XUnity.AutoTranslator.Plugin.Core.AutoTranslationPlugin.HandleImage(Object source, Sprite& sprite, Texture2D& texture, Boolean isPrefixHooked)

Game uses Unity 2022.3.20f1c1 and I'm using BepInEx 6.0.0-be.697 It doesn't dump anything so i tried generating a hash for the replacements manually and those don't work either

ManlyMarco commented 1 week ago

Looks like the game uses il2cpp and necessary constructors got stripped out. You could probably make it work in that specific game by changing the constructor calls seen in the stack trace to a different one and compiling your own build. What you need to change it to depends on that specific game, check interop assemblies for what is available.

chyzman commented 1 week ago

interop assemblies? (sorry if this is an obvious question)