StringTable Asset: Difference between revisions

From COD Engine Research
No edit summary
No edit summary
 
(6 intermediate revisions by 2 users not shown)
Line 7: Line 7:
[[Category:MW3]]
[[Category:MW3]]
[[Category:BO2]]
[[Category:BO2]]
[[Category:BO3]]
[[Category:Ghosts]]
[[Category:Ghosts]]
StringTable assets are essentially the CoD engine's way of storing Excel tables for different types of data for different usages. This asset has existed on every CoD from the earliest Call of Duty 4 Alpha to Ghosts. The number of values is columnCount * rowCount. To get a particular cell index, follow this...
[[Category:AW]]
desiredEntry = (columnCount * desiredRow) + desiredColumn;
StringTable assets are essentially the CoD engine's way of storing Excel tables for different types of data for different usages. This asset has existed on every CoD from the earliest Call of Duty 4 Alpha to Advanced Warfare. The number of values is columnCount * rowCount. To get a particular cell index, follow this...
<syntaxhighlight lang="cpp">
desiredEntry = (columnCount * desiredRow) + desiredColumn;
</syntaxhighlight>
== Call of Duty 4 & World at War ==
== Call of Duty 4 & World at War ==
This StringTable is about as simple as it gets.  
This StringTable is about as simple as it gets.  
struct StringTable
<syntaxhighlight lang="cpp">
{
struct StringTable
  const char *name;
{
  int columnCount;
  const char *name;
  int rowCount;
  int columnCount;
  const char **values;
  int rowCount;
};
  const char **values;
== Modern Warfare 2 & 3 & Ghosts ==
};
struct StringEntry
</syntaxhighlight>
{
== Modern Warfare 2 & 3 & Ghosts & Advanced Warfare ==
const char *value;
<syntaxhighlight lang="cpp">
unsigned int hash;
struct StringTableCell
};
{
  const char *string;
struct StringTable  
  int hash;  
{
};
const char *name;
 
int columnCount;
struct StringTable  
int rowCount;
{
StringEntry *strings;
  const char *name;
};
  int columnCount;
  int rowCount;
  StringTableCell *strings;
};
</syntaxhighlight>
The hash in StringEntry can be generated by this function:
The hash in StringEntry can be generated by this function:
unsigned int hash(const char* str)
<syntaxhighlight lang="cpp">
{
unsigned int hash(const char* str)
    unsigned int hash = 0;
{
    
  unsigned int hash = 0;
    while(*str != 0)
 
        hash = tolower( *str++ ) + (31 * hash);
   while(*str != 0)
    hash = tolower( *str++ ) + (31 * hash);
    return hash;
 
}
  return hash;
== Black Ops 1 & 2 ==
}
struct StringEntry
</syntaxhighlight>
{
== Black Ops 1 & 2 & 3 ==
const char *value;
<syntaxhighlight lang="cpp">
unsigned int hash;
struct StringTableCell
};
{
  const char *string;
struct StringTable
  int hash;
{
};
const char *name;
 
int columnCount;
struct StringTable
int rowCount;
{
StringEntry *values;
  const char *name;
unsigned __int16 *cellIndex;
  int columnCount;
};
  int rowCount;
  StringTableCell *values;
  __int16 *cellIndex;
};
</syntaxhighlight>
The hash in StringEntry can be generated by this function:
The hash in StringEntry can be generated by this function:
unsigned int hash(const char* str)
<syntaxhighlight lang="cpp">
{
unsigned int hash(const char* str)
    unsigned int hash = 5381;
{
  unsigned int hash = 5381;
    while( *str != 0)
        hash = ((hash << 5) + hash) + *str++;
  while( *str != 0)
    hash = ((hash << 5) + hash) + *str++;
    return hash;
}
  return hash;
}
</syntaxhighlight>
== Source Format ==
== Source Format ==
StringTables are stored in "raw/" at optional paths as comma-seperated Excel tables, similar to below...
StringTables are stored in "raw/" at optional paths as comma-seperated Excel tables, similar to below...
entry1,entry2,entry3
<syntaxhighlight lang="cpp">
entry4,entry5,entry6
entry1,entry2,entry3
entry4,entry5,entry6
</syntaxhighlight>
For example, take a look at "mp/clantagfeatures.csv" from Black Ops 1.
For example, take a look at "mp/clantagfeatures.csv" from Black Ops 1.
#Clan Tag Features,,,,,,,,,,,,,,,,
<pre style="white-space: pre-wrap;
,,,,,,,,,,,,,,,,
white-space: -moz-pre-wrap;
a0,b1,c2,d3,e4,f5,g6,h7,i8,j9,k10,l11,m12,n13,o14,p15,q16
white-space: -pre-wrap;
#INDX,#name,#unlocklvl,#unlockplvl,#cost,#type,#data,#nframes,#phase,#frame1,#frame2,#frame3,#frame4,#frame5,#frame6,#frame7,#frame8
white-space: -o-pre-wrap;
0,none,,,,tagcolor,,,,,,,,,,,
word-wrap: break-word;">
1,red,,13,250,tagcolor,1,,,,,,,,,,
#Clan Tag Features,,,,,,,,,,,,,,,,
2,green,,13,250,tagcolor,2,,,,,,,,,,
,,,,,,,,,,,,,,,,
3,yellow,,13,250,tagcolor,3,,,,,,,,,,
a0,b1,c2,d3,e4,f5,g6,h7,i8,j9,k10,l11,m12,n13,o14,p15,q16
4,blue,,13,250,tagcolor,4,,,,,,,,,,
#INDX,#name,#unlocklvl,#unlockplvl,#cost,#type,#data,#nframes,#phase,#frame1,#frame2,#frame3,#frame4,#frame5,#frame6,#frame7,#frame8
5,cyan,,13,250,tagcolor,5,,,,,,,,,,
0,none,,,,tagcolor,,,,,,,,,,,
6,magenta,,13,250,tagcolor,6,,,,,,,,,,
1,red,,13,250,tagcolor,1,,,,,,,,,,
2,green,,13,250,tagcolor,2,,,,,,,,,,
3,yellow,,13,250,tagcolor,3,,,,,,,,,,
4,blue,,13,250,tagcolor,4,,,,,,,,,,
5,cyan,,13,250,tagcolor,5,,,,,,,,,,
6,magenta,,13,250,tagcolor,6,,,,,,,,,,
</pre>

