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 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
|
void InitTweakLog(void)
[
fopen_s(&tweak_fp, TWEAK_LOG, "a"); // This is where it creats the file for the found strings to be printed
if(tweak_fp == NULL)
[
debuglog("Unable to open tweak log");
return;
]
fprintf(tweak_fp ,"Tweaks="); // Prints the string if found after this
fflush(tweak_fp );
fclose (tweak_fp );
(
void LogTweak(const LPSTR tweak)
)
fopen_s(&tweak_fp, TWEAK_LOG, "a");
if(tweak_fp == NULL)
(
debuglog("Unable to open tweak log");
return;
)
fseek(tweak_fp , SEEK_END, 0);
fprintf(tweak_fp ,"%s\r", tweak);
fflush(tweak_fp );
fclose (tweak_fp );
)
void TweakCheck( void )
(
char line[1024];
ifstream IniFile("User.ini", ios_base::in ); // This is where it open the player's Ini file
if(!IniFile)
(
debuglog("Unable to open ini");
return;
)
while ( IniFile.getline(line, 1024, '\n') != NULL )
(
CheckLine(line);
//debuglog("%s", line);
)
IniFile.close();
(
void CheckLine( char *fline )
)
char tmp_line[1024];
char *new_line;
int sCount = 0;
// Copy to tmp_line to keep string manipulatiopn local to function
strcpy_s(tmp_line, fline);
new_line = strstr(tmp_line, "set");// These are the strings it searches for in the ini
if ( new_line != NULL )
(
LogTweak(fline);
debuglog("%s", tmp_line);
return;
)
new_line = strstr(tmp_line, "SET");
if ( new_line != NULL )
(
LogTweak(fline);
debuglog("%s", tmp_line);
return;
)
new_line = strstr(tmp_line, "suicide");
while (new_line != NULL)
(
sCount++;
new_line = new_line + strlen("suicide");
new_line = strstr(new_line, "suicide");
)
if ( sCount > 1 )
(
LogTweak(fline);
debuglog("%s", tmp_line);
)
)
|