Hard Light Productions Forums
Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: Amon_Re on April 16, 2003, 10:37:03 am
-
More questions.... sorry guys :)
Currently my freespace folder is ordered like this:
c:\games\freespace
c:\games\freespace\data
c:\games\freespace\fsport
c:\games\freespace\fsport\data
c:\games\freespace\othercampaign
c:\games\freespace\othercampaign\data
...
Now, with the - mod parametre it's easy to tell FS2_Open to use those directories aswell, wich enables me to keep my main datafolder clean.
Now, however, that i'm toying with Fred2Open i was wondering if such a thing can also be done with Fred2Open.
I already tried -mod but that didn't work out... :)
Cheers,
-
Good catch, if it doesn't, it should, DTP?
-
I feel so usefull now ;)
I'll post'm as i find them :ha:
Cheers,
-
I did this yesterday; eventually, this is quite simple. We must allow FRED2 to parse its command-line *before* it initializes the C file system. Then, the parser will be able to detect the "-mod" switch if FRED2 is launched this way: "fred2.exe -mod ", what will trigger the CFile init sequence to build a secondary file system on the "mod_name" directory. Here are the details for the dev team:
* File "FRED2\Management.cpp", function "fred_init()"; just before this statement:
if (cfile_init(Fred_exe_dir)) exit(1);
You could simply add this one:
parse_cmdline(GetCommandLine());
Adding this #include line at the beginning of this file will be required too:
#include "cmdline.h" // parse_cmdline
* Practically, I prefered to pass a variable (szCommandLine) to the parse_ ... function; I initialized it there:
File "FRED2\Fred.cpp", function "CFREDApp::InitInstance()":
/////////////////////////////////////////////////////////////////////////////
// CFREDApp initialization
char *szCommandLine;
BOOL CFREDApp::InitInstance()
{
...
szCommandLine = GetCommandLine(); // retrieve the command-line string for the FRED2 process
// not added by me
strcpy(Fred_exe_dir, __argv[0]);
...
}
Of course, I "externalized" this variable in "Fred.h":
extern char *szCommandLine;
That's all! This works seamlessly for me. My new background bitmaps which are located in a mod directory are loaded correctly in the background editor :) I hope I have been cleared in my explanations (did not succeed to indent the code here). Also, sorry for non-coders people: the above lines must be scary for you.
-
They don't scare me, but i don't have the source nor a compiler ;)
An exe would be nice... :)
Cheers,