X-Git-Url: http://deadsoftware.ru/gitweb?a=blobdiff_plain;f=src%2Fshared%2Fwadreader.pas;h=7aeef80aeb1d3e9069814a1c883fd64094fe3286;hb=83dba8e8957923e6a8f6541d7935345a59cf5bde;hp=b8f14db952daaa900e0a6e85ce8d669519ad3c7f;hpb=997a94053b44d7b4c6e149cd3e50463386ef730c;p=d2df-sdl.git diff --git a/src/shared/wadreader.pas b/src/shared/wadreader.pas index b8f14db..7aeef80 100644 --- a/src/shared/wadreader.pas +++ b/src/shared/wadreader.pas @@ -50,10 +50,15 @@ function g_ExtractFilePathName (resourceStr: AnsiString): AnsiString; function findDiskWad (fname: AnsiString): AnsiString; +var + wadoptDebug: Boolean = false; + wadoptFast: Boolean = false; + + implementation uses - SysUtils, Classes, BinEditor, e_log, g_options, utils, MAPSTRUCT; + SysUtils, Classes{, BinEditor}, e_log{, g_options}, utils, MAPSTRUCT; function findDiskWad (fname: AnsiString): AnsiString; @@ -135,7 +140,11 @@ begin if (lastSlash < 0) and (resourceStr[f] = '\') or (resourceStr[f] = '/') then lastSlash := f; if resourceStr[f] = ':' then begin - if lastSlash > 0 then result := normSlashes(Copy(resourceStr, f, lastSlash-f)); + if lastSlash > 0 then + begin + result := normSlashes(Copy(resourceStr, f, lastSlash-f)); + while (length(result) > 0) and (result[1] = '/') do Delete(result, 1, 1); + end; exit; end; end; @@ -170,9 +179,12 @@ begin if resourceStr[f] = ':' then begin result := normSlashes(Copy(resourceStr, f+1, length(resourceStr))); + while (length(result) > 0) and (result[1] = '/') do Delete(result, 1, 1); exit; end; end; + result := normSlashes(resourceStr); + while (length(result) > 0) and (result[1] = '/') do Delete(result, 1, 1); end; @@ -361,7 +373,7 @@ begin {$ENDIF} result := true; {$IFDEF SFS_DWFAD_DEBUG} - if gSFSDebug then + if wadoptDebug then e_WriteLog(Format('DFWAD: file [%s] FOUND in [%s]; size is %d bytes', [name, fFileName, Len]), MSG_NOTIFY); {$ENDIF} exit; @@ -429,11 +441,11 @@ begin exit; end; {$IFDEF SFS_DWFAD_DEBUG} - if gSFSDebug then e_WriteLog(Format('TWADFile.ReadFile: FOUND [%s]', [rfn]), MSG_NOTIFY); + if wadoptDebug then e_WriteLog(Format('TWADFile.ReadFile: FOUND [%s]', [rfn]), MSG_NOTIFY); {$ENDIF} // cache this wad try - if gSFSFastMode then + if wadoptFast then begin if not SFSAddDataFile(rfn, true) then exit; end @@ -448,7 +460,7 @@ begin if fIter = nil then Exit; fFileName := rfn; {$IFDEF SFS_DWFAD_DEBUG} - if gSFSDebug then e_WriteLog(Format('TWADFile.ReadFile: [%s] opened', [fFileName]), MSG_NOTIFY); + if wadoptDebug then e_WriteLog(Format('TWADFile.ReadFile: [%s] opened', [fFileName]), MSG_NOTIFY); {$ENDIF} Result := True; end;