mirror of
https://github.com/ioquake/ioq3.git
synced 2024-11-10 07:11:46 +00:00
* (bug 3112) Removal of QVM name obfuscation (TsT <tst2006@gmail.com>)
* Add developer warning when texture loading falls back on jpg from tga * Remove uppercase extension hack from texture loading since the Q3 pk3 file system is case insensitive anyway and you would likely want to know about the failures when loading images from the native FS
This commit is contained in:
parent
1144f567e8
commit
4997c4764a
2 changed files with 8 additions and 38 deletions
|
@ -972,22 +972,6 @@ qboolean FS_FilenameCompare( const char *s1, const char *s2 ) {
|
||||||
return qfalse; // strings are equal
|
return qfalse; // strings are equal
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
===========
|
|
||||||
FS_ShiftedStrStr
|
|
||||||
===========
|
|
||||||
*/
|
|
||||||
char *FS_ShiftedStrStr(const char *string, const char *substring, int shift) {
|
|
||||||
char buf[MAX_STRING_TOKENS];
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; substring[i]; i++) {
|
|
||||||
buf[i] = substring[i] + shift;
|
|
||||||
}
|
|
||||||
buf[i] = '\0';
|
|
||||||
return strstr(string, buf);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
===========
|
===========
|
||||||
FS_FOpenFileRead
|
FS_FOpenFileRead
|
||||||
|
@ -1123,19 +1107,13 @@ int FS_FOpenFileRead( const char *filename, fileHandle_t *file, qboolean uniqueF
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// qagame.qvm - 13
|
if (!(pak->referenced & FS_QAGAME_REF) && strstr(filename, "game.qvm")) {
|
||||||
// dTZT`X!di`
|
|
||||||
if (!(pak->referenced & FS_QAGAME_REF) && FS_ShiftedStrStr(filename, "dTZT`X!di`", 13)) {
|
|
||||||
pak->referenced |= FS_QAGAME_REF;
|
pak->referenced |= FS_QAGAME_REF;
|
||||||
}
|
}
|
||||||
// cgame.qvm - 7
|
if (!(pak->referenced & FS_CGAME_REF) && strstr(filename, "cgame.qvm")) {
|
||||||
// \`Zf^'jof
|
|
||||||
if (!(pak->referenced & FS_CGAME_REF) && FS_ShiftedStrStr(filename , "\\`Zf^'jof", 7)) {
|
|
||||||
pak->referenced |= FS_CGAME_REF;
|
pak->referenced |= FS_CGAME_REF;
|
||||||
}
|
}
|
||||||
// ui.qvm - 5
|
if (!(pak->referenced & FS_UI_REF) && strstr(filename, "ui.qvm")) {
|
||||||
// pd)lqh
|
|
||||||
if (!(pak->referenced & FS_UI_REF) && FS_ShiftedStrStr(filename , "pd)lqh", 5)) {
|
|
||||||
pak->referenced |= FS_UI_REF;
|
pak->referenced |= FS_UI_REF;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4405,11 +4405,14 @@ void R_LoadImage( const char *name, byte **pic, int *width, int *height ) {
|
||||||
if (!*pic) {
|
if (!*pic) {
|
||||||
// try jpg in place of tga
|
// try jpg in place of tga
|
||||||
char altname[MAX_QPATH];
|
char altname[MAX_QPATH];
|
||||||
|
|
||||||
strcpy( altname, name );
|
strcpy( altname, name );
|
||||||
len = strlen( altname );
|
len = strlen( altname );
|
||||||
altname[len-3] = 'j';
|
altname[len-3] = 'j';
|
||||||
altname[len-2] = 'p';
|
altname[len-2] = 'p';
|
||||||
altname[len-1] = 'g';
|
altname[len-1] = 'g';
|
||||||
|
|
||||||
|
ri.Printf( PRINT_DEVELOPER, "WARNING: %s failed, trying %s\n", name, altname );
|
||||||
LoadJPG( altname, pic, width, height );
|
LoadJPG( altname, pic, width, height );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4477,19 +4480,8 @@ image_t *R_FindImageFile( const char *name, qboolean mipmap, qboolean allowPicmi
|
||||||
// load the pic from disk
|
// load the pic from disk
|
||||||
//
|
//
|
||||||
R_LoadImage( name, &pic, &width, &height );
|
R_LoadImage( name, &pic, &width, &height );
|
||||||
if ( pic == NULL ) { // if we dont get a successful load
|
if ( pic == NULL ) {
|
||||||
char altname[MAX_QPATH]; // copy the name
|
return NULL;
|
||||||
int len; //
|
|
||||||
strcpy( altname, name ); //
|
|
||||||
len = strlen( altname ); //
|
|
||||||
altname[len-3] = toupper(altname[len-3]); // and try upper case extension for unix systems
|
|
||||||
altname[len-2] = toupper(altname[len-2]); //
|
|
||||||
altname[len-1] = toupper(altname[len-1]); //
|
|
||||||
ri.Printf( PRINT_DEVELOPER, "trying %s...\n", altname ); //
|
|
||||||
R_LoadImage( altname, &pic, &width, &height ); //
|
|
||||||
if (pic == NULL) { // if that fails
|
|
||||||
return NULL; // bail
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
image = R_CreateImage( ( char * ) name, pic, width, height, mipmap, allowPicmip, glWrapClampMode );
|
image = R_CreateImage( ( char * ) name, pic, width, height, mipmap, allowPicmip, glWrapClampMode );
|
||||||
|
|
Loading…
Reference in a new issue