Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b513956e70 | |||
| 2ab94a1cb8 | |||
| a18368acd2 | |||
| c56cbd741b | |||
| ef80b0faba | |||
| 832ba66295 | |||
| 1562bf60e8 | |||
| 852052174e |
4
.gitignore
vendored
4
.gitignore
vendored
@@ -2,5 +2,7 @@
|
|||||||
.idea
|
.idea
|
||||||
/.vs
|
/.vs
|
||||||
/Debug
|
/Debug
|
||||||
|
/Release
|
||||||
|
/x64
|
||||||
/KAvEAT
|
/KAvEAT
|
||||||
/x64/Debug
|
/inno/out
|
||||||
|
|||||||
@@ -23,28 +23,32 @@
|
|||||||
<ProjectGuid>{8C76412E-908C-4071-96B7-AC9428CB56E0}</ProjectGuid>
|
<ProjectGuid>{8C76412E-908C-4071-96B7-AC9428CB56E0}</ProjectGuid>
|
||||||
<Keyword>Win32Proj</Keyword>
|
<Keyword>Win32Proj</Keyword>
|
||||||
<ProjectName>KAvEAT</ProjectName>
|
<ProjectName>KAvEAT</ProjectName>
|
||||||
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
|
<WindowsTargetPlatformVersion>7.0</WindowsTargetPlatformVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<PlatformToolset>v141_xp</PlatformToolset>
|
<PlatformToolset>v141_xp</PlatformToolset>
|
||||||
|
<UseOfMfc>Static</UseOfMfc>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
<PlatformToolset>v141_xp</PlatformToolset>
|
<PlatformToolset>v141_xp</PlatformToolset>
|
||||||
|
<UseOfMfc>Static</UseOfMfc>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<PlatformToolset>v141_xp</PlatformToolset>
|
<PlatformToolset>v141_xp</PlatformToolset>
|
||||||
|
<UseOfMfc>Static</UseOfMfc>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
<PlatformToolset>v141_xp</PlatformToolset>
|
<PlatformToolset>v141_xp</PlatformToolset>
|
||||||
|
<UseOfMfc>Static</UseOfMfc>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
<ImportGroup Label="ExtensionSettings">
|
<ImportGroup Label="ExtensionSettings">
|
||||||
@@ -85,6 +89,8 @@
|
|||||||
<AdditionalIncludeDirectories>C:\Program Files %28x86%29\ImageMagick-7.1.1-Q16\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>C:\Program Files %28x86%29\ImageMagick-7.1.1-Q16\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<LanguageStandard_C>stdc11</LanguageStandard_C>
|
<LanguageStandard_C>stdc11</LanguageStandard_C>
|
||||||
<CompileAs>CompileAsCpp</CompileAs>
|
<CompileAs>CompileAsCpp</CompileAs>
|
||||||
|
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||||
|
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
@@ -99,6 +105,8 @@
|
|||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<AdditionalIncludeDirectories>C:\Program Files\ImageMagick-7.1.1-Q16\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>C:\Program Files\ImageMagick-7.1.1-Q16\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<CompileAs>CompileAsCpp</CompileAs>
|
<CompileAs>CompileAsCpp</CompileAs>
|
||||||
|
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||||
|
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
@@ -114,6 +122,8 @@
|
|||||||
<AdditionalIncludeDirectories>C:\Program Files %28x86%29\ImageMagick-7.1.1-Q16\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>C:\Program Files %28x86%29\ImageMagick-7.1.1-Q16\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<LanguageStandard_C>stdc11</LanguageStandard_C>
|
<LanguageStandard_C>stdc11</LanguageStandard_C>
|
||||||
<CompileAs>CompileAsCpp</CompileAs>
|
<CompileAs>CompileAsCpp</CompileAs>
|
||||||
|
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||||
|
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
@@ -130,6 +140,8 @@
|
|||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<AdditionalIncludeDirectories>C:\Program Files\ImageMagick-7.1.1-Q16\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>C:\Program Files\ImageMagick-7.1.1-Q16\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<CompileAs>CompileAsCpp</CompileAs>
|
<CompileAs>CompileAsCpp</CompileAs>
|
||||||
|
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||||
|
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
|||||||
82
inno/setup.iss
Normal file
82
inno/setup.iss
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
; Script generated by the Inno Setup Script Wizard.
|
||||||
|
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
|
||||||
|
|
||||||
|
#define MyAppName "KAvEAT"
|
||||||
|
#define MyAppVersion "1.1.0"
|
||||||
|
#define MyAppPublisher "bonkmaykr"
|
||||||
|
#define MyAppURL "https://kangworlds.net/"
|
||||||
|
#define MyAppUpdateURL "https://git.worlio.com/bonkmaykr/KAvEAT/releases"
|
||||||
|
#define MyAppSourceURL "https://git.worlio.com/bonkmaykr/KAvEAT"
|
||||||
|
#define MyAppExeName "KAvEAT.exe"
|
||||||
|
|
||||||
|
[Setup]
|
||||||
|
; NOTE: The value of AppId uniquely identifies this application. Do not use the same AppId value in installers for other applications.
|
||||||
|
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
|
||||||
|
AppId={{71FB8A33-47D3-454D-B814-FEC78C5226E8}
|
||||||
|
AppName={#MyAppName}
|
||||||
|
AppVersion={#MyAppVersion}
|
||||||
|
;AppVerName={#MyAppName} {#MyAppVersion}
|
||||||
|
AppPublisher={#MyAppPublisher}
|
||||||
|
AppPublisherURL={#MyAppURL}
|
||||||
|
AppSupportURL={#MyAppSourceURL}
|
||||||
|
AppUpdatesURL={#MyAppUpdateURL}
|
||||||
|
DefaultDirName={autopf64}\{#MyAppName}
|
||||||
|
DefaultGroupName={#MyAppName}
|
||||||
|
DisableProgramGroupPage=yes
|
||||||
|
LicenseFile=C:\Users\kangang\source\repos\KAvEAT\LICENSE
|
||||||
|
;PrivilegesRequiredOverridesAllowed=dialog
|
||||||
|
OutputDir=C:\Users\kangang\source\repos\KAvEAT\inno\out
|
||||||
|
OutputBaseFilename=kaveat
|
||||||
|
SetupIconFile=C:\Users\kangang\source\repos\KAvEAT\kaveat.ico
|
||||||
|
Compression=lzma
|
||||||
|
SolidCompression=yes
|
||||||
|
WizardStyle=classic
|
||||||
|
|
||||||
|
[Languages]
|
||||||
|
Name: "english"; MessagesFile: "compiler:Default.isl"
|
||||||
|
|
||||||
|
[Files]
|
||||||
|
Source: "C:\Users\kangang\source\repos\KAvEAT\x64\Release\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion
|
||||||
|
Source: "C:\Users\kangang\source\repos\KAvEAT\x64\Release\CORE_RL_brotli_.dll"; DestDir: "{app}"; Flags: ignoreversion
|
||||||
|
Source: "C:\Users\kangang\source\repos\KAvEAT\x64\Release\CORE_RL_bzlib_.dll"; DestDir: "{app}"; Flags: ignoreversion
|
||||||
|
Source: "C:\Users\kangang\source\repos\KAvEAT\x64\Release\CORE_RL_cairo_.dll"; DestDir: "{app}"; Flags: ignoreversion
|
||||||
|
Source: "C:\Users\kangang\source\repos\KAvEAT\x64\Release\CORE_RL_exr_.dll"; DestDir: "{app}"; Flags: ignoreversion
|
||||||
|
Source: "C:\Users\kangang\source\repos\KAvEAT\x64\Release\CORE_RL_flif_.dll"; DestDir: "{app}"; Flags: ignoreversion
|
||||||
|
Source: "C:\Users\kangang\source\repos\KAvEAT\x64\Release\CORE_RL_freetype_.dll"; DestDir: "{app}"; Flags: ignoreversion
|
||||||
|
Source: "C:\Users\kangang\source\repos\KAvEAT\x64\Release\CORE_RL_fribidi_.dll"; DestDir: "{app}"; Flags: ignoreversion
|
||||||
|
Source: "C:\Users\kangang\source\repos\KAvEAT\x64\Release\CORE_RL_glib_.dll"; DestDir: "{app}"; Flags: ignoreversion
|
||||||
|
Source: "C:\Users\kangang\source\repos\KAvEAT\x64\Release\CORE_RL_harfbuzz_.dll"; DestDir: "{app}"; Flags: ignoreversion
|
||||||
|
Source: "C:\Users\kangang\source\repos\KAvEAT\x64\Release\CORE_RL_heif_.dll"; DestDir: "{app}"; Flags: ignoreversion
|
||||||
|
Source: "C:\Users\kangang\source\repos\KAvEAT\x64\Release\CORE_RL_jpeg-turbo_.dll"; DestDir: "{app}"; Flags: ignoreversion
|
||||||
|
Source: "C:\Users\kangang\source\repos\KAvEAT\x64\Release\CORE_RL_jpeg-xl_.dll"; DestDir: "{app}"; Flags: ignoreversion
|
||||||
|
Source: "C:\Users\kangang\source\repos\KAvEAT\x64\Release\CORE_RL_lcms_.dll"; DestDir: "{app}"; Flags: ignoreversion
|
||||||
|
Source: "C:\Users\kangang\source\repos\KAvEAT\x64\Release\CORE_RL_lqr_.dll"; DestDir: "{app}"; Flags: ignoreversion
|
||||||
|
Source: "C:\Users\kangang\source\repos\KAvEAT\x64\Release\CORE_RL_lzma_.dll"; DestDir: "{app}"; Flags: ignoreversion
|
||||||
|
Source: "C:\Users\kangang\source\repos\KAvEAT\x64\Release\CORE_RL_Magick++_.dll"; DestDir: "{app}"; Flags: ignoreversion
|
||||||
|
Source: "C:\Users\kangang\source\repos\KAvEAT\x64\Release\CORE_RL_MagickCore_.dll"; DestDir: "{app}"; Flags: ignoreversion
|
||||||
|
Source: "C:\Users\kangang\source\repos\KAvEAT\x64\Release\CORE_RL_MagickWand_.dll"; DestDir: "{app}"; Flags: ignoreversion
|
||||||
|
Source: "C:\Users\kangang\source\repos\KAvEAT\x64\Release\CORE_RL_openjpeg_.dll"; DestDir: "{app}"; Flags: ignoreversion
|
||||||
|
Source: "C:\Users\kangang\source\repos\KAvEAT\x64\Release\CORE_RL_pango_.dll"; DestDir: "{app}"; Flags: ignoreversion
|
||||||
|
Source: "C:\Users\kangang\source\repos\KAvEAT\x64\Release\CORE_RL_png_.dll"; DestDir: "{app}"; Flags: ignoreversion
|
||||||
|
Source: "C:\Users\kangang\source\repos\KAvEAT\x64\Release\CORE_RL_raw_.dll"; DestDir: "{app}"; Flags: ignoreversion
|
||||||
|
Source: "C:\Users\kangang\source\repos\KAvEAT\x64\Release\CORE_RL_rsvg_.dll"; DestDir: "{app}"; Flags: ignoreversion
|
||||||
|
Source: "C:\Users\kangang\source\repos\KAvEAT\x64\Release\CORE_RL_tiff_.dll"; DestDir: "{app}"; Flags: ignoreversion
|
||||||
|
Source: "C:\Users\kangang\source\repos\KAvEAT\x64\Release\CORE_RL_webp_.dll"; DestDir: "{app}"; Flags: ignoreversion
|
||||||
|
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]
|
||||||
|
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
|
||||||
|
Name: "{group}\Kangworlds.net"; Filename: "{#MyAppURL}"
|
||||||
|
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"
|
||||||
|
|
||||||
|
[Registry]
|
||||||
|
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; \
|
||||||
|
ValueType: expandsz; ValueName: "Path"; ValueData: "{olddata};{app}"
|
||||||
|
|
||||||
|
[Messages]
|
||||||
|
FinishedLabel=Setup has finished installing [name] on your computer. KAvEAT has been added to your system's PATH through the Windows Registry.
|
||||||
|
ClickFinish=Run "KAvEAT.exe" from the command line (in any location on your computer) to use the program.
|
||||||
BIN
kaveat.ico
Normal file
BIN
kaveat.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 131 KiB |
68
main.c
68
main.c
@@ -3,6 +3,9 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <MagickWand/MagickWand.h>
|
#include <MagickWand/MagickWand.h>
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#include <Windows.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
int isPowerOfTwo(int x) {return x && (!(x & (x - 1)));}
|
int isPowerOfTwo(int x) {return x && (!(x & (x - 1)));}
|
||||||
|
|
||||||
@@ -34,11 +37,12 @@ unsigned int nearest_power_of_2(unsigned int n) {
|
|||||||
struct options {
|
struct options {
|
||||||
uint32_t r;
|
uint32_t r;
|
||||||
int s;
|
int s;
|
||||||
uint8_t c;
|
uint16_t c;
|
||||||
int o;
|
int o;
|
||||||
int l;
|
int l;
|
||||||
int w;
|
int w;
|
||||||
int h;
|
int h;
|
||||||
|
int d;
|
||||||
};
|
};
|
||||||
|
|
||||||
void printHelp() {
|
void printHelp() {
|
||||||
@@ -48,6 +52,11 @@ void printHelp() {
|
|||||||
"A maximum of 360 different frames can be used for a single avatar.\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"
|
"If the size of any frame does not match, it will be resized to match the first frame.\n"
|
||||||
"\n"
|
"\n"
|
||||||
|
"When using KAvEAT to create environment textures, please keep in mind that Worlds has\n"
|
||||||
|
"a limit of 9x9 tiles per CMP/MOV file due to the URL parser only reading single digits.\n"
|
||||||
|
"This makes the practical maximum resolution of avatars 2048x2048. World textures can not\n"
|
||||||
|
"have more than 9 frames but can bypass both limits by splitting walls into more pieces.\n"
|
||||||
|
"\n"
|
||||||
"Available options:\n"
|
"Available options:\n"
|
||||||
" -r # Maximum resolution, where # is a power of 2. For example, 256 pixels would be \"-r 8\"\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"
|
" -s Stretch the image when non-pot or mismatched size, as opposed to fitting it within.\n"
|
||||||
@@ -57,6 +66,8 @@ void printHelp() {
|
|||||||
" so using this setting with different image sizes will cause visible bars to appear\n"
|
" so using this setting with different image sizes will cause visible bars to appear\n"
|
||||||
" unless you combine it with the -s option, which will always fill the canvas for each\n"
|
" unless you combine it with the -s option, which will always fill the canvas for each\n"
|
||||||
" frame. The same is true for all imported frames which contain an alpha channel.\n"
|
" frame. The same is true for all imported frames which contain an alpha channel.\n"
|
||||||
|
" -d Don't run COMPIMG, don't delete temporary files. Useful if COMPIMG is broken for some\n"
|
||||||
|
" reason, or if you want to customize the command line options given to it.\n"
|
||||||
// " -l Enable Lanczos filtering when scaling the image.\n" //point filter unimplemented
|
// " -l Enable Lanczos filtering when scaling the image.\n" //point filter unimplemented
|
||||||
//" -w Specify the number of subdivisions to make horizontally per frame.\n"
|
//" -w Specify the number of subdivisions to make horizontally per frame.\n"
|
||||||
//" Use this if you are importing a spritesheet. Each cut is perfectly even.\n"
|
//" Use this if you are importing a spritesheet. Each cut is perfectly even.\n"
|
||||||
@@ -66,13 +77,24 @@ void printHelp() {
|
|||||||
//" -h Same as -w, but vertical. If used with -w, KAvEAT 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"
|
//" 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"); }
|
void printNoFrames() { printf("You need to specify at least one frame to use, goober.\n"); }
|
||||||
|
|
||||||
int main(const int argc, char *argv[]) {
|
int main(const int argc, char *argv[]) {
|
||||||
printf(
|
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"
|
"Copyright (c) 2025 Brett \"bonkmaykr\" Bergstrom\n"
|
||||||
"This program is free software under the MIT license.\n"
|
"This program is free software under the MIT license.\n"
|
||||||
"\n"
|
"\n"
|
||||||
@@ -91,22 +113,25 @@ int main(const int argc, char *argv[]) {
|
|||||||
struct options opt;
|
struct options opt;
|
||||||
opt.r = 0;
|
opt.r = 0;
|
||||||
opt.s = 0;
|
opt.s = 0;
|
||||||
opt.c = 255;
|
opt.c = 0xDEAD;
|
||||||
opt.o = 0;
|
opt.o = 0;
|
||||||
opt.l = 0;
|
opt.l = 0;
|
||||||
opt.w = 0;
|
opt.w = 0;
|
||||||
opt.h = 0;
|
opt.h = 0;
|
||||||
|
opt.d = 0;
|
||||||
uint16_t numFrames = 0;
|
uint16_t numFrames = 0;
|
||||||
char* frames[360];
|
char* frames[360];
|
||||||
|
|
||||||
int i = 2;
|
int i = 2;
|
||||||
while (i < argc) {
|
while (i < argc) {
|
||||||
if (argv[i][0] == '+') {
|
if (argv[i][0] == '+') {
|
||||||
|
if (numFrames < 360) {
|
||||||
frames[numFrames] = (char*)malloc(strlen(argv[i]) + 1);
|
frames[numFrames] = (char*)malloc(strlen(argv[i]) + 1);
|
||||||
memcpy(frames[numFrames], &argv[i][1], strlen(argv[i]) + 1);
|
memcpy(frames[numFrames], &argv[i][1], strlen(argv[i]) + 1);
|
||||||
printf("Adding frame to search index: %s\n", frames[numFrames]);
|
printf("Adding frame to search index: %s\n", frames[numFrames]);
|
||||||
|
|
||||||
numFrames++;
|
numFrames++;
|
||||||
|
} else printf("REJECTING new frame as it exceeds the frame limit.\n");
|
||||||
} else if (strcmp(argv[i], "-r") == 0) {
|
} else if (strcmp(argv[i], "-r") == 0) {
|
||||||
if (i == argc-1) { printf("No parameter for option: -r\n"); return 0; }
|
if (i == argc-1) { printf("No parameter for option: -r\n"); return 0; }
|
||||||
int r = pow(2, trunc(atof(argv[i+1])));
|
int r = pow(2, trunc(atof(argv[i+1])));
|
||||||
@@ -122,9 +147,11 @@ int main(const int argc, char *argv[]) {
|
|||||||
} else if (strcmp(argv[i], "-c") == 0) {
|
} else if (strcmp(argv[i], "-c") == 0) {
|
||||||
if (i == argc-1) { printf("No parameter for option: -c\n"); return 0; }
|
if (i == argc-1) { printf("No parameter for option: -c\n"); return 0; }
|
||||||
const int c = trunc(atof(argv[i+1]));
|
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;
|
opt.c = c - 1;
|
||||||
i++;
|
i++;
|
||||||
|
} else if (strcmp(argv[i], "-d") == 0) {
|
||||||
|
opt.d = !opt.d;
|
||||||
} else {
|
} else {
|
||||||
printf("I don't know what \"%s\" means!\n", argv[i]);
|
printf("I don't know what \"%s\" means!\n", argv[i]);
|
||||||
return 0;
|
return 0;
|
||||||
@@ -132,6 +159,7 @@ int main(const int argc, char *argv[]) {
|
|||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
if (numFrames == 0) { printNoFrames(); return 0; }
|
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;}
|
if (MagickReadImage(mw, frames[0]) == MagickFalse) { printf("ERROR trying to read %s\n", frames[0]); return 0;}
|
||||||
MagickSetImageFormat(mw, "BMP3");
|
MagickSetImageFormat(mw, "BMP3");
|
||||||
@@ -293,6 +321,11 @@ int main(const int argc, char *argv[]) {
|
|||||||
|
|
||||||
MagickWriteImage(chunk, framename);
|
MagickWriteImage(chunk, framename);
|
||||||
|
|
||||||
|
char* command = (char*)malloc(512); // lazy hack until magickwand is fixed
|
||||||
|
sprintf(command, "mogrify -depth 8 -define bmp:format=bmp3 -type palette -compress none %s", framename);
|
||||||
|
system(command);
|
||||||
|
free(command);
|
||||||
|
|
||||||
iw++;
|
iw++;
|
||||||
}
|
}
|
||||||
ih++;
|
ih++;
|
||||||
@@ -301,6 +334,7 @@ int main(const int argc, char *argv[]) {
|
|||||||
}
|
}
|
||||||
fclose(partlist);
|
fclose(partlist);
|
||||||
|
|
||||||
|
if (!opt.d) {
|
||||||
// Pass on images to COMPIMG
|
// Pass on images to COMPIMG
|
||||||
printf("Encoding texture file...\n");
|
printf("Encoding texture file...\n");
|
||||||
char* command = (char*)malloc((54 + 3 * abs(1-opt.o) + strlen(filename))*sizeof(char)); // MSVC
|
char* command = (char*)malloc((54 + 3 * abs(1-opt.o) + strlen(filename))*sizeof(char)); // MSVC
|
||||||
@@ -312,9 +346,31 @@ 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);
|
sprintf(command, "./compimg.exe -ace -c%d -r0 -pt%s -emov -M%s +segments.txt", opt.c+1, argTransparent, filename);
|
||||||
#endif
|
#endif
|
||||||
printf("%s\n", command);
|
printf("%s\n", command);
|
||||||
if (system(command)) { printf("ERROR trying to run COMPIMG!\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("\n\n!!! DONE !!!\nYour avatar name is: %s%ds*%dh*%dv*.mov\n", filename, numFrames, piecesX, piecesY);
|
printf("Cleaning up temporary files...\n");
|
||||||
|
while (i < numFrames) {
|
||||||
|
int ih = 0;
|
||||||
|
while (ih < piecesY) {
|
||||||
|
int iw = 0;
|
||||||
|
while (iw < piecesX) {
|
||||||
|
char* framename = (char*)malloc(12 * piecesX * piecesY * sizeof(char)); // MSVC
|
||||||
|
sprintf(framename, "f%d%d%d.bmp", i, iw, ih);
|
||||||
|
remove(framename);
|
||||||
|
free(framename);
|
||||||
|
|
||||||
|
iw++;
|
||||||
|
}
|
||||||
|
ih++;
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
remove("segments.txt");
|
||||||
|
|
||||||
|
printf("\n\n!!! DONE !!!\n");
|
||||||
|
if (opt.d)
|
||||||
|
printf("Your avatar name is: %s%ds*%dh*%dv*.mov\n", filename, numFrames, piecesX, piecesY);
|
||||||
|
|
||||||
if(mw) mw = DestroyMagickWand(mw);
|
if(mw) mw = DestroyMagickWand(mw);
|
||||||
MagickWandTerminus();
|
MagickWandTerminus();
|
||||||
|
|||||||
Reference in New Issue
Block a user