mirror of
https://github.com/nzp-team/fteqw.git
synced 2025-01-22 00:11:58 +00:00
a fix for the fteqccgui issue that was annoying shpuld
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5244 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
08ca60d1bf
commit
8df89fc186
3 changed files with 48 additions and 27 deletions
|
@ -13,7 +13,7 @@ void GUI_DialogPrint(char *title, char *text);
|
||||||
void *GUIReadFile(const char *fname, unsigned char *(*buf_get)(void *ctx, size_t len), void *buf_ctx, size_t *out_size);
|
void *GUIReadFile(const char *fname, unsigned char *(*buf_get)(void *ctx, size_t len), void *buf_ctx, size_t *out_size);
|
||||||
int GUIFileSize(const char *fname);
|
int GUIFileSize(const char *fname);
|
||||||
|
|
||||||
int GUI_ParseCommandLine(char *args); //0=gui, 1=commandline
|
int GUI_ParseCommandLine(char *args, pbool keepsrcanddir); //0=gui, 1=commandline
|
||||||
void GUI_SaveConfig(void);
|
void GUI_SaveConfig(void);
|
||||||
void GUI_RevealOptions(void);
|
void GUI_RevealOptions(void);
|
||||||
int GUIprintf(const char *msg, ...);
|
int GUIprintf(const char *msg, ...);
|
||||||
|
|
|
@ -6994,7 +6994,7 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin
|
||||||
strcpy(enginecommandline, "");
|
strcpy(enginecommandline, "");
|
||||||
|
|
||||||
GUI_SetDefaultOpts();
|
GUI_SetDefaultOpts();
|
||||||
mode = GUI_ParseCommandLine(lpCmdLine);
|
mode = GUI_ParseCommandLine(lpCmdLine, false);
|
||||||
|
|
||||||
if(mode == 1)
|
if(mode == 1)
|
||||||
{
|
{
|
||||||
|
@ -7140,15 +7140,14 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin
|
||||||
{
|
{
|
||||||
*s = '\0';
|
*s = '\0';
|
||||||
strcpy(progssrcname, s+1);
|
strcpy(progssrcname, s+1);
|
||||||
|
SetCurrentDirectory(progssrcdir);
|
||||||
}
|
}
|
||||||
|
|
||||||
SetCurrentDirectory(progssrcdir);
|
|
||||||
*progssrcdir = '\0';
|
*progssrcdir = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
//reset project/directory options
|
//reset project/directory options
|
||||||
GUI_SetDefaultOpts();
|
GUI_SetDefaultOpts();
|
||||||
GUI_ParseCommandLine(lpCmdLine);
|
GUI_ParseCommandLine(lpCmdLine, true);
|
||||||
GUI_RevealOptions();
|
GUI_RevealOptions();
|
||||||
|
|
||||||
//if the project is a .dat or .zip then decompile it now (so we can access the 'source')
|
//if the project is a .dat or .zip then decompile it now (so we can access the 'source')
|
||||||
|
|
|
@ -443,7 +443,7 @@ void GUI_LoadConfig(void)
|
||||||
|
|
||||||
|
|
||||||
//this function takes the windows specified commandline and strips out all the options menu items.
|
//this function takes the windows specified commandline and strips out all the options menu items.
|
||||||
int GUI_ParseCommandLine(char *args)
|
int GUI_ParseCommandLine(char *args, pbool keepsrcanddir)
|
||||||
{
|
{
|
||||||
int paramlen=0;
|
int paramlen=0;
|
||||||
int l, p;
|
int l, p;
|
||||||
|
@ -494,24 +494,30 @@ int GUI_ParseCommandLine(char *args)
|
||||||
args++;
|
args++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
progssrcname[l++] = *args++;
|
if (!keepsrcanddir)
|
||||||
|
progssrcname[l++] = *args;
|
||||||
|
args++;
|
||||||
}
|
}
|
||||||
progssrcname[l] = 0;
|
if (!keepsrcanddir)
|
||||||
|
progssrcname[l] = 0;
|
||||||
|
|
||||||
next = args;
|
next = args;
|
||||||
|
|
||||||
args = strrchr(progssrcname, '\\');
|
if (!keepsrcanddir)
|
||||||
while(args && strchr(args, '/'))
|
|
||||||
args = strchr(args, '/');
|
|
||||||
if (args)
|
|
||||||
{
|
{
|
||||||
memcpy(progssrcdir, progssrcname, args-progssrcname);
|
args = strrchr(progssrcname, '\\');
|
||||||
progssrcdir[args-progssrcname] = 0;
|
while(args && strchr(args, '/'))
|
||||||
args++;
|
args = strchr(args, '/');
|
||||||
memmove(progssrcname, args, strlen(args)+1);
|
if (args)
|
||||||
|
{
|
||||||
|
memcpy(progssrcdir, progssrcname, args-progssrcname);
|
||||||
|
progssrcdir[args-progssrcname] = 0;
|
||||||
|
args++;
|
||||||
|
memmove(progssrcname, args, strlen(args)+1);
|
||||||
|
|
||||||
SetCurrentDirectoryA(progssrcdir);
|
SetCurrentDirectoryA(progssrcdir);
|
||||||
*progssrcdir = 0;
|
*progssrcdir = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
args = next;
|
args = next;
|
||||||
}
|
}
|
||||||
|
@ -687,20 +693,36 @@ int GUI_ParseCommandLine(char *args)
|
||||||
while (*next == ' ')
|
while (*next == ' ')
|
||||||
next++;
|
next++;
|
||||||
|
|
||||||
l = 0;
|
if (keepsrcanddir)
|
||||||
while (*next != ' ' && *next)
|
{ //ignore it
|
||||||
progssrcname[l++] = *next++;
|
while (*next != ' ' && *next)
|
||||||
progssrcname[l] = 0;
|
next++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
l = 0;
|
||||||
|
while (*next != ' ' && *next)
|
||||||
|
progssrcname[l++] = *next++;
|
||||||
|
progssrcname[l] = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (!strnicmp(parameters+paramlen, "-src ", 5) || !strnicmp(parameters+paramlen, "/src ", 5))
|
else if (!strnicmp(parameters+paramlen, "-src ", 5) || !strnicmp(parameters+paramlen, "/src ", 5))
|
||||||
{
|
{
|
||||||
while (*next == ' ')
|
while (*next == ' ')
|
||||||
next++;
|
next++;
|
||||||
|
|
||||||
l = 0;
|
if (keepsrcanddir)
|
||||||
while (*next != ' ' && *next)
|
{ //ignore it
|
||||||
progssrcdir[l++] = *next++;
|
while (*next != ' ' && *next)
|
||||||
progssrcdir[l] = 0;
|
next++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
l = 0;
|
||||||
|
while (*next != ' ' && *next)
|
||||||
|
progssrcdir[l++] = *next++;
|
||||||
|
progssrcdir[l] = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (!strnicmp(parameters+paramlen, "-T", 2) || !strnicmp(parameters+paramlen, "/T", 2)) //the target
|
else if (!strnicmp(parameters+paramlen, "-T", 2) || !strnicmp(parameters+paramlen, "/T", 2)) //the target
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue