// adjust filename for foreign languages and WAV/MP3 issues. // static qboolean S_LoadSound_FileNameAdjuster(char *psFilename) { #if defined(_XBOX) const char* ext = "wxb"; #elif defined(_WINDOWS) const char* ext = "wav"; #elif defined(_GAMECUBE) const char* ext = "wgc"; #endif int len = strlen(psFilename); #if 0 char *psVoice = strstr(psFilename,"chars"); if (psVoice) { // account for foreign voices... // extern cvar_t* sp_language; if (sp_language && sp_language->integer==SP_LANGUAGE_GERMAN) { strncpy(psVoice,"chr_d",5); // same number of letters as "chars" } else if (sp_language && sp_language->integer==SP_LANGUAGE_FRENCH) { strncpy(psVoice,"chr_f",5); // same number of letters as "chars" } else { psVoice = NULL; // use this ptr as a flag as to whether or not we substituted with a foreign version } } #else char *psVoice = NULL; #endif psFilename[len-3] = ext[0]; psFilename[len-2] = ext[1]; psFilename[len-1] = ext[2]; int code = Sys_GetFileCode( psFilename ); if ( code == -1 ) { //hmmm, not found, ok, maybe we were trying a foreign noise ("arghhhhh.mp3" that doesn't matter?) but it // was missing? Can't tell really, since both types are now in sound/chars. Oh well, fall back to English for now... if (psVoice) // were we trying to load foreign? { // yep, so fallback to re-try the english... // strncpy(psVoice,"chars",5); psFilename[len-3] = ext[0]; psFilename[len-2] = ext[1]; psFilename[len-1] = ext[2]; code = Sys_GetFileCode( psFilename ); } } return code; }
/* ================= FS_Access ================= */ qboolean FS_Access( const char *filename ) { GOBBool status; FS_CheckInit(); char* gobname = FS_BuildGOBPath( filename ); if (GOBAccess(gobname, &status) != GOBERR_OK || status != GOB_TRUE) { return Sys_GetFileCode( filename ) != -1; } return qtrue; }
static int FS_FOpenFileReadOS( const char *filename, fileHandle_t f ) { if (Sys_GetFileCode(filename) != -1) { char* osname = FS_BuildOSPath( filename ); fsh[f].whandle = WF_Open(osname, true, false); if (fsh[f].whandle >= 0) { fsh[f].used = qtrue; fsh[f].gob = qfalse; return FS_filelength(f); } } return -1; }