-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
STR_StringTable.bt
74 lines (61 loc) · 1.58 KB
/
STR_StringTable.bt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
//------------------------------------------------
//--- 010 Editor v12.0.1 Binary Template
//
// File: Forza String Table
// Authors: Nenkai#9075
// Version:
// Purpose:
// Category:
// File Mask: .str
// ID Bytes:
// History:
//------------------------------------------------
typedef struct
{
uint Hash <format=hex>;
int StringOffset <format=hex, fgcolor=cRed, comment="Relative to string table">;
} entry;
typedef struct
{
wstring str <bgcolor=cGray>;
} String <optimize=false>;
struct
{
struct
{
short version;
char Name[0x7E];
short Empty;
short TableCount;
int TableOffsets[TableCount] <format=hex>;
} Header <size=0x8C>;
local int i = 0;
for (i = 0; i < Header.TableCount; i++)
{
struct
{
int TableSize <format=hex, fgcolor=cYellow>;
int StringsSize <format=hex, fgcolor=cYellow>;
int EntryCount <fgcolor=cGreen>;
entry entries[EntryCount];
String strs[EntryCount];
} StringTable;
}
} StringTable;
/* C# Sample for the hashing function
static long HashString(string str, int bitSize, bool caseInsensitive)
{
long v = (((long)1) << bitSize) - 1;
long res = v;
byte v7 = (byte)(bitSize - 7);
for (var i = 0; i < str.Length; i++)
{
char c = str[i];
if (!caseInsensitive && char.IsLetter(c) && char.IsUpper(c))
c = char.ToLower(c);
res = v & (((c ^ res) << 7) | ((c ^ res) >> v7));
}
return res;
}
HashString("IDS_Mode1String_2990", 32, true);
*/