Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Sign in to follow this  
netnomad312

Running Legacy from other programs

Recommended Posts

I made this program at school today to help me test my wads without using batch files like I'm doing now (yes, I know there are probably more professionally made ones out there, but this one serves my purposes). It's supposed to run one of my three commonly used source ports with one of the three IWADs I own, as well as a few other parameters... here's a picture of it. Usually I test this wad in ZDoom, but I wanted to see if Legacy worked from this program.

EDIT: I TRIED to provide screenshots, but they all got horribly distorted. Basically when I try to run Legacy, it gives me this error:

"Your legacy.dat file is version 0.0, you need version 1.41
Use the legacy.dat coming from the same zip file of this exe.

Use -nocheckwadversion to remove this check,
but this can cause Legacy to hang."

...weird. What causes this, exactly?

Share this post


Link to post

Have you changed the directory to that of Legacy? It's not very smart when it comes to figuring out where it's stuff is.

Share this post


Link to post

Bleh, that's true... when adding the IWADs I told it to use the ones in the ZDoom directory (which is where all my original files from Doomm95 are). Guess next week I have to add another check for Legacy. ¬_¬

Share this post


Link to post

Sorry to double post, but it's better than making another topic (...right?). I tried today to fix it, but failed. Legacy still thinks I'm not using the right IWAD, or whatever it is. I actually checked; the strings are correct (if the "Legacy" radio button is selected, it adds "-iwad [legacy path]/[iwad].wad" instead of the default path).

Then I thought it might be that you can only call Legacy like that from its own folder, so I copied the exe into that folder... still no luck. Any other ideas?

A related question: next week I'm going to add a doom2.exe choice. I forget, is the Doom 1 executable here somewhere? Or can doom2.exe run different iwads (I doubt it)?

Share this post


Link to post
netnomad312 said:

Or can doom2.exe run different iwads (I doubt it)?

If you run doom2.exe with doom.wad, then it works, but you're not playing Ultimate Doom then; you're playing Doom v.1.9 (just three episodes). Doom2.exe doesn't accept the "-iwad" switch in the command line though. To achieve that, you'd copy doom2.exe to your c:\doom folder, and just run the program.

You can use doom2.exe with the Final Doom iwads - the simplest way is just to use them as if they were pwads (copy plutonia.wad and tnt.wad to your c:\doom2 folder and run with "doom2 -file tnt.wad" or "doom2 -file plutonia.wad" (without the quotes).

Share this post


Link to post

Meh, sounds complicated. I'll just disable all the IWAD buttons but Doom2 when doom2.exe is picked.

Oh... here's a working picture. This is how it looks when it loads.


All it's really doing is piecing together a pair of strings (one is the program path, the other is the command list) to run the program. But like I said, it now has a check that, when Legacy is used, it uses the IWADs in the Legacy folder instead of the default folder. This is why I don't understand why it's not working...

Share this post


Link to post

I'll see if I can duplicate the problem - but I doubt it's a problem with your program, rather legacy's fault for being bitchy about the location of the iwad and the way it's loaded.



Being the bastard that I am, I have copied your interface into my own version of the program (Written in Delphi) - not that I need to do that, seeing as I could have just had two edit boxes and a button to test it, heh.

Share this post


Link to post

Heh... damn you 1337er-than-me people, in a way. Hey, you have browse boxes. Cool. I need to add some of those.

Can you tell me how to store "default data" in an INI file? I guess that's a bit off-topic, but that's what I'd really like to do this week (so I can actually send it to people without making versions for them).

Share this post


Link to post



Use some Comboboxes for the IWADs and engines. That way you could even code separate configuration files and settings for each engine.
And believe me, you don't want to use .INI files in VB, unless you write your own parser for it. You could do with a simple textfile or maybe even a binary file. It's not like people need to change it in any other way then using the program.

Share this post


Link to post

ComboBox's would be much better.

I don't know much about vb, it's been years since I touched it.

You could simply have the program write to a text file:

Line 0 c:\doom\zdoom\zdoom.exe
Line 1 c:\doom\legacy\legacy.exe
Line 2 c:\doom\prboom\prboom.exe
Line 3 c:\doom\iwads\doom.wad
Line 4 c:\doom\iwads\doom2.wad
Line 5 c:\doom\iwads\final.wad
Line 6 
Line 7


Then have your program load them and put them in the appropriate box at run time.
If you only have a few options, this would be fine - otherwise it becomes a mess to keep track of.

Delphi has a nice component for parsing ini files - something I'm going to have to learn me thinks

Share this post


Link to post

A-ha. Yes, I read somewhere that using text files were easier. Can I use a text file with other stuff (description, about info, etc.) in it, and then have the paths (saying "to change your default paths...")? Also, I'd have to figure out how to load them, which I also don't know... :-/

EDIT: This is a page I found on that topic, but it seems a bit unclear, and different from your method. Hmm.

Share this post


Link to post

Or create a Type like this:

Public Type ConfigData
    LastDir As String
    nMonkeys As Long
    CheeseWeight As Single
    Sausage As Boolean
End Type
Then define it as a variable (all of this in a module BTW):
Public Config As ConfigData
Then you can access the configuration like this:
ConfigData.Sausage = True
ConfigData.nMonkeys = 6
Saving could be done like this:
Open App.path & "\launcher.cfg" For Binary As #1
    Put #1, , ConfigData
Close #1
And loading like this:
Open App.path & "\launcher.cfg" For Binary As #1
    Get #1, , ConfigData
Close #1

Alternatively, there's CodeImp's configuration class. With that and some general understanding of how classes work in Visual Basic you can make those fancy Doom Builder configuration files and load\save them by calling class methods.

Share this post


Link to post

Yeah, I'm still trying to get a handle on that stuff (classes and such) in VB, having never learned any of it before. It makes sense, sort of... but in your example, how do I choose what line gets written to/loaded from?

Share this post


Link to post

If your still having the problem getting legacy to load, make sure your putting quote marks around the exe part

If your combining variables such as

engine + iwad + pwad + deh + etc
You would be better off adding them to one variable So you would hav a variable that contains:
"C:\Games\Doom\Doom Legacy\Legacy.exe" -file C:\Games\Doom\IWADS\doom2.wad 
It should work fine.


Edit: No it shouldn't. I just found I had a copy of the doom2 wad in my legacy folder - once I removed that, 'Main wad not found' error ahoy.

Share this post


Link to post

I have two strings... strProgram and strCommand. The former is just the path of the exe (program path + program filename), while the latter is everything else (iwad + pwad + deh + misc. options). I did this because, where I found out how to run programs in the first place, the tutorial said to use a function with two different arguments for "filename" (in this case an executable) and parameters. But of course, some of this would already be defined if I were to figure out saving/loading...

Yeah,about Legacy: I've tried the following so far:
1. Originally I just had Legacy try to run with the default path's iwads. That didn't work.
2. Last week I tried to solve this by adding a check... if the Legacy button was selected, the -iwad points to the ones in the Legacy folder. It still didn't work (but I'm sure the check was in effect; I even had it give me a popup box with the command string so I could check it).
3. I tried copying the program into the Legacy folder and running it from there. Still no luck.

