|
|
@ -15,22 +15,22 @@ using namespace std;
|
|
|
|
// returns a lower case version of the string
|
|
|
|
// returns a lower case version of the string
|
|
|
|
string tolower (const string & s)
|
|
|
|
string tolower (const string & s)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
string d (s);
|
|
|
|
string d (s);
|
|
|
|
|
|
|
|
|
|
|
|
transform (d.begin (), d.end (), d.begin (), (int(*)(int)) tolower);
|
|
|
|
transform (d.begin (), d.end (), d.begin (), (int(*)(int)) tolower);
|
|
|
|
return d;
|
|
|
|
return d;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
string groupBy2(const string & s)
|
|
|
|
string groupBy2(const string & s)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
string d;
|
|
|
|
string d;
|
|
|
|
for(int i =2;i<s.length();i++){
|
|
|
|
for(int i =2;i<s.length();i++){
|
|
|
|
if(i%2==0)
|
|
|
|
if(i%2==0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
d+= s.substr(i-2,2) + " ";
|
|
|
|
d+= s.substr(i-2,2) + " ";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
d+=s.substr(s.length()-2,2);
|
|
|
|
d+=s.substr(s.length()-2,2);
|
|
|
|
return(d);
|
|
|
|
return(d);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
uint32_t endian_swap(uint32_t x)
|
|
|
|
uint32_t endian_swap(uint32_t x)
|
|
|
@ -39,57 +39,65 @@ uint32_t endian_swap(uint32_t x)
|
|
|
|
((x<<8) & 0x00FF0000) |
|
|
|
|
((x<<8) & 0x00FF0000) |
|
|
|
|
((x>>8) & 0x0000FF00) |
|
|
|
|
((x>>8) & 0x0000FF00) |
|
|
|
|
(x<<24);
|
|
|
|
(x<<24);
|
|
|
|
return x;
|
|
|
|
return x;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int main (void)
|
|
|
|
int main (void)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
DFHack::API DF ("Memory.xml");
|
|
|
|
DFHack::API DF("Memory.xml");
|
|
|
|
if(!DF.Attach())
|
|
|
|
try
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
DF.Attach();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
catch (exception& e)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
cerr << "DF not found" << endl;
|
|
|
|
cerr << e.what() << endl;
|
|
|
|
|
|
|
|
#ifndef LINUX_BUILD
|
|
|
|
|
|
|
|
cin.ignore();
|
|
|
|
|
|
|
|
#endif
|
|
|
|
return 1;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
vector< vector<string> > englishWords;
|
|
|
|
|
|
|
|
vector< vector<string> > foreignWords;
|
|
|
|
vector< vector<string> > englishWords;
|
|
|
|
|
|
|
|
vector< vector<string> > foreignWords;
|
|
|
|
if(!DF.InitReadNameTables(englishWords,foreignWords))
|
|
|
|
if(!DF.InitReadNameTables(englishWords,foreignWords))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
cerr << "Could not get Names" << endl;
|
|
|
|
cerr << "Could not get Names" << endl;
|
|
|
|
return 1;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
string input;
|
|
|
|
string input;
|
|
|
|
DF.ForceResume();
|
|
|
|
DF.ForceResume();
|
|
|
|
cout << "\nSelect Name to search or q to Quit" << endl;
|
|
|
|
cout << "\nSelect Name to search or q to Quit" << endl;
|
|
|
|
getline (cin, input);
|
|
|
|
getline (cin, input);
|
|
|
|
while(input != "q"){
|
|
|
|
while(input != "q"){
|
|
|
|
for( uint32_t i = 0; i < englishWords.size();i++){
|
|
|
|
for( uint32_t i = 0; i < englishWords.size();i++){
|
|
|
|
for( uint32_t j = 0;j < englishWords[i].size();j++){
|
|
|
|
for( uint32_t j = 0;j < englishWords[i].size();j++){
|
|
|
|
if(englishWords[i][j] != ""){
|
|
|
|
if(englishWords[i][j] != ""){
|
|
|
|
uint32_t found = tolower(input).find(tolower(englishWords[i][j]));
|
|
|
|
uint32_t found = tolower(input).find(tolower(englishWords[i][j]));
|
|
|
|
if(found != string::npos){
|
|
|
|
if(found != string::npos){
|
|
|
|
stringstream value;
|
|
|
|
stringstream value;
|
|
|
|
value << setfill('0') << setw(8) << hex << endian_swap(j);
|
|
|
|
value << setfill('0') << setw(8) << hex << endian_swap(j);
|
|
|
|
cout << englishWords[i][j] << " " << groupBy2(value.str()) << endl;
|
|
|
|
cout << englishWords[i][j] << " " << groupBy2(value.str()) << endl;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for( uint32_t i = 0; i < foreignWords.size();i++){
|
|
|
|
for( uint32_t i = 0; i < foreignWords.size();i++){
|
|
|
|
for( uint32_t j = 0;j < foreignWords[i].size();j++){
|
|
|
|
for( uint32_t j = 0;j < foreignWords[i].size();j++){
|
|
|
|
uint32_t found = tolower(input).find(tolower(foreignWords[i][j]));
|
|
|
|
uint32_t found = tolower(input).find(tolower(foreignWords[i][j]));
|
|
|
|
if(found != string::npos){
|
|
|
|
if(found != string::npos){
|
|
|
|
stringstream value;
|
|
|
|
stringstream value;
|
|
|
|
value << setfill('0') << setw(8) << hex << endian_swap(j);
|
|
|
|
value << setfill('0') << setw(8) << hex << endian_swap(j);
|
|
|
|
cout << foreignWords[i][j] << " " << groupBy2(value.str()) << endl;
|
|
|
|
cout << foreignWords[i][j] << " " << groupBy2(value.str()) << endl;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
DF.Resume();
|
|
|
|
DF.Resume();
|
|
|
|
getline(cin,input);
|
|
|
|
getline(cin,input);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
DF.Detach();
|
|
|
|
DF.Detach();
|
|
|
|
DF.FinishReadNameTables();
|
|
|
|
DF.FinishReadNameTables();
|
|
|
|
#ifndef LINUX_BUILD
|
|
|
|
#ifndef LINUX_BUILD
|
|
|
|
cout << "Done. Press any key to continue" << endl;
|
|
|
|
cout << "Done. Press any key to continue" << endl;
|
|
|
|
cin.ignore();
|
|
|
|
cin.ignore();
|
|
|
|