[FIXED] Loading levels from subdirectory doesn't work
#1
Basically when trying to load a level from inside a subdirectory of the missions folder, the level fails to load. It can't find the .rdl file.
Reply
#2
Quick question: Are you trying this with an actual RDL file or a HOG?
The greatest pleasure in life is to do what people say you cannot do.
Uhm... Honey, there's a head in the toilet!
Reply
#3
I believe most of them were hogs that gave the error. Basically I just download the LOTW from DMDB, which has several of the levels in a TOP10 folder. Those levels (or most of them) wouldn't load.
Reply
#4
My experience with LOTW was that quite a few of them did not work even when installed properly.  I do not recall whether anything in the TOP10 group was affected.
Reply
#5
I was using the fixed version of the LOTW on the DMDB (All of the included missions work).

This also happens with other levels outside of the LOTW if they are put inside a subdirectory of /missions

EDIT: I actually haven't checked this on the latest unification...
Reply
#6
I have not changed anything in that area in quite a while.  I doubt it would have started working in the latest code if it did not work for you when last you tested it.
Reply
#7
Ah, I remember this old bug. The way it seems to work is, D1X- and D2X-Rebirth will search "missions" and its subdirs for .msn, .mn2, and .hog files and will load them without problems. But when loading a .rdl or .rl2 file, the game will only search inside the mission's .hog file and the root of "missions" - no subdirs. If it doesn't find the level file, the game will then exit with an error.

You can actually put a .msn or .mn2 file in a subdir of "missions", and its corresponding .rdl or .rl2 files in the root of "missions", and the levels will load.

Just to clarify, DOS D1 and D2 never supported subdirs at all (and D1 didn't even have a "missions" dir; mission files went in the game's root dir).
Reply
#8
I finally had time to look at this.  It works as Ryusei describes, and for the reasons you might expect based on his description.  Unfortunately, fixing it was a bit more involved than I had hoped.  In 2005 (!), Chris commited make add_missions_to_list recursive to let the game search subdirectories under missions.  If it finds an msn/mn2 file, it will try to discover a hog file at the path formed by replacing the msn/mn2 extension with hog.  This allows it to open hog files in the subdirectory.  When it mounts any hog file, no matter where it was found, it mounts it at the root of the game data directory.  That is why the bare names in the msn/mn2 work to find the files in the hog, even when the hog is buried in a subdirectory.  However, if the rdl/rl2 files are also in the subdirectory, using the bare name is wrong.  The level loader has a special case that, if the file is not found, then it retries the search in the missions subdirectory.  If that also fails, then the load fails and the game crashes.

The file names are stored in a buffer that does not have room for the subdirectory name.  For now, I modified the code so that the directory of the msn/mn2 is saved and the retry uses the directory of the msn/mn2 file instead of the hardcoded path missions.

10.5 years is not too long to wait for a bug fix, is it?
Reply
#9
Thanks for the work Kp. No I don't think 10 years is too long Tongue
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)