Share this post


Link to post

Legacy needs ALL of it's files in order to run. Copying the exe into the Zdoom folder would do nothing for Legacy because it needs it's own data as well. Keep your program where it was before so it won't mess up where it is looking for wads and then tell your program to execute the Legacy.exe file in your actual Legacy folder. If that doesn't work, than your Legacy is odd...

Share this post


Link to post

That's exactly what I was doing. The only possibility I can see is that its "current directory" isn't the same, in which case I figured copying the program into the Legacy folder would work... but it didn't.

EDIT: Hah... I'm an idiot... I forgot that the function I'm using also has a "current directory" that I had to enter. See, one tutorial I read told me to define the function ShellExecute as follows:

Public Declare Function ShellExecute Lib "shell32.dll"
Alias "ShellExecuteA" (ByVal hWnd As Long, ByVal
lpOperation As String, ByVal lpFile As String, ByVal
lpParameters As String,    ByVal lpDirectory As String,
ByVal nShowCmd As Long) As Long
This is all one line, BTW... I just had to split it up so that it wouldn't extend this window (it looked weird that way).

Anyway, I still don't know what all of it means, but it works. I simply forgot the "lpDirectory" part was there because it ran off the side of the screen. Anyway, now I have a check for the Legacy button that executes the program using the Legacy folder as the current directory. It works now, so my original problem is solved.

Now the only thing left to do is figure out all those blasted text files. I can successfully open a text file using the same function, but that function doesn't read from or write data to a file (although now I have a nice little "help" button that loads it).

Share this post


Link to post
netnomad312 said:

I made this program at school today to help me test my wads without using batch files like I'm doing now (yes, I know there are probably more professionally made ones out there, but this one serves my purposes). It's supposed to run one of my three commonly used source ports with one of the three IWADs I own, as well as a few other parameters... here's a picture of it. Usually I test this wad in ZDoom, but I wanted to see if Legacy worked from this program.

EDIT: I TRIED to provide screenshots, but they all got horribly distorted. Basically when I try to run Legacy, it gives me this error:

"Your legacy.dat file is version 0.0, you need version 1.41
Use the legacy.dat coming from the same zip file of this exe.

Use -nocheckwadversion to remove this check,
but this can cause Legacy to hang."

...weird. What causes this, exactly?


Nice job so far. It's a compliment when someone copies your work:)

You didn't say exactly, but I'm assuming you are using the -iwad parameter? That works perfectly since that's what I use. (I'm not fond of copying IWADS all over the place - so I always use -iwad).

I'm assuming you are setting the working directory correctly. Then the only thing I can think of is long file names. That's a path that has anything with more than 8 charactes or there's a blank in the patch. Blanks in particular cause parsing errors (they do in some ports for sure).

I've never tested Legacy with long file names, but you can either make them short filenames (there's an api for doing that) or put them in quotes when passed on the command line. I make either of those an option since I prefer to keep filenames in the original format

Share this post


Link to post

Have a skip through this code of that old Doom launcher up there in my screenshot (written in VB6): http://www.whacked.daniel-carroll.co.uk/temp/launchtool_src.zip

IIRC it also uses the ShellExecuteEx function or a derative. Plus it has a nice configuration class that can handle most of the icky configuration stuff for you.

<brag>It also has extendable support for pretty much any engine, and can also read from WAD files to find out map numbers and things like that.</brag>

Share this post


Link to post

Only in Java, I'm afraid. I've never known any C++, although I know it's really similar (I've been wanting to take a course in it or VB but couldn't yet). All I know about VB comes from two years ago in a highschool course, and we never did classes.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
×