// ==========================================================================
// Identify the SRB2 version, and IWAD file to use.
// ==========================================================================
static void IdentifyVersion(void)
{
char *srb2wad1, *srb2wad2;
const char *srb2waddir = NULL;
#if defined (__unix__) || defined (UNIXCOMMON) || defined (SDL)
// change to the directory where 'srb2.srb' is found
srb2waddir = I_LocateWad();
#endif
// get the current directory (possible problem on NT with "." as current dir)
if (srb2waddir)
{
strlcpy(srb2path,srb2waddir,sizeof (srb2path));
}
else
{
#ifndef _WIN32_WCE
if (getcwd(srb2path, 256) != NULL)
srb2waddir = srb2path;
else
#endif
{
#ifdef _arch_dreamcast
srb2waddir = "/cd";
#else
srb2waddir = ".";
#endif
}
}
#if defined (macintosh) && !defined (SDL)
// cwd is always "/" when app is dbl-clicked
if (!stricmp(srb2waddir, "/"))
srb2waddir = I_GetWadDir();
#endif
// Commercial.
srb2wad1 = malloc(strlen(srb2waddir)+1+8+1);
srb2wad2 = malloc(strlen(srb2waddir)+1+8+1);
if (srb2wad1 == NULL && srb2wad2 == NULL)
I_Error("No more free memory to look in %s", srb2waddir);
if (srb2wad1 != NULL)
sprintf(srb2wad1, pandf, srb2waddir, text[SRB2SRB]);
if (srb2wad2 != NULL)
sprintf(srb2wad2, pandf, srb2waddir, text[SRB2WAD]);
// will be overwritten in case of -cdrom or unix/win home
snprintf(configfile, sizeof configfile, "%s" PATHSEP CONFIGFILENAME, srb2waddir);
configfile[sizeof configfile - 1] = '\0';
// Load the IWAD
if (srb2wad2 != NULL && FIL_ReadFileOK(srb2wad2))
D_AddFile(srb2wad2);
else if (srb2wad1 != NULL && FIL_ReadFileOK(srb2wad1))
D_AddFile(srb2wad1);
else
I_Error("SRB2.SRB/SRB2.WAD not found! Expected in %s, ss files: %s and %s\n", srb2waddir, srb2wad1, srb2wad2);
if (srb2wad1)
free(srb2wad1);
if (srb2wad2)
free(srb2wad2);
// if you change the ordering of this or add/remove a file, be sure to update the md5
// checking in D_SRB2Main
// Add the players
D_AddFile(va(pandf,srb2waddir,text[SONICPLR])); //sonic.plr
D_AddFile(va(pandf,srb2waddir,text[TAILSPLR])); //tails.plr
D_AddFile(va(pandf,srb2waddir,text[KNUXPLR])); //knux.plr
#ifndef _PSP // PSPDEV's CRT haves a limit of 16 files opened at a time
// Add the weapons
D_AddFile(va(pandf,srb2waddir,"rings.wpn")); //rings.wpn
#endif
// Add... nights?
D_AddFile(va(pandf,srb2waddir,"drill.dta")); //drill.dta
D_AddFile(va(pandf,srb2waddir,"soar.dta")); //soar.dta
#if !defined (SDL) || defined (HAVE_MIXER)
{
#if defined (DC) && 0
const char *musicfile = "music_dc.dta";
#else
const char *musicfile = text[MUSICWAD];
#endif
const char *musicpath = va(pandf,srb2waddir,musicfile);
int ms = W_VerifyNMUSlumps(musicpath); // Don't forget the music!
if (ms == 1)
D_AddFile(musicpath);
else if (ms == 0)
I_Error("File %s has been modified with non-music lumps",musicfile);
}
#endif
}
/* ======================================================================== */
// Just print the nice red titlebar like the original SRB2 for DOS.
/* ======================================================================== */