Add support for parsing comments in steam.inf
This commit is contained in:
		
							parent
							
								
									aca6b682e6
								
							
						
					
					
						commit
						e01565fc0f
					
				| @ -57,7 +57,7 @@ char crashGamePath[512]; | |||||||
| char crashCommandLine[1024]; | char crashCommandLine[1024]; | ||||||
| char crashSourceModPath[512]; | char crashSourceModPath[512]; | ||||||
| char crashGameDirectory[256]; | char crashGameDirectory[256]; | ||||||
| char steamInf[512]; | char steamInf[1024]; | ||||||
| 
 | 
 | ||||||
| char dumpStoragePath[512]; | char dumpStoragePath[512]; | ||||||
| char logPath[512]; | char logPath[512]; | ||||||
| @ -570,11 +570,13 @@ bool Accelerator::SDK_OnLoad(char *error, size_t maxlength, bool late) | |||||||
| 
 | 
 | ||||||
| 	FILE *steamInfFile = fopen(steamInfPath, "rb"); | 	FILE *steamInfFile = fopen(steamInfPath, "rb"); | ||||||
| 	if (steamInfFile) { | 	if (steamInfFile) { | ||||||
| 		char steamInfTemp[256] = {0}; | 		char steamInfTemp[1024] = {0}; | ||||||
| 		fread(steamInfTemp, sizeof(char), sizeof(steamInfTemp) - 1, steamInfFile); | 		fread(steamInfTemp, sizeof(char), sizeof(steamInfTemp) - 1, steamInfFile); | ||||||
| 
 | 
 | ||||||
| 		fclose(steamInfFile); | 		fclose(steamInfFile); | ||||||
| 
 | 
 | ||||||
|  | 		unsigned commentChars = 0; | ||||||
|  | 		unsigned valueChars = 0; | ||||||
| 		unsigned source = 0; | 		unsigned source = 0; | ||||||
| 		strcpy(steamInf, "\nSteam_"); | 		strcpy(steamInf, "\nSteam_"); | ||||||
| 		unsigned target = 7; // strlen("\nSteam_");
 | 		unsigned target = 7; // strlen("\nSteam_");
 | ||||||
| @ -583,20 +585,39 @@ bool Accelerator::SDK_OnLoad(char *error, size_t maxlength, bool late) | |||||||
| 				source++; | 				source++; | ||||||
| 				break; | 				break; | ||||||
| 			} | 			} | ||||||
|  | 			if (steamInfTemp[source] == '/') { | ||||||
|  | 				source++; | ||||||
|  | 				commentChars++; | ||||||
|  | 				continue; | ||||||
|  | 			} | ||||||
|  | 			if (commentChars == 1) { | ||||||
|  | 				commentChars = 0; | ||||||
|  | 				steamInf[target++] = '/'; | ||||||
|  | 				valueChars++; | ||||||
|  | 			} | ||||||
| 			if (steamInfTemp[source] == '\r') { | 			if (steamInfTemp[source] == '\r') { | ||||||
| 				source++; | 				source++; | ||||||
| 				continue; | 				continue; | ||||||
| 			} | 			} | ||||||
| 			if (steamInfTemp[source] == '\n') { | 			if (steamInfTemp[source] == '\n') { | ||||||
|  | 				commentChars = 0; | ||||||
| 				source++; | 				source++; | ||||||
| 				if (steamInfTemp[source] == '\0') { | 				if (steamInfTemp[source] == '\0') { | ||||||
| 					break; | 					break; | ||||||
| 				} | 				} | ||||||
| 				strcpy(&steamInf[target], "\nSteam_"); | 				if (valueChars > 0) { | ||||||
| 				target += 7; | 					valueChars = 0; | ||||||
|  | 					strcpy(&steamInf[target], "\nSteam_"); | ||||||
|  | 					target += 7; | ||||||
|  | 				} | ||||||
|  | 				continue; | ||||||
|  | 			} | ||||||
|  | 			if (commentChars >= 2) { | ||||||
|  | 				source++; | ||||||
| 				continue; | 				continue; | ||||||
| 			} | 			} | ||||||
| 			steamInf[target++] = steamInfTemp[source++]; | 			steamInf[target++] = steamInfTemp[source++]; | ||||||
|  | 			valueChars++; | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -18,9 +18,9 @@ | |||||||
| 
 | 
 | ||||||
| #define SM_BUILD_TAG		"-manual" | #define SM_BUILD_TAG		"-manual" | ||||||
| #define SM_BUILD_UNIQUEID	"[MANUAL BUILD]" | #define SM_BUILD_UNIQUEID	"[MANUAL BUILD]" | ||||||
| #define SM_VERSION			"2.3.2" | #define SM_VERSION			"2.3.3" | ||||||
| #define SM_FULL_VERSION		SM_VERSION SM_BUILD_TAG | #define SM_FULL_VERSION		SM_VERSION SM_BUILD_TAG | ||||||
| #define SM_FILE_VERSION		2,3,2,0 | #define SM_FILE_VERSION		2,3,3,0 | ||||||
| 
 | 
 | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -1 +1 @@ | |||||||
| 2.3.2 | 2.3.3 | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user