Windows support
This commit is contained in:
6
.gitignore
vendored
6
.gitignore
vendored
@@ -1,2 +1,6 @@
|
||||
/cmake-build-debug/
|
||||
.idea
|
||||
.idea
|
||||
/.vs
|
||||
/Debug
|
||||
/KAvEAT
|
||||
/x64/Debug
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
cmake_minimum_required(VERSION 3.31)
|
||||
project(kavat C)
|
||||
cmake_minimum_required(VERSION 3.28)
|
||||
project(kaveat C)
|
||||
|
||||
set(CMAKE_C_STANDARD 11)
|
||||
|
||||
add_executable(kavat main.c)
|
||||
add_executable(kaveat main.c)
|
||||
|
||||
FIND_PACKAGE(ImageMagick
|
||||
REQUIRED
|
||||
@@ -14,6 +14,6 @@ add_compile_definitions(MAGICKCORE_HDRI_ENABLE=0)
|
||||
add_compile_definitions(MAGICKCORE_QUANTUM_DEPTH=8)
|
||||
|
||||
set(CMAKE_SYSTEM_NAME Linux)
|
||||
target_include_directories(kavat PUBLIC ${ImageMagick_INCLUDE_DIRS} ${ImageMagick_MagickWand_INCLUDE_DIRS})
|
||||
target_link_libraries(kavat m ${ImageMagick_LIBRARIES} ${ImageMagick_MagickWand_LIBRARY})
|
||||
target_link_directories(kavat PUBLIC ${ImageMagick_INCLUDE_DIRS} ${ImageMagick_MagickWand_INCLUDE_DIRS})
|
||||
target_include_directories(kaveat PUBLIC ${ImageMagick_INCLUDE_DIRS} ${ImageMagick_MagickWand_INCLUDE_DIRS})
|
||||
target_link_libraries(kaveat m ${ImageMagick_LIBRARIES} ${ImageMagick_MagickWand_LIBRARY})
|
||||
target_link_directories(kaveat PUBLIC ${ImageMagick_INCLUDE_DIRS} ${ImageMagick_MagickWand_INCLUDE_DIRS})
|
||||
|
||||
28
KAvEAT.sln
Normal file
28
KAvEAT.sln
Normal file
@@ -0,0 +1,28 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.12.35521.163 d17.12
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "KAvaT", "KAvaT.vcxproj", "{8C76412E-908C-4071-96B7-AC9428CB56E0}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{8C76412E-908C-4071-96B7-AC9428CB56E0}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{8C76412E-908C-4071-96B7-AC9428CB56E0}.Debug|x64.Build.0 = Debug|x64
|
||||
{8C76412E-908C-4071-96B7-AC9428CB56E0}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{8C76412E-908C-4071-96B7-AC9428CB56E0}.Debug|x86.Build.0 = Debug|Win32
|
||||
{8C76412E-908C-4071-96B7-AC9428CB56E0}.Release|x64.ActiveCfg = Release|x64
|
||||
{8C76412E-908C-4071-96B7-AC9428CB56E0}.Release|x64.Build.0 = Release|x64
|
||||
{8C76412E-908C-4071-96B7-AC9428CB56E0}.Release|x86.ActiveCfg = Release|Win32
|
||||
{8C76412E-908C-4071-96B7-AC9428CB56E0}.Release|x86.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
149
KAvaT.vcxproj
Normal file
149
KAvaT.vcxproj
Normal file
@@ -0,0 +1,149 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>17.0</VCProjectVersion>
|
||||
<ProjectGuid>{8C76412E-908C-4071-96B7-AC9428CB56E0}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<ProjectName>KAvEAT</ProjectName>
|
||||
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v141_xp</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v141_xp</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v141_xp</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v141_xp</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<IncludePath>$(VC_IncludePath);$(WindowsSdk_71A_IncludePath)</IncludePath>
|
||||
<LibraryPath>$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<AdditionalIncludeDirectories>C:\Program Files\ImageMagick-7.1.1-Q16\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<LanguageStandard_C>stdc11</LanguageStandard_C>
|
||||
<CompileAs>CompileAsCpp</CompileAs>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<AdditionalDependencies>CORE_RL_MagickWand_.lib;CORE_RL_MagickCore_.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>C:\Program Files\ImageMagick-7.1.1-Q16\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<AdditionalIncludeDirectories>C:\Program Files\ImageMagick-7.1.1-Q16\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<CompileAs>CompileAsCpp</CompileAs>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<AdditionalLibraryDirectories>C:\Program Files\ImageMagick-7.1.1-Q16\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>CORE_RL_MagickWand_.lib;CORE_RL_MagickCore_.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<AdditionalIncludeDirectories>C:\Program Files\ImageMagick-7.1.1-Q16\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<LanguageStandard_C>stdc11</LanguageStandard_C>
|
||||
<CompileAs>CompileAsCpp</CompileAs>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalDependencies>CORE_RL_MagickWand_.lib;CORE_RL_MagickCore_.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>C:\Program Files\ImageMagick-7.1.1-Q16\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<AdditionalIncludeDirectories>C:\Program Files\ImageMagick-7.1.1-Q16\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<CompileAs>CompileAsCpp</CompileAs>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalLibraryDirectories>C:\Program Files\ImageMagick-7.1.1-Q16\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>CORE_RL_MagickWand_.lib;CORE_RL_MagickCore_.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="main.c" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
22
KAvaT.vcxproj.filters
Normal file
22
KAvaT.vcxproj.filters
Normal file
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="main.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
4
KAvaT.vcxproj.user
Normal file
4
KAvaT.vcxproj.user
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup />
|
||||
</Project>
|
||||
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