mirror of
https://github.com/yuzu-emu/FasTC.git
synced 2025-01-09 02:05:38 +00:00
Fix indentation in unix command-line tool and also make sure to not use strcat for our logfile since it messes up the compressed image output.
This commit is contained in:
parent
cdbf72b6c0
commit
f03d381092
|
@ -55,18 +55,18 @@ void PrintUsage() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExtractBasename(const char *filename, char *buf, int bufSz) {
|
void ExtractBasename(const char *filename, char *buf, int bufSz) {
|
||||||
int len = strlen(filename);
|
int len = strlen(filename);
|
||||||
const char *end = filename + len;
|
const char *end = filename + len;
|
||||||
while(--end != filename) {
|
while(--end != filename) {
|
||||||
if(*end == '.')
|
if(*end == '.')
|
||||||
{
|
{
|
||||||
int numChars = end - filename + 1;
|
int numChars = end - filename + 1;
|
||||||
int toCopy = (numChars > bufSz)? bufSz : numChars;
|
int toCopy = (numChars > bufSz)? bufSz : numChars;
|
||||||
memcpy(buf, filename, toCopy);
|
memcpy(buf, filename, toCopy);
|
||||||
buf[toCopy - 1] = '\0';
|
buf[toCopy - 1] = '\0';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
|
@ -161,16 +161,16 @@ int main(int argc, char **argv) {
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
char basename[256];
|
char basename[256];
|
||||||
ExtractBasename(argv[fileArg], basename, 256);
|
ExtractBasename(argv[fileArg], basename, 256);
|
||||||
|
|
||||||
ImageFile file (argv[fileArg]);
|
ImageFile file (argv[fileArg]);
|
||||||
if(!file.Load()) {
|
if(!file.Load()) {
|
||||||
fprintf(stderr, "Error loading file: %s\n", argv[fileArg]);
|
fprintf(stderr, "Error loading file: %s\n", argv[fileArg]);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Image *img = file.GetImage();
|
const Image *img = file.GetImage();
|
||||||
|
|
||||||
int numBlocks = (img->GetWidth() * img->GetHeight())/16;
|
int numBlocks = (img->GetWidth() * img->GetHeight())/16;
|
||||||
BlockStatManager *statManager = NULL;
|
BlockStatManager *statManager = NULL;
|
||||||
|
@ -201,12 +201,14 @@ int main(int argc, char **argv) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if(bSaveLog) {
|
if(bSaveLog) {
|
||||||
statManager->ToFile(strcat(basename, ".log"));
|
char logname[256];
|
||||||
|
sprintf(logname, "%s.log", basename);
|
||||||
|
statManager->ToFile(logname);
|
||||||
}
|
}
|
||||||
|
|
||||||
Image cImg (*ci);
|
Image cImg (*ci);
|
||||||
ImageFile cImgFile (strcat(basename, "-bc7.png"), eFileFormat_PNG, cImg);
|
ImageFile cImgFile (strcat(basename, "-bc7.png"), eFileFormat_PNG, cImg);
|
||||||
cImgFile.Write();
|
cImgFile.Write();
|
||||||
|
|
||||||
// Cleanup
|
// Cleanup
|
||||||
delete ci;
|
delete ci;
|
||||||
|
|
Loading…
Reference in a new issue