This commit is contained in:
Asher Baker 2016-09-11 12:30:20 +01:00
parent db4150b651
commit 36d465f9e1

View File

@ -529,38 +529,36 @@ bool Accelerator::SDK_OnLoad(char *error, size_t maxlength, bool late)
char steamInfPath[512]; char steamInfPath[512];
g_pSM->BuildPath(Path_Game, steamInfPath, sizeof(steamInfPath), "steam.inf"); g_pSM->BuildPath(Path_Game, steamInfPath, sizeof(steamInfPath), "steam.inf");
FILE *f = fopen(steamInfPath, "rb"); FILE *steamInfFile = fopen(steamInfPath, "rb");
if (!f) { if (steamInfFile) {
return; char steamInfTemp[256] = {0};
} fread(steamInfTemp, sizeof(char), sizeof(steamInfTemp) - 1, steamInfFile);
char steamInfTemp[256] = {0}; fclose(steamInfFile);
fread(steamInfTemp, sizeof(char), sizeof(steamInfTemp) - 1, f);
fclose(f); unsigned source = 0;
strcpy(steamInf, "\nSteam_");
unsigned source = 0; unsigned target = 7; // strlen("\nSteam_");
strcpy(steamInf, "\nSteam_"); while (true) {
unsigned target = 7; // strlen("\nSteam_");
while (true) {
if (steamInfTemp[source] == '\0') {
source++;
break;
}
if (steamInfTemp[source] == '\r') {
source++;
continue;
}
if (steamInfTemp[source] == '\n') {
source++;
if (steamInfTemp[source] == '\0') { if (steamInfTemp[source] == '\0') {
source++;
break; break;
} }
strcpy(&steamInf[target], "\nSteam_"); if (steamInfTemp[source] == '\r') {
target += 7; source++;
continue; continue;
}
if (steamInfTemp[source] == '\n') {
source++;
if (steamInfTemp[source] == '\0') {
break;
}
strcpy(&steamInf[target], "\nSteam_");
target += 7;
continue;
}
steamInf[target++] = steamInfTemp[source++];
} }
steamInf[target++] = steamInfTemp[source++];
} }
if (late) { if (late) {