Can't get GZDoom to compile and run (Windows 10)

Post a reply

Smilies
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :geek: :ugeek: :!: :?: :idea: :arrow: :| :mrgreen: :3: :wub: >:( :blergh:
View more smilies

BBCode is OFF
Smilies are ON

Topic review
   

Expand view Topic review: Can't get GZDoom to compile and run (Windows 10)

Re: Can't get GZDoom to compile and run (Windows 10)

by drfrag » Wed May 16, 2018 2:21 pm

Thanks, that tag is not on any branch and i was missing tags in my local repo.

Then you'll need Git and to work on the current master.

Re: Can't get GZDoom to compile and run (Windows 10)

by RockstarRaccoon » Wed May 16, 2018 1:44 pm

Alright, new code is building fine on my computer! Thanks for all the help guys, and glad that I ended up helping you find an error! :3

Working on that AutoMap stuff I wanted to test now. Hope to be trying to get it in the main build soon!

Re: Can't get GZDoom to compile and run (Windows 10)

by Graf Zahl » Wed May 16, 2018 1:11 pm

drfrag wrote: I was wrong and the link i provided earlier was for an older version, i still don't know where the code for 3.3.2 is in the repo.
It's at the g3.3.2 tag, where else? If you just look at master's history you won't find it. The release tags will always be off the mainline because of the versioning info they need.

Re: Can't get GZDoom to compile and run (Windows 10)

by drfrag » Wed May 16, 2018 12:47 pm

If you want to make some modifications to the code you should install Git and TortoiseGit.
That said you could also check that commit and copy-pasta the changes in your source manually.
I was wrong and the link i provided earlier was for an older version, i still don't know where the code for 3.3.2 is in the repo.
Right now AFAIK there are a couple of branches with the fix applied, the official master https://github.com/coelckers/gzdoom/archive/master.zip and my unofficial MinGW maintenance branch https://github.com/drfrag666/gzdoom/archive/g3.3mgw.zip (this is mostly up to date minus the 2D and GL refactor).

Re: Can't get GZDoom to compile and run (Windows 10)

by RockstarRaccoon » Wed May 16, 2018 7:55 am

Well, it's a new computer, so I don't have the older Windows SDKs on it, so the fix is preferable. I'm assuming I would get that from the gitHub version? Yep.

Re: Can't get GZDoom to compile and run (Windows 10)

by Graf Zahl » Wed May 16, 2018 7:44 am

Yes, _mental_ has committed a fix a few hours ago.
You would actually be able to compile it if CMake allowed selection of the desired Windows SDK.

Re: Can't get GZDoom to compile and run (Windows 10)

by RockstarRaccoon » Wed May 16, 2018 7:37 am

So, we were right? This isn't a problem with anything I'm doing, the code just doesn't work anymore? So, I should either change that line or use the Linux compiler? Has this been fixed in the latest GitHub build?

Re: Can't get GZDoom to compile and run (Windows 10)

by Cacodemon345 » Wed May 16, 2018 6:11 am

Graf Zahl wrote:bad app code
...is the reason why a lot of Windows games in the 90s no longer work anymore, due to bad coding shit.

Re: Can't get GZDoom to compile and run (Windows 10)

by drfrag » Wed May 16, 2018 3:27 am

Now i see the program is expected to crash anyway and to allow it to continue a custom invalid parameter handler would be required.

Re: Can't get GZDoom to compile and run (Windows 10)

by Graf Zahl » Wed May 16, 2018 3:22 am

Which wouldn't help you in any way here, because it's not an error in the operating system but in some library code that got linked into GZDoom that caused the problem.
In all seriousness, why was this function even used? IMO it's a classic case of bad app code causing problems down the line because it wasn't fully thought through.

Fun stuff: Before 2008 this was using GetModuleFileName but then Randi must have read about this strange function and changed the code without any real need. Then later problems on MinGW surfaced and the #ifdef got added. And now we're back to the start, as it always should have remained.

Re: Can't get GZDoom to compile and run (Windows 10)

by Cacodemon345 » Wed May 16, 2018 3:14 am

EDIT: The crash is caused by a new Windows SDK, 10.0.17134.0 in my case. _get_pgmptr() assigns an empty string to its argument. Looks like Microsoft cannot release anything that won't break existing software. It's a new trend in software industry and everyone wants to be a part of it...
That's another time Microsoft fixed up another undefined behaviour, ever since older DDraw games started to break...
That's the reason why I prefer older Win7.

Re: Can't get GZDoom to compile and run (Windows 10)

by drfrag » Wed May 16, 2018 3:07 am

Luckily this kind of stuff doesn't happen with MinGW. :mrgreen:
But now seriously according to Monkeysoft _get_pgmptr should not return zero when pValue is NULL but EINVAL.
https://msdn.microsoft.com/en-us/library/24awhcba.aspx

Re: Can't get GZDoom to compile and run (Windows 10)

by Graf Zahl » Wed May 16, 2018 2:13 am

The real error here is assuming that 'strrchr' always returns something valid and usable. You do not code like that!!!
This would already crash if the file name contained forward slashes or no slashes at all.

Just remove that case and always use GetModuleFileName. I don't get it why such a totally redundant special case needs to be here and why it is necessary to check some CRT internal here.

Re: Can't get GZDoom to compile and run (Windows 10)

by _mental_ » Wed May 16, 2018 1:18 am

It's here. This can happen only if _get_pgmptr() function returns zero but for some reason assigns nullptr to its argument.

Code: Select all

#ifdef _MSC_VER
		if (_get_pgmptr(&program) != 0)
		{
			I_FatalError("Could not determine program location.");
		}
#else
		// ...
#endif
		progdir = program;
		program = progdir.LockBuffer();
		*(strrchr(program, '\\') + 1) = '\0';   // <------
		//... 
EDIT: The crash is caused by a new Windows SDK, 10.0.17134.0 in my case. _get_pgmptr() assigns an empty string to its argument. Looks like Microsoft cannot release anything that won't break existing software. It's a new trend in software industry and everyone wants to be a part of it...

Re: Can't get GZDoom to compile and run (Windows 10)

by Graf Zahl » Wed May 16, 2018 12:15 am

Where does it crash? Post a screenshot of the actual code where it happens in the debugger with some local variables visible. But I have the feeling this comes from some system DLL prematurely aborting the app. If you can, set a breakpoint on WinMain and try to see if it even gets there.

Top