1
#include "IniIteratorChar.h"
3
const char IniIteratorChar::iteratorChar[] = "+";
4
const char IniIteratorChar::iteratorReplacementFormat[] = "%d";
6
char IniIteratorChar::buffer[0x800] = "\0";
8
int IniIteratorChar::iteratorValue = 0;
10
DEFINE_HOOK(5260A2, IteratorChar_Process_Method1, 6)
12
GET(CCINIClass*, ini, EBP);
13
GET(CCINIClass::INIEntry*, entry, ESI);
14
GET_STACK(CCINIClass::INISection*, section, 0x40);
16
if(strcmp(entry->Key, IniIteratorChar::iteratorChar) == 0) {
17
sprintf(IniIteratorChar::buffer, "%d", IniIteratorChar::iteratorValue++);
19
CRT::free(entry->Key);
20
entry->Key = CRT::strdup(IniIteratorChar::buffer);
24
//Debug::Log("[%s] %s = %s (Method 1)\n", section->Name, entry->Key, entry->Value);
29
DEFINE_HOOK(525D23, IteratorChar_Process_Method2, 5)
31
GET(char*, value, ESI);
32
LEA_STACK(char*, key, 0x78)
33
LEA_STACK(char*, section, 0x278);
35
if(strcmp(key, IniIteratorChar::iteratorChar) == 0) {
36
strcpy(IniIteratorChar::buffer, value);
37
sprintf(key, "%d", IniIteratorChar::iteratorValue++);
39
char* newValue = key + strlen(key) + 1;
40
strcpy(newValue, IniIteratorChar::buffer);
41
R->ESI<char*>(newValue);
42
value = newValue; //for correct debug display
45
//Debug::Log("[%s] %s = %s (Method 2)\n", section, key, value);
49
//Uncomment this hook to have all INI sections and their entries printed to the log!
51
A_FINE_HOOK(474230, IteratorChar_SectionInfo, 5)
53
GET(CCINIClass*, ini, ESI);
55
GenericNode* sectionNode = &ini->Sections.First;
58
if(*((unsigned int*)sectionNode) == 0x7EB73C)
60
INIClass::INISection* section = (INIClass::INISection*)sectionNode;
61
Debug::Log("[%s]\n", section->Name);
63
GenericNode* entryNode = §ion->Entries.First;
66
if(*((unsigned int*)entryNode) == 0x7EB734)
68
INIClass::INIEntry* entry = (INIClass::INIEntry*)entryNode;
69
unsigned int checksum = 0xAFFEAFFE;
71
for(int i = 0; i < section->CheckedEntries.Count; i++)
73
if(section->CheckedEntries.Entries[i].Entry == entry)
75
checksum = section->CheckedEntries.Entries[i].Checksum;
79
Debug::Log("\t%s = %s (Checksum: %08X)\n", entry->Key, entry->Value, checksum);
81
entryNode = entryNode->Next;
84
sectionNode = sectionNode->Next;