Major bug found in Power Render

Started by
5 comments, last by Phillip Schuster 24 years, 7 months ago
I have decided not to fix the 8.3 filename problem because .3DS files do not support long filenames.
Author of Power Render (http:/www.powerrender.com)
Advertisement
Hi !!

Well, but that is a resource of big problems when selling a professionell products. For internet demos this may be fine, but when selling products mainly for windows 9x it's a big problem, because when somebody installs it in a long filename path, the program crashes ;(((((

With Survival (our first Power Render professional game sold in Europe and shortly in USA) we had a lot of problems due to this fact and a lot of support has be done !!

But, then please tell me : Does the PR_LoadPRO-Function work with long filenames ??? If so, it'll be fine, and I simply write my own bmp-importer and texture-loading routines, which will support long filenames.


Thanks.

Phillip

Phillip Schuster
I looked through my source and found nothing that limited the filename length. You should be able to load in long filename textures, however like I mentioned you'll have problems if you use .3DS for importing.

The other problem with pathnames lies in the path you try to run a PR application from. If it contains spaces I believe the routine that extracts parameters from the command line interprets the space as the start of parameters. I'll have to look at this (it's in winutil.c and could be fixed yourself if you want to try).

Author of Power Render (http:/www.powerrender.com)
There's a MSVC++ function to convert from long to short pathnames:

DWORD GetShortPathName(LPCTSTR lpszLongPath, LPTSTR lpszShortPath, DWORD cchBuffer);

cchBuffer is the length of the lpszShortPath parameter, which receives the short version.

The function is identical to interrupt 21h, function 7160h, minor code 1h.

Chris !!

I am sorry. You are right. I first didn't understand that with 3DS. But of course you are right. Well, but when using the MAX-Plug-In it should work, right ??

So, the 3DS-Format does not store the filepath, just the filename, right ?? I don't use textures with long filenames, just directories with long filenames, and there the program crashes.

Ok, I will play around a bit with it, and I will see how I can fix my problems.


Darren, thank you very much for the function, I will try that out.

Phillip

Phillip Schuster
Hi all !!

I have found a major bug of Power Render. This also explains why my first game didn't work with my installation routine !
The bug is:
PR_LoadTexture
wloadxxx
and other file-loading routines jus work with the 8.3-Filename-Format. Using long filenames crashes the program, because it cannot find the file.

I know, that Power Render is also written to support DOS, but I think in the windows-build, this should be removed, because it gives a lot of problems.

I found the bug while loading my heightmap for my new terrain engine. My Path is:
d:\visual c projects\terrain\...
When loading the heightmap with wloadpcx I ran into the problem.
Then, after an hour of debugging I came to this idea and put everything in
d:\prtest\terrain
and it works there !!

What's quite amusing is, that PR_LoadPRO works (with texture loading) even in my long-filenames-directory.

Chris, please modify this, because it's a major problem I think ??

Phillip

Phillip Schuster
Replace the function in winutil.c with this. I haven't tested it fully but I think it works properly. I just made it look for the last slash and work forwards from there. Since none of the utils use slash for options it should be fine.


/*
* Converts lpCmdLine to WinMain into argc, argv
*/
static char *argvbuf[32];
static char cmdLineBuffer[1024];
char **
commandLineToArgv(LPSTR lpCmdLine, int *pArgc)
{
char *p, *pEnd, *p2;
int argc = 0;


if (lpCmdLine == NULL)
{
*pArgc = argc;
return argvbuf;
}

strcpy (cmdLineBuffer, lpCmdLine);
p = cmdLineBuffer;
pEnd = p + strlen (cmdLineBuffer);
if (pEnd >= &cmdLineBuffer[1022])
pEnd = &cmdLineBuffer[1022];

fflush (stdout);

p2 = pEnd;
while ((p2 > p) && (*p2 != '\\'))
p2--;
while ((*p2 != ' ') && (p2 != pEnd))
{
if (*p2 == '\"') *p2 = 0;
p2++;
}

if (*p2 == ' ') *p2++ = 0;
if (*p2 == '\"') *p2++ = 0;

while (*p == '\"') p++;

argvbuf[argc++] = p;
p = p2;

while (1)
{
/* skip over white space */
fflush (stdout);

while (*p == ' ') p++;
if (p >= pEnd) break;

while (*p == '\"') p++;
if (p >= pEnd) break;

argvbuf[argc++] = p;
if (argc >= 32) break;

/* skip till there's a 0 or a white space */
while (*p && (*p != ' ')) p++;

if (*p == ' ') *p++ = 0;
if (*p == '\"') *p++ = 0;
}

*pArgc = argc;
return argvbuf;
}

Author of Power Render (http:/www.powerrender.com)

This topic is closed to new replies.

Advertisement