TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
TFileNameDatabase Class Reference

#include <CascMndx.h>

Public Member Functions

 TFileNameDatabase ()
 
void ExchangeWith (TFileNameDatabase &Target)
 
int LoadFromStream (TByteStream &InStream)
 
int LoadFromStream_Exchange (TByteStream &InStream)
 
DWORD sub_1959CB0 (DWORD dwHashValue)
 
DWORD sub_1959F50 (DWORD arg_0)
 
DWORD GetNameFragmentOffsetEx (DWORD LoBitsIndex, DWORD HiBitsIndex)
 
DWORD GetNameFragmentOffset (DWORD LoBitsIndex)
 
bool sub_1957B80 (TMndxFindResult *pStruct1C, DWORD dwKey)
 
bool CheckNextPathFragment (TMndxFindResult *pStruct1C)
 
bool FindFileInDatabase (TMndxFindResult *pStruct1C)
 
void sub_1958D70 (TMndxFindResult *pStruct1C, DWORD arg_4)
 
bool sub_1959010 (TMndxFindResult *pStruct1C, DWORD arg_4)
 
bool sub_1958B00 (TMndxFindResult *pStruct1C)
 
bool sub_1959460 (TMndxFindResult *pStruct1C)
 

Public Attributes

TSparseArray Struct68_00
 
TSparseArray FileNameIndexes
 
TSparseArray Struct68_D0
 
TGenericArray FrgmDist_LoBits
 
TBitEntryArray FrgmDist_HiBits
 
TNameIndexStruct IndexStruct_174
 
TFileNameDatabasePtr NextDB
 
TGenericArray NameFragTable
 
DWORD NameFragIndexMask
 
DWORD field_214
 
TStruct10 Struct10
 
TByteStream MarStream
 

Constructor & Destructor Documentation

TFileNameDatabase::TFileNameDatabase ( )
1447 {
1448  NameFragIndexMask = 0;
1449  field_214 = 0;
1450 }
DWORD field_214
Definition: CascMndx.h:338
DWORD NameFragIndexMask
Definition: CascMndx.h:337

+ Here is the caller graph for this function:

Member Function Documentation

bool TFileNameDatabase::CheckNextPathFragment ( TMndxFindResult pStruct1C)
1875 {
1876  TStruct40 * pStruct40 = pStruct1C->pStruct40;
1877  LPBYTE pbPathName = (LPBYTE)pStruct1C->szSearchMask;
1878  DWORD CollisionIndex;
1879  DWORD NameFragIndex;
1880  DWORD SaveCharIndex;
1881  DWORD HiBitsIndex;
1882  DWORD FragOffs;
1883 
1884  // Calculate index of the next name fragment in the name fragment table
1885  NameFragIndex = ((pStruct40->ItemIndex << 0x05) ^ pStruct40->ItemIndex ^ pbPathName[pStruct40->CharIndex]) & NameFragIndexMask;
1886 
1887  // Does the hash value match?
1888  if(NameFragTable.NameFragArray[NameFragIndex].ItemIndex == pStruct40->ItemIndex)
1889  {
1890  // Check if there is single character match
1891  if(IS_SINGLE_CHAR_MATCH(NameFragTable, NameFragIndex))
1892  {
1893  pStruct40->ItemIndex = NameFragTable.NameFragArray[NameFragIndex].NextIndex;
1894  pStruct40->CharIndex++;
1895  return true;
1896  }
1897 
1898  // Check if there is a name fragment match
1899  if(NextDB.pDB != NULL)
1900  {
1901  if(!NextDB.pDB->sub_1957B80(pStruct1C, NameFragTable.NameFragArray[NameFragIndex].FragOffs))
1902  return false;
1903  }
1904  else
1905  {
1906  if(!IndexStruct_174.CheckNameFragment(pStruct1C, NameFragTable.NameFragArray[NameFragIndex].FragOffs))
1907  return false;
1908  }
1909 
1910  pStruct40->ItemIndex = NameFragTable.NameFragArray[NameFragIndex].NextIndex;
1911  return true;
1912  }
1913 
1914  //
1915  // Conflict: Multiple hashes give the same table index
1916  //
1917 
1918  // HOTS: 1957A0E
1919  CollisionIndex = sub_1959CB0(pStruct40->ItemIndex) + 1;
1920  if(!Struct68_00.IsItemPresent(CollisionIndex))
1921  return false;
1922 
1923  pStruct40->ItemIndex = (CollisionIndex - pStruct40->ItemIndex - 1);
1924  HiBitsIndex = 0xFFFFFFFF;
1925 
1926 // CascDumpSparseArray("E:\\casc-array-68.txt", &FileNameIndexes);
1927 // CascDumpSparseArray("E:\\casc-array-D0.txt", &Struct68_D0);
1928 
1929  // HOTS: 1957A41:
1930  do
1931  {
1932  // HOTS: 1957A41
1933  // Check if the low 8 bits if the fragment offset contain a single character
1934  // or an offset to a name fragment
1935  if(Struct68_D0.IsItemPresent(pStruct40->ItemIndex))
1936  {
1937  if(HiBitsIndex == 0xFFFFFFFF)
1938  {
1939  // HOTS: 1957A6C
1940  HiBitsIndex = Struct68_D0.GetItemValue(pStruct40->ItemIndex);
1941  }
1942  else
1943  {
1944  // HOTS: 1957A7F
1945  HiBitsIndex++;
1946  }
1947 
1948  // HOTS: 1957A83
1949  SaveCharIndex = pStruct40->CharIndex;
1950 
1951  // Get the name fragment offset as combined value from lower 8 bits and upper bits
1952  FragOffs = GetNameFragmentOffsetEx(pStruct40->ItemIndex, HiBitsIndex);
1953 
1954  // Compare the string with the fragment name database
1955  if(NextDB.pDB != NULL)
1956  {
1957  // HOTS: 1957AEC
1958  if(NextDB.pDB->sub_1957B80(pStruct1C, FragOffs))
1959  return true;
1960  }
1961  else
1962  {
1963  // HOTS: 1957AF7
1964  if(IndexStruct_174.CheckNameFragment(pStruct1C, FragOffs))
1965  return true;
1966  }
1967 
1968  // HOTS: 1957B0E
1969  // If there was partial match with the fragment, end the search
1970  if(pStruct40->CharIndex != SaveCharIndex)
1971  return false;
1972  }
1973  else
1974  {
1975  // HOTS: 1957B1C
1976  if(FrgmDist_LoBits.ByteArray[pStruct40->ItemIndex] == pStruct1C->szSearchMask[pStruct40->CharIndex])
1977  {
1978  pStruct40->CharIndex++;
1979  return true;
1980  }
1981  }
1982 
1983  // HOTS: 1957B32
1984  pStruct40->ItemIndex++;
1985  CollisionIndex++;
1986  }
1987  while(Struct68_00.IsItemPresent(CollisionIndex));
1988  return false;
1989 }
DWORD GetItemValue(DWORD ItemIndex)
Definition: CascRootFile_Mndx.cpp:1034
DWORD sub_1959CB0(DWORD dwHashValue)
Definition: CascRootFile_Mndx.cpp:1485
const char * szSearchMask
Definition: CascMndx.h:200
DWORD CharIndex
Definition: CascMndx.h:183
Definition: CascMndx.h:172
TStruct40 * pStruct40
Definition: CascMndx.h:206
arena_t NULL
Definition: jemalloc_internal.h:624
DWORD ItemIndex
Definition: CascMndx.h:182
BYTE * LPBYTE
Definition: CascPort.h:152
bool CheckNameFragment(TMndxFindResult *pStruct1C, DWORD dwFragOffs)
Definition: CascRootFile_Mndx.cpp:1126
TGenericArray NameFragTable
Definition: CascMndx.h:335
TGenericArray FrgmDist_LoBits
Definition: CascMndx.h:329
TNameIndexStruct IndexStruct_174
Definition: CascMndx.h:332
unsigned int DWORD
Definition: CascPort.h:139
DWORD IsItemPresent(DWORD ItemIndex)
Definition: CascMndx.h:220
TFileNameDatabase * pDB
Definition: CascMndx.h:286
DWORD NameFragIndexMask
Definition: CascMndx.h:337
TFileNameDatabasePtr NextDB
Definition: CascMndx.h:333
DWORD GetNameFragmentOffsetEx(DWORD LoBitsIndex, DWORD HiBitsIndex)
Definition: CascMndx.h:304
TSparseArray Struct68_00
Definition: CascMndx.h:324
bool IS_SINGLE_CHAR_MATCH(TGenericArray &Table, DWORD ItemIndex)
Definition: CascMndx.h:354
TSparseArray Struct68_D0
Definition: CascMndx.h:326
bool sub_1957B80(TMndxFindResult *pStruct1C, DWORD dwKey)
Definition: CascRootFile_Mndx.cpp:1992

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void TFileNameDatabase::ExchangeWith ( TFileNameDatabase Target)
1454 {
1455  TFileNameDatabasePtr TempPtr;
1456  DWORD dwTemp;
1457 
1461 
1464 
1466 
1467  TempPtr = NextDB;
1468  NextDB = Target.NextDB;
1469  Target.NextDB = TempPtr;
1470 
1472 
1473  dwTemp = NameFragIndexMask;
1475  Target.NameFragIndexMask = dwTemp;
1476 
1477  dwTemp = field_214;
1478  field_214 = Target.field_214;
1479  Target.field_214 = dwTemp;
1480 
1481  Struct10.CopyFrom(Target.Struct10);
1482 }
Definition: CascMndx.h:272
void ExchangeWith(TNameIndexStruct &Target)
Definition: CascRootFile_Mndx.cpp:1286
DWORD field_214
Definition: CascMndx.h:338
void ExchangeWith(TGenericArray &Target)
Definition: CascRootFile_Mndx.cpp:483
TStruct10 Struct10
Definition: CascMndx.h:339
void CopyFrom(TStruct10 &Target)
Definition: CascRootFile_Mndx.cpp:1333
TGenericArray NameFragTable
Definition: CascMndx.h:335
TGenericArray FrgmDist_LoBits
Definition: CascMndx.h:329
TBitEntryArray FrgmDist_HiBits
Definition: CascMndx.h:330
TNameIndexStruct IndexStruct_174
Definition: CascMndx.h:332
unsigned int DWORD
Definition: CascPort.h:139
DWORD NameFragIndexMask
Definition: CascMndx.h:337
TFileNameDatabasePtr NextDB
Definition: CascMndx.h:333
TSparseArray FileNameIndexes
Definition: CascMndx.h:325
void ExchangeWith(TBitEntryArray &Target)
Definition: CascRootFile_Mndx.cpp:841
void ExchangeWith(TSparseArray &TargetObject)
Definition: CascRootFile_Mndx.cpp:972
TSparseArray Struct68_00
Definition: CascMndx.h:324
TSparseArray Struct68_D0
Definition: CascMndx.h:326

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool TFileNameDatabase::FindFileInDatabase ( TMndxFindResult pStruct1C)
2529 {
2530  TStruct40 * pStruct40 = pStruct1C->pStruct40;
2531 
2532  pStruct40->ItemIndex = 0;
2533  pStruct40->CharIndex = 0;
2535 
2536  if(pStruct1C->cchSearchMask > 0)
2537  {
2538  while(pStruct40->CharIndex < pStruct1C->cchSearchMask)
2539  {
2540  // HOTS: 01957F12
2541  if(!CheckNextPathFragment(pStruct1C))
2542  return false;
2543  }
2544  }
2545 
2546  // HOTS: 1957F26
2547  if(!FileNameIndexes.IsItemPresent(pStruct40->ItemIndex))
2548  return false;
2549 
2550  pStruct1C->szFoundPath = pStruct1C->szSearchMask;
2551  pStruct1C->cchFoundPath = pStruct1C->cchSearchMask;
2552  pStruct1C->FileNameIndex = FileNameIndexes.GetItemValue(pStruct40->ItemIndex);
2553  return true;
2554 }
DWORD GetItemValue(DWORD ItemIndex)
Definition: CascRootFile_Mndx.cpp:1034
const char * szSearchMask
Definition: CascMndx.h:200
DWORD CharIndex
Definition: CascMndx.h:183
Definition: CascMndx.h:172
TStruct40 * pStruct40
Definition: CascMndx.h:206
DWORD ItemIndex
Definition: CascMndx.h:182
DWORD FileNameIndex
Definition: CascMndx.h:205
bool CheckNextPathFragment(TMndxFindResult *pStruct1C)
Definition: CascRootFile_Mndx.cpp:1874
#define CASC_SEARCH_INITIALIZING
Definition: CascMndx.h:21
DWORD IsItemPresent(DWORD ItemIndex)
Definition: CascMndx.h:220
TSparseArray FileNameIndexes
Definition: CascMndx.h:325
const char * szFoundPath
Definition: CascMndx.h:203
size_t cchFoundPath
Definition: CascMndx.h:204
DWORD SearchPhase
Definition: CascMndx.h:185
size_t cchSearchMask
Definition: CascMndx.h:201

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

