mirror of
https://github.com/lindbergh-loader/lindbergh-loader.git
synced 2026-09-22 22:48:03 +03:00
refactor: delegate strdup'd command string buffer freeing to compileShader and remove a redundant free.
This commit is contained in:
@@ -2,6 +2,13 @@
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
|
||||
## [2.1.3]
|
||||
### Added
|
||||
- MJ4 Rev. A, MJ4 Rev. F and MJ4 Evolution Rev. B support.
|
||||
### Fixed
|
||||
- Fixed a bug in the shader patching code that prevented the loader to compile shaders for non nVidia GPUs.
|
||||
|
||||
## [2.1.2]
|
||||
### Added
|
||||
- Virtual Card file support for ID4 and ID5 (read the documentation).
|
||||
|
||||
@@ -976,10 +976,10 @@ void glBindTexture(GLenum target, GLuint texture)
|
||||
}
|
||||
}
|
||||
|
||||
int parseCgcArgs(const char *input, const char ***compilerArgs, const char **outputFileName)
|
||||
int parseCgcArgs(const char *input, const char ***compilerArgs, const char **outputFileName, char **bufferToFree)
|
||||
{
|
||||
char *inputCopy = strdup(input);
|
||||
char *toFree = inputCopy;
|
||||
*bufferToFree = inputCopy;
|
||||
char *token = strtok(inputCopy, " ");
|
||||
char **args = malloc(256 * sizeof(char *));
|
||||
int count = 0;
|
||||
@@ -1014,7 +1014,6 @@ int parseCgcArgs(const char *input, const char ***compilerArgs, const char **out
|
||||
}
|
||||
(*compilerArgs)[argIndex] = NULL;
|
||||
free(args);
|
||||
free(toFree);
|
||||
if (strcmp(profile, "vp40") == 0)
|
||||
{
|
||||
return 6150;
|
||||
@@ -1215,9 +1214,9 @@ int compileWithCGC(char *command)
|
||||
{
|
||||
const char **compilerArgs = NULL;
|
||||
const char *outputFileName = NULL;
|
||||
char *argsBuffer = NULL;
|
||||
|
||||
int profile = parseCgcArgs(command, &compilerArgs, &outputFileName);
|
||||
|
||||
int profile = parseCgcArgs(command, &compilerArgs, &outputFileName, &argsBuffer);
|
||||
size_t *ctx = _cgCreateContext();
|
||||
|
||||
char *program = NULL;
|
||||
@@ -1248,10 +1247,9 @@ int compileWithCGC(char *command)
|
||||
|
||||
fprintf(outputFile, "%s", compiledSource);
|
||||
fclose(outputFile);
|
||||
|
||||
free(argsBuffer);
|
||||
_cgDestroyProgram(program);
|
||||
_cgDestroyContext(ctx);
|
||||
free((void *)*compilerArgs);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user