Latest revision as of 07:16, 31 October 2015

StringTable assets are essentially the CoD engine's way of storing Excel tables for different types of data for different usages. This asset has existed on every CoD from the earliest Call of Duty 4 Alpha to Advanced Warfare. The number of values is columnCount * rowCount. To get a particular cell index, follow this...

desiredEntry = (columnCount * desiredRow) + desiredColumn;

Call of Duty 4 & World at War

This StringTable is about as simple as it gets.

struct StringTable
{
  const char *name;
  int columnCount;
  int rowCount;
  const char **values;
};

Modern Warfare 2 & 3 & Ghosts & Advanced Warfare

struct StringTableCell
{
  const char *string;
  int hash; 
};

struct StringTable 
{
  const char *name;
  int columnCount;
  int rowCount;
  StringTableCell *strings;
};

The hash in StringEntry can be generated by this function:

unsigned int hash(const char* str)
{
  unsigned int hash = 0;

  while(*str != 0)
    hash = tolower( *str++ ) + (31 * hash);

  return hash;
}

Black Ops 1 & 2 & 3

struct StringTableCell
{
  const char *string;
  int hash;
};

struct StringTable
{
  const char *name;
  int columnCount;
  int rowCount;
  StringTableCell *values;
  __int16 *cellIndex;
};

The hash in StringEntry can be generated by this function:

unsigned int hash(const char* str)
{
  unsigned int hash = 5381;
	 
  while( *str != 0)
    hash = ((hash << 5) + hash) + *str++;
		 
  return hash;
}

Source Format

StringTables are stored in "raw/" at optional paths as comma-seperated Excel tables, similar to below...

entry1,entry2,entry3
entry4,entry5,entry6

For example, take a look at "mp/clantagfeatures.csv" from Black Ops 1.

#Clan Tag Features,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,
a0,b1,c2,d3,e4,f5,g6,h7,i8,j9,k10,l11,m12,n13,o14,p15,q16
#INDX,#name,#unlocklvl,#unlockplvl,#cost,#type,#data,#nframes,#phase,#frame1,#frame2,#frame3,#frame4,#frame5,#frame6,#frame7,#frame8
0,none,,,,tagcolor,,,,,,,,,,,
1,red,,13,250,tagcolor,1,,,,,,,,,,
2,green,,13,250,tagcolor,2,,,,,,,,,,
3,yellow,,13,250,tagcolor,3,,,,,,,,,,
4,blue,,13,250,tagcolor,4,,,,,,,,,,
5,cyan,,13,250,tagcolor,5,,,,,,,,,,
6,magenta,,13,250,tagcolor,6,,,,,,,,,,