bbepis / XUnity.AutoTranslator

MIT License
2.01k stars 293 forks source link

Fix HandleInputSafe crashing in some games #531

Closed ManlyMarco closed 5 months ago

ManlyMarco commented 6 months ago

In some cases input API can throw an InvalidOperationException, resulting in error spam on every frame. I don't see any reason to catch only specific Exceptions, they are logged and the end result is the same - Input API isn't usable.

Full exception message: System.InvalidOperationException: You are trying to read Input using the UnityEngine.Input class, but you have switched active Input handling to Input System package in Player Settings.

astef89 commented 5 months ago

Hi can you help me? while I'm playing WITH PCBS2 translated into Italian I get an error when I do any tutorial you said that this error can be fixed how do you do it? thanks in advance

ManlyMarco commented 5 months ago

@astef89 If you get the error I mentioned then just clone this PR and build it.

astef89 commented 5 months ago

@ManlyMarco I'm not very good at C# programming, do you have any suggestions for me? How can I do it? I already have all the Visual Studio 2022 tools and the source file... can you help me proceed? Thank you very much LogOutput.log

ManlyMarco commented 5 months ago

This PR won't help in your case.

astef89 commented 5 months ago

@ManlyMarco ah as I didn't say.:(can you tell me what causes that error? Is there a way when I play to deactivate automatic translation without crashing the game? an alternative solution please help me I'm desperate... I also tried the hot keys but they don't work.....

ManlyMarco commented 5 months ago

No idea what's exactly wrong, it depends on the game. Some of the other PRs may help.

astef89 commented 5 months ago

@ManlyMarco Can you link them to me? I want to try them all, thank you very much

ManlyMarco commented 5 months ago

Not sure what you want me to link, they are all on this repo https://github.com/bbepis/XUnity.AutoTranslator/pulls

There might be an update next week so if you don't know how to build code from PRs you could wait for that.

If you need help building the project in general I suggest asking on the BepInEx discord server.

astef89 commented 5 months ago

Non sono sicuro di cosa vuoi che colleghi, sono tutti su questo repository https://github.com/bbepis/XUnity.AutoTranslator/pulls

Potrebbe esserci un aggiornamento la prossima settimana, quindi se non sai come creare codice dai PR potresti aspettarlo.

Se hai bisogno di aiuto per costruire il progetto in generale ti suggerisco di chiedere sul server Discord di BepInEx.

@ManlyMarco if you tell me that an update will be released next week I will wait very patiently... Meanwhile I'm having fun converting your PR IN DLL To try maybe I can solve it but as said it's a whole new world for me... what great news I'm really hoping for an update next week

astef89 commented 5 months ago

@ManlyMarco I looked at the log file...and I really think that with your fix I should solve it, I hope so, thank you very much for answering everything

[Warning:XUnity.AutoTranslator] Input API is not available! System.TypeLoadException: Could not load type 'UnityEngine.Input' from assembly 'UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. at XUnity.AutoTranslator.Plugin.Core.AutoTranslationPlugin.HandleInput() at XUnity.AutoTranslator.Plugin.Core.AutoTranslationPlugin.HandleInputSafe() [Info :XUnity.AutoTranslator] Skipping plugin scan because no plugin-specific translations has been registered. [Error :XUnity.AutoTranslator] Error occurred during translation. System.NullReferenceException: Object reference not set to an instance of an object.

VelhoZagaia commented 5 months ago

I'm playing adventure quest 3d, at first everything went well, but a few minutes later the game crashes when starting dialogues with NPCs.

astef89 commented 5 months ago

@ManlyMarco Hi friend, when will the next update come out? I'm looking forward to it...thanks you

ManlyMarco commented 5 months ago

This + #467 should resolve most issues with input not working, but if the game uses the new input system it won't work yet until #329 is fixed.

ManlyMarco commented 5 months ago

@ManlyMarco Hi friend, when will the next update come out? I'm looking forward to it...thanks you

Now.

astef89 commented 5 months ago

@ManlyMarco thank you, thank you... as soon as I get home I'll try the new update