No ETA, since the exception that's being thrown is telling me that something is going wrong the frame before.
[Update 11/5] Okay, I figured it out. There are some corner cases where Terraria will dispose of its render targets, not recreate them, but still have renderToScreen set to false, which leads to XNA calls telling Terraria to render to a disposed render target.
I'll spend tonight analyzing the code base and hopefully I'll be able to figure out not only which MSIL instructions to inject, but where...
[Update #2 11/5] Easier to do this fix in C# and then inject the method call...
- Hook into Terraria.Main.Window.ClientSizeChanged and reset the graphics device and default render target.
- Completely replace Terraria.Main.InitTargets() and Terraria.Main.ReleaseTargets().
- Clear the "loaded" flag on all of the content loaded outside of Terraria.Main.LoadContent() to prevent ObjectDisposedExceptions.
[Update #4 11/6] A version of RomTerraria with only XNA Hi-Def and large resolution support will be released as a preview as soon as I hear back from all my testers. Please be aware that because of how MSIL injection works, RomTerraria will ONLY work with the Steam version of Terraria at the moment. Once I get my hands on a retail copy, I'll look into extending it to work properly with the retail version.
[Update #5 11/6] Working on a weird issue where the XNA profile is resetting back to Reach, but almost there. Tossing in one extra feature to make up for the delay. Guess what it is? Hint: what was exclusive to the retail release?