Hard Light Productions Forums

Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: General Battuta on June 06, 2014, 07:33:44 pm

Title: EMERGENCY REQUEST: fix erange errors on long paths
Post by: General Battuta on June 06, 2014, 07:33:44 pm
The Steam version of this game installs to a long-ass file path.

We are about to get a flood of people trying to install FSO, because the Steam version doesn't work at ALL out of the box.

When they try to run FSO in their long-ass file path, they are going to get ERANGE errors and get ****ed.

Can we fix this error and get a new build up in the launcher ASAP?
Title: Re: EMERGENCY REQUEST: fix erange errors on long paths
Post by: niffiwan on June 06, 2014, 07:59:07 pm
IIRC m!m mentioned he had code for this in one of his github branches.  If we can find it and get some intense testing done in the next few days then we should stand a decent chance of quickly getting this into a 3.7.2RC3 (Of course, I do not speak alone for the SCP... but surely this is a worthy cause.)
Title: Re: EMERGENCY REQUEST: fix erange errors on long paths
Post by: NGTM-1R on June 06, 2014, 08:24:51 pm
Seconding this. The Steam release is a huge opportunity for us, but only if FSO works well for them.
Title: Re: EMERGENCY REQUEST: fix erange errors on long paths
Post by: mjn.mixael on June 06, 2014, 08:27:54 pm
It's pretty clear the flood of error reports has already begun.
Title: Re: EMERGENCY REQUEST: fix erange errors on long paths
Post by: m!m on June 06, 2014, 08:46:25 pm
Sorry to dissapoint you but my solution depends on the compresed VP branch which is not ready for trunk yet (it is also based off the SDL branch which would be another problem.
Maybe it could be an option to patch the cfile system to be able to handle longer paths otherwise.
Title: Re: EMERGENCY REQUEST: fix erange errors on long paths
Post by: niffiwan on June 06, 2014, 09:11:22 pm
No worries, I might see if I can do a simple bump to the char[] size.
Title: Re: EMERGENCY REQUEST: fix erange errors on long paths
Post by: niffiwan on June 07, 2014, 12:20:37 am
Double post... here's some code that I hope will do the job:  https://github.com/niffiwan/fs2open.github.com/commits/longer_paths

I've bumped MAX_PATH_LEN to 256 (from 128), other #defines like #CFILE_MAX_PATH_LEN are already at 256 or higher.  There's not much point going much higher since Windows only supports MAX_PATH of 260 anyway (including the drive letter and NUL, yes 260 is technically not 100% correct, but if explorer, cmd.exe and powershell prompt can't handle it...).  I also checked through the code for the magic number 128 (far too many of them) and I think I've updated all the relevant ones to use MAX_PATH_LEN.

For testing, so far I've played Surrender Belisarius and The Blade Itself (BP) and both seemed to work fine with root FSO install dir 201 chars long (note that subdirs take up a fair portion of the allowed path length).  A lot more testing will be needed though :)

Lastly, have some executables for testing...(still building...). http://www.mediafire.com/download/od3zovwl2qwcdgm/longpath.7z (http://www.mediafire.com/download/od3zovwl2qwcdgm/longpath.7z)

It'd be great for this to get as much testing as possible. Play missions from as many mods as possible, just from the techroom should be fine, and watch out for errors, warning, or missing stuff (like textures, glowmaps, scripts failing, etc).
Title: Re: EMERGENCY REQUEST: fix erange errors on long paths
Post by: mjn.mixael on June 07, 2014, 12:43:12 am
Let's clarify... Please only test on mods that you are 150% sure have no missing files and no missing dependencies. This probably means to think twice about testing on really old mods, or mods that you've changed the mod.ini to a newer MediaVPs version than what it officially supports. False positives won't make this go faster.
Title: Re: EMERGENCY REQUEST: fix erange errors on long paths
Post by: AdmiralRalwood on June 07, 2014, 01:04:20 am
I did a test on a very long filepath that I confirmed to generate erange errors on 3.7.2RC2 and it worked successfully in my tests with the retail assets and the 2014 MediaVPs (and BP2, although that mod.ini was modified to point to the 2014 MVPs a long time ago). Didn't see any instances of 127/128 magic numbers related to file paths that you missed in your patch, niffiwan.
Title: Re: EMERGENCY REQUEST: fix erange errors on long paths
Post by: niffiwan on June 08, 2014, 03:50:34 am
OK - it's committed to trunk, and should be in the next nightly. If anyone encounters any issues, please let me know!
Title: Re: EMERGENCY REQUEST: fix erange errors on long paths
Post by: Bobboau on June 08, 2014, 08:31:11 am
want to clarify something, the game as installed by steam does not work for a great many people due to this bug existing in retail.
Title: Re: EMERGENCY REQUEST: fix erange errors on long paths
Post by: General Battuta on June 08, 2014, 08:37:57 am
want to clarify something, the game as installed by steam does not work for a great many people due to this bug existing in retail.

I don't think the Steam version of this game is failing to work due to the ERANGE error, though I could be wrong.
Title: Re: EMERGENCY REQUEST: fix erange errors on long paths
Post by: The E on June 08, 2014, 08:39:52 am
It doesn't matter where the error comes from. What matters is making sure that it's fixed on our end.
Title: Re: EMERGENCY REQUEST: fix erange errors on long paths
Post by: General Battuta on June 08, 2014, 10:31:29 am
He is talking about the steam 'won't run' error which is not the topic of this thread.
Title: Re: EMERGENCY REQUEST: fix erange errors on long paths
Post by: Bobboau on June 08, 2014, 03:25:54 pm
I thought it was the same error, a bug that has been around since retail.

if that is not the case then I apologize for the derail.
Title: Re: EMERGENCY REQUEST: fix erange errors on long paths
Post by: AdmiralRalwood on June 08, 2014, 03:43:10 pm
Steam problem appears to be caused by missing registry entries, not long file paths (otherwise, people wouldn't be able to run FSO from their steam install path; as long as they don't use the MediaVPs, that apparently works fine).