NeighTools / UnityDoorstop

Doorstop -- run C# before Unity does!
GNU Lesser General Public License v2.1
419 stars 62 forks source link

Error message unreadable (Error invoking code) #28

Closed Jonyleo closed 1 year ago

Jonyleo commented 1 year ago

I'm having problems debbuging an error message.

Info: Game: Little witch in the woods OS: Win 10 Visual Studio 2019 (used to build the entrypoint [release mode])

Steps to reproduce:

Using the Example entrypoint class in the README. Placed winhttp.dll and .ini files in the game's root directory Placed entrypoint in LWITW_Mods/net5.0/LWITW_ModLoader.dll Changed ini file to reflect the entrypoint location. Run the game and get this error:

(changed private information to ...)

Assembly dir: ...\Little Witch in the Woods\LWIW_Data\Managed
Opening assembly: ...\Little Witch in the Woods\LWITW_Mods\net5.0\LWITW_ModLoader.dll
Opened Assembly DLL (4096 bytes); opening its main image
Image opened; loading included assembly
Assembly loaded; looking for Doorstop.Entrypoint:Start
Invoking method 00000298F8FE6D68
Error invoking code!
Error message: 祓瑳浥䤮⹏楆敬潎䙴畯摮硅散瑰潩㩮䌠畯摬渠瑯氠慯⁤楦敬漠⁲獡敳扭祬✠祓瑳浥䤮⹏楆敬祓瑳浥‬敖獲潩ãµDone

As you can see, that error message is pretty much unreadable.

Note: not sure if this is worth anything, but the dll is not 4096 bytes in size, it's actually 5K, let me know if that is a problem

Any help? Thank you

Jonyleo commented 1 year ago

Weird followup, If I leave the start function empty it no longer gives out warnings

Assembly dir: ...\Little Witch in the Woods\LWIW_Data\Managed
Opening assembly ...\Little Witch in the Woods\LWITW_Mods\net5.0\LWITW_ModLoader.dll
Opened Assembly DLL (3072 bytes); opening its main image
Image opened; loading included assembly
Assembly loaded; looking for Doorstop.Entrypoint:Start
Invoking method 0000015015F49968
Done
Jonyleo commented 1 year ago

Fixed it, change bootstrap.c:118 from string_to_utf8 to string_to_utf16

Probably only when it's unicode, so something like

ifdef UNICODE

utf16()...

else

utf8()

endif