Compare commits
3 Commits
c56cbd741b
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| b513956e70 | |||
| 2ab94a1cb8 | |||
| a18368acd2 |
@@ -2,7 +2,7 @@
|
||||
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
|
||||
|
||||
#define MyAppName "KAvEAT"
|
||||
#define MyAppVersion "1.0.0"
|
||||
#define MyAppVersion "1.1.0"
|
||||
#define MyAppPublisher "bonkmaykr"
|
||||
#define MyAppURL "https://kangworlds.net/"
|
||||
#define MyAppUpdateURL "https://git.worlio.com/bonkmaykr/KAvEAT/releases"
|
||||
@@ -65,6 +65,7 @@ Source: "C:\Users\kangang\source\repos\KAvEAT\x64\Release\CORE_RL_webp_.dll"; De
|
||||
Source: "C:\Users\kangang\source\repos\KAvEAT\x64\Release\CORE_RL_xml_.dll"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "C:\Users\kangang\source\repos\KAvEAT\x64\Release\CORE_RL_zip_.dll"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "C:\Users\kangang\source\repos\KAvEAT\x64\Release\CORE_RL_zlib_.dll"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "C:\Users\kangang\source\repos\KAvEAT\x64\Release\mogrify.exe"; DestDir: "{app}"; Flags: ignoreversion
|
||||
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
|
||||
|
||||
[Icons]
|
||||
|
||||
28
main.c
28
main.c
@@ -3,6 +3,9 @@
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <MagickWand/MagickWand.h>
|
||||
#ifdef _MSC_VER
|
||||
#include <Windows.h>
|
||||
#endif
|
||||
|
||||
int isPowerOfTwo(int x) {return x && (!(x & (x - 1)));}
|
||||
|
||||
@@ -34,7 +37,7 @@ unsigned int nearest_power_of_2(unsigned int n) {
|
||||
struct options {
|
||||
uint32_t r;
|
||||
int s;
|
||||
uint8_t c;
|
||||
uint16_t c;
|
||||
int o;
|
||||
int l;
|
||||
int w;
|
||||
@@ -74,13 +77,24 @@ void printHelp() {
|
||||
//" -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"
|
||||
);
|
||||
|
||||
#ifdef _MSC_VER
|
||||
DWORD procIDs[2];
|
||||
DWORD maxCount = 2;
|
||||
if (GetConsoleProcessList((LPDWORD)procIDs, maxCount) == 1) {
|
||||
printf("\n\nTHIS PROGRAM IS DESIGNED FOR USE WITH A TERMINAL.\n"
|
||||
"Please run cmd.exe first! Then you can use the tool.\n");
|
||||
system("pause");
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void printNoFrames() { printf("You need to specify at least one frame to use, goober.\n"); }
|
||||
|
||||
int main(const int argc, char *argv[]) {
|
||||
printf(
|
||||
"Knowledge Adventure Worlds Easy Avatar Tool, version 1\n"
|
||||
"Knowledge Adventure Worlds Easy Avatar Tool, version 1.1.1\n"
|
||||
"Copyright (c) 2025 Brett \"bonkmaykr\" Bergstrom\n"
|
||||
"This program is free software under the MIT license.\n"
|
||||
"\n"
|
||||
@@ -99,7 +113,7 @@ int main(const int argc, char *argv[]) {
|
||||
struct options opt;
|
||||
opt.r = 0;
|
||||
opt.s = 0;
|
||||
opt.c = 255;
|
||||
opt.c = 0xDEAD;
|
||||
opt.o = 0;
|
||||
opt.l = 0;
|
||||
opt.w = 0;
|
||||
@@ -133,7 +147,7 @@ int main(const int argc, char *argv[]) {
|
||||
} else if (strcmp(argv[i], "-c") == 0) {
|
||||
if (i == argc-1) { printf("No parameter for option: -c\n"); return 0; }
|
||||
const int c = trunc(atof(argv[i+1]));
|
||||
if (c < 1 || c > 256) { printf("Invalid number of colors: %s\n", argv[i+1]); return 0; }
|
||||
if (c < 1 || c > 256 - (!opt.o)) { printf("Invalid number of colors: %s\nThe maximum palette size is 255 for transparent MOVs and 256 for opaque ones.\n", argv[i+1]); return 0; }
|
||||
opt.c = c - 1;
|
||||
i++;
|
||||
} else if (strcmp(argv[i], "-d") == 0) {
|
||||
@@ -145,6 +159,7 @@ int main(const int argc, char *argv[]) {
|
||||
i++;
|
||||
}
|
||||
if (numFrames == 0) { printNoFrames(); return 0; }
|
||||
if (opt.c == 0xDEAD) { if (opt.o) opt.c = 254; else opt.c = 255; }
|
||||
|
||||
if (MagickReadImage(mw, frames[0]) == MagickFalse) { printf("ERROR trying to read %s\n", frames[0]); return 0;}
|
||||
MagickSetImageFormat(mw, "BMP3");
|
||||
@@ -319,7 +334,7 @@ int main(const int argc, char *argv[]) {
|
||||
}
|
||||
fclose(partlist);
|
||||
|
||||
if (opt.d) {
|
||||
if (!opt.d) {
|
||||
// Pass on images to COMPIMG
|
||||
printf("Encoding texture file...\n");
|
||||
char* command = (char*)malloc((54 + 3 * abs(1-opt.o) + strlen(filename))*sizeof(char)); // MSVC
|
||||
@@ -331,7 +346,7 @@ int main(const int argc, char *argv[]) {
|
||||
sprintf(command, "./compimg.exe -ace -c%d -r0 -pt%s -emov -M%s +segments.txt", opt.c+1, argTransparent, filename);
|
||||
#endif
|
||||
printf("%s\n", command);
|
||||
if (system(command)) { printf("ERROR trying to run COMPIMG!\nMake sure that COMPIMG.EXE is inside of the folder you are working in.\n"); return 0; }
|
||||
if (system(command)) { printf("ERROR trying to run COMPIMG!\nMake sure that COMPIMG.EXE is inside of the folder you are working in.\n"); }
|
||||
|
||||
printf("Cleaning up temporary files...\n");
|
||||
while (i < numFrames) {
|
||||
@@ -351,6 +366,7 @@ int main(const int argc, char *argv[]) {
|
||||
i++;
|
||||
}
|
||||
}
|
||||
remove("segments.txt");
|
||||
|
||||
printf("\n\n!!! DONE !!!\n");
|
||||
if (opt.d)
|
||||
|
||||
Reference in New Issue
Block a user