DWORD TFileNameDatabase::GetNameFragmentOffset ( DWORD  LoBitsIndex)
inline
311  {
312  return GetNameFragmentOffsetEx(LoBitsIndex, Struct68_D0.GetItemValue(LoBitsIndex));
313  }
DWORD GetItemValue(DWORD ItemIndex)
Definition: CascRootFile_Mndx.cpp:1034
DWORD GetNameFragmentOffsetEx(DWORD LoBitsIndex, DWORD HiBitsIndex)
Definition: CascMndx.h:304
TSparseArray Struct68_D0
Definition: CascMndx.h:326

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

DWORD TFileNameDatabase::GetNameFragmentOffsetEx ( DWORD  LoBitsIndex,
DWORD  HiBitsIndex 
)
inline
305  {
306  return (FrgmDist_HiBits.GetBitEntry(HiBitsIndex) << 0x08) | FrgmDist_LoBits.ByteArray[LoBitsIndex];
307  }
DWORD GetBitEntry(DWORD EntryIndex)
Definition: CascMndx.h:141
TGenericArray FrgmDist_LoBits
Definition: CascMndx.h:329
TBitEntryArray FrgmDist_HiBits
Definition: CascMndx.h:330

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int TFileNameDatabase::LoadFromStream ( TByteStream InStream)
2558 {
2559  DWORD dwBitMask;
2560  int nError;
2561 
2562  nError = Struct68_00.LoadFromStream_Exchange(InStream);
2563  if(nError != ERROR_SUCCESS)
2564  return nError;
2565 
2566  nError = FileNameIndexes.LoadFromStream_Exchange(InStream);
2567  if(nError != ERROR_SUCCESS)
2568  return nError;
2569 
2570  nError = Struct68_D0.LoadFromStream_Exchange(InStream);
2571  if(nError != ERROR_SUCCESS)
2572  return nError;
2573 
2574  // HOTS: 019597CD
2575  nError = FrgmDist_LoBits.LoadBytes_Copy(InStream);
2576  if(nError != ERROR_SUCCESS)
2577  return nError;
2578 
2579  nError = FrgmDist_HiBits.LoadFromStream_Exchange(InStream);
2580  if(nError != ERROR_SUCCESS)
2581  return nError;
2582 
2583  // HOTS: 019597F5
2584  nError = IndexStruct_174.LoadFromStream_Exchange(InStream);
2585  if(nError != ERROR_SUCCESS)
2586  return nError;
2587 
2588  // HOTS: 0195980A
2590  {
2591  TFileNameDatabase * pNextDB = new TFileNameDatabase;
2592 
2593  nError = NextDB.SetDatabase(pNextDB);
2594  if(nError != ERROR_SUCCESS)
2595  return nError;
2596 
2597  if(NextDB.pDB == NULL)
2598  return ERROR_NOT_ENOUGH_MEMORY;
2599 
2600  nError = NextDB.pDB->LoadFromStream(InStream);
2601  if(nError != ERROR_SUCCESS)
2602  return nError;
2603  }
2604 
2605  // HOTS: 0195986B
2606  nError = NameFragTable.LoadFragmentInfos_Copy(InStream);
2607  if(nError != ERROR_SUCCESS)
2608  return nError;
2609 
2611 
2612  nError = InStream.GetValue_DWORD(field_214);
2613  if(nError != ERROR_SUCCESS)
2614  return nError;
2615 
2616  nError = InStream.GetValue_DWORD(dwBitMask);
2617  if(nError != ERROR_SUCCESS)
2618  return nError;
2619 
2620  return Struct10.sub_1957800(dwBitMask);
2621 }
int sub_1957800(DWORD dwBitMask)
Definition: CascRootFile_Mndx.cpp:1429
Definition: CascMndx.h:289
#define ERROR_NOT_ENOUGH_MEMORY
Definition: CascPort.h:208
DWORD field_214
Definition: CascMndx.h:338
arena_t NULL
Definition: jemalloc_internal.h:624
TStruct10 Struct10
Definition: CascMndx.h:339
int SetDatabase(TFileNameDatabase *pNewDB)
Definition: CascRootFile_Mndx.cpp:2741
int GetValue_DWORD(DWORD &Value)
Definition: CascRootFile_Mndx.cpp:428
int LoadFromStream_Exchange(TByteStream &InStream)
Definition: CascRootFile_Mndx.cpp:1020
TFileNameDatabase()
Definition: CascRootFile_Mndx.cpp:1446
int LoadFromStream(TByteStream &InStream)
Definition: CascRootFile_Mndx.cpp:2557
int LoadFragmentInfos_Copy(TByteStream &InStream)
Definition: CascRootFile_Mndx.cpp:800
int LoadBytes_Copy(TByteStream &InStream)
Definition: CascRootFile_Mndx.cpp:786
TGenericArray NameFragTable
Definition: CascMndx.h:335
TGenericArray FrgmDist_LoBits
Definition: CascMndx.h:329
TBitEntryArray FrgmDist_HiBits
Definition: CascMndx.h:330
DWORD ItemCount
Definition: CascMndx.h:129
TGenericArray NameFragments
Definition: CascMndx.h:250
TNameIndexStruct IndexStruct_174
Definition: CascMndx.h:332
unsigned int DWORD
Definition: CascPort.h:139
TFileNameDatabase * pDB
Definition: CascMndx.h:286
DWORD NameFragIndexMask
Definition: CascMndx.h:337
TFileNameDatabasePtr NextDB
Definition: CascMndx.h:333
TSparseArray FileNameIndexes
Definition: CascMndx.h:325
int LoadFromStream_Exchange(TByteStream &InStream)
Definition: CascRootFile_Mndx.cpp:1308
int LoadFromStream_Exchange(TByteStream &InStream)
Definition: CascRootFile_Mndx.cpp:886
TSparseArray Struct68_00
Definition: CascMndx.h:324
TSparseArray Struct68_D0
Definition: CascMndx.h:326
DWORD ValidItemCount
Definition: CascMndx.h:229
#define ERROR_SUCCESS
Definition: CascPort.h:204

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int TFileNameDatabase::LoadFromStream_Exchange ( TByteStream InStream)
2625 {
2626  TFileNameDatabase TempDatabase;
2627  ARRAY_POINTER Pointer;
2628  DWORD dwSignature;
2629  int nError;
2630 
2631  // Get pointer to MAR signature
2632  nError = InStream.GetBytes(sizeof(DWORD), &Pointer);
2633  if(nError != ERROR_SUCCESS)
2634  return nError;
2635 
2636  // Verify the signature
2637  dwSignature = Pointer.Uint32s[0];
2638  if(dwSignature != CASC_MAR_SIGNATURE)
2639  return ERROR_BAD_FORMAT;
2640 
2641  nError = TempDatabase.LoadFromStream(InStream);
2642  if(nError != ERROR_SUCCESS)
2643  return nError;
2644 
2645  MarStream.ExchangeWith(InStream);
2646  ExchangeWith(TempDatabase);
2647  return ERROR_SUCCESS;
2648 }
Definition: CascMndx.h:49
Definition: CascMndx.h:289
TByteStream MarStream
Definition: CascMndx.h:340
void ExchangeWith(TByteStream &Target)
Definition: CascRootFile_Mndx.cpp:337
PDWORD Uint32s
Definition: CascMndx.h:53
int LoadFromStream(TByteStream &InStream)
Definition: CascRootFile_Mndx.cpp:2557
int GetBytes(DWORD cbByteCount, PARRAY_POINTER PtrArray)
Definition: CascRootFile_Mndx.cpp:347
unsigned int DWORD
Definition: CascPort.h:139
#define CASC_MAR_SIGNATURE
Definition: CascRootFile_Mndx.cpp:20
#define ERROR_BAD_FORMAT
Definition: CascPort.h:214
void ExchangeWith(TFileNameDatabase &Target)
Definition: CascRootFile_Mndx.cpp:1453
#define ERROR_SUCCESS
Definition: CascPort.h:204

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool TFileNameDatabase::sub_1957B80 ( TMndxFindResult pStruct1C,
DWORD  dwKey 
)
1993 {
1994  TStruct40 * pStruct40 = pStruct1C->pStruct40;
1995  PNAME_FRAG pNameEntry;
1996  DWORD FragOffs;
1997  DWORD eax, edi;
1998 
1999  edi = arg_4;
2000 
2001  // HOTS: 1957B95
2002  for(;;)
2003  {
2004  pNameEntry = NameFragTable.NameFragArray + (edi & NameFragIndexMask);
2005  if(edi == pNameEntry->NextIndex)
2006  {
2007  // HOTS: 01957BB4
2008  if((pNameEntry->FragOffs & 0xFFFFFF00) != 0xFFFFFF00)
2009  {
2010  // HOTS: 1957BC7
2011  if(NextDB.pDB != NULL)
2012  {
2013  // HOTS: 1957BD3
2014  if(!NextDB.pDB->sub_1957B80(pStruct1C, pNameEntry->FragOffs))
2015  return false;
2016  }
2017  else
2018  {
2019  // HOTS: 1957BE0
2020  if(!IndexStruct_174.CheckNameFragment(pStruct1C, pNameEntry->FragOffs))
2021  return false;
2022  }
2023  }
2024  else
2025  {
2026  // HOTS: 1957BEE
2027  if(pStruct1C->szSearchMask[pStruct40->CharIndex] != (char)pNameEntry->FragOffs)
2028  return false;
2029  pStruct40->CharIndex++;
2030  }
2031 
2032  // HOTS: 1957C05
2033  edi = pNameEntry->ItemIndex;
2034  if(edi == 0)
2035  return true;
2036 
2037  if(pStruct40->CharIndex >= pStruct1C->cchSearchMask)
2038  return false;
2039  }
2040  else
2041  {
2042  // HOTS: 1957C30
2043  if(Struct68_D0.IsItemPresent(edi))
2044  {
2045  // HOTS: 1957C4C
2046  if(NextDB.pDB != NULL)
2047  {
2048  // HOTS: 1957C58
2049  FragOffs = GetNameFragmentOffset(edi);
2050  if(!NextDB.pDB->sub_1957B80(pStruct1C, FragOffs))
2051  return false;
2052  }
2053  else
2054  {
2055  // HOTS: 1957350
2056  FragOffs = GetNameFragmentOffset(edi);
2057  if(!IndexStruct_174.CheckNameFragment(pStruct1C, FragOffs))
2058  return false;
2059  }
2060  }
2061  else
2062  {
2063  // HOTS: 1957C8E
2064  if(FrgmDist_LoBits.ByteArray[edi] != pStruct1C->szSearchMask[pStruct40->CharIndex])
2065  return false;
2066 
2067  pStruct40->CharIndex++;
2068  }
2069 
2070  // HOTS: 1957CB2
2071  if(edi <= field_214)
2072  return true;
2073 
2074  if(pStruct40->CharIndex >= pStruct1C->cchSearchMask)
2075  return false;
2076 
2077  eax = sub_1959F50(edi);
2078  edi = (eax - edi - 1);
2079  }
2080  }
2081 }
const char * szSearchMask
Definition: CascMndx.h:200
DWORD sub_1959F50(DWORD arg_0)
Definition: CascRootFile_Mndx.cpp:1688
DWORD ItemIndex
Definition: CascMndx.h:34
DWORD CharIndex
Definition: CascMndx.h:183
Definition: CascMndx.h:172
DWORD field_214
Definition: CascMndx.h:338
TStruct40 * pStruct40
Definition: CascMndx.h:206
arena_t NULL
Definition: jemalloc_internal.h:624
bool CheckNameFragment(TMndxFindResult *pStruct1C, DWORD dwFragOffs)
Definition: CascRootFile_Mndx.cpp:1126
DWORD FragOffs
Definition: CascMndx.h:36
TGenericArray NameFragTable
Definition: CascMndx.h:335
TGenericArray FrgmDist_LoBits
Definition: CascMndx.h:329
Definition: CascMndx.h:32
TNameIndexStruct IndexStruct_174
Definition: CascMndx.h:332
unsigned int DWORD
Definition: CascPort.h:139
DWORD IsItemPresent(DWORD ItemIndex)
Definition: CascMndx.h:220
TFileNameDatabase * pDB
Definition: CascMndx.h:286
DWORD NameFragIndexMask
Definition: CascMndx.h:337
TFileNameDatabasePtr NextDB
Definition: CascMndx.h:333
DWORD GetNameFragmentOffset(DWORD LoBitsIndex)
Definition: CascMndx.h:310
TSparseArray Struct68_D0
Definition: CascMndx.h:326
DWORD NextIndex
Definition: CascMndx.h:35
bool sub_1957B80(TMndxFindResult *pStruct1C, DWORD dwKey)
Definition: CascRootFile_Mndx.cpp:1992
size_t cchSearchMask
Definition: CascMndx.h:201

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool TFileNameDatabase::sub_1958B00 ( TMndxFindResult pStruct1C)
2417 {
2418  TStruct40 * pStruct40 = pStruct1C->pStruct40;
2419  LPBYTE pbPathName = (LPBYTE)pStruct1C->szSearchMask;
2420  DWORD CollisionIndex;
2421  DWORD FragmentOffset;
2422  DWORD SaveCharIndex;
2423  DWORD ItemIndex;
2424  DWORD FragOffs;
2425  DWORD var_4;
2426 
2427  ItemIndex = pbPathName[pStruct40->CharIndex] ^ (pStruct40->ItemIndex << 0x05) ^ pStruct40->ItemIndex;
2428  ItemIndex = ItemIndex & NameFragIndexMask;
2429  if(pStruct40->ItemIndex == NameFragTable.NameFragArray[ItemIndex].ItemIndex)
2430  {
2431  // HOTS: 1958B45
2432  FragmentOffset = NameFragTable.NameFragArray[ItemIndex].FragOffs;
2433  if((FragmentOffset & 0xFFFFFF00) == 0xFFFFFF00)
2434  {
2435  // HOTS: 1958B88
2436  pStruct40->array_00.InsertOneItem_CHAR((char)FragmentOffset);
2437  pStruct40->ItemIndex = NameFragTable.NameFragArray[ItemIndex].NextIndex;
2438  pStruct40->CharIndex++;
2439  return true;
2440  }
2441 
2442  // HOTS: 1958B59
2443  if(NextDB.pDB != NULL)
2444  {
2445  if(!NextDB.pDB->sub_1959010(pStruct1C, FragmentOffset))
2446  return false;
2447  }
2448  else
2449  {
2450  if(!IndexStruct_174.CheckAndCopyNameFragment(pStruct1C, FragmentOffset))
2451  return false;
2452  }
2453 
2454  // HOTS: 1958BCA
2455  pStruct40->ItemIndex = NameFragTable.NameFragArray[ItemIndex].NextIndex;
2456  return true;
2457  }
2458 
2459  // HOTS: 1958BE5
2460  CollisionIndex = sub_1959CB0(pStruct40->ItemIndex) + 1;
2461  if(!Struct68_00.IsItemPresent(CollisionIndex))
2462  return false;
2463 
2464  pStruct40->ItemIndex = (CollisionIndex - pStruct40->ItemIndex - 1);
2465  var_4 = 0xFFFFFFFF;
2466 
2467  // HOTS: 1958C20
2468  for(;;)
2469  {
2470  if(Struct68_D0.IsItemPresent(pStruct40->ItemIndex))
2471  {
2472  // HOTS: 1958C0E
2473  if(var_4 == 0xFFFFFFFF)
2474  {
2475  // HOTS: 1958C4B
2476  var_4 = Struct68_D0.GetItemValue(pStruct40->ItemIndex);
2477  }
2478  else
2479  {
2480  var_4++;
2481  }
2482 
2483  // HOTS: 1958C62
2484  SaveCharIndex = pStruct40->CharIndex;
2485 
2486  FragOffs = GetNameFragmentOffsetEx(pStruct40->ItemIndex, var_4);
2487  if(NextDB.pDB != NULL)
2488  {
2489  // HOTS: 1958CCB
2490  if(NextDB.pDB->sub_1959010(pStruct1C, FragOffs))
2491  return true;
2492  }
2493  else
2494  {
2495  // HOTS: 1958CD6
2496  if(IndexStruct_174.CheckAndCopyNameFragment(pStruct1C, FragOffs))
2497  return true;
2498  }
2499 
2500  // HOTS: 1958CED
2501  if(SaveCharIndex != pStruct40->CharIndex)
2502  return false;
2503  }
2504  else
2505  {
2506  // HOTS: 1958CFB
2507  if(FrgmDist_LoBits.ByteArray[pStruct40->ItemIndex] == pStruct1C->szSearchMask[pStruct40->CharIndex])
2508  {
2509  // HOTS: 1958D11
2510  pStruct40->array_00.InsertOneItem_CHAR(FrgmDist_LoBits.ByteArray[pStruct40->ItemIndex]);
2511  pStruct40->CharIndex++;
2512  return true;
2513  }
2514  }
2515 
2516  // HOTS: 1958D11
2517  pStruct40->ItemIndex++;
2518  CollisionIndex++;
2519 
2520  if(!Struct68_00.IsItemPresent(CollisionIndex))
2521  break;
2522  }
2523 
2524  return false;
2525 }
DWORD GetItemValue(DWORD ItemIndex)
Definition: CascRootFile_Mndx.cpp:1034
DWORD sub_1959CB0(DWORD dwHashValue)
Definition: CascRootFile_Mndx.cpp:1485
const char * szSearchMask
Definition: CascMndx.h:200
DWORD CharIndex
Definition: CascMndx.h:183
Definition: CascMndx.h:172
TStruct40 * pStruct40
Definition: CascMndx.h:206
arena_t NULL
Definition: jemalloc_internal.h:624
DWORD ItemIndex
Definition: CascMndx.h:182
void InsertOneItem_CHAR(char OneChar)
Definition: CascRootFile_Mndx.cpp:563
BYTE * LPBYTE
Definition: CascPort.h:152
TGenericArray NameFragTable
Definition: CascMndx.h:335
TGenericArray FrgmDist_LoBits
Definition: CascMndx.h:329
TGenericArray array_00
Definition: CascMndx.h:180
TNameIndexStruct IndexStruct_174
Definition: CascMndx.h:332
unsigned int DWORD
Definition: CascPort.h:139
DWORD IsItemPresent(DWORD ItemIndex)
Definition: CascMndx.h:220
TFileNameDatabase * pDB
Definition: CascMndx.h:286
DWORD NameFragIndexMask
Definition: CascMndx.h:337
TFileNameDatabasePtr NextDB
Definition: CascMndx.h:333
DWORD GetNameFragmentOffsetEx(DWORD LoBitsIndex, DWORD HiBitsIndex)
Definition: CascMndx.h:304
TSparseArray Struct68_00
Definition: CascMndx.h:324
bool sub_1959010(TMndxFindResult *pStruct1C, DWORD arg_4)
Definition: CascRootFile_Mndx.cpp:2155
bool CheckAndCopyNameFragment(TMndxFindResult *pStruct1C, DWORD dwFragOffs)
Definition: CascRootFile_Mndx.cpp:1178
TSparseArray Struct68_D0
Definition: CascMndx.h:326

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void TFileNameDatabase::sub_1958D70 ( TMndxFindResult pStruct1C,
DWORD  arg_4 
)
2085 {
2086  TStruct40 * pStruct40 = pStruct1C->pStruct40;
2087  PNAME_FRAG pNameEntry;
2088 
2089  // HOTS: 1958D84
2090  for(;;)
2091  {
2092  pNameEntry = NameFragTable.NameFragArray + (arg_4 & NameFragIndexMask);
2093  if(arg_4 == pNameEntry->NextIndex)
2094  {
2095  // HOTS: 1958DA6
2096  if((pNameEntry->FragOffs & 0xFFFFFF00) != 0xFFFFFF00)
2097  {
2098  // HOTS: 1958DBA
2099  if(NextDB.pDB != NULL)
2100  {
2101  NextDB.pDB->sub_1958D70(pStruct1C, pNameEntry->FragOffs);
2102  }
2103  else
2104  {
2105  IndexStruct_174.CopyNameFragment(pStruct1C, pNameEntry->FragOffs);
2106  }
2107  }
2108  else
2109  {
2110  // HOTS: 1958DE7
2111  // Insert the low 8 bits to the path being built
2112  pStruct40->array_00.InsertOneItem_CHAR((char)(pNameEntry->FragOffs & 0xFF));
2113  }
2114 
2115  // HOTS: 1958E71
2116  arg_4 = pNameEntry->ItemIndex;
2117  if(arg_4 == 0)
2118  return;
2119  }
2120  else
2121  {
2122  // HOTS: 1958E8E
2123  if(Struct68_D0.IsItemPresent(arg_4))
2124  {
2125  DWORD FragOffs;
2126 
2127  // HOTS: 1958EAF
2128  FragOffs = GetNameFragmentOffset(arg_4);
2129  if(NextDB.pDB != NULL)
2130  {
2131  NextDB.pDB->sub_1958D70(pStruct1C, FragOffs);
2132  }
2133  else
2134  {
2135  IndexStruct_174.CopyNameFragment(pStruct1C, FragOffs);
2136  }
2137  }
2138  else
2139  {
2140  // HOTS: 1958F50
2141  // Insert one character to the path being built
2142  pStruct40->array_00.InsertOneItem_CHAR(FrgmDist_LoBits.CharArray[arg_4]);
2143  }
2144 
2145  // HOTS: 1958FDE
2146  if(arg_4 <= field_214)
2147  return;
2148 
2149  arg_4 = 0xFFFFFFFF - arg_4 + sub_1959F50(arg_4);
2150  }
2151  }
2152 }
DWORD sub_1959F50(DWORD arg_0)
Definition: CascRootFile_Mndx.cpp:1688
void CopyNameFragment(TMndxFindResult *pStruct1C, DWORD dwFragOffs)
Definition: CascRootFile_Mndx.cpp:1254
DWORD ItemIndex
Definition: CascMndx.h:34
Definition: CascMndx.h:172
DWORD field_214
Definition: CascMndx.h:338
TStruct40 * pStruct40
Definition: CascMndx.h:206
arena_t NULL
Definition: jemalloc_internal.h:624
void InsertOneItem_CHAR(char OneChar)
Definition: CascRootFile_Mndx.cpp:563
void sub_1958D70(TMndxFindResult *pStruct1C, DWORD arg_4)
Definition: CascRootFile_Mndx.cpp:2084
DWORD FragOffs
Definition: CascMndx.h:36
TGenericArray NameFragTable
Definition: CascMndx.h:335
TGenericArray FrgmDist_LoBits
Definition: CascMndx.h:329
Definition: CascMndx.h:32
TGenericArray array_00
Definition: CascMndx.h:180
unsigned int DWORD
Definition: CascPort.h:139
TNameIndexStruct IndexStruct_174
Definition: CascMndx.h:332
DWORD IsItemPresent(DWORD ItemIndex)
Definition: CascMndx.h:220
TFileNameDatabase * pDB
Definition: CascMndx.h:286
DWORD NameFragIndexMask
Definition: CascMndx.h:337
TFileNameDatabasePtr NextDB
Definition: CascMndx.h:333
DWORD GetNameFragmentOffset(DWORD LoBitsIndex)
Definition: CascMndx.h:310
TSparseArray Struct68_D0
Definition: CascMndx.h:326
DWORD NextIndex
Definition: CascMndx.h:35

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool TFileNameDatabase::sub_1959010 ( TMndxFindResult pStruct1C,
DWORD  arg_4 
)
2156 {
2157  TStruct40 * pStruct40 = pStruct1C->pStruct40;
2158  PNAME_FRAG pNameEntry;
2159 
2160  // HOTS: 1959024
2161  for(;;)
2162  {
2163  pNameEntry = NameFragTable.NameFragArray + (arg_4 & NameFragIndexMask);
2164  if(arg_4 == pNameEntry->NextIndex)
2165  {
2166  // HOTS: 1959047
2167  if((pNameEntry->FragOffs & 0xFFFFFF00) != 0xFFFFFF00)
2168  {
2169  // HOTS: 195905A
2170  if(NextDB.pDB != NULL)
2171  {
2172  if(!NextDB.pDB->sub_1959010(pStruct1C, pNameEntry->FragOffs))
2173  return false;
2174  }
2175  else
2176  {
2177  if(!IndexStruct_174.CheckAndCopyNameFragment(pStruct1C, pNameEntry->FragOffs))
2178  return false;
2179  }
2180  }
2181  else
2182  {
2183  // HOTS: 1959092
2184  if((char)(pNameEntry->FragOffs & 0xFF) != pStruct1C->szSearchMask[pStruct40->CharIndex])
2185  return false;
2186 
2187  // Insert the low 8 bits to the path being built
2188  pStruct40->array_00.InsertOneItem_CHAR((char)(pNameEntry->FragOffs & 0xFF));
2189  pStruct40->CharIndex++;
2190  }
2191 
2192  // HOTS: 195912E
2193  arg_4 = pNameEntry->ItemIndex;
2194  if(arg_4 == 0)
2195  return true;
2196  }
2197  else
2198  {
2199  // HOTS: 1959147
2200  if(Struct68_D0.IsItemPresent(arg_4))
2201  {
2202  DWORD FragOffs;
2203 
2204  // HOTS: 195917C
2205  FragOffs = GetNameFragmentOffset(arg_4);
2206  if(NextDB.pDB != NULL)
2207  {
2208  if(!NextDB.pDB->sub_1959010(pStruct1C, FragOffs))
2209  return false;
2210  }
2211  else
2212  {
2213  if(!IndexStruct_174.CheckAndCopyNameFragment(pStruct1C, FragOffs))
2214  return false;
2215  }
2216  }
2217  else
2218  {
2219  // HOTS: 195920E
2220  if(FrgmDist_LoBits.CharArray[arg_4] != pStruct1C->szSearchMask[pStruct40->CharIndex])
2221  return false;
2222 
2223  // Insert one character to the path being built
2224  pStruct40->array_00.InsertOneItem_CHAR(FrgmDist_LoBits.CharArray[arg_4]);
2225  pStruct40->CharIndex++;
2226  }
2227 
2228  // HOTS: 19592B6
2229  if(arg_4 <= field_214)
2230  return true;
2231 
2232  arg_4 = 0xFFFFFFFF - arg_4 + sub_1959F50(arg_4);
2233  }
2234 
2235  // HOTS: 19592D5
2236  if(pStruct40->CharIndex >= pStruct1C->cchSearchMask)
2237  break;
2238  }
2239 
2240  sub_1958D70(pStruct1C, arg_4);
2241  return true;
2242 }
const char * szSearchMask
Definition: CascMndx.h:200
DWORD sub_1959F50(DWORD arg_0)
Definition: CascRootFile_Mndx.cpp:1688
DWORD ItemIndex
Definition: CascMndx.h:34
DWORD CharIndex
Definition: CascMndx.h:183
Definition: CascMndx.h:172
DWORD field_214
Definition: CascMndx.h:338
TStruct40 * pStruct40
Definition: CascMndx.h:206
arena_t NULL
Definition: jemalloc_internal.h:624
void InsertOneItem_CHAR(char OneChar)
Definition: CascRootFile_Mndx.cpp:563
void sub_1958D70(TMndxFindResult *pStruct1C, DWORD arg_4)
Definition: CascRootFile_Mndx.cpp:2084
DWORD FragOffs
Definition: CascMndx.h:36
TGenericArray NameFragTable
Definition: CascMndx.h:335
TGenericArray FrgmDist_LoBits
Definition: CascMndx.h:329
Definition: CascMndx.h:32
TGenericArray array_00
Definition: CascMndx.h:180
unsigned int DWORD
Definition: CascPort.h:139
TNameIndexStruct IndexStruct_174
Definition: CascMndx.h:332
DWORD IsItemPresent(DWORD ItemIndex)
Definition: CascMndx.h:220
TFileNameDatabase * pDB
Definition: CascMndx.h:286
DWORD NameFragIndexMask
Definition: CascMndx.h:337
TFileNameDatabasePtr NextDB
Definition: CascMndx.h:333
DWORD GetNameFragmentOffset(DWORD LoBitsIndex)
Definition: CascMndx.h:310
bool sub_1959010(TMndxFindResult *pStruct1C, DWORD arg_4)
Definition: CascRootFile_Mndx.cpp:2155
bool CheckAndCopyNameFragment(TMndxFindResult *pStruct1C, DWORD dwFragOffs)
Definition: CascRootFile_Mndx.cpp:1178
TSparseArray Struct68_D0
Definition: CascMndx.h:326
DWORD NextIndex
Definition: CascMndx.h:35
size_t cchSearchMask
Definition: CascMndx.h:201

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool TFileNameDatabase::sub_1959460 ( TMndxFindResult pStruct1C)
2246 {
2247  TStruct40 * pStruct40 = pStruct1C->pStruct40;
2248  PPATH_STOP pPathStop;
2249  PATH_STOP PathStop;
2250  DWORD NewMaxItemCount;
2251  DWORD FragOffs;
2252  DWORD edi;
2253 
2254  if(pStruct40->SearchPhase == CASC_SEARCH_FINISHED)
2255  return false;
2256 
2257  if(pStruct40->SearchPhase != CASC_SEARCH_SEARCHING)
2258  {
2259  // HOTS: 1959489
2260  pStruct40->InitSearchBuffers();
2261 
2262  // If the caller passed a part of the search path, we need to find that one
2263  while(pStruct40->CharIndex < pStruct1C->cchSearchMask)
2264  {
2265  if(!sub_1958B00(pStruct1C))
2266  {
2267  pStruct40->SearchPhase = CASC_SEARCH_FINISHED;
2268  return false;
2269  }
2270  }
2271 
2272  // HOTS: 19594b0
2273  PathStop.ItemIndex = pStruct40->ItemIndex;
2274  PathStop.field_4 = 0;
2275  PathStop.field_8 = pStruct40->array_00.ItemCount;
2276  PathStop.field_C = 0xFFFFFFFF;
2277  PathStop.field_10 = 0xFFFFFFFF;
2278  pStruct40->PathStops.InsertOneItem_PATH_STOP(PathStop);
2279  pStruct40->ItemCount = 1;
2280 
2281  if(FileNameIndexes.IsItemPresent(pStruct40->ItemIndex))
2282  {
2283  pStruct1C->szFoundPath = pStruct40->array_00.FirstValid.Chars;
2284  pStruct1C->cchFoundPath = pStruct40->array_00.ItemCount;
2285  pStruct1C->FileNameIndex = FileNameIndexes.GetItemValue(pStruct40->ItemIndex);
2286  return true;
2287  }
2288  }
2289 
2290  // HOTS: 1959522
2291  for(;;)
2292  {
2293  // HOTS: 1959530
2294  if(pStruct40->ItemCount == pStruct40->PathStops.ItemCount)
2295  {
2296  PPATH_STOP pLastStop;
2297  DWORD CollisionIndex;
2298 
2299  pLastStop = pStruct40->PathStops.FirstValid.PathStopPtr + pStruct40->PathStops.ItemCount - 1;
2300  CollisionIndex = sub_1959CB0(pLastStop->ItemIndex) + 1;
2301 
2302  // Insert a new structure
2303  PathStop.ItemIndex = CollisionIndex - pLastStop->ItemIndex - 1;;
2304  PathStop.field_4 = CollisionIndex;
2305  PathStop.field_8 = 0;
2306  PathStop.field_C = 0xFFFFFFFF;
2307  PathStop.field_10 = 0xFFFFFFFF;
2308  pStruct40->PathStops.InsertOneItem_PATH_STOP(PathStop);
2309  }
2310 
2311  // HOTS: 19595BD
2312  pPathStop = pStruct40->PathStops.FirstValid.PathStopPtr + pStruct40->ItemCount;
2313 
2314  // HOTS: 19595CC
2315  if(Struct68_00.IsItemPresent(pPathStop->field_4++))
2316  {
2317  // HOTS: 19595F2
2318  pStruct40->ItemCount++;
2319 
2320  if(Struct68_D0.IsItemPresent(pPathStop->ItemIndex))
2321  {
2322  // HOTS: 1959617
2323  if(pPathStop->field_C == 0xFFFFFFFF)
2324  pPathStop->field_C = Struct68_D0.GetItemValue(pPathStop->ItemIndex);
2325  else
2326  pPathStop->field_C++;
2327 
2328  // HOTS: 1959630
2329  FragOffs = GetNameFragmentOffsetEx(pPathStop->ItemIndex, pPathStop->field_C);
2330  if(NextDB.pDB != NULL)
2331  {
2332  // HOTS: 1959649
2333  NextDB.pDB->sub_1958D70(pStruct1C, FragOffs);
2334  }
2335  else
2336  {
2337  // HOTS: 1959654
2338  IndexStruct_174.CopyNameFragment(pStruct1C, FragOffs);
2339  }
2340  }
2341  else
2342  {
2343  // HOTS: 1959665
2344  // Insert one character to the path being built
2345  pStruct40->array_00.InsertOneItem_CHAR(FrgmDist_LoBits.CharArray[pPathStop->ItemIndex]);
2346  }
2347 
2348  // HOTS: 19596AE
2349  pPathStop->field_8 = pStruct40->array_00.ItemCount;
2350 
2351  // HOTS: 19596b6
2352  if(FileNameIndexes.IsItemPresent(pPathStop->ItemIndex))
2353  {
2354  // HOTS: 19596D1
2355  if(pPathStop->field_10 == 0xFFFFFFFF)
2356  {
2357  // HOTS: 19596D9
2358  pPathStop->field_10 = FileNameIndexes.GetItemValue(pPathStop->ItemIndex);
2359  }
2360  else
2361  {
2362  pPathStop->field_10++;
2363  }
2364 
2365  // HOTS: 1959755
2366  pStruct1C->szFoundPath = pStruct40->array_00.FirstValid.Chars;
2367  pStruct1C->cchFoundPath = pStruct40->array_00.ItemCount;
2368  pStruct1C->FileNameIndex = pPathStop->field_10;
2369  return true;
2370  }
2371  }
2372  else
2373  {
2374  // HOTS: 19596E9
2375  if(pStruct40->ItemCount == 1)
2376  {
2377  pStruct40->SearchPhase = CASC_SEARCH_FINISHED;
2378  return false;
2379  }
2380 
2381  // HOTS: 19596F5
2382  pPathStop = pStruct40->PathStops.FirstValid.PathStopPtr + pStruct40->ItemCount - 1;
2383  pPathStop->ItemIndex++;
2384 
2385  pPathStop = pStruct40->PathStops.FirstValid.PathStopPtr + pStruct40->ItemCount - 2;
2386  edi = pPathStop->field_8;
2387 
2388  if(edi > pStruct40->array_00.MaxItemCount)
2389  {
2390  // HOTS: 1959717
2391  NewMaxItemCount = edi;
2392 
2393  if(pStruct40->array_00.MaxItemCount > (edi / 2))
2394  {
2395  if(pStruct40->array_00.MaxItemCount > 0x7FFFFFFF)
2396  {
2397  NewMaxItemCount = 0xFFFFFFFF;
2398  }
2399  else
2400  {
2401  NewMaxItemCount = pStruct40->array_00.MaxItemCount + pStruct40->array_00.MaxItemCount;
2402  }
2403  }
2404 
2405  pStruct40->array_00.SetMaxItems_CHARS(NewMaxItemCount);
2406  }
2407 
2408  // HOTS: 1959749
2409  pStruct40->array_00.ItemCount = edi;
2410  pStruct40->ItemCount--;
2411  }
2412  }
2413 }
DWORD GetItemValue(DWORD ItemIndex)
Definition: CascRootFile_Mndx.cpp:1034
DWORD sub_1959CB0(DWORD dwHashValue)
Definition: CascRootFile_Mndx.cpp:1485
DWORD field_8
Definition: CascMndx.h:44
ARRAY_POINTER FirstValid
Definition: CascMndx.h:126
void CopyNameFragment(TMndxFindResult *pStruct1C, DWORD dwFragOffs)
Definition: CascRootFile_Mndx.cpp:1254
DWORD field_C
Definition: CascMndx.h:45
DWORD CharIndex
Definition: CascMndx.h:183
Definition: CascMndx.h:172
TStruct40 * pStruct40
Definition: CascMndx.h:206
arena_t NULL
Definition: jemalloc_internal.h:624
DWORD ItemCount
Definition: CascMndx.h:184
DWORD ItemIndex
Definition: CascMndx.h:182
void InsertOneItem_CHAR(char OneChar)
Definition: CascRootFile_Mndx.cpp:563
DWORD field_10
Definition: CascMndx.h:46
#define CASC_SEARCH_SEARCHING
Definition: CascMndx.h:22
void sub_1958D70(TMndxFindResult *pStruct1C, DWORD arg_4)
Definition: CascRootFile_Mndx.cpp:2084
void SetMaxItems_CHARS(DWORD NewMaxItemCount)
Definition: CascRootFile_Mndx.cpp:515
DWORD FileNameIndex
Definition: CascMndx.h:205
TGenericArray FrgmDist_LoBits
Definition: CascMndx.h:329
DWORD ItemCount
Definition: CascMndx.h:129
DWORD field_4
Definition: CascMndx.h:43
TGenericArray array_00
Definition: CascMndx.h:180
TNameIndexStruct IndexStruct_174
Definition: CascMndx.h:332
unsigned int DWORD
Definition: CascPort.h:139
DWORD IsItemPresent(DWORD ItemIndex)
Definition: CascMndx.h:220
PPATH_STOP PathStopPtr
Definition: CascMndx.h:56
TFileNameDatabase * pDB
Definition: CascMndx.h:286
TFileNameDatabasePtr NextDB
Definition: CascMndx.h:333
Definition: CascMndx.h:40
TSparseArray FileNameIndexes
Definition: CascMndx.h:325
void InsertOneItem_PATH_STOP(PATH_STOP &NewItem)
Definition: CascRootFile_Mndx.cpp:589
#define CASC_SEARCH_FINISHED
Definition: CascMndx.h:23
DWORD GetNameFragmentOffsetEx(DWORD LoBitsIndex, DWORD HiBitsIndex)
Definition: CascMndx.h:304
void InitSearchBuffers()
Definition: CascRootFile_Mndx.cpp:911
DWORD ItemIndex
Definition: CascMndx.h:42
const char * szFoundPath
Definition: CascMndx.h:203
char * Chars
Definition: CascMndx.h:52
size_t cchFoundPath
Definition: CascMndx.h:204
DWORD MaxItemCount
Definition: CascMndx.h:130
TSparseArray Struct68_00
Definition: CascMndx.h:324
DWORD SearchPhase
Definition: CascMndx.h:185
TSparseArray Struct68_D0
Definition: CascMndx.h:326
TGenericArray PathStops
Definition: CascMndx.h:181
bool sub_1958B00(TMndxFindResult *pStruct1C)
Definition: CascRootFile_Mndx.cpp:2416
size_t cchSearchMask
Definition: CascMndx.h:201

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

DWORD TFileNameDatabase::sub_1959CB0 ( DWORD  dwHashValue)
1486 {
1487  PTRIPLET pTriplet;
1488  DWORD dwKeyShifted = (dwItemIndex >> 9);
1489  DWORD eax, ebx, ecx, edx, esi, edi;
1490 
1491  // If lower 9 is zero
1492  edx = dwItemIndex;
1493  if((edx & 0x1FF) == 0)
1494  return Struct68_00.ArrayDwords_38.Uint32Array[dwKeyShifted];
1495 
1496  eax = Struct68_00.ArrayDwords_38.Uint32Array[dwKeyShifted] >> 9;
1497  esi = (Struct68_00.ArrayDwords_38.Uint32Array[dwKeyShifted + 1] + 0x1FF) >> 9;
1498  dwItemIndex = esi;
1499 
1500  if((eax + 0x0A) >= esi)
1501  {
1502  // HOTS: 1959CF7
1503  pTriplet = Struct68_00.BaseValues.TripletArray + eax + 1;
1504  edi = (eax << 0x09);
1505  ebx = edi - pTriplet->BaseValue + 0x200;
1506  while(edx >= ebx)
1507  {
1508  // HOTS: 1959D14
1509  edi += 0x200;
1510  pTriplet++;
1511 
1512  ebx = edi - pTriplet->BaseValue + 0x200;
1513  eax++;
1514  }
1515  }
1516  else
1517  {
1518  // HOTS: 1959D2E
1519  while((eax + 1) < esi)
1520  {
1521  // HOTS: 1959D38
1522  // ecx = Struct68_00.BaseValues.TripletArray;
1523  esi = (esi + eax) >> 1;
1524  ebx = (esi << 0x09) - Struct68_00.BaseValues.TripletArray[esi].BaseValue;
1525  if(edx < ebx)
1526  {
1527  // HOTS: 01959D4B
1528  dwItemIndex = esi;
1529  }
1530  else
1531  {
1532  // HOTS: 1959D50
1533  eax = esi;
1534  esi = dwItemIndex;
1535  }
1536  }
1537  }
1538 
1539  // HOTS: 1959D5F
1540  pTriplet = Struct68_00.BaseValues.TripletArray + eax;
1541  edx += pTriplet->BaseValue - (eax << 0x09);
1542  edi = (eax << 4);
1543 
1544  eax = pTriplet->Value2;
1545  ecx = (eax >> 0x17);
1546  ebx = 0x100 - ecx;
1547  if(edx < ebx)
1548  {
1549  // HOTS: 1959D8C
1550  ecx = ((eax >> 0x07) & 0xFF);
1551  esi = 0x80 - ecx;
1552  if(edx < esi)
1553  {
1554  // HOTS: 01959DA2
1555  eax = eax & 0x7F;
1556  ecx = 0x40 - eax;
1557  if(edx >= ecx)
1558  {
1559  // HOTS: 01959DB7
1560  edi += 2;
1561  edx = edx + eax - 0x40;
1562  }
1563  }
1564  else
1565  {
1566  // HOTS: 1959DC0
1567  eax = (eax >> 0x0F) & 0xFF;
1568  esi = 0xC0 - eax;
1569  if(edx < esi)
1570  {
1571  // HOTS: 1959DD3
1572  edi += 4;
1573  edx = edx + ecx - 0x80;
1574  }
1575  else
1576  {
1577  // HOTS: 1959DD3
1578  edi += 6;
1579  edx = edx + eax - 0xC0;
1580  }
1581  }
1582  }
1583  else
1584  {
1585  // HOTS: 1959DE8
1586  esi = pTriplet->Value3;
1587  eax = ((esi >> 0x09) & 0x1FF);
1588  ebx = 0x180 - eax;
1589  if(edx < ebx)
1590  {
1591  // HOTS: 01959E00
1592  esi = esi & 0x1FF;
1593  eax = (0x140 - esi);
1594  if(edx < eax)
1595  {
1596  // HOTS: 1959E11
1597  edi = edi + 8;
1598  edx = edx + ecx - 0x100;
1599  }
1600  else
1601  {
1602  // HOTS: 1959E1D
1603  edi = edi + 0x0A;
1604  edx = edx + esi - 0x140;
1605  }
1606  }
1607  else
1608  {
1609  // HOTS: 1959E29
1610  esi = (esi >> 0x12) & 0x1FF;
1611  ecx = (0x1C0 - esi);
1612  if(edx < ecx)
1613  {
1614  // HOTS: 1959E3D
1615  edi = edi + 0x0C;
1616  edx = edx + eax - 0x180;
1617  }
1618  else
1619  {
1620  // HOTS: 1959E49
1621  edi = edi + 0x0E;
1622  edx = edx + esi - 0x1C0;
1623  }
1624  }
1625  }
1626 
1627  // HOTS: 1959E53:
1628  // Calculate the number of bits set in the value of "ecx"
1629  ecx = ~Struct68_00.ItemBits.Uint32Array[edi];
1630  eax = GetNumberOfSetBits(ecx);
1631  esi = eax >> 0x18;
1632 
1633  if(edx >= esi)
1634  {
1635  // HOTS: 1959ea4
1636  ecx = ~Struct68_00.ItemBits.Uint32Array[++edi];
1637  edx = edx - esi;
1638  eax = GetNumberOfSetBits(ecx);
1639  }
1640 
1641  // HOTS: 1959eea
1642  // ESI gets the number of set bits in the lower 16 bits of ECX
1643  esi = (eax >> 0x08) & 0xFF;
1644  edi = edi << 0x05;
1645  if(edx < esi)
1646  {
1647  // HOTS: 1959EFC
1648  eax = eax & 0xFF;
1649  if(edx >= eax)
1650  {
1651  // HOTS: 1959F05
1652  ecx >>= 0x08;
1653  edi += 0x08;
1654  edx -= eax;
1655  }
1656  }
1657  else
1658  {
1659  // HOTS: 1959F0D
1660  eax = (eax >> 0x10) & 0xFF;
1661  if(edx < eax)
1662  {
1663  // HOTS: 1959F19
1664  ecx >>= 0x10;
1665  edi += 0x10;
1666  edx -= esi;
1667  }
1668  else
1669  {
1670  // HOTS: 1959F23
1671  ecx >>= 0x18;
1672  edi += 0x18;
1673  edx -= eax;
1674  }
1675  }
1676 
1677  // HOTS: 1959f2b
1678  edx = edx << 0x08;
1679  ecx = ecx & 0xFF;
1680 
1681  // BUGBUG: Possible buffer overflow here. Happens when dwItemIndex >= 0x9C.
1682  // The same happens in Heroes of the Storm (build 29049), so I am not sure
1683  // if this is a bug or a case that never happens
1684  assert((ecx + edx) < sizeof(table_1BA1818));
1685  return table_1BA1818[ecx + edx] + edi;
1686 }
DWORD BaseValue
Definition: CascMndx.h:27
DWORD Value3
Definition: CascMndx.h:29
TGenericArray BaseValues
Definition: CascMndx.h:230
DWORD GetNumberOfSetBits(DWORD Value32)
Definition: CascRootFile_Mndx.cpp:240
TGenericArray ArrayDwords_38
Definition: CascMndx.h:231
DWORD Value2
Definition: CascMndx.h:28
unsigned int DWORD
Definition: CascPort.h:139
Definition: CascMndx.h:25
unsigned char table_1BA1818[0x800]
Definition: CascRootFile_Mndx.cpp:104
TSparseArray Struct68_00
Definition: CascMndx.h:324
TGenericArray ItemBits
Definition: CascMndx.h:227

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

DWORD TFileNameDatabase::sub_1959F50 ( DWORD  arg_0)
1689 {
1690  PTRIPLET pTriplet;
1691  PDWORD ItemArray;
1692  DWORD eax, ebx, ecx, edx, esi, edi;
1693 
1694  edx = arg_0;
1695  eax = arg_0 >> 0x09;
1696  if((arg_0 & 0x1FF) == 0)
1697  return Struct68_00.ArrayDwords_50.Uint32Array[eax];
1698 
1699  ItemArray = Struct68_00.ArrayDwords_50.Uint32Array + eax;
1700  eax = (ItemArray[0] >> 0x09);
1701  edi = (ItemArray[1] + 0x1FF) >> 0x09;
1702 
1703  if((eax + 0x0A) > edi)
1704  {
1705  // HOTS: 01959F94
1706  pTriplet = Struct68_00.BaseValues.TripletArray + eax + 1;
1707  while(edx >= pTriplet->BaseValue)
1708  {
1709  // HOTS: 1959FA3
1710  pTriplet++;
1711  eax++;
1712  }
1713  }
1714  else
1715  {
1716  // Binary search
1717  // HOTS: 1959FAD
1718  if((eax + 1) < edi)
1719  {
1720  // HOTS: 1959FB4
1721  esi = (edi + eax) >> 1;
1722  if(edx < Struct68_00.BaseValues.TripletArray[esi].BaseValue)
1723  {
1724  // HOTS: 1959FC4
1725  edi = esi;
1726  }
1727  else
1728  {
1729  // HOTS: 1959FC8
1730  eax = esi;
1731  }
1732  }
1733  }
1734 
1735  // HOTS: 1959FD4
1736  pTriplet = Struct68_00.BaseValues.TripletArray + eax;
1737  edx = edx - pTriplet->BaseValue;
1738  edi = eax << 0x04;
1739  eax = pTriplet->Value2;
1740  ebx = (eax >> 0x17);
1741  if(edx < ebx)
1742  {
1743  // HOTS: 1959FF1
1744  esi = (eax >> 0x07) & 0xFF;
1745  if(edx < esi)
1746  {
1747  // HOTS: 0195A000
1748  eax = eax & 0x7F;
1749  if(edx >= eax)
1750  {
1751  // HOTS: 195A007
1752  edi = edi + 2;
1753  edx = edx - eax;
1754  }
1755  }
1756  else
1757  {
1758  // HOTS: 195A00E
1759  eax = (eax >> 0x0F) & 0xFF;
1760  if(edx < eax)
1761  {
1762  // HOTS: 195A01A
1763  edi += 4;
1764  edx = edx - esi;
1765  }
1766  else
1767  {
1768  // HOTS: 195A01F
1769  edi += 6;
1770  edx = edx - eax;
1771  }
1772  }
1773  }
1774  else
1775  {
1776  // HOTS: 195A026
1777  esi = pTriplet->Value3;
1778  eax = (pTriplet->Value3 >> 0x09) & 0x1FF;
1779  if(edx < eax)
1780  {
1781  // HOTS: 195A037
1782  esi = esi & 0x1FF;
1783  if(edx < esi)
1784  {
1785  // HOTS: 195A041
1786  edi = edi + 8;
1787  edx = edx - ebx;
1788  }
1789  else
1790  {
1791  // HOTS: 195A048
1792  edi = edi + 0x0A;
1793  edx = edx - esi;
1794  }
1795  }
1796  else
1797  {
1798  // HOTS: 195A04D
1799  esi = (esi >> 0x12) & 0x1FF;
1800  if(edx < esi)
1801  {
1802  // HOTS: 195A05A
1803  edi = edi + 0x0C;
1804  edx = edx - eax;
1805  }
1806  else
1807  {
1808  // HOTS: 195A061
1809  edi = edi + 0x0E;
1810  edx = edx - esi;
1811  }
1812  }
1813  }
1814 
1815  // HOTS: 195A066
1816  esi = Struct68_00.ItemBits.Uint32Array[edi];
1817  eax = GetNumberOfSetBits(esi);
1818  ecx = eax >> 0x18;
1819 
1820  if(edx >= ecx)
1821  {
1822  // HOTS: 195A0B2
1823  esi = Struct68_00.ItemBits.Uint32Array[++edi];
1824  edx = edx - ecx;
1825  eax = GetNumberOfSetBits(esi);
1826  }
1827 
1828  // HOTS: 195A0F6
1829  ecx = (eax >> 0x08) & 0xFF;
1830 
1831  edi = (edi << 0x05);
1832  if(edx < ecx)
1833  {
1834  // HOTS: 195A111
1835  eax = eax & 0xFF;
1836  if(edx >= eax)
1837  {
1838  // HOTS: 195A111
1839  edi = edi + 0x08;
1840  esi = esi >> 0x08;
1841  edx = edx - eax;
1842  }
1843  }
1844  else
1845  {
1846  // HOTS: 195A119
1847  eax = (eax >> 0x10) & 0xFF;
1848  if(edx < eax)
1849  {
1850  // HOTS: 195A125
1851  esi = esi >> 0x10;
1852  edi = edi + 0x10;
1853  edx = edx - ecx;
1854  }
1855  else
1856  {
1857  // HOTS: 195A12F
1858  esi = esi >> 0x18;
1859  edi = edi + 0x18;
1860  edx = edx - eax;
1861  }
1862  }
1863 
1864  esi = esi & 0xFF;
1865  edx = edx << 0x08;
1866 
1867  // BUGBUG: Potential buffer overflow
1868  // Happens in Heroes of the Storm when arg_0 == 0x5B
1869  assert((esi + edx) < sizeof(table_1BA1818));
1870  return table_1BA1818[esi + edx] + edi;
1871 }
DWORD * PDWORD
Definition: CascPort.h:151
DWORD BaseValue
Definition: CascMndx.h:27
TGenericArray ArrayDwords_50
Definition: CascMndx.h:232
DWORD Value3
Definition: CascMndx.h:29
TGenericArray BaseValues
Definition: CascMndx.h:230
DWORD GetNumberOfSetBits(DWORD Value32)
Definition: CascRootFile_Mndx.cpp:240
DWORD Value2
Definition: CascMndx.h:28
unsigned int DWORD
Definition: CascPort.h:139
Definition: CascMndx.h:25
unsigned char table_1BA1818[0x800]
Definition: CascRootFile_Mndx.cpp:104
TSparseArray Struct68_00
Definition: CascMndx.h:324
TGenericArray ItemBits
Definition: CascMndx.h:227

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Member Data Documentation

DWORD TFileNameDatabase::field_214
TSparseArray TFileNameDatabase::FileNameIndexes
TBitEntryArray TFileNameDatabase::FrgmDist_HiBits
TGenericArray TFileNameDatabase::FrgmDist_LoBits
TNameIndexStruct TFileNameDatabase::IndexStruct_174
TByteStream TFileNameDatabase::MarStream
DWORD TFileNameDatabase::NameFragIndexMask
TGenericArray TFileNameDatabase::NameFragTable
TFileNameDatabasePtr TFileNameDatabase::NextDB
TStruct10 TFileNameDatabase::Struct10
TSparseArray TFileNameDatabase::Struct68_00
TSparseArray TFileNameDatabase::Struct68_D0

The documentation for this class was generated from the following files: