it seems i just managed to get real mod support into the fs2source,
preliminary tests show it to work well and so far no bugs.
so how did i do it.
Well, i have added yet another commandline arguement.
if you start my exe that is in fs2dtpmod.exe like this
fs2dtpmod.exe -mod mymod
then the game will look for additional files in
Freespace2/mymod/data
Freespace2/mymod/data/tables
Freespace2/mymod/data/models/
and all files found there will be used
any files not found there will be looked for
in
freespace2/
freespace2/data/
freespace2/data/tables.
I´m pretty sure it works, but further testing is needed before i will go ahead and commit it.
this will solve several problems, like when people play with the same pilot in different mods
I´m not sure however if it will accept VP files in
the mod root that in this case would be freespace2/mymod/
but here is what i did
----------------
in cfile/cfile.h around line 392
#define CF_TYPE_MOD_ROOT 36
#define CF_TYPE_MOD_DATA 37
#define CF_TYPE_MOD_MAPS 38
#define CF_TYPE_MOD_TEXT 39
#define CF_TYPE_MOD_MISSIONS 40
#define CF_TYPE_MOD_MODELS 41
#define CF_TYPE_MOD_TABLES 42
#define CF_TYPE_MOD_SOUNDS 43
#define CF_TYPE_MOD_SOUNDS_8B22K 44
#define CF_TYPE_MOD_SOUNDS_16B11K 45
#define CF_TYPE_MOD_VOICE 46
#define CF_TYPE_MOD_VOICE_BRIEFINGS 47
#define CF_TYPE_MOD_VOICE_CMD_BRIEF 48
#define CF_TYPE_MOD_VOICE_DEBREIFINGS 49
#define CF_TYPE_MOD_VOICE_PERSONAS 50
#define CF_TYPE_MOD_VOICE_SPECIAL 51
#define CF_TYPE_MOD_VOICE_TRAINING 52
#define CF_TYPE_MOD_MUSIC 53
#define CF_TYPE_MOD_MOVIES 54
#define CF_TYPE_MOD_INTERFACE 55
#define CF_TYPE_MOD_FONT 56
#define CF_TYPE_MOD_EFFECTS 57
#define CF_TYPE_MOD_HUD 58
#define CF_TYPE_MOD_PLAYER_MAIN 59
#define CF_TYPE_MOD_PLAYER_IMAGES_MAIN 60
#define CF_TYPE_MOD_CACHE 61
#define CF_TYPE_MOD_PLAYERS 62
#define CF_TYPE_MOD_SINGLE_PLAYERS 63
#define CF_TYPE_MOD_MULTI_PLAYERS 64
#define CF_TYPE_MOD_MULTI_CACHE 65
#define CF_TYPE_MOD_CONFIG 66
#define CF_TYPE_MOD_SQUAD_IMAGES_MAIN 67
#define CF_TYPE_MOD_DEMOS 68
#define CF_TYPE_MOD_CBANIMS 69
#define CF_TYPE_MOD_INTEL_ANIMS 70
#define CF_MAX_PATH_TYPES 71
-----------------
in cfile / cfile.cpp at the very start of function int cfile_init(char *exe_dir, char *cdrom_dir)
{
if(Cmdline_mod) {
char modname[256];
Cmdline_mod = cf_add_modname(Cmdline_mod, "\\");
strcpy(modname,Cmdline_mod);
strcpy(Pathtypes[2].path,cf_add_modname(Cmdline_mod,"Data"));
Cmdline_mod = modname;
strcpy(Pathtypes[3].path,cf_add_modname(Cmdline_mod,"Data\\Maps"));
Cmdline_mod = modname;
strcpy(Pathtypes[4].path,cf_add_modname(Cmdline_mod,"Data\\Text"));
Cmdline_mod = modname;
strcpy(Pathtypes[5].path,cf_add_modname(Cmdline_mod,"Data\\Missions"));
Cmdline_mod = modname;
strcpy(Pathtypes[6].path,cf_add_modname(Cmdline_mod,"Data\\Models"));
Cmdline_mod = modname;
strcpy(Pathtypes[7].path,cf_add_modname(Cmdline_mod,"Data\\Tables"));
Cmdline_mod = modname;
strcpy(Pathtypes[8].path,cf_add_modname(Cmdline_mod,"Data\\Sounds"));
Cmdline_mod = modname;
strcpy(Pathtypes[9].path,cf_add_modname(Cmdline_mod,"Data\\Sounds\\8b22k"));
Cmdline_mod = modname;
strcpy(Pathtypes[10].path,cf_add_modname(Cmdline_mod,"Data\\Sounds\\16b11k"));
Cmdline_mod = modname;
strcpy(Pathtypes[11].path,cf_add_modname(Cmdline_mod,"Data\\Voice"));
Cmdline_mod = modname;
strcpy(Pathtypes[12].path,cf_add_modname(Cmdline_mod,"Data\\Voice\\Briefing"));
Cmdline_mod = modname;
strcpy(Pathtypes[13].path,cf_add_modname(Cmdline_mod,"Data\\Voice\\Command_briefings"));
Cmdline_mod = modname;
strcpy(Pathtypes[14].path,cf_add_modname(Cmdline_mod,"Data\\Voice\\Debriefing"));
Cmdline_mod = modname;
strcpy(Pathtypes[15].path,cf_add_modname(Cmdline_mod,"Data\\Voice\\Personas"));
Cmdline_mod = modname;
strcpy(Pathtypes[16].path,cf_add_modname(Cmdline_mod,"Data\\Voice\\Special"));
Cmdline_mod = modname;
strcpy(Pathtypes[17].path,cf_add_modname(Cmdline_mod,"Data\\Voice\\Training"));
Cmdline_mod = modname;
strcpy(Pathtypes[18].path,cf_add_modname(Cmdline_mod,"Data\\Music"));
Cmdline_mod = modname;
strcpy(Pathtypes[19].path,cf_add_modname(Cmdline_mod,"Data\\Movies"));
Cmdline_mod = modname;
strcpy(Pathtypes[20].path,cf_add_modname(Cmdline_mod,"Data\\Interface"));
Cmdline_mod = modname;
strcpy(Pathtypes[21].path,cf_add_modname(Cmdline_mod,"Data\\Fonts"));
Cmdline_mod = modname;
strcpy(Pathtypes[22].path,cf_add_modname(Cmdline_mod,"Data\\Effects"));
Cmdline_mod = modname;
strcpy(Pathtypes[23].path,cf_add_modname(Cmdline_mod,"Data\\Hud"));
Cmdline_mod = modname;
strcpy(Pathtypes[24].path,cf_add_modname(Cmdline_mod,"Data\\Players"));
Cmdline_mod = modname;
strcpy(Pathtypes[25].path,cf_add_modname(Cmdline_mod,"Data\\Players\\Images"));
Cmdline_mod = modname;
strcpy(Pathtypes[26].path,cf_add_modname(Cmdline_mod,"Data\\Data\\Cache"));
Cmdline_mod = modname;
strcpy(Pathtypes[27].path,cf_add_modname(Cmdline_mod,"Data\\Players"));
Cmdline_mod = modname;
strcpy(Pathtypes[28].path,cf_add_modname(Cmdline_mod,"Data\\Players\\Single"));
Cmdline_mod = modname;
strcpy(Pathtypes[29].path,cf_add_modname(Cmdline_mod,"Data\\Players\\Multi"));
Cmdline_mod = modname;
strcpy(Pathtypes[30].path,cf_add_modname(Cmdline_mod,"Data\\Players\\MultiData"));
Cmdline_mod = modname;
strcpy(Pathtypes[31].path,cf_add_modname(Cmdline_mod,"Data\\Config"));
Cmdline_mod = modname;
strcpy(Pathtypes[32].path,cf_add_modname(Cmdline_mod,"Data\\Players\\Squads"));
Cmdline_mod = modname;
strcpy(Pathtypes[33].path,cf_add_modname(Cmdline_mod,"Data\\Demos"));
Cmdline_mod = modname;
strcpy(Pathtypes[34].path,cf_add_modname(Cmdline_mod,"Data\\CBAnims"));
Cmdline_mod = modname;
strcpy(Pathtypes[35].path,cf_add_modname(Cmdline_mod,"Data\\IntelAnims"));
Cmdline_mod = modname;
strcpy(Pathtypes[36].path,cf_add_modname(Cmdline_mod,""));
Cmdline_mod = modname;
Hold_mod = Pathtypes[7].path; //DTP debugthing
}
i know that above could be done with a loop like for(i =2;I<37;I++), but im still learning, and believe me, I learned quite a bit about conversions when speaking c++.
and in the same file i added this function that is very similar to *cf_add_ext(*x,*x)
char *cf_add_modname(char *filename, char *ext)
{
int flen, elen;
static char path[MAX_PATH_LEN];
flen = strlen(filename);
elen = strlen(ext);
Assert(flen < MAX_PATH_LEN);
strcpy(path, filename);
if ((flen < MAX_PATH_LEN) || stricmp(path + flen - elen, ext)) {
Assert(flen + elen < MAX_PATH_LEN);
strcat(path, ext);
}
return path;
}
I will download some VP files and start checking it out, but so far it looks soooo sweet

.