61 lines
1.2 KiB
C++
61 lines
1.2 KiB
C++
#include "classes.h"
|
|
|
|
// 00a159d0
|
|
uint32_t KAGE_Filesys_FileManager::GetPrimaryFilePathHash(uint8_t *filePath)
|
|
{
|
|
uint32_t hash;
|
|
uint32_t normalizedCh;
|
|
uint8_t lowerCh;
|
|
uint8_t ch;
|
|
|
|
if (filePath == GHIDRA_CAST<uint8_t *>(0x0)) {
|
|
return 0;
|
|
}
|
|
hash = 0x1505;
|
|
ch = *filePath;
|
|
while (ch != 0) {
|
|
filePath = filePath + 1;
|
|
lowerCh = ch + 0x20;
|
|
if (0x19 < (uint8_t)(ch + 0xbf)) {
|
|
lowerCh = ch;
|
|
}
|
|
normalizedCh = GHIDRA_UINT(lowerCh);
|
|
if (lowerCh == 0x5c) {
|
|
normalizedCh = 0x2f;
|
|
}
|
|
hash = hash * 0x21 + normalizedCh;
|
|
ch = *filePath;
|
|
}
|
|
return hash;
|
|
}
|
|
|
|
// 00a15ab0
|
|
uint32_t KAGE_Filesys_FileManager::GetSecondaryFilePathHash()
|
|
{
|
|
uint8_t bVar1;
|
|
uint32_t uVar2;
|
|
uint8_t *in_ECX;
|
|
uint8_t bVar3;
|
|
uint32_t uVar4;
|
|
|
|
if (in_ECX == GHIDRA_CAST<uint8_t *>(0x0)) {
|
|
return 0;
|
|
}
|
|
uVar4 = 0x5bb2220e;
|
|
bVar1 = *in_ECX;
|
|
while (bVar1 != 0) {
|
|
in_ECX = in_ECX + 1;
|
|
bVar3 = bVar1 + 0x20;
|
|
if (0x19 < (uint8_t)(bVar1 + 0xbf)) {
|
|
bVar3 = bVar1;
|
|
}
|
|
uVar2 = GHIDRA_UINT(bVar3);
|
|
if (bVar3 == 0x5c) {
|
|
uVar2 = 0x2f;
|
|
}
|
|
uVar4 = (uVar2 ^ uVar4) * 0x1000193;
|
|
bVar1 = *in_ECX;
|
|
}
|
|
return uVar4;
|
|
}
|