Windows support
This commit is contained in:
21
main.c
21
main.c
@@ -43,14 +43,11 @@ struct options {
|
||||
|
||||
void printHelp() {
|
||||
printf(
|
||||
"usage: kavat <target MOV> <source images> [options]\n"
|
||||
"usage: kaveat <target MOV> <source images> [options]\n"
|
||||
"Where each source begins with +, and is added as an animation frame.\n"
|
||||
"A maximum of 360 different frames can be used for a single avatar.\n"
|
||||
"If the size of any frame does not match, it will be resized to match the first frame.\n"
|
||||
"\n"
|
||||
"THIS PROGRAM IS DESIGNED FOR HOLOGRAMS ONLY. If you are making world textures.\n"
|
||||
"you best learn how to run COMPIMG manually, please see https://kangworlds.net/tutorials/cmp\n"
|
||||
"\n"
|
||||
"Available options:\n"
|
||||
" -r # Maximum resolution, where # is a power of 2. For example, 256 pixels would be \"-r 8\"\n"
|
||||
" -s Stretch the image when non-pot or mismatched size, as opposed to fitting it within.\n"
|
||||
@@ -66,7 +63,7 @@ void printHelp() {
|
||||
//" Note that this process happens AFTER importing each image, and will be\n"
|
||||
//" applied to each one separately. DO NOT use this to combine a spritesheet"
|
||||
//" with individual frames or you will have a very, very bad time."
|
||||
//" -h Same as -w, but vertical. If used with -w, KAvaT will create each chunk\n"
|
||||
//" -h Same as -w, but vertical. If used with -w, KAvEAT will create each chunk\n"
|
||||
//" from each row left-to-right first, not each column top-to-bottom.\n"
|
||||
);
|
||||
}
|
||||
@@ -77,13 +74,14 @@ void printNoFrames() {
|
||||
|
||||
int main(const int argc, char *argv[]) {
|
||||
printf(
|
||||
"Knowledge Adventure Worlds Avatar Tool, version 1\n"
|
||||
"Knowledge Adventure Worlds Easy Avatar Tool, version 1\n"
|
||||
"Copyright (c) 2025 Brett \"bonkmaykr\" Bergstrom\n"
|
||||
"This program is free software under the MIT license.\n"
|
||||
"\n"
|
||||
);
|
||||
if (argc < 2) { printHelp(); return 0; }
|
||||
char filename[strlen(argv[1])]; strcpy(filename, argv[1]);
|
||||
char* filename = (char*)malloc(strlen(argv[1])*sizeof(char)); // MSVC
|
||||
strcpy(filename, argv[1]);
|
||||
printf("Creating avatar %s.mov\n", filename);
|
||||
if (argc < 3) { printNoFrames(); return 0; }
|
||||
|
||||
@@ -226,16 +224,12 @@ int main(const int argc, char *argv[]) {
|
||||
MagickCropImage(chunk, chunkw, chunkh, (chunkw*iw)+(width*i), chunkh*ih);
|
||||
|
||||
printf("Saving frame #%d, chunk offset %d,%d\n", i+1, iw, ih);
|
||||
char framename[12*piecesX*piecesY]; // this is stupid
|
||||
char* framename = (char*)malloc(12 * piecesX * piecesY * sizeof(char)); // MSVC
|
||||
sprintf(framename, "f%d%d%d.bmp", i, iw, ih);
|
||||
fprintf(partlist, "f%d%d%d.bmp\n", i, iw, ih);
|
||||
|
||||
MagickWriteImage(chunk, framename);
|
||||
|
||||
//char command[57 + 12*piecesX*piecesY]; // retard hack :)))))) because magickwand can't just do what i fucking ask
|
||||
//sprintf(command, "mogrify -depth 8 -define bmp:format=bmp3 -type palette %s", framename);
|
||||
//if (system(command)) { printf("ERROR trying to run mogrify! Is imagemagick installed to your PATH?\n"); return 0; }
|
||||
|
||||
iw++;
|
||||
}
|
||||
ih++;
|
||||
@@ -246,7 +240,7 @@ int main(const int argc, char *argv[]) {
|
||||
|
||||
// Pass on images to COMPIMG
|
||||
printf("Encoding texture file...\n");
|
||||
char command[54 + 3*opt.o + strlen(filename)];
|
||||
char* command = (char*)malloc((54 + 3 * opt.o + strlen(filename))*sizeof(char)); // MSVC
|
||||
char argTransparent[3];
|
||||
if (opt.o == 0) sprintf(argTransparent, " -t");
|
||||
sprintf(command, "./compimg.exe -ace -c%d -r0 -pt%s -emov -M%s +segments.txt", opt.c+1, argTransparent, filename);
|
||||
@@ -256,5 +250,6 @@ int main(const int argc, char *argv[]) {
|
||||
|
||||
if(mw) mw = DestroyMagickWand(mw);
|
||||
MagickWandTerminus();
|
||||
// don't clean up heap strings since the OS will reclaim the memory anyway
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user