FNA-XNA / FNA

FNA - Accuracy-focused XNA4 reimplementation for open platforms
https://fna-xna.github.io/
2.63k stars 266 forks source link

Strange Error #265

Closed briermay closed 5 years ago

briermay commented 5 years ago

when running a game built with fna and after copying the other dlls from the fna-libs folder I get the strangest error and I cannot figure out why. I do not get the same error if I reference MonoGame on the same project, only if I reference the FNA.DLL

http://prntscr.com/oht6cb

flibitijibibo commented 5 years ago

If your game is in a git repo, restart the whole machine and run git clean -fd. This deletes ALL files that are not in revision control, so be careful. EDIT: Also git clean -fdX to remove stuff in .gitignore, like bin and obj.

The point is to clean out any residual files that you have and should resolve any conflicts that may have come from trying to run both in a single repo. Aside from that, a hard error is an issue with the OS, not any application code (as far as I know).

briermay commented 5 years ago

its not in any repos, and the exact same game built with MonoGame cross platform desktop project runs just fine. the one with fna is the only one that gives me this error, but the game actually still runs and processes input, I just also get that hard error box. oh and its not all the time it does it, sometimes it will start up just fine other times it won't. oh and I doubt its an OS issue I just installed windows 10 like 3 days ago so its a pretty clean install other than VS 2017 and the necessary development bits

briermay commented 5 years ago

also zipped up the files and send them to 2 different friends and they both get the same error, so if it causes said error on 3 machines it cannot be an os issue, it has to be an fna related issue somewhere

briermay commented 5 years ago

after setting some breakpoints, it happens in src/FNAPlatform/SDL2_FNAPlatform.cs when it hits the public static GameWindow CreateWindow() function. the second it hits that function I get the unkown hard error.

flibitijibibo commented 5 years ago

If it's creating a window and clearing to blue then it's something external to us. Are you all using similar capturing software? Note that your game is the only one exhibiting this issue and a basic clear application has no reason to fail. Also, can you post this zip file here?

briermay commented 5 years ago

sure. and just because I'm the only one who has posted doesn't mean I'm the only one having the issue. its an absolute skeleton app. no resources are being loaded or anything. and as I said MonoGame and both original XNA 4.0 work fine. its only the FNA that I'm having issues with. as for capturing software 1 of the machines I have no idea, but neither mine nor my boyfriends have any capture software installed. Game.zip

flibitijibibo commented 5 years ago

With this binary I was unable to reproduce any issues on Windows 7, Windows 10 Pro, Wine, Linux, or macOS. A Linux Valgrind test came out clean as well.

If it really is FNA as you say it is, you'll find the exact same error in the following games on Steam/itch.io:

Googling "Windows 10 Hard Error" produces some very concerning results:

https://www.google.com/search?q=windows+10+hard+error

It looks like you may have to go all-in with hardware testing, from CHKDSK to forcing the dedicated GPU (if this is a hybrid setup) to using a restore point to go back to the vanilla installation. If you've run anything that tries to fix the privacy issues with Win10 it's possible that negatively affected the system as well.

briermay commented 5 years ago

none of which are free and able to try out. I dunno I've googled that also and thing is its a clean install. plus my boyfriends is also a clean install, and 10 other friends of discord also have the same error with that same zip. I guess I'll just give up and use monogame which gives me absolutely no errors. not to mention all google results list other very specific apps giving the error and this game build is the only thing that causes it which is really baffling. I have many other games installed and none of them give any issues

briermay commented 5 years ago

ok so if its indeed a system error then you please do one thing for me to know if its something to do with my dev ide, etc. can you make a simple game no content, just clears the screen like the one I posted, and post it for me to try. as the maker of fna if yours causes no issues then I know its something I've done, and if it does cause issues then I'll know its a system error.

briermay commented 5 years ago

Screenshot_4 that produced no issues but still trying things to see if its indeed a system issue

TheSpydog commented 5 years ago

Hey there! I tried running the app like 10 times in a row on my Windows 10 machine and never encountered the error. Attached is a zip file with a newly-created empty FNA project that works flawlessly on my machine. I have a few theories why you and your friends might be encountering this issue, but let's see if this binary works first...

FNAEmptyTest.zip

briermay commented 5 years ago

yea I get the same error

TheSpydog commented 5 years ago

Okay, good to know. What puzzles me the most is that your friends get the error on their machines. I've never heard of anyone else having this problem so it seems odd that we've suddenly got 12 different people confirming it. A few thoughts:

  1. What graphics card does your PC have? If it's producing the error in the CreateWindow function, it could be that something's amiss with OpenGL windowing support on your computer.

  2. You recently installed Windows 10, right? What is the current version / OS build of Win10 on your system? (About Your PC > Windows Specifications)

  3. Do you have a game controller connected to your machine?

  4. This is going to sound like a stretch, but I'm wondering if somehow whatever's causing the issue on your machine is propagating through the zip file when sent via Discord. Sounds crazy, right? If you want to test this theory, message me the file over Discord ([my GitHub username]#8210) and I'll test it. EDIT: Tested this and there's still no error.

briermay commented 5 years ago

MonoGame uses opengl as well and it runs with no issues

briermay commented 5 years ago

ok so I have found what is causing the error and it is definitely in fna as I can now run the game with no hard error. not sure why the change I made stops the error but this is what I did in SDL2_FNAPlatform.cs the following is what is causing it for me:

// This _should_ be the first real SDL call we make...
SDL.SDL_Init(
    SDL.SDL_INIT_VIDEO |
    SDL.SDL_INIT_JOYSTICK |
    SDL.SDL_INIT_GAMECONTROLLER |
    SDL.SDL_INIT_HAPTIC
);

if I change that simply to: SDL.SDL_Init(SDL.SDL_INIT_VIDEO);

then this error goes away.

briermay commented 5 years ago

unknown another friend on windows 7 same error also so its getting to a point that i seriously doubt this is a machine issue

flibitijibibo commented 5 years ago

Looking at MG’s dependency tree real quick it looks like they’re still on SDL 2.0.8. What happens if you use this SDL2 lib instead of our current one in fnalibs:

https://www.libsdl.org/release/SDL2-2.0.8-win32-x86.zip

Be sure no joysticks are plugged in when you try this.

flibitijibibo commented 5 years ago

Another possible line to add to the beginning of Main:

SDL2.SDL.SDL_SetHint(SDL2.SDL.SDL_HINT_JOYSTICK_HIDAPI, “0”);
flibitijibibo commented 5 years ago

Some more information that suggests that HID access is being sabotaged by certain Windows configurations:

https://github.com/signal11/hidapi/issues/231

https://hg.libsdl.org/SDL/file/05dddfb66b85/src/hidapi/windows/hid.c#l253

briermay commented 5 years ago

the part that's boggling me is monogame initializes the gamepad stuff just fine. gonna root around in it and see how they are doing it.

flibitijibibo commented 5 years ago

The init stuff will be the same, it’s only a bitflag from the application side. The difference is the inclusion of HIDAPI in 2.0.9, so we need to test 2.0.8 first to be sure we can file this on the SDL Bugzilla.

flibitijibibo commented 5 years ago

Their init call is identical:

https://github.com/MonoGame/MonoGame/blob/develop/MonoGame.Framework/Platform/SDL/SDLGamePlatform.cs#L52

So just in case you missed it, here's the SDL2.dll you need to test:

https://www.libsdl.org/release/SDL2-2.0.8-win32-x86.zip

briermay commented 5 years ago

I'll try that when my boyfriend has a chance, I ended up giving up on windows and just re-installed Linux. I have far less issues and the Linux gaming has come a long way (all my games that never ran now run flawlessly with Proton and Steam Play)

flibitijibibo commented 5 years ago

Closing due to old age - from what I can tell this unique to very specific setups, and is related to the HID layer in SDL, not FNA. This should probably be tested against SDL's joystick test and filed on their Bugzilla.