added '--addon <addon>'
git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@1165 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
Changes towards version 0.3:
|
Changes towards version 0.3:
|
||||||
|
- added '--addon <addon>' - SvdB
|
||||||
- keys.cfg from incompatible control scheme version is now renamed
|
- keys.cfg from incompatible control scheme version is now renamed
|
||||||
automatically to keys.old -Mika
|
automatically to keys.old -Mika
|
||||||
- Added warranty message in the console on startup, SvdB
|
- Added warranty message in the console on startup, SvdB
|
||||||
|
|||||||
+56
-9
@@ -50,10 +50,12 @@ extern uio_DirHandle *rootDir;
|
|||||||
|
|
||||||
|
|
||||||
static void mountContentDir (uio_Repository *repository,
|
static void mountContentDir (uio_Repository *repository,
|
||||||
const char *contentPath);
|
const char *contentPath, const char **addons);
|
||||||
|
static void mountDirZips (uio_MountHandle *contentHandle,
|
||||||
|
uio_DirHandle *dirHandle);
|
||||||
|
|
||||||
void
|
void
|
||||||
prepareContentDir (char *contentDirName)
|
prepareContentDir (char *contentDirName, const char **addons)
|
||||||
{
|
{
|
||||||
const char *testfile = "version";
|
const char *testfile = "version";
|
||||||
char cwd[PATH_MAX];
|
char cwd[PATH_MAX];
|
||||||
@@ -72,7 +74,7 @@ prepareContentDir (char *contentDirName)
|
|||||||
"directory.\n");
|
"directory.\n");
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
mountContentDir (repository, cwd);
|
mountContentDir (repository, cwd, addons);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -161,9 +163,10 @@ prepareMeleeDir (void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
mountContentDir (uio_Repository *repository, const char *contentPath) {
|
mountContentDir (uio_Repository *repository, const char *contentPath,
|
||||||
|
const char **addons) {
|
||||||
uio_MountHandle *contentHandle;
|
uio_MountHandle *contentHandle;
|
||||||
uio_DirHandle *packagesDir;
|
uio_DirHandle *packagesDir, *addonsDir, *addonDir;
|
||||||
static uio_AutoMount *autoMount[] = { NULL };
|
static uio_AutoMount *autoMount[] = { NULL };
|
||||||
|
|
||||||
contentHandle = uio_mountDir (repository, "/",
|
contentHandle = uio_mountDir (repository, "/",
|
||||||
@@ -185,19 +188,63 @@ mountContentDir (uio_Repository *repository, const char *contentPath) {
|
|||||||
packagesDir = uio_openDir (repository, "/packages", 0);
|
packagesDir = uio_openDir (repository, "/packages", 0);
|
||||||
if (packagesDir == NULL) {
|
if (packagesDir == NULL) {
|
||||||
// No packages dir means no packages to load.
|
// No packages dir means no packages to load.
|
||||||
|
if (addons[0] != NULL) {
|
||||||
|
// addons were specified, but there's no /packages dir,
|
||||||
|
// let alone a /packages/addons dir.
|
||||||
|
fprintf (stderr, "Warning: There's no 'packages/addons' "
|
||||||
|
"directory in the 'content' directory;\n\t'--addon' "
|
||||||
|
"options are ignored.\n");
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mountDirZips (contentHandle, packagesDir);
|
||||||
|
|
||||||
|
// NB: note the difference between addonsDir and addonDir.
|
||||||
|
// the former is the dir 'packages/addons', the latter a directory
|
||||||
|
// in that dir.
|
||||||
|
addonsDir = uio_openDirRelative (packagesDir, "addons", 0);
|
||||||
|
if (addonsDir == NULL) {
|
||||||
|
// No addon dir found.
|
||||||
|
fprintf (stderr, "Warning: There's no 'packages/addons' "
|
||||||
|
"directory in the 'content' directory;\n\t'--addon' "
|
||||||
|
"options are ignored.\n");
|
||||||
|
uio_closeDir (packagesDir);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
uio_closeDir (packagesDir);
|
||||||
|
|
||||||
|
for (; *addons != NULL; addons++)
|
||||||
{
|
{
|
||||||
|
addonDir = uio_openDirRelative (addonsDir, *addons, 0);
|
||||||
|
if (addonDir == NULL) {
|
||||||
|
fprintf (stderr, "Warning: directory 'packages/addons/%s' "
|
||||||
|
"not found; addon skipped.\n", *addons);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
mountDirZips (contentHandle, addonDir);
|
||||||
|
|
||||||
|
uio_closeDir (addonDir);
|
||||||
|
}
|
||||||
|
|
||||||
|
uio_closeDir (addonsDir);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
mountDirZips (uio_MountHandle *contentHandle, uio_DirHandle *dirHandle)
|
||||||
|
{
|
||||||
|
static uio_AutoMount *autoMount[] = { NULL };
|
||||||
uio_DirList *dirList;
|
uio_DirList *dirList;
|
||||||
|
|
||||||
dirList = uio_getDirList(packagesDir, "", ".zip", match_MATCH_SUFFIX);
|
dirList = uio_getDirList (dirHandle, "", ".zip", match_MATCH_SUFFIX);
|
||||||
if (dirList != NULL) {
|
if (dirList != NULL) {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < dirList->numNames; i++) {
|
for (i = 0; i < dirList->numNames; i++) {
|
||||||
if (uio_mountDir (repository, "/", uio_FSTYPE_ZIP,
|
if (uio_mountDir (repository, "/", uio_FSTYPE_ZIP,
|
||||||
packagesDir, dirList->names[i], "/", autoMount,
|
dirHandle, dirList->names[i], "/", autoMount,
|
||||||
uio_MOUNT_BELOW | uio_MOUNT_RDONLY,
|
uio_MOUNT_BELOW | uio_MOUNT_RDONLY,
|
||||||
contentHandle) == NULL) {
|
contentHandle) == NULL) {
|
||||||
fprintf (stderr, "Warning: Could not mount '%s': %s.\n",
|
fprintf (stderr, "Warning: Could not mount '%s': %s.\n",
|
||||||
@@ -207,7 +254,7 @@ mountContentDir (uio_Repository *repository, const char *contentPath) {
|
|||||||
}
|
}
|
||||||
uio_freeDirList (dirList);
|
uio_freeDirList (dirList);
|
||||||
}
|
}
|
||||||
uio_closeDir(packagesDir);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -44,7 +44,7 @@ extern uio_DirHandle *configDir;
|
|||||||
extern uio_DirHandle *saveDir;
|
extern uio_DirHandle *saveDir;
|
||||||
extern uio_DirHandle *meleeDir;
|
extern uio_DirHandle *meleeDir;
|
||||||
|
|
||||||
void prepareContentDir (char *contentDirName);
|
void prepareContentDir (char *contentDirName, const char **addons);
|
||||||
void prepareConfigDir(void);
|
void prepareConfigDir(void);
|
||||||
void prepareMeleeDir(void);
|
void prepareMeleeDir(void);
|
||||||
void prepareSaveDir(void);
|
void prepareSaveDir(void);
|
||||||
|
|||||||
+50
-21
@@ -75,6 +75,8 @@ main (int argc, char *argv[])
|
|||||||
char contentdir[1000];
|
char contentdir[1000];
|
||||||
float gamma = 1.0;
|
float gamma = 1.0;
|
||||||
int gammaset = 0;
|
int gammaset = 0;
|
||||||
|
const char **addons;
|
||||||
|
int numAddons;
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
@@ -83,7 +85,8 @@ main (int argc, char *argv[])
|
|||||||
FONT_OPT,
|
FONT_OPT,
|
||||||
SCROLL_OPT,
|
SCROLL_OPT,
|
||||||
SOUND_OPT,
|
SOUND_OPT,
|
||||||
STEREOSFX_OPT
|
STEREOSFX_OPT,
|
||||||
|
ADDON_OPT
|
||||||
};
|
};
|
||||||
|
|
||||||
int option_index = 0, c;
|
int option_index = 0, c;
|
||||||
@@ -113,6 +116,7 @@ main (int argc, char *argv[])
|
|||||||
{"scroll", 1, NULL, SCROLL_OPT},
|
{"scroll", 1, NULL, SCROLL_OPT},
|
||||||
{"sound", 1, NULL, SOUND_OPT},
|
{"sound", 1, NULL, SOUND_OPT},
|
||||||
{"stereosfx", 0, NULL, STEREOSFX_OPT},
|
{"stereosfx", 0, NULL, STEREOSFX_OPT},
|
||||||
|
{"addon", 1, NULL, ADDON_OPT},
|
||||||
{0, 0, 0, 0}
|
{0, 0, 0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -130,6 +134,17 @@ main (int argc, char *argv[])
|
|||||||
strcpy (contentdir, "content");
|
strcpy (contentdir, "content");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* InitThreadSystem should come before anything else.
|
||||||
|
* The memory system uses semaphores.
|
||||||
|
* Everything else uses the memory system.
|
||||||
|
*/
|
||||||
|
InitThreadSystem ();
|
||||||
|
mem_init ();
|
||||||
|
|
||||||
|
addons = HMalloc(1 * sizeof (const char *));
|
||||||
|
addons[0] = NULL;
|
||||||
|
numAddons = 0;
|
||||||
|
|
||||||
while ((c = getopt_long(argc, argv, "r:d:foc:b:spn:?hM:S:T:m:q:ug:", long_options, &option_index)) != -1)
|
while ((c = getopt_long(argc, argv, "r:d:foc:b:spn:?hM:S:T:m:q:ug:", long_options, &option_index)) != -1)
|
||||||
{
|
{
|
||||||
switch (c) {
|
switch (c) {
|
||||||
@@ -269,48 +284,62 @@ main (int argc, char *argv[])
|
|||||||
case STEREOSFX_OPT:
|
case STEREOSFX_OPT:
|
||||||
optStereoSFX = TRUE;
|
optStereoSFX = TRUE;
|
||||||
break;
|
break;
|
||||||
|
case ADDON_OPT:
|
||||||
|
numAddons++;
|
||||||
|
addons = HRealloc(addons,
|
||||||
|
(numAddons + 1) * sizeof (const char *));
|
||||||
|
addons[numAddons - 1] = optarg;
|
||||||
|
addons[numAddons] = NULL;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
printf ("\nOption %s not found!\n", long_options[option_index].name);
|
printf ("\nOption %s not found!\n", long_options[option_index].name);
|
||||||
case '?':
|
case '?':
|
||||||
case 'h':
|
case 'h':
|
||||||
printf("\nOptions:\n");
|
printf("Options:\n");
|
||||||
printf(" -r, --res=WIDTHxHEIGHT (default 640x480, bigger works only with --opengl)\n");
|
printf(" -r, --res=WIDTHxHEIGHT (default 640x480, bigger "
|
||||||
|
"works only with --opengl)\n");
|
||||||
printf(" -d, --bpp=BITSPERPIXEL (default 16)\n");
|
printf(" -d, --bpp=BITSPERPIXEL (default 16)\n");
|
||||||
printf(" -f, --fullscreen (default off)\n");
|
printf(" -f, --fullscreen (default off)\n");
|
||||||
printf(" -o, --opengl (default off)\n");
|
printf(" -o, --opengl (default off)\n");
|
||||||
printf(" -c, --scale=MODE (bilinear, biadapt or biadv, default is none)\n");
|
printf(" -c, --scale=MODE (bilinear, biadapt or biadv, "
|
||||||
printf(" -b, --meleescale=MODE (nearest or trilinear, default is trilinear)\n");
|
"default is none)\n");
|
||||||
|
printf(" -b, --meleescale=MODE (nearest or trilinear, "
|
||||||
|
"default is trilinear)\n");
|
||||||
printf(" -s, --scanlines (default off)\n");
|
printf(" -s, --scanlines (default off)\n");
|
||||||
printf(" -p, --fps (default off)\n");
|
printf(" -p, --fps (default off)\n");
|
||||||
printf(" -g, --gamma=CORRECTIONVALUE (default 1.0, which causes no change)\n");
|
printf(" -g, --gamma=CORRECTIONVALUE (default 1.0, which "
|
||||||
|
"causes no change)\n");
|
||||||
printf(" -n, --contentdir=CONTENTDIR\n");
|
printf(" -n, --contentdir=CONTENTDIR\n");
|
||||||
printf(" -M, --musicvol=VOLUME (0-100, default 100)\n");
|
printf(" -M, --musicvol=VOLUME (0-100, default 100)\n");
|
||||||
printf(" -S, --sfxvol=VOLUME (0-100, default 100)\n");
|
printf(" -S, --sfxvol=VOLUME (0-100, default 100)\n");
|
||||||
printf(" -T, --speechvol=VOLUME (0-100, default 100)\n");
|
printf(" -T, --speechvol=VOLUME (0-100, default 100)\n");
|
||||||
printf(" -q, --audioquality=QUALITY (high, medium or low, default medium)\n");
|
printf(" -q, --audioquality=QUALITY (high, medium or low, "
|
||||||
|
"default medium)\n");
|
||||||
printf(" -u, --nosubtitles\n");
|
printf(" -u, --nosubtitles\n");
|
||||||
printf(" --sound=DRIVER (openal, mixsdl, none; default mixsdl)\n");
|
printf(" --addon <addon> (using a specific addon; "
|
||||||
printf(" --stereosfx (enables positional sound effects, currently only for openal)\n");
|
"may be specified multiple times)\n");
|
||||||
printf("The following options can take either '3do' or 'pc' as an option:\n");
|
printf(" --sound=DRIVER (openal, mixsdl, none; default "
|
||||||
|
"mixsdl)\n");
|
||||||
|
printf(" --stereosfx (enables positional sound effects, "
|
||||||
|
"currently only for openal)\n");
|
||||||
|
printf("The following options can take either '3do' or 'pc' "
|
||||||
|
"as an option:\n");
|
||||||
printf(" -m, --music : Music version (default 3do)\n");
|
printf(" -m, --music : Music version (default 3do)\n");
|
||||||
printf(" --cscan : coarse-scan display, pc=text, 3do=hieroglyphs (default 3do)\n");
|
printf(" --cscan : coarse-scan display, pc=text, "
|
||||||
printf(" --menu : menu type, pc=text, 3do=graphical (default 3do)\n");
|
"3do=hieroglyphs (default 3do)\n");
|
||||||
|
printf(" --menu : menu type, pc=text, 3do=graphical "
|
||||||
|
"(default 3do)\n");
|
||||||
printf(" --font : font types and colors (default pc)\n");
|
printf(" --font : font types and colors (default pc)\n");
|
||||||
printf(" --scroll : ff/frev during comm. pc=per-page, 3do=smooth (default pc)\n");
|
printf(" --scroll : ff/frev during comm. pc=per-page, "
|
||||||
|
"3do=smooth (default pc)\n");
|
||||||
return 0;
|
return 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* InitThreadSystem should come before anything else.
|
|
||||||
* The memory system uses semaphores.
|
|
||||||
* Everything else uses the memory system.
|
|
||||||
*/
|
|
||||||
InitThreadSystem ();
|
|
||||||
mem_init ();
|
|
||||||
|
|
||||||
initIO();
|
initIO();
|
||||||
prepareContentDir (contentdir);
|
prepareContentDir (contentdir, addons);
|
||||||
|
HFree (addons);
|
||||||
prepareConfigDir ();
|
prepareConfigDir ();
|
||||||
prepareMeleeDir ();
|
prepareMeleeDir ();
|
||||||
prepareSaveDir ();
|
prepareSaveDir ();
|
||||||
|
|||||||
Reference in New Issue
Block a user