0x0ade / FEZMod-Legacy

Kinda dead FEZ mod. Check the linked issue comment for further info.
https://github.com/0x0ade/FEZMod-Legacy/issues/5#issuecomment-341082111
MIT License
23 stars 2 forks source link

Creating SpriteBatches sometimes doesn't work #24

Closed 0x0ade closed 8 years ago

0x0ade commented 8 years ago

Similar issues have happened with XnaToFna with BasicEffect. Currently makes FEZMod.Speedrun completely unusable and may kill other modules. It doesn't affect normal gameplay.

It only happens in FEZ 1.12. Weirdly it only happens sometimes or with DISABLE_THREADING (I guess basically when it would crash in #23).

STDOUT:

(17:38:55.956) [FEZMod] JustAnotherFEZMod (FEZMod) 0.3a8
(17:38:56.021) [FEZMod] Running .NET 4.5+ codepath for setting the default culture.
(17:38:56.034) [FEZMod] Initializing FEZ mods...
(17:38:56.046) [FEZMod] Found referenced assembly mscorlib
(17:38:56.129) [FEZMod] Found referenced assembly Mono.Security
(17:38:56.134) [FEZMod] Found referenced assembly System.Xml
(17:38:56.175) [FEZMod] Found referenced assembly System.Security
(17:38:56.177) [FEZMod] Found referenced assembly System.Configuration
(17:38:56.183) [FEZMod] Found referenced assembly System
(17:38:56.309) [FEZMod] Found referenced assembly Mono.Posix
(17:38:56.336) [FEZMod] Found referenced assembly System.Core
(17:38:56.390) [FEZMod] Found referenced assembly FNA
(17:38:56.409) [FEZMod] Found referenced assembly Common
(17:38:56.411) [FEZMod] Found referenced assembly XnaWordWrapCore
(17:38:56.413) [FEZMod] Found referenced assembly SimpleDefinitionLanguage
(17:38:56.417) [FEZMod] Found referenced assembly ContentSerialization
(17:38:56.426) [FEZMod] Found referenced assembly System.Drawing
(17:38:56.432) [FEZMod] Found referenced assembly FezEngine
(17:38:56.485) [FEZMod] Pre-Initializing FEZMod.Engine
(17:38:56.488) [FEZMod] Found referenced assembly Steamworks.NET
(17:38:56.492) [FEZMod] Found referenced assembly EasyStorage
(17:38:56.494) [FEZMod] Found referenced assembly Mono.Cecil
(17:38:56.509) [FEZMod] Found referenced assembly MonoMod
(17:38:56.510) [FEZMod] Found referenced assembly FEZ
(17:38:56.560) [FEZMod] Pre-Initializing FEZMod.FezEditor
(17:38:56.562) [FEZMod] Pre-Initializing FEZDroid
(17:38:56.564) [FEZDroid] Checking if running in Android
(17:38:56.565) [FEZMod] Pre-Initializing FEZMod.Corruption
(17:38:56.566) [FEZMod] Pre-Initializing FEZMod.Speedrun
(17:38:56.573) [FEZMod] Checking for custom arguments...
(17:38:56.573) [FEZMod] Found -pphd / --pixel-perfect-high-definition
(17:38:56.590) [FEZMod.Engine] Found -nc / --no-cache
(17:38:56.590) [FEZMod.Engine] Found -mnc / --music-no-cache
(17:38:56.592) [FEZMod] Passing to FEZ...
ATTENTION: default value of option vblank_mode overridden by environment.
(17:38:57.449) [Version] 1.12 | 0.3a8, Build Date : 2015-11-24 11:36:15 PM
[S_API FAIL] SteamAPI_Init() failed; SteamAPI_IsSteamRunning() failed.
[S_API FAIL] SteamAPI_Init() failed; unable to locate a running instance of Steam, or a local steamclient.so.
OpenGL Device: Gallium 0.4 on AMD RV730 (DRM 2.43.0, LLVM 3.6.2)
OpenGL Driver: 3.0 Mesa 11.1.0-devel (git-ef8eebc 2015-09-17 vivid-oibaf-ppa)
OpenGL Vendor: X.Org
MojoShader Profile: glsl120
EXT_swap_control_tear unsupported. Fall back to standard VSync.
(17:38:57.777) [Instancing] Hardware instancing is enabled
(17:38:57.778) [Multisampling] Multisample count is 0
(17:38:57.786) [SettingsManager] Screen set to {{Width:1366 Height:768 Format:Color}}
(17:38:57.786) [SettingsManager] Screen mode is : Borderless Fullscreen
(17:38:57.787) [SettingsManager] Backbuffer is 1366x768
(17:38:57.787) [SettingsManager] VSync is off
(17:38:57.787) [SettingsManager] Multisample count is 0
(17:38:58.051) [Threading] Multithreading is enabled
(17:39:01.020) [Intro] First draw done!
(17:39:01.330) [StaticPreloader] SharedContentManager preloaded.
(17:39:01.338) [StaticPreloader] Music library initialized.
(17:39:01.429) [StaticPreloader] Volume levels loaded.
(17:39:02.115) [StaticPreloader] Animations filled.
(17:39:02.116) [StaticPreloader] Text scroll pre-initialized.
(17:39:02.118) [StaticPreloader] World map pre-initialized.
(17:39:02.119) [StaticPreloader] Pause menu pre-initialized.
(17:39:05.299) [Unhandled Exception] System.Exception: 
at Microsoft.Xna.Framework.Graphics.OpenGLDevice.CreateEffect (byte[]) [0x00058] in /home/maik/fnadroid/FNA/src/Graphics/OpenGLDevice.cs:1799
at Microsoft.Xna.Framework.Graphics.Effect..ctor (Microsoft.Xna.Framework.Graphics.GraphicsDevice,byte[]) [0x00080] in /home/maik/fnadroid/FNA/src/Graphics/Effect/Effect.cs:248
at Microsoft.Xna.Framework.Graphics.SpriteBatch..ctor (Microsoft.Xna.Framework.Graphics.GraphicsDevice) [0x00086] in /home/maik/fnadroid/FNA/src/Graphics/SpriteBatch.cs:125
at FezGame.Components.SpeedrunInfo.LoadContent () <IL 0x00007, 0x00033>
at Microsoft.Xna.Framework.DrawableGameComponent.Initialize () [0x00015] in /home/maik/fnadroid/FNA/src/DrawableGameComponent.cs:100
at FezGame.Components.SpeedrunInfo.Initialize () <IL 0x00001, 0x0000f>
at Microsoft.Xna.Framework.Game.Components_ComponentAdded (object,Microsoft.Xna.Framework.GameComponentCollectionEventArgs) [0x00007] in /home/maik/fnadroid/FNA/src/Game.cs:922
at Microsoft.Xna.Framework.GameComponentCollection.OnComponentAdded (Microsoft.Xna.Framework.GameComponentCollectionEventArgs) [0x00015] in /home/maik/fnadroid/FNA/src/GameComponentCollection.cs:88
at Microsoft.Xna.Framework.GameComponentCollection.InsertItem (int,Microsoft.Xna.Framework.IGameComponent) [0x00030] in /home/maik/fnadroid/FNA/src/GameComponentCollection.cs:59
at System.Collections.ObjectModel.Collection`1<Microsoft.Xna.Framework.IGameComponent>.Add (Microsoft.Xna.Framework.IGameComponent) <0x0008c>
at FezEngine.Tools.ServiceHelper.orig_AddComponent (Microsoft.Xna.Framework.IGameComponent,bool) <IL 0x00027, 0x00086>
at FezEngine.Tools.ServiceHelper.AddComponent (Microsoft.Xna.Framework.IGameComponent,bool) <IL 0x00002, 0x00017>
at FezEngine.Tools.ServiceHelper.AddComponent (Microsoft.Xna.Framework.IGameComponent) <IL 0x00002, 0x0000f>
at FezGame.Speedrun.FezSpeedrun.LoadComponents (FezGame.Fez) <IL 0x00005, 0x0003f>
at (wrapper dynamic-method) object. (object,object[]) <IL 0x0001a, 0x0003a>
at Common.ReflectionHelper.InvokeMethod (System.Reflection.MethodInfo,object,object[]) <IL 0x00008, 0x0002c>
at FezGame.Mod.FEZMod.CallInEachModule (string,object[]) <IL 0x0008a, 0x00197>
at FezGame.Mod.FEZMod.LoadComponents (FezGame.Fez) <IL 0x0008e, 0x00187>
at FezGame.Fez.LoadComponents (FezGame.Fez) <IL 0x00007, 0x00017>
at Common.Logger.Try<FezGame.Fez> (System.Action`1<FezGame.Fez>,FezGame.Fez) <0x00029>

(17:39:05.300) [Intro] Preloading complete.
(17:39:05.977) [Intro] Changing Intro Screen to : Polytron
(17:39:08.980) [Intro] Changing Intro Screen to : Trapdoor
(17:39:10.876) [Intro] Changing Intro Screen to : TrixelEngine
(17:39:13.393) [Intro] Changing Intro Screen to : SaveIndicator
(17:39:16.735) [Intro] Changing Intro Screen to : Fez
renaudbedard commented 8 years ago

If you do any kind of thing that would cause GL calls (newing an Effect class does), you need to wrap it in a FezEngine.Tools.DrawActionScheduler.Schedule(() => { /* ... */ }; call in 1.12... or unset DISABLE_THREADING :)

0x0ade commented 8 years ago

Ah, this could also explain my issue with the on-screen button textures in FEZ FNADroid being black when loaded in LoadContent, but properly rendering when loaded in Draw. At least .Speedrun works now again :D

About unsetting DISABLE_THREADING: Will FEZ 1.12 ship with DISABLE_THREADING set or unset? I remember it being set for fna-unstable. Unsetting it still makes FEZ hang.

renaudbedard commented 8 years ago

1.12 will have DISABLE_THREADING enabled, since it helps a bunch with